@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
|
@@ -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":["jsx/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//# sourceMappingURL=TooltipSimple.js.map\n"],"mappings":";;;;;;;;AAMA,MAAM,gBAAgB,oBACnB,EAAE,OAAO,UAAU,cAAc,UAAU,GAAG,gBAAgB,QAAQ;CACrE;CACA,MAAM,QAAQ,MAAM,SAAS,KAAK,QAAQ;CAC1C,IAAI,CAAC,OAAO;EACV,OAAO;CACT;CACA,OAAuB,qBACrB,SACA;EACE,YAAY;EACZ,QAAQ;EACR,QAAQ;EACR,OAAO;EACP,QAAQ;EACR,GAAG;EACH,GAAG,WAAW,EAAE,MAAM,MAAM,IAAI;EAChC,UAAU,CACQ,oBACd,QAAQ,SACR;GACE,GAAG,OAAO,UAAU,YAAY,EAC9B,cAAc,MAChB;GACA,SAAS;GACT,UAAU,OAAO,MAAM,eAAe,KAAK,IAAI,MAAM,aAAa,OAAO,EAAE,IAAI,CAAC,IAAI;EACtF,CACF,GACgB,qBACd,QAAQ,SACR;GACE,OAAO;GACP,GAAG;GACH,OAAO;GACP,SAAS;GACT,eAAe;GACf,mBAAmB,iBAAiB,SAAS,aAAa,QAAQ,IAAI,CAAC;GACvE,iBAAiB,KAAK,IACpB,GACA,KAAK,MACH,iBAAiB,QAAQ,aAAa,QAAQ,IAAI,CAAC,IAAI,MAAO,CAChE,CACF;GACA,cAAc,iBAAiB,UAAU,aAAa,QAAQ,IAAI,CAAC;GACnE,WAAW;GACX,YAAY,CAAC,WAAW,EAAE,SAAS,EAAE,mBAAmB,KAAK,EAAE,CAAC;GAChE,GAAG;GACH,aAAa,CAAC,aAAa,SAAS;GACpC,UAAU,CACQ,oBACd,QAAQ,OACR;IACE,MAAM,aAAa,QAAQ;IAC3B,iBAAiB;IACjB,aAAa;GACf,CACF,GACgB,oBACd,WACA;IACE,UAAU;IACV,UAAU;IACV,WAAW;IACX,UAAU;IACV,MAAM;IACN,UAAU;GACZ,CACF,CACF;EACF,CACF,CACF;CACF,CACF;AACF,CACF"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
|
+
var TooltipSimple_native_exports = {};
|
|
25
|
+
__export(TooltipSimple_native_exports, { TooltipSimple: () => TooltipSimple });
|
|
26
|
+
module.exports = __toCommonJS(TooltipSimple_native_exports);
|
|
27
|
+
var RenderChildren = function(props) {
|
|
28
|
+
return props.children;
|
|
29
|
+
};
|
|
30
|
+
var TooltipSimple = RenderChildren;
|
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
for (var name in all) __defProp(target, name, {
|
|
10
|
+
get: all[name],
|
|
11
|
+
enumerable: true
|
|
12
|
+
});
|
|
12
13
|
};
|
|
13
14
|
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
+
get: () => from[key],
|
|
18
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
21
22
|
};
|
|
22
|
-
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
-
value: true
|
|
24
|
-
}), mod);
|
|
23
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
24
|
var TooltipSimple_native_exports = {};
|
|
26
|
-
__export(TooltipSimple_native_exports, {
|
|
27
|
-
TooltipSimple: () => TooltipSimple
|
|
28
|
-
});
|
|
25
|
+
__export(TooltipSimple_native_exports, { TooltipSimple: () => TooltipSimple });
|
|
29
26
|
module.exports = __toCommonJS(TooltipSimple_native_exports);
|
|
30
|
-
var RenderChildren = function
|
|
31
|
-
|
|
27
|
+
var RenderChildren = function(props) {
|
|
28
|
+
return props.children;
|
|
32
29
|
};
|
|
33
30
|
var TooltipSimple = RenderChildren;
|
|
31
|
+
|
|
34
32
|
//# sourceMappingURL=TooltipSimple.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"TooltipSimple.native.js","names":[],"sources":["jsx/TooltipSimple.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar TooltipSimple_native_exports = {};\n__export(TooltipSimple_native_exports, {\n TooltipSimple: () => TooltipSimple\n});\nmodule.exports = __toCommonJS(TooltipSimple_native_exports);\nvar RenderChildren = function(props) {\n return props.children;\n};\nvar TooltipSimple = RenderChildren;\n//# sourceMappingURL=TooltipSimple.native.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC9B,KAAK,IAAI,QAAQ,KACf,UAAU,QAAQ,MAAM;EAAE,KAAK,IAAI;EAAO,YAAY;CAAK,CAAC;AAChE;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,+BAA+B,CAAC;AACpC,SAAS,8BAA8B,EACrC,qBAAqB,cACvB,CAAC;AACD,OAAO,UAAU,aAAa,4BAA4B;AAC1D,IAAI,iBAAiB,SAAS,OAAO;CACnC,OAAO,MAAM;AACf;AACA,IAAI,gBAAgB"}
|
package/dist/jsx/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./Tooltip.mjs"
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export * from "./Tooltip.mjs"
|
|
2
|
+
|
|
3
|
+
export * from "./TooltipSimple.mjs"
|
package/dist/jsx/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "./Tooltip.mjs"
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export * from "./Tooltip.mjs"
|
|
2
|
+
|
|
3
|
+
export * from "./TooltipSimple.mjs"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var index_exports = {};
|
|
20
|
+
module.exports = __toCommonJS(index_exports);
|
|
21
|
+
__reExport(index_exports, require("./Tooltip.native.js"), module.exports);
|
|
22
|
+
__reExport(index_exports, require("./TooltipSimple.native.js"), module.exports);
|
package/dist/jsx/index.native.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
8
|
var __copyProps = (to, from, except, desc) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
11
|
+
get: () => from[key],
|
|
12
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
15
16
|
};
|
|
16
17
|
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);
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
19
|
var index_exports = {};
|
|
21
20
|
module.exports = __toCommonJS(index_exports);
|
|
22
21
|
__reExport(index_exports, require("./Tooltip.native.js"), module.exports);
|
|
23
22
|
__reExport(index_exports, require("./TooltipSimple.native.js"), module.exports);
|
|
23
|
+
|
|
24
24
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.native.js","names":[],"sources":["jsx/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __copyProps = (to, from, except, desc) => {\n if (from && typeof from === \"object\" || typeof from === \"function\") {\n for (let key of __getOwnPropNames(from))\n if (!__hasOwnProp.call(to, key) && key !== except)\n __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });\n }\n return to;\n};\nvar __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, \"default\"), secondTarget && __copyProps(secondTarget, mod, \"default\"));\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\nmodule.exports = __toCommonJS(index_exports);\n__reExport(index_exports, require(\"./Tooltip\"), module.exports);\n__reExport(index_exports, require(\"./TooltipSimple\"), module.exports);\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC5C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EAClE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GACpC,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QACzC,UAAU,IAAI,KAAK;GAAE,WAAW,KAAK;GAAM,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAAW,CAAC;CACvH;CACA,OAAO;AACT;AACA,IAAI,cAAc,QAAQ,KAAK,kBAAkB,YAAY,QAAQ,KAAK,SAAS,GAAG,gBAAgB,YAAY,cAAc,KAAK,SAAS;AAC9I,IAAI,gBAAgB,QAAQ,YAAY,UAAU,CAAC,GAAG,cAAc,EAAE,OAAO,KAAK,CAAC,GAAG,GAAG;AACzF,IAAI,gBAAgB,CAAC;AACrB,OAAO,UAAU,aAAa,aAAa;AAC3C,WAAW,eAAe,QAAQ,qBAAW,GAAG,OAAO,OAAO;AAC9D,WAAW,eAAe,QAAQ,2BAAiB,GAAG,OAAO,OAAO"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/tooltip",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0-beta.637.1",
|
|
4
4
|
"source": "src/index.tsx",
|
|
5
5
|
"files": [
|
|
6
6
|
"src",
|
|
@@ -34,23 +34,23 @@
|
|
|
34
34
|
"clean:build": "tamagui-build clean:build"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@tamagui/compose-refs": "
|
|
38
|
-
"@tamagui/core": "
|
|
39
|
-
"@tamagui/create-context": "
|
|
40
|
-
"@tamagui/floating": "
|
|
41
|
-
"@tamagui/get-token": "
|
|
42
|
-
"@tamagui/helpers": "
|
|
43
|
-
"@tamagui/polyfill-dev": "
|
|
44
|
-
"@tamagui/popover": "
|
|
45
|
-
"@tamagui/popper": "
|
|
46
|
-
"@tamagui/stacks": "
|
|
47
|
-
"@tamagui/text": "
|
|
48
|
-
"@tamagui/use-controllable-state": "
|
|
37
|
+
"@tamagui/compose-refs": "3.0.0-beta.637.1",
|
|
38
|
+
"@tamagui/core": "3.0.0-beta.637.1",
|
|
39
|
+
"@tamagui/create-context": "3.0.0-beta.637.1",
|
|
40
|
+
"@tamagui/floating": "3.0.0-beta.637.1",
|
|
41
|
+
"@tamagui/get-token": "3.0.0-beta.637.1",
|
|
42
|
+
"@tamagui/helpers": "3.0.0-beta.637.1",
|
|
43
|
+
"@tamagui/polyfill-dev": "3.0.0-beta.637.1",
|
|
44
|
+
"@tamagui/popover": "3.0.0-beta.637.1",
|
|
45
|
+
"@tamagui/popper": "3.0.0-beta.637.1",
|
|
46
|
+
"@tamagui/stacks": "3.0.0-beta.637.1",
|
|
47
|
+
"@tamagui/text": "3.0.0-beta.637.1",
|
|
48
|
+
"@tamagui/use-controllable-state": "3.0.0-beta.637.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@tamagui/build": "
|
|
51
|
+
"@tamagui/build": "3.0.0-beta.637.1",
|
|
52
52
|
"react": ">=19",
|
|
53
|
-
"react-native": "0.
|
|
53
|
+
"react-native": "0.86.2"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"react": ">=19"
|
package/src/Tooltip.tsx
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createStyledHOC,
|
|
3
|
+
createRefComponent,
|
|
4
|
+
defaultTokenSizePolicy,
|
|
5
|
+
styled,
|
|
6
|
+
} from '@tamagui/core'
|
|
1
7
|
import '@tamagui/polyfill-dev'
|
|
2
8
|
|
|
3
9
|
import { FloatingDelayGroup, useDelayGroupContext, type Delay } from '@tamagui/floating'
|
|
4
10
|
import type { SizeTokens, TamaguiElement } from '@tamagui/core'
|
|
5
11
|
import { useEvent } from '@tamagui/core'
|
|
6
12
|
import { FloatingOverrideContext } from '@tamagui/floating'
|
|
7
|
-
import {
|
|
13
|
+
import { oneSizeTokenSmaller } from '@tamagui/get-token'
|
|
8
14
|
import { withStaticProperties } from '@tamagui/helpers'
|
|
9
15
|
import type {
|
|
10
16
|
PopoverAnchorProps,
|
|
@@ -21,6 +27,7 @@ import {
|
|
|
21
27
|
} from '@tamagui/popover'
|
|
22
28
|
import type { PopperArrowProps, PopperProps } from '@tamagui/popper'
|
|
23
29
|
import { Popper, PopperContentFrame } from '@tamagui/popper'
|
|
30
|
+
import { getElevation } from '@tamagui/stacks'
|
|
24
31
|
import { useControllableState } from '@tamagui/use-controllable-state'
|
|
25
32
|
import * as React from 'react'
|
|
26
33
|
|
|
@@ -32,7 +39,16 @@ type ScopedProps<P> = Omit<P, 'scope'> & { scope?: TooltipScopes }
|
|
|
32
39
|
|
|
33
40
|
export type TooltipContentProps = ScopedProps<PopoverContentProps>
|
|
34
41
|
|
|
35
|
-
|
|
42
|
+
const TooltipContentFrame = styled(PopperContentFrame, {
|
|
43
|
+
variants: {
|
|
44
|
+
elevation: {
|
|
45
|
+
number: getElevation,
|
|
46
|
+
Size: getElevation,
|
|
47
|
+
},
|
|
48
|
+
} as const,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
// warning: setting to createStyledHOC causes issues with themes across portal roots
|
|
36
52
|
|
|
37
53
|
// performance: avoid 2 components we never use
|
|
38
54
|
const ALWAYS_DISABLE_TOOLTIP = {
|
|
@@ -42,8 +58,9 @@ const ALWAYS_DISABLE_TOOLTIP = {
|
|
|
42
58
|
// dismiss: true
|
|
43
59
|
} as const
|
|
44
60
|
|
|
45
|
-
const TooltipContent =
|
|
46
|
-
|
|
61
|
+
const TooltipContent = createStyledHOC(
|
|
62
|
+
TooltipContentFrame,
|
|
63
|
+
(props: TooltipContentProps, ref) => {
|
|
47
64
|
const preventAnimation = React.useContext(PreventTooltipAnimationContext)
|
|
48
65
|
const zIndexFromContext = React.useContext(TooltipZIndexContext)
|
|
49
66
|
|
|
@@ -51,44 +68,38 @@ const TooltipContent = PopperContentFrame.styleable<TooltipContentProps>(
|
|
|
51
68
|
<PopoverContent
|
|
52
69
|
scope={props.scope || TOOLTIP_SCOPE}
|
|
53
70
|
alwaysDisable={ALWAYS_DISABLE_TOOLTIP}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
pointerEvents: 'none',
|
|
58
|
-
size: '$true',
|
|
59
|
-
})}
|
|
60
|
-
ref={ref}
|
|
61
|
-
// zIndex from root Tooltip prop flows to portal
|
|
71
|
+
backgroundColor="background"
|
|
72
|
+
alignItems="center"
|
|
73
|
+
pointerEvents="none"
|
|
62
74
|
{...(zIndexFromContext !== undefined && { zIndex: zIndexFromContext })}
|
|
63
75
|
{...props}
|
|
64
|
-
{...(preventAnimation && {
|
|
65
|
-
|
|
66
|
-
})}
|
|
76
|
+
{...(preventAnimation && { transition: null })}
|
|
77
|
+
ref={ref}
|
|
67
78
|
/>
|
|
68
79
|
)
|
|
69
80
|
},
|
|
70
81
|
{
|
|
71
|
-
|
|
72
|
-
componentName: 'Tooltip',
|
|
73
|
-
},
|
|
82
|
+
displayName: 'Tooltip',
|
|
74
83
|
}
|
|
75
84
|
)
|
|
76
85
|
|
|
77
|
-
const TooltipArrow =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
const TooltipArrow = createRefComponent<TamaguiElement, PopperArrowProps>(
|
|
87
|
+
(props, ref) => {
|
|
88
|
+
const { className, ...rest } = props
|
|
89
|
+
return (
|
|
90
|
+
<PopoverArrow
|
|
91
|
+
scope={props.scope || TOOLTIP_SCOPE}
|
|
92
|
+
className={`is_Tooltip ${className || ''}`.trim()}
|
|
93
|
+
ref={ref}
|
|
94
|
+
{...rest}
|
|
95
|
+
/>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
)
|
|
87
99
|
|
|
88
100
|
export type TooltipProps = ScopedProps<
|
|
89
101
|
PopperProps & {
|
|
90
102
|
open?: boolean
|
|
91
|
-
unstyled?: boolean
|
|
92
103
|
children?: React.ReactNode
|
|
93
104
|
onOpenChange?: (open: boolean) => void
|
|
94
105
|
focus?: {
|
|
@@ -144,7 +155,7 @@ export const closeOpenTooltips = () => {
|
|
|
144
155
|
setOpens.forEach((x) => x(false))
|
|
145
156
|
}
|
|
146
157
|
|
|
147
|
-
const TooltipComponent =
|
|
158
|
+
const TooltipComponent = createRefComponent(function Tooltip(
|
|
148
159
|
props: TooltipProps,
|
|
149
160
|
// no real ref here but React complaining need to see why see SandboxCustomStyledAnimatedTooltip.ts
|
|
150
161
|
ref
|
|
@@ -219,19 +230,14 @@ const TooltipComponent = React.forwardRef(function Tooltip(
|
|
|
219
230
|
const onCustomAnchorAdd = React.useCallback(() => setHasCustomAnchor(true), [])
|
|
220
231
|
const onCustomAnchorRemove = React.useCallback(() => setHasCustomAnchor(false), [])
|
|
221
232
|
const contentId = React.useId()
|
|
222
|
-
const smallerSize =
|
|
223
|
-
? null
|
|
224
|
-
: getSize('$true', {
|
|
225
|
-
shift: -2,
|
|
226
|
-
bounds: [0],
|
|
227
|
-
})
|
|
233
|
+
const smallerSize = oneSizeTokenSmaller(defaultTokenSizePolicy.fontSize)
|
|
228
234
|
|
|
229
235
|
const content = (
|
|
230
236
|
<FloatingOverrideContext.Provider value={floatingContext}>
|
|
231
237
|
{/* default tooltip to a smaller size */}
|
|
232
238
|
<Popper
|
|
233
239
|
scope={scope}
|
|
234
|
-
size={smallerSize
|
|
240
|
+
size={smallerSize as SizeTokens}
|
|
235
241
|
allowFlip
|
|
236
242
|
stayInFrame
|
|
237
243
|
open={open}
|
|
@@ -265,7 +271,7 @@ const TooltipComponent = React.forwardRef(function Tooltip(
|
|
|
265
271
|
return content
|
|
266
272
|
})
|
|
267
273
|
|
|
268
|
-
const TooltipTrigger =
|
|
274
|
+
const TooltipTrigger = createRefComponent(function TooltipTrigger(
|
|
269
275
|
props: ScopedProps<PopoverTriggerProps>,
|
|
270
276
|
ref: any
|
|
271
277
|
) {
|
|
@@ -273,7 +279,7 @@ const TooltipTrigger = React.forwardRef(function TooltipTrigger(
|
|
|
273
279
|
return <PopoverTrigger {...rest} scope={scope || TOOLTIP_SCOPE} ref={ref} />
|
|
274
280
|
})
|
|
275
281
|
|
|
276
|
-
const TooltipAnchor =
|
|
282
|
+
const TooltipAnchor = createRefComponent(function TooltipAnchor(
|
|
277
283
|
props: ScopedProps<PopoverAnchorProps>,
|
|
278
284
|
ref: any
|
|
279
285
|
) {
|
package/src/TooltipSimple.tsx
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { createRefComponent, getVariableValue } from '@tamagui/core'
|
|
2
|
+
import { getRadius, getSize, getSpace } from '@tamagui/get-token'
|
|
3
|
+
import type { YStackProps } from '@tamagui/stacks'
|
|
3
4
|
import { Paragraph } from '@tamagui/text'
|
|
4
5
|
import * as React from 'react'
|
|
5
6
|
|
|
@@ -10,10 +11,10 @@ export type TooltipSimpleProps = TooltipProps & {
|
|
|
10
11
|
disabled?: boolean
|
|
11
12
|
label?: React.ReactNode
|
|
12
13
|
children?: React.ReactNode
|
|
13
|
-
contentProps?:
|
|
14
|
+
contentProps?: YStackProps
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
export const TooltipSimple: React.FC<TooltipSimpleProps> =
|
|
17
|
+
export const TooltipSimple: React.FC<TooltipSimpleProps> = createRefComponent(
|
|
17
18
|
({ label, children, contentProps, disabled, ...tooltipProps }, ref) => {
|
|
18
19
|
'use no memo'
|
|
19
20
|
|
|
@@ -46,35 +47,35 @@ export const TooltipSimple: React.FC<TooltipSimpleProps> = React.forwardRef(
|
|
|
46
47
|
</Tooltip.Trigger>
|
|
47
48
|
|
|
48
49
|
<Tooltip.Content
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
scale=
|
|
52
|
-
|
|
53
|
-
opacity={1}
|
|
50
|
+
theme="Tooltip"
|
|
51
|
+
y="enter:-4px exit:-4px"
|
|
52
|
+
scale="1 enter:0.96 exit:0.96"
|
|
53
|
+
opacity="1 enter:0 exit:0"
|
|
54
54
|
pointerEvents="none"
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
},
|
|
66
|
-
]}
|
|
55
|
+
paddingHorizontal={getVariableValue(getSpace(tooltipProps.size ?? true))}
|
|
56
|
+
paddingVertical={Math.max(
|
|
57
|
+
0,
|
|
58
|
+
Math.round(
|
|
59
|
+
(getVariableValue(getSize(tooltipProps.size ?? true)) as number) * 0.36 - 9
|
|
60
|
+
)
|
|
61
|
+
)}
|
|
62
|
+
borderRadius={getVariableValue(getRadius(tooltipProps.size ?? true))}
|
|
63
|
+
boxShadow="0 2px 4px shadow-color"
|
|
64
|
+
transition={['quicker', { opacity: { overshootClamping: true } }]}
|
|
67
65
|
{...contentProps}
|
|
66
|
+
animateOnly={['transform', 'opacity']}
|
|
68
67
|
>
|
|
69
|
-
<Tooltip.Arrow
|
|
68
|
+
<Tooltip.Arrow
|
|
69
|
+
size={tooltipProps.size ?? 7}
|
|
70
|
+
backgroundColor="background"
|
|
71
|
+
borderColor="border-color"
|
|
72
|
+
/>
|
|
70
73
|
<Paragraph
|
|
71
74
|
maxWidth={350}
|
|
72
75
|
overflow="hidden"
|
|
73
|
-
size="$3"
|
|
74
76
|
textAlign="center"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}}
|
|
77
|
+
textWrap="web:balance"
|
|
78
|
+
size="3"
|
|
78
79
|
>
|
|
79
80
|
{label}
|
|
80
81
|
</Paragraph>
|