@tamagui/tooltip 2.7.7 → 3.0.0-beta.637.1
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/cjs/Tooltip.cjs +161 -202
- package/dist/cjs/Tooltip.native.cjs +48 -0
- package/dist/cjs/Tooltip.native.js +29 -29
- package/dist/cjs/Tooltip.native.js.map +1 -1
- package/dist/cjs/TooltipSimple.cjs +64 -94
- package/dist/cjs/TooltipSimple.native.cjs +30 -0
- package/dist/cjs/TooltipSimple.native.js +17 -19
- package/dist/cjs/TooltipSimple.native.js.map +1 -1
- package/dist/cjs/index.cjs +10 -11
- package/dist/cjs/index.native.cjs +22 -0
- package/dist/cjs/index.native.js +10 -10
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/Tooltip.mjs +144 -179
- package/dist/esm/Tooltip.mjs.map +1 -1
- package/dist/esm/Tooltip.native.js +14 -12
- package/dist/esm/Tooltip.native.js.map +1 -1
- package/dist/esm/TooltipSimple.mjs +48 -68
- package/dist/esm/TooltipSimple.mjs.map +1 -1
- package/dist/esm/TooltipSimple.native.js +3 -2
- package/dist/esm/TooltipSimple.native.js.map +1 -1
- package/dist/esm/index.js +3 -3
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/index.native.js +3 -3
- package/dist/jsx/Tooltip.mjs +144 -179
- package/dist/jsx/Tooltip.mjs.map +1 -1
- package/dist/jsx/Tooltip.native.cjs +48 -0
- package/dist/jsx/Tooltip.native.js +29 -29
- package/dist/jsx/Tooltip.native.js.map +1 -1
- package/dist/jsx/TooltipSimple.mjs +48 -68
- package/dist/jsx/TooltipSimple.mjs.map +1 -1
- package/dist/jsx/TooltipSimple.native.cjs +30 -0
- package/dist/jsx/TooltipSimple.native.js +17 -19
- package/dist/jsx/TooltipSimple.native.js.map +1 -1
- package/dist/jsx/index.js +3 -3
- package/dist/jsx/index.mjs +3 -3
- package/dist/jsx/index.native.cjs +22 -0
- package/dist/jsx/index.native.js +10 -10
- package/dist/jsx/index.native.js.map +1 -1
- package/package.json +15 -15
- package/src/Tooltip.tsx +45 -39
- package/src/TooltipSimple.tsx +27 -26
- package/types/Tooltip.d.ts +15 -27
- package/types/Tooltip.d.ts.map +1 -1
- package/types/Tooltip.native.d.ts +9 -6
- package/types/Tooltip.native.d.ts.map +1 -1
- package/types/TooltipSimple.d.ts +2 -2
- package/types/TooltipSimple.d.ts.map +1 -1
- package/types/TooltipSimple.native.d.ts +3 -1
- package/types/TooltipSimple.native.d.ts.map +1 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/index.native.js.map +0 -1
- package/dist/jsx/index.js.map +0 -1
- package/dist/jsx/index.mjs.map +0 -1
package/dist/esm/Tooltip.mjs
CHANGED
|
@@ -1,202 +1,167 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { getSize } from "@tamagui/get-token";
|
|
1
|
+
import { createRefComponent, createStyledHOC, defaultTokenSizePolicy, styled, useEvent } from "@tamagui/core";
|
|
2
|
+
import { FloatingDelayGroup, FloatingOverrideContext, useDelayGroupContext } from "@tamagui/floating";
|
|
3
|
+
import { oneSizeTokenSmaller } from "@tamagui/get-token";
|
|
5
4
|
import { withStaticProperties } from "@tamagui/helpers";
|
|
6
5
|
import { PopoverAnchor, PopoverArrow, PopoverContent, PopoverContextProvider, PopoverTrigger, useFloatingContext } from "@tamagui/popover";
|
|
7
6
|
import { Popper, PopperContentFrame } from "@tamagui/popper";
|
|
7
|
+
import { getElevation } from "@tamagui/stacks";
|
|
8
8
|
import { useControllableState } from "@tamagui/use-controllable-state";
|
|
9
9
|
import * as React from "react";
|
|
10
10
|
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
|
|
11
12
|
const TOOLTIP_SCOPE = "";
|
|
13
|
+
const TooltipContentFrame = styled(PopperContentFrame, { variants: { elevation: {
|
|
14
|
+
number: getElevation,
|
|
15
|
+
Size: getElevation
|
|
16
|
+
} } });
|
|
12
17
|
const ALWAYS_DISABLE_TOOLTIP = {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// it's nice to hit escape to hide a tooltip
|
|
16
|
-
// dismiss: true
|
|
18
|
+
focus: true,
|
|
19
|
+
"remove-scroll": true
|
|
17
20
|
};
|
|
18
|
-
const TooltipContent =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
componentName: "Tooltip"
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
const TooltipArrow = React.forwardRef((props, ref) => {
|
|
45
|
-
return /* @__PURE__ */jsx(PopoverArrow, {
|
|
46
|
-
scope: props.scope || TOOLTIP_SCOPE,
|
|
47
|
-
componentName: "Tooltip",
|
|
48
|
-
ref,
|
|
49
|
-
...props
|
|
50
|
-
});
|
|
21
|
+
const TooltipContent = createStyledHOC(TooltipContentFrame, (props, ref) => {
|
|
22
|
+
const preventAnimation = React.useContext(PreventTooltipAnimationContext);
|
|
23
|
+
const zIndexFromContext = React.useContext(TooltipZIndexContext);
|
|
24
|
+
return /* @__PURE__ */ jsx(PopoverContent, {
|
|
25
|
+
scope: props.scope || TOOLTIP_SCOPE,
|
|
26
|
+
alwaysDisable: ALWAYS_DISABLE_TOOLTIP,
|
|
27
|
+
backgroundColor: "background",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
pointerEvents: "none",
|
|
30
|
+
...zIndexFromContext !== void 0 && { zIndex: zIndexFromContext },
|
|
31
|
+
...props,
|
|
32
|
+
...preventAnimation && { transition: null },
|
|
33
|
+
ref
|
|
34
|
+
});
|
|
35
|
+
}, { displayName: "Tooltip" });
|
|
36
|
+
const TooltipArrow = createRefComponent((props, ref) => {
|
|
37
|
+
const { className, ...rest } = props;
|
|
38
|
+
return /* @__PURE__ */ jsx(PopoverArrow, {
|
|
39
|
+
scope: props.scope || TOOLTIP_SCOPE,
|
|
40
|
+
className: `is_Tooltip ${className || ""}`.trim(),
|
|
41
|
+
ref,
|
|
42
|
+
...rest
|
|
43
|
+
});
|
|
51
44
|
});
|
|
52
45
|
const PreventTooltipAnimationContext = React.createContext(false);
|
|
53
46
|
const TooltipZIndexContext = React.createContext(void 0);
|
|
54
|
-
const TooltipGroup = ({
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
timeoutMs,
|
|
64
|
-
delay: React.useMemo(() => delay, [JSON.stringify(delay)]),
|
|
65
|
-
children
|
|
66
|
-
})
|
|
67
|
-
});
|
|
47
|
+
const TooltipGroup = ({ children, delay, preventAnimation = false, timeoutMs }) => {
|
|
48
|
+
return /* @__PURE__ */ jsx(PreventTooltipAnimationContext.Provider, {
|
|
49
|
+
value: preventAnimation,
|
|
50
|
+
children: /* @__PURE__ */ jsx(FloatingDelayGroup, {
|
|
51
|
+
timeoutMs,
|
|
52
|
+
delay: React.useMemo(() => delay, [JSON.stringify(delay)]),
|
|
53
|
+
children
|
|
54
|
+
})
|
|
55
|
+
});
|
|
68
56
|
};
|
|
69
|
-
const setOpens = /* @__PURE__ */new Set();
|
|
57
|
+
const setOpens = /* @__PURE__ */ new Set();
|
|
70
58
|
const closeOpenTooltips = () => {
|
|
71
|
-
|
|
59
|
+
setOpens.forEach((x) => x(false));
|
|
72
60
|
};
|
|
73
|
-
const TooltipComponent =
|
|
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
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
triggerRef,
|
|
154
|
-
open,
|
|
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, {
|
|
166
|
-
value: zIndex,
|
|
167
|
-
children: content
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
return content;
|
|
61
|
+
const TooltipComponent = createRefComponent(function Tooltip(props, ref) {
|
|
62
|
+
"use no memo";
|
|
63
|
+
const { children, delay: delayProp, restMs: restMsProp, onOpenChange: onOpenChangeProp, focus, open: openProp, disableAutoCloseOnScroll, zIndex, scope = TOOLTIP_SCOPE, ...restProps } = props;
|
|
64
|
+
const triggerRef = React.useRef(null);
|
|
65
|
+
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
66
|
+
const { delay: delayGroup, setCurrentId } = useDelayGroupContext();
|
|
67
|
+
const delay = delayProp !== void 0 ? delayProp : delayGroup ?? 400;
|
|
68
|
+
const restMs = restMsProp ?? (typeof delay === "number" ? delay : 0);
|
|
69
|
+
const [open, setOpen] = useControllableState({
|
|
70
|
+
prop: openProp,
|
|
71
|
+
defaultProp: false,
|
|
72
|
+
onChange: onOpenChangeProp
|
|
73
|
+
});
|
|
74
|
+
const id = props.groupId;
|
|
75
|
+
const onOpenChange = useEvent((open2) => {
|
|
76
|
+
if (open2) {
|
|
77
|
+
setCurrentId(id);
|
|
78
|
+
}
|
|
79
|
+
setOpen(open2);
|
|
80
|
+
});
|
|
81
|
+
React.useEffect(() => {
|
|
82
|
+
if (!open) return;
|
|
83
|
+
if (disableAutoCloseOnScroll) return;
|
|
84
|
+
if (typeof document === "undefined") return;
|
|
85
|
+
const closeIt = () => {
|
|
86
|
+
setOpen(false);
|
|
87
|
+
};
|
|
88
|
+
setOpens.add(setOpen);
|
|
89
|
+
document.documentElement.addEventListener("scroll", closeIt);
|
|
90
|
+
return () => {
|
|
91
|
+
setOpens.delete(setOpen);
|
|
92
|
+
document.documentElement.removeEventListener("scroll", closeIt);
|
|
93
|
+
};
|
|
94
|
+
}, [open, disableAutoCloseOnScroll]);
|
|
95
|
+
const floatingContext = useFloatingContext({
|
|
96
|
+
open,
|
|
97
|
+
setOpen: onOpenChange,
|
|
98
|
+
disable: false,
|
|
99
|
+
disableFocus: false,
|
|
100
|
+
hoverable: true,
|
|
101
|
+
role: "tooltip",
|
|
102
|
+
focus,
|
|
103
|
+
groupId: id,
|
|
104
|
+
delay,
|
|
105
|
+
restMs
|
|
106
|
+
});
|
|
107
|
+
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);
|
|
108
|
+
const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);
|
|
109
|
+
const contentId = React.useId();
|
|
110
|
+
const smallerSize = oneSizeTokenSmaller(defaultTokenSizePolicy.fontSize);
|
|
111
|
+
const content = /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, {
|
|
112
|
+
value: floatingContext,
|
|
113
|
+
children: /* @__PURE__ */ jsx(Popper, {
|
|
114
|
+
scope,
|
|
115
|
+
size: smallerSize,
|
|
116
|
+
allowFlip: true,
|
|
117
|
+
stayInFrame: true,
|
|
118
|
+
open,
|
|
119
|
+
...restProps,
|
|
120
|
+
children: /* @__PURE__ */ jsx(PopoverContextProvider, {
|
|
121
|
+
scope,
|
|
122
|
+
contentId,
|
|
123
|
+
triggerRef,
|
|
124
|
+
open,
|
|
125
|
+
onOpenChange: setOpen,
|
|
126
|
+
onOpenToggle: voidFn,
|
|
127
|
+
hasCustomAnchor,
|
|
128
|
+
onCustomAnchorAdd,
|
|
129
|
+
onCustomAnchorRemove,
|
|
130
|
+
children
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
if (zIndex !== void 0) {
|
|
135
|
+
return /* @__PURE__ */ jsx(TooltipZIndexContext.Provider, {
|
|
136
|
+
value: zIndex,
|
|
137
|
+
children: content
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
return content;
|
|
171
141
|
});
|
|
172
|
-
const TooltipTrigger =
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
scope: scope || TOOLTIP_SCOPE,
|
|
180
|
-
ref
|
|
181
|
-
});
|
|
142
|
+
const TooltipTrigger = createRefComponent(function TooltipTrigger2(props, ref) {
|
|
143
|
+
const { scope, ...rest } = props;
|
|
144
|
+
return /* @__PURE__ */ jsx(PopoverTrigger, {
|
|
145
|
+
...rest,
|
|
146
|
+
scope: scope || TOOLTIP_SCOPE,
|
|
147
|
+
ref
|
|
148
|
+
});
|
|
182
149
|
});
|
|
183
|
-
const TooltipAnchor =
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
scope: scope || TOOLTIP_SCOPE,
|
|
191
|
-
ref
|
|
192
|
-
});
|
|
150
|
+
const TooltipAnchor = createRefComponent(function TooltipAnchor2(props, ref) {
|
|
151
|
+
const { scope, ...rest } = props;
|
|
152
|
+
return /* @__PURE__ */ jsx(PopoverAnchor, {
|
|
153
|
+
...rest,
|
|
154
|
+
scope: scope || TOOLTIP_SCOPE,
|
|
155
|
+
ref
|
|
156
|
+
});
|
|
193
157
|
});
|
|
194
158
|
const Tooltip2 = withStaticProperties(TooltipComponent, {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
159
|
+
Anchor: TooltipAnchor,
|
|
160
|
+
Arrow: TooltipArrow,
|
|
161
|
+
Content: TooltipContent,
|
|
162
|
+
Trigger: TooltipTrigger
|
|
199
163
|
});
|
|
200
164
|
const voidFn = () => {};
|
|
165
|
+
|
|
201
166
|
export { Tooltip2 as Tooltip, TooltipGroup, closeOpenTooltips };
|
|
202
167
|
//# sourceMappingURL=Tooltip.mjs.map
|
package/dist/esm/Tooltip.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":[],"sources":["esm/Tooltip.js"],"sourcesContent":["import {\n createStyledHOC,\n createRefComponent,\n defaultTokenSizePolicy,\n styled\n} from \"@tamagui/core\";\n\nimport { FloatingDelayGroup, useDelayGroupContext } from \"@tamagui/floating\";\nimport { useEvent } from \"@tamagui/core\";\nimport { FloatingOverrideContext } from \"@tamagui/floating\";\nimport { oneSizeTokenSmaller } from \"@tamagui/get-token\";\nimport { withStaticProperties } from \"@tamagui/helpers\";\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverContent,\n PopoverContextProvider,\n PopoverTrigger,\n useFloatingContext\n} from \"@tamagui/popover\";\nimport { Popper, PopperContentFrame } from \"@tamagui/popper\";\nimport { getElevation } from \"@tamagui/stacks\";\nimport { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst TOOLTIP_SCOPE = \"\";\nconst TooltipContentFrame = styled(PopperContentFrame, {\n variants: {\n elevation: {\n number: getElevation,\n Size: getElevation\n }\n }\n});\nconst ALWAYS_DISABLE_TOOLTIP = {\n focus: true,\n \"remove-scroll\": true\n // it's nice to hit escape to hide a tooltip\n // dismiss: true\n};\nconst TooltipContent = createStyledHOC(\n TooltipContentFrame,\n (props, ref) => {\n const preventAnimation = React.useContext(PreventTooltipAnimationContext);\n const zIndexFromContext = React.useContext(TooltipZIndexContext);\n return /* @__PURE__ */ jsx(\n PopoverContent,\n {\n scope: props.scope || TOOLTIP_SCOPE,\n alwaysDisable: ALWAYS_DISABLE_TOOLTIP,\n backgroundColor: \"background\",\n alignItems: \"center\",\n pointerEvents: \"none\",\n ...zIndexFromContext !== void 0 && { zIndex: zIndexFromContext },\n ...props,\n ...preventAnimation && { transition: null },\n ref\n }\n );\n },\n {\n displayName: \"Tooltip\"\n }\n);\nconst TooltipArrow = createRefComponent(\n (props, ref) => {\n const { className, ...rest } = props;\n return /* @__PURE__ */ jsx(\n PopoverArrow,\n {\n scope: props.scope || TOOLTIP_SCOPE,\n className: `is_Tooltip ${className || \"\"}`.trim(),\n ref,\n ...rest\n }\n );\n }\n);\nconst PreventTooltipAnimationContext = React.createContext(false);\nconst TooltipZIndexContext = React.createContext(void 0);\nconst TooltipGroup = ({\n children,\n delay,\n preventAnimation = false,\n timeoutMs\n}) => {\n return /* @__PURE__ */ jsx(PreventTooltipAnimationContext.Provider, { value: preventAnimation, children: /* @__PURE__ */ jsx(\n FloatingDelayGroup,\n {\n timeoutMs,\n delay: React.useMemo(() => delay, [JSON.stringify(delay)]),\n children\n }\n ) });\n};\nconst setOpens = /* @__PURE__ */ new Set();\nconst closeOpenTooltips = () => {\n setOpens.forEach((x) => x(false));\n};\nconst TooltipComponent = createRefComponent(function Tooltip(props, ref) {\n \"use no memo\";\n const {\n children,\n delay: delayProp,\n restMs: restMsProp,\n onOpenChange: onOpenChangeProp,\n focus,\n open: openProp,\n disableAutoCloseOnScroll,\n zIndex,\n scope = TOOLTIP_SCOPE,\n ...restProps\n } = props;\n const triggerRef = React.useRef(null);\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);\n const { delay: delayGroup, setCurrentId } = useDelayGroupContext();\n const delay = delayProp !== void 0 ? delayProp : delayGroup ?? 400;\n const restMs = restMsProp ?? (typeof delay === \"number\" ? delay : 0);\n const [open, setOpen] = useControllableState({\n prop: openProp,\n defaultProp: false,\n onChange: onOpenChangeProp\n });\n const id = props.groupId;\n const onOpenChange = useEvent((open2) => {\n if (open2) {\n setCurrentId(id);\n }\n setOpen(open2);\n });\n React.useEffect(() => {\n if (!open) return;\n if (disableAutoCloseOnScroll) return;\n if (typeof document === \"undefined\") return;\n const closeIt = () => {\n setOpen(false);\n };\n setOpens.add(setOpen);\n document.documentElement.addEventListener(\"scroll\", closeIt);\n return () => {\n setOpens.delete(setOpen);\n document.documentElement.removeEventListener(\"scroll\", closeIt);\n };\n }, [open, disableAutoCloseOnScroll]);\n const floatingContext = useFloatingContext({\n open,\n setOpen: onOpenChange,\n disable: false,\n disableFocus: false,\n hoverable: true,\n role: \"tooltip\",\n focus,\n groupId: id,\n delay,\n restMs\n });\n const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), []);\n const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), []);\n const contentId = React.useId();\n const smallerSize = oneSizeTokenSmaller(defaultTokenSizePolicy.fontSize);\n const content = /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, { value: floatingContext, children: /* @__PURE__ */ jsx(\n Popper,\n {\n scope,\n size: smallerSize,\n allowFlip: true,\n stayInFrame: true,\n open,\n ...restProps,\n children: /* @__PURE__ */ jsx(\n PopoverContextProvider,\n {\n scope,\n contentId,\n triggerRef,\n open,\n onOpenChange: setOpen,\n onOpenToggle: voidFn,\n hasCustomAnchor,\n onCustomAnchorAdd,\n onCustomAnchorRemove,\n children\n }\n )\n }\n ) });\n if (zIndex !== void 0) {\n return /* @__PURE__ */ jsx(TooltipZIndexContext.Provider, { value: zIndex, children: content });\n }\n return content;\n});\nconst TooltipTrigger = createRefComponent(function TooltipTrigger2(props, ref) {\n const { scope, ...rest } = props;\n return /* @__PURE__ */ jsx(PopoverTrigger, { ...rest, scope: scope || TOOLTIP_SCOPE, ref });\n});\nconst TooltipAnchor = createRefComponent(function TooltipAnchor2(props, ref) {\n const { scope, ...rest } = props;\n return /* @__PURE__ */ jsx(PopoverAnchor, { ...rest, scope: scope || TOOLTIP_SCOPE, ref });\n});\nconst Tooltip2 = withStaticProperties(TooltipComponent, {\n Anchor: TooltipAnchor,\n Arrow: TooltipArrow,\n Content: TooltipContent,\n Trigger: TooltipTrigger\n});\nconst voidFn = () => {\n};\nexport {\n Tooltip2 as Tooltip,\n TooltipGroup,\n closeOpenTooltips\n};\n//# sourceMappingURL=Tooltip.js.map\n"],"mappings":";;;;;;;;;;;;AAyBA,MAAM,gBAAgB;AACtB,MAAM,sBAAsB,OAAO,oBAAoB,EACrD,UAAU,EACR,WAAW;CACT,QAAQ;CACR,MAAM;AACR,EACF,EACF,CAAC;AACD,MAAM,yBAAyB;CAC7B,OAAO;CACP,iBAAiB;AAGnB;AACA,MAAM,iBAAiB,gBACrB,sBACC,OAAO,QAAQ;CACd,MAAM,mBAAmB,MAAM,WAAW,8BAA8B;CACxE,MAAM,oBAAoB,MAAM,WAAW,oBAAoB;CAC/D,OAAuB,oBACrB,gBACA;EACE,OAAO,MAAM,SAAS;EAC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AAiB,mBAAmB,SAAS,gBAAgB,OAAO,KAAK;CAC7E,MAAM,EAAE,OAAO,GAAG,SAAS;CAC3B,OAAuB,oBAAI,gBAAgB;EAAE,GAAG;EAAM,OAAO,SAAS;EAAe;CAAI,CAAC;AAC5F,CAAC;AACD,MAAM,gBAAgB,mBAAmB,SAAS,eAAe,OAAO,KAAK;CAC3E,MAAM,EAAE,OAAO,GAAG,SAAS;CAC3B,OAAuB,oBAAI,eAAe;EAAE,GAAG;EAAM,OAAO,SAAS;EAAe;CAAI,CAAC;AAC3F,CAAC;AACD,MAAM,WAAW,qBAAqB,kBAAkB;CACtD,QAAQ;CACR,OAAO;CACP,SAAS;CACT,SAAS;AACX,CAAC;AACD,MAAM,eAAe,CACrB"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { withStaticProperties } from "@tamagui/helpers";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
var RenderChildren = function(props) {
|
|
4
|
+
return props.children;
|
|
4
5
|
};
|
|
5
|
-
var RenderNull = function
|
|
6
|
-
|
|
6
|
+
var RenderNull = function(props) {
|
|
7
|
+
return null;
|
|
7
8
|
};
|
|
8
|
-
var TooltipGroup = function
|
|
9
|
-
|
|
9
|
+
var TooltipGroup = function() {
|
|
10
|
+
return null;
|
|
10
11
|
};
|
|
11
|
-
var closeOpenTooltips = function
|
|
12
|
+
var closeOpenTooltips = function() {};
|
|
12
13
|
var Tooltip = withStaticProperties(RenderChildren, {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
Anchor: RenderChildren,
|
|
15
|
+
Arrow: RenderNull,
|
|
16
|
+
Close: RenderNull,
|
|
17
|
+
Content: RenderNull,
|
|
18
|
+
Trigger: RenderChildren
|
|
18
19
|
});
|
|
20
|
+
|
|
19
21
|
export { Tooltip, TooltipGroup, closeOpenTooltips };
|
|
20
22
|
//# sourceMappingURL=Tooltip.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Tooltip.native.js","names":[],"sources":["esm/Tooltip.native.js"],"sourcesContent":["import { withStaticProperties } from \"@tamagui/helpers\";\nvar RenderChildren = function(props) {\n return props.children;\n};\nvar RenderNull = function(props) {\n return null;\n};\nvar TooltipGroup = function() {\n return null;\n};\nvar closeOpenTooltips = function() {\n};\nvar Tooltip = withStaticProperties(RenderChildren, {\n Anchor: RenderChildren,\n Arrow: RenderNull,\n Close: RenderNull,\n Content: RenderNull,\n Trigger: RenderChildren\n});\nexport {\n Tooltip,\n TooltipGroup,\n closeOpenTooltips\n};\n//# sourceMappingURL=Tooltip.native.js.map\n"],"mappings":";;;AACA,IAAI,iBAAiB,SAAS,OAAO;CACnC,OAAO,MAAM;AACf;AACA,IAAI,aAAa,SAAS,OAAO;CAC/B,OAAO;AACT;AACA,IAAI,eAAe,WAAW;CAC5B,OAAO;AACT;AACA,IAAI,oBAAoB,WAAW,CACnC;AACA,IAAI,UAAU,qBAAqB,gBAAgB;CACjD,QAAQ;CACR,OAAO;CACP,OAAO;CACP,SAAS;CACT,SAAS;AACX,CAAC"}
|
|
@@ -1,76 +1,56 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createRefComponent, getVariableValue } from "@tamagui/core";
|
|
2
|
+
import { getRadius, getSize, getSpace } from "@tamagui/get-token";
|
|
2
3
|
import { Paragraph } from "@tamagui/text";
|
|
3
4
|
import * as React from "react";
|
|
4
5
|
import { Tooltip } from "./Tooltip.mjs";
|
|
5
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
const TooltipSimple = React.forwardRef(({
|
|
7
|
-
label,
|
|
8
|
-
children,
|
|
9
|
-
contentProps,
|
|
10
|
-
disabled,
|
|
11
|
-
...tooltipProps
|
|
12
|
-
}, ref) => {
|
|
13
|
-
"use no memo";
|
|
14
7
|
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}],
|
|
61
|
-
...contentProps,
|
|
62
|
-
children: [/* @__PURE__ */jsx(Tooltip.Arrow, {}), /* @__PURE__ */jsx(Paragraph, {
|
|
63
|
-
maxWidth: 350,
|
|
64
|
-
overflow: "hidden",
|
|
65
|
-
size: "$3",
|
|
66
|
-
textAlign: "center",
|
|
67
|
-
"$platform-web": {
|
|
68
|
-
textWrap: "balance"
|
|
69
|
-
},
|
|
70
|
-
children: label
|
|
71
|
-
})]
|
|
72
|
-
})]
|
|
73
|
-
});
|
|
8
|
+
const TooltipSimple = createRefComponent(({ label, children, contentProps, disabled, ...tooltipProps }, ref) => {
|
|
9
|
+
"use no memo";
|
|
10
|
+
const child = React.Children.only(children);
|
|
11
|
+
if (!label) {
|
|
12
|
+
return children;
|
|
13
|
+
}
|
|
14
|
+
return /* @__PURE__ */ jsxs(Tooltip, {
|
|
15
|
+
disableRTL: true,
|
|
16
|
+
offset: 15,
|
|
17
|
+
restMs: 40,
|
|
18
|
+
delay: 40,
|
|
19
|
+
zIndex: 1e6,
|
|
20
|
+
...tooltipProps,
|
|
21
|
+
...disabled ? { open: false } : null,
|
|
22
|
+
children: [/* @__PURE__ */ jsx(Tooltip.Trigger, {
|
|
23
|
+
...typeof label === "string" && { "aria-label": label },
|
|
24
|
+
asChild: "except-style",
|
|
25
|
+
children: ref && React.isValidElement(child) ? React.cloneElement(child, { ref }) : child
|
|
26
|
+
}), /* @__PURE__ */ jsxs(Tooltip.Content, {
|
|
27
|
+
theme: "Tooltip",
|
|
28
|
+
y: "enter:-4px exit:-4px",
|
|
29
|
+
scale: "1 enter:0.96 exit:0.96",
|
|
30
|
+
opacity: "1 enter:0 exit:0",
|
|
31
|
+
pointerEvents: "none",
|
|
32
|
+
paddingHorizontal: getVariableValue(getSpace(tooltipProps.size ?? true)),
|
|
33
|
+
paddingVertical: Math.max(0, Math.round(getVariableValue(getSize(tooltipProps.size ?? true)) * .36 - 9)),
|
|
34
|
+
borderRadius: getVariableValue(getRadius(tooltipProps.size ?? true)),
|
|
35
|
+
boxShadow: "0 2px 4px shadow-color",
|
|
36
|
+
transition: ["quicker", { opacity: { overshootClamping: true } }],
|
|
37
|
+
...contentProps,
|
|
38
|
+
animateOnly: ["transform", "opacity"],
|
|
39
|
+
children: [/* @__PURE__ */ jsx(Tooltip.Arrow, {
|
|
40
|
+
size: tooltipProps.size ?? 7,
|
|
41
|
+
backgroundColor: "background",
|
|
42
|
+
borderColor: "border-color"
|
|
43
|
+
}), /* @__PURE__ */ jsx(Paragraph, {
|
|
44
|
+
maxWidth: 350,
|
|
45
|
+
overflow: "hidden",
|
|
46
|
+
textAlign: "center",
|
|
47
|
+
textWrap: "web:balance",
|
|
48
|
+
size: "3",
|
|
49
|
+
children: label
|
|
50
|
+
})]
|
|
51
|
+
})]
|
|
52
|
+
});
|
|
74
53
|
});
|
|
54
|
+
|
|
75
55
|
export { TooltipSimple };
|
|
76
56
|
//# sourceMappingURL=TooltipSimple.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"TooltipSimple.js","names":[],"sources":["esm/TooltipSimple.js"],"sourcesContent":["import { createRefComponent, getVariableValue } from \"@tamagui/core\";\nimport { getRadius, getSize, getSpace } from \"@tamagui/get-token\";\nimport { Paragraph } from \"@tamagui/text\";\nimport * as React from \"react\";\nimport { Tooltip } from \"./Tooltip\";\nimport { jsx, jsxs } from \"react/jsx-runtime\";\nconst TooltipSimple = createRefComponent(\n ({ label, children, contentProps, disabled, ...tooltipProps }, ref) => {\n \"use no memo\";\n const child = React.Children.only(children);\n if (!label) {\n return children;\n }\n return /* @__PURE__ */ jsxs(\n Tooltip,\n {\n disableRTL: true,\n offset: 15,\n restMs: 40,\n delay: 40,\n zIndex: 1e6,\n ...tooltipProps,\n ...disabled ? { open: false } : null,\n children: [\n /* @__PURE__ */ jsx(\n Tooltip.Trigger,\n {\n ...typeof label === \"string\" && {\n \"aria-label\": label\n },\n asChild: \"except-style\",\n children: ref && React.isValidElement(child) ? React.cloneElement(child, { ref }) : child\n }\n ),\n /* @__PURE__ */ jsxs(\n Tooltip.Content,\n {\n theme: \"Tooltip\",\n y: \"enter:-4px exit:-4px\",\n scale: \"1 enter:0.96 exit:0.96\",\n opacity: \"1 enter:0 exit:0\",\n pointerEvents: \"none\",\n paddingHorizontal: getVariableValue(getSpace(tooltipProps.size ?? true)),\n paddingVertical: Math.max(\n 0,\n Math.round(\n getVariableValue(getSize(tooltipProps.size ?? true)) * 0.36 - 9\n )\n ),\n borderRadius: getVariableValue(getRadius(tooltipProps.size ?? true)),\n boxShadow: \"0 2px 4px shadow-color\",\n transition: [\"quicker\", { opacity: { overshootClamping: true } }],\n ...contentProps,\n animateOnly: [\"transform\", \"opacity\"],\n children: [\n /* @__PURE__ */ jsx(\n Tooltip.Arrow,\n {\n size: tooltipProps.size ?? 7,\n backgroundColor: \"background\",\n borderColor: \"border-color\"\n }\n ),\n /* @__PURE__ */ jsx(\n Paragraph,\n {\n maxWidth: 350,\n overflow: \"hidden\",\n textAlign: \"center\",\n textWrap: \"web:balance\",\n size: \"3\",\n children: label\n }\n )\n ]\n }\n )\n ]\n }\n );\n }\n);\nexport {\n TooltipSimple\n};\n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+
{"version":3,"file":"TooltipSimple.native.js","names":[],"sources":["esm/TooltipSimple.native.js"],"sourcesContent":["var RenderChildren = function(props) {\n return props.children;\n};\nvar TooltipSimple = RenderChildren;\nexport {\n TooltipSimple\n};\n//# sourceMappingURL=TooltipSimple.native.js.map\n"],"mappings":";AAAA,IAAI,iBAAiB,SAAS,OAAO;CACnC,OAAO,MAAM;AACf;AACA,IAAI,gBAAgB"}
|