@tamagui/tooltip 3.0.0-beta.1342.1 → 3.0.0-beta.1348.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 +1 -1
- package/dist/cjs/TooltipSimple.cjs +2 -2
- package/dist/esm/Tooltip.mjs +1 -1
- package/dist/esm/Tooltip.mjs.map +1 -1
- package/dist/esm/TooltipSimple.mjs +2 -2
- package/dist/esm/TooltipSimple.mjs.map +1 -1
- package/dist/jsx/Tooltip.mjs +1 -1
- package/dist/jsx/Tooltip.mjs.map +1 -1
- package/dist/jsx/TooltipSimple.mjs +2 -2
- package/dist/jsx/TooltipSimple.mjs.map +1 -1
- package/package.json +13 -13
- package/src/Tooltip.tsx +0 -4
- package/src/TooltipSimple.tsx +4 -2
- package/types/Tooltip.d.ts +0 -4
- package/types/Tooltip.d.ts.map +1 -1
- package/types/TooltipSimple.d.ts +2 -0
- package/types/TooltipSimple.d.ts.map +1 -1
package/dist/cjs/Tooltip.cjs
CHANGED
|
@@ -92,7 +92,7 @@ const closeOpenTooltips = () => {
|
|
|
92
92
|
};
|
|
93
93
|
const TooltipComponent = (0, import_core.createRefComponent)(function Tooltip(props, ref) {
|
|
94
94
|
"use no memo";
|
|
95
|
-
const { children, delay: delayProp, restMs: restMsProp, onOpenChange: onOpenChangeProp, focus, open: openProp, disableAutoCloseOnScroll, zIndex, scope = TOOLTIP_SCOPE,
|
|
95
|
+
const { children, delay: delayProp, restMs: restMsProp, onOpenChange: onOpenChangeProp, focus, open: openProp, disableAutoCloseOnScroll, zIndex, scope = TOOLTIP_SCOPE, ...restProps } = props;
|
|
96
96
|
const triggerRef = React.useRef(null);
|
|
97
97
|
const closeReasonRef = React.useRef(void 0);
|
|
98
98
|
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
@@ -32,7 +32,7 @@ var import_text = require("@tamagui/text");
|
|
|
32
32
|
var React = __toESM(require("react"), 1);
|
|
33
33
|
var import_Tooltip = require("./Tooltip.cjs");
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
|
-
const TooltipSimple = (0, import_core.createRefComponent)(({ label, children, contentProps, disabled, ...tooltipProps }, ref) => {
|
|
35
|
+
const TooltipSimple = (0, import_core.createRefComponent)(({ label, children, contentProps, disabled, size = 7, ...tooltipProps }, ref) => {
|
|
36
36
|
"use no memo";
|
|
37
37
|
const child = React.Children.only(children);
|
|
38
38
|
if (!label) {
|
|
@@ -70,7 +70,7 @@ const TooltipSimple = (0, import_core.createRefComponent)(({ label, children, co
|
|
|
70
70
|
},
|
|
71
71
|
...contentProps,
|
|
72
72
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_Tooltip.Tooltip.Arrow, {
|
|
73
|
-
size
|
|
73
|
+
size,
|
|
74
74
|
backgroundColor: "background",
|
|
75
75
|
borderColor: "border-color"
|
|
76
76
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_text.Paragraph, {
|
package/dist/esm/Tooltip.mjs
CHANGED
|
@@ -57,7 +57,7 @@ const closeOpenTooltips = () => {
|
|
|
57
57
|
};
|
|
58
58
|
const TooltipComponent = createRefComponent(function Tooltip(props, ref) {
|
|
59
59
|
"use no memo";
|
|
60
|
-
const { children, delay: delayProp, restMs: restMsProp, onOpenChange: onOpenChangeProp, focus, open: openProp, disableAutoCloseOnScroll, zIndex, scope = TOOLTIP_SCOPE,
|
|
60
|
+
const { children, delay: delayProp, restMs: restMsProp, onOpenChange: onOpenChangeProp, focus, open: openProp, disableAutoCloseOnScroll, zIndex, scope = TOOLTIP_SCOPE, ...restProps } = props;
|
|
61
61
|
const triggerRef = React.useRef(null);
|
|
62
62
|
const closeReasonRef = React.useRef(void 0);
|
|
63
63
|
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
package/dist/esm/Tooltip.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":[],"sources":["esm/Tooltip.js"],"sourcesContent":["import { createStyledHOC, createRefComponent, styled } from \"@tamagui/core\";\n\nimport { FloatingDelayGroup, useDelayGroupContext } from \"@tamagui/floating\";\nimport { useEvent } from \"@tamagui/core\";\nimport { FloatingOverrideContext } from \"@tamagui/floating\";\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 { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst TOOLTIP_SCOPE = \"\";\nconst TooltipContentFrame = styled(PopperContentFrame, {});\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 paddingHorizontal: \"2\",\n paddingVertical: \"1\",\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
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":[],"sources":["esm/Tooltip.js"],"sourcesContent":["import { createStyledHOC, createRefComponent, styled } from \"@tamagui/core\";\n\nimport { FloatingDelayGroup, useDelayGroupContext } from \"@tamagui/floating\";\nimport { useEvent } from \"@tamagui/core\";\nimport { FloatingOverrideContext } from \"@tamagui/floating\";\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 { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst TOOLTIP_SCOPE = \"\";\nconst TooltipContentFrame = styled(PopperContentFrame, {});\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 paddingHorizontal: \"2\",\n paddingVertical: \"1\",\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 closeReasonRef = React.useRef(void 0);\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 closeReasonRef,\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 content = /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, { value: floatingContext, children: /* @__PURE__ */ jsx(Popper, { scope, allowFlip: true, stayInFrame: true, open, ...restProps, children: /* @__PURE__ */ jsx(\n PopoverContextProvider,\n {\n scope,\n contentId,\n triggerRef,\n open,\n onOpenChange: setOpen,\n closeReasonRef,\n onOpenToggle: voidFn,\n hasCustomAnchor,\n onCustomAnchorAdd,\n onCustomAnchorRemove,\n children\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":";;;;;;;;;;AAkBA,MAAM,gBAAgB;AACtB,MAAM,sBAAsB,OAAO,oBAAoB,CAAC,CAAC;AACzD,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;EACtB,eAAe;EACf,iBAAiB;EACjB,YAAY;EACZ,eAAe;EACf,mBAAmB;EACnB,iBAAiB;EACjB,GAAG,sBAAsB,KAAK,KAAK,EAAE,QAAQ,kBAAkB;EAC/D,GAAG;EACH,GAAG,oBAAoB,EAAE,YAAY,KAAK;EAC1C;CACF,CACF;AACF,GACA,EACE,aAAa,UACf,CACF;AACA,MAAM,eAAe,oBAClB,OAAO,QAAQ;CACd,MAAM,EAAE,WAAW,GAAG,SAAS;CAC/B,OAAuB,oBACrB,cACA;EACE,OAAO,MAAM,SAAS;EACtB,WAAW,cAAc,aAAa,KAAK,KAAK;EAChD;EACA,GAAG;CACL,CACF;AACF,CACF;AACA,MAAM,iCAAiC,MAAM,cAAc,KAAK;AAChE,MAAM,uBAAuB,MAAM,cAAc,KAAK,CAAC;AACvD,MAAM,gBAAgB,EACpB,UACA,OACA,mBAAmB,OACnB,gBACI;CACJ,OAAuB,oBAAI,+BAA+B,UAAU;EAAE,OAAO;EAAkB,UAA0B,oBACvH,oBACA;GACE;GACA,OAAO,MAAM,cAAc,OAAO,CAAC,KAAK,UAA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A,SAAS;EACT;EACA;CACF,CAAC;CACD,MAAM,oBAAoB,MAAM,kBAAkB,mBAAmB,IAAI,GAAG,CAAC,CAAC;CAC9E,MAAM,uBAAuB,MAAM,kBAAkB,mBAAmB,KAAK,GAAG,CAAC,CAAC;CAClF,MAAM,YAAY,MAAM,MAAM;CAC9B,MAAM,UAA0B,oBAAI,wBAAwB,UAAU;EAAE,OAAO;EAAiB,UAA0B,oBAAI,QAAQ;GAAE;GAAO,WAAW;GAAM,aAAa;GAAM;GAAM,GAAG;GAAW,UAA0B,oBAC/N,wBACA;IACE;IACA;IACA;IACA;IACA,cAAc;IACd;IACA,cAAc;IACd;IACA;IACA;IACA;GACF,CACF;EAAE,CAAC;CAAE,CAAC;CACN,IAAI,WAAW,KAAK,GAAG;EACrB,OAAuB,oBAAI,qBAAqB,UAAU;GAAE,OAAO;GAAQ,UAAU;EAAQ,CAAC;CAChG;CACA,OAAO;AACT,CAAC;AACD,MAAM,iBAAiB,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"}
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { Tooltip } from "./Tooltip.mjs";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
|
-
const TooltipSimple = createRefComponent(({ label, children, contentProps, disabled, ...tooltipProps }, ref) => {
|
|
7
|
+
const TooltipSimple = createRefComponent(({ label, children, contentProps, disabled, size = 7, ...tooltipProps }, ref) => {
|
|
8
8
|
"use no memo";
|
|
9
9
|
const child = React.Children.only(children);
|
|
10
10
|
if (!label) {
|
|
@@ -42,7 +42,7 @@ const TooltipSimple = createRefComponent(({ label, children, contentProps, disab
|
|
|
42
42
|
},
|
|
43
43
|
...contentProps,
|
|
44
44
|
children: [/* @__PURE__ */ jsx(Tooltip.Arrow, {
|
|
45
|
-
size
|
|
45
|
+
size,
|
|
46
46
|
backgroundColor: "background",
|
|
47
47
|
borderColor: "border-color"
|
|
48
48
|
}), /* @__PURE__ */ jsx(Paragraph, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipSimple.js","names":[],"sources":["esm/TooltipSimple.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/core\";\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: \"brand\",\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: \"2\",\n paddingVertical: \"1\",\n borderRadius: 6,\n boxShadow: \"0 2px 4px shadow-color\",\n transition: {\n preset: \"quicker\",\n properties: \"transform, opacity\",\n opacity: { preset: \"quicker\", spring: { overshootClamping: true } }\n },\n ...contentProps,\n children: [\n /* @__PURE__ */ jsx(\n Tooltip.Arrow,\n {\n size
|
|
1
|
+
{"version":3,"file":"TooltipSimple.js","names":[],"sources":["esm/TooltipSimple.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/core\";\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, size = 7, ...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: \"brand\",\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: \"2\",\n paddingVertical: \"1\",\n borderRadius: 6,\n boxShadow: \"0 2px 4px shadow-color\",\n transition: {\n preset: \"quicker\",\n properties: \"transform, opacity\",\n opacity: { preset: \"quicker\", spring: { overshootClamping: true } }\n },\n ...contentProps,\n children: [\n /* @__PURE__ */ jsx(\n Tooltip.Arrow,\n {\n size,\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":";;;;;;;AAKA,MAAM,gBAAgB,oBACnB,EAAE,OAAO,UAAU,cAAc,UAAU,OAAO,GAAG,GAAG,gBAAgB,QAAQ;CAC/E;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;GACnB,iBAAiB;GACjB,cAAc;GACd,WAAW;GACX,YAAY;IACV,QAAQ;IACR,YAAY;IACZ,SAAS;KAAE,QAAQ;KAAW,QAAQ,EAAE,mBAAmB,KAAK;IAAE;GACpE;GACA,GAAG;GACH,UAAU,CACQ,oBACd,QAAQ,OACR;IACE;IACA,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"}
|
package/dist/jsx/Tooltip.mjs
CHANGED
|
@@ -57,7 +57,7 @@ const closeOpenTooltips = () => {
|
|
|
57
57
|
};
|
|
58
58
|
const TooltipComponent = createRefComponent(function Tooltip(props, ref) {
|
|
59
59
|
"use no memo";
|
|
60
|
-
const { children, delay: delayProp, restMs: restMsProp, onOpenChange: onOpenChangeProp, focus, open: openProp, disableAutoCloseOnScroll, zIndex, scope = TOOLTIP_SCOPE,
|
|
60
|
+
const { children, delay: delayProp, restMs: restMsProp, onOpenChange: onOpenChangeProp, focus, open: openProp, disableAutoCloseOnScroll, zIndex, scope = TOOLTIP_SCOPE, ...restProps } = props;
|
|
61
61
|
const triggerRef = React.useRef(null);
|
|
62
62
|
const closeReasonRef = React.useRef(void 0);
|
|
63
63
|
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
package/dist/jsx/Tooltip.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","names":[],"sources":["jsx/Tooltip.js"],"sourcesContent":["import { createStyledHOC, createRefComponent, styled } from \"@tamagui/core\";\n\nimport { FloatingDelayGroup, useDelayGroupContext } from \"@tamagui/floating\";\nimport { useEvent } from \"@tamagui/core\";\nimport { FloatingOverrideContext } from \"@tamagui/floating\";\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 { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst TOOLTIP_SCOPE = \"\";\nconst TooltipContentFrame = styled(PopperContentFrame, {});\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 paddingHorizontal: \"2\",\n paddingVertical: \"1\",\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
|
|
1
|
+
{"version":3,"file":"Tooltip.js","names":[],"sources":["jsx/Tooltip.js"],"sourcesContent":["import { createStyledHOC, createRefComponent, styled } from \"@tamagui/core\";\n\nimport { FloatingDelayGroup, useDelayGroupContext } from \"@tamagui/floating\";\nimport { useEvent } from \"@tamagui/core\";\nimport { FloatingOverrideContext } from \"@tamagui/floating\";\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 { useControllableState } from \"@tamagui/use-controllable-state\";\nimport * as React from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\nconst TOOLTIP_SCOPE = \"\";\nconst TooltipContentFrame = styled(PopperContentFrame, {});\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 paddingHorizontal: \"2\",\n paddingVertical: \"1\",\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 closeReasonRef = React.useRef(void 0);\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 closeReasonRef,\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 content = /* @__PURE__ */ jsx(FloatingOverrideContext.Provider, { value: floatingContext, children: /* @__PURE__ */ jsx(Popper, { scope, allowFlip: true, stayInFrame: true, open, ...restProps, children: /* @__PURE__ */ jsx(\n PopoverContextProvider,\n {\n scope,\n contentId,\n triggerRef,\n open,\n onOpenChange: setOpen,\n closeReasonRef,\n onOpenToggle: voidFn,\n hasCustomAnchor,\n onCustomAnchorAdd,\n onCustomAnchorRemove,\n children\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":";;;;;;;;;;AAkBA,MAAM,gBAAgB;AACtB,MAAM,sBAAsB,OAAO,oBAAoB,CAAC,CAAC;AACzD,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;EACtB,eAAe;EACf,iBAAiB;EACjB,YAAY;EACZ,eAAe;EACf,mBAAmB;EACnB,iBAAiB;EACjB,GAAG,sBAAsB,KAAK,KAAK,EAAE,QAAQ,kBAAkB;EAC/D,GAAG;EACH,GAAG,oBAAoB,EAAE,YAA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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"}
|
|
@@ -4,7 +4,7 @@ import * as React from "react";
|
|
|
4
4
|
import { Tooltip } from "./Tooltip.mjs";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
|
-
const TooltipSimple = createRefComponent(({ label, children, contentProps, disabled, ...tooltipProps }, ref) => {
|
|
7
|
+
const TooltipSimple = createRefComponent(({ label, children, contentProps, disabled, size = 7, ...tooltipProps }, ref) => {
|
|
8
8
|
"use no memo";
|
|
9
9
|
const child = React.Children.only(children);
|
|
10
10
|
if (!label) {
|
|
@@ -42,7 +42,7 @@ const TooltipSimple = createRefComponent(({ label, children, contentProps, disab
|
|
|
42
42
|
},
|
|
43
43
|
...contentProps,
|
|
44
44
|
children: [/* @__PURE__ */ jsx(Tooltip.Arrow, {
|
|
45
|
-
size
|
|
45
|
+
size,
|
|
46
46
|
backgroundColor: "background",
|
|
47
47
|
borderColor: "border-color"
|
|
48
48
|
}), /* @__PURE__ */ jsx(Paragraph, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipSimple.js","names":[],"sources":["jsx/TooltipSimple.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/core\";\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: \"brand\",\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: \"2\",\n paddingVertical: \"1\",\n borderRadius: 6,\n boxShadow: \"0 2px 4px shadow-color\",\n transition: {\n preset: \"quicker\",\n properties: \"transform, opacity\",\n opacity: { preset: \"quicker\", spring: { overshootClamping: true } }\n },\n ...contentProps,\n children: [\n /* @__PURE__ */ jsx(\n Tooltip.Arrow,\n {\n size
|
|
1
|
+
{"version":3,"file":"TooltipSimple.js","names":[],"sources":["jsx/TooltipSimple.js"],"sourcesContent":["import { createRefComponent } from \"@tamagui/core\";\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, size = 7, ...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: \"brand\",\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: \"2\",\n paddingVertical: \"1\",\n borderRadius: 6,\n boxShadow: \"0 2px 4px shadow-color\",\n transition: {\n preset: \"quicker\",\n properties: \"transform, opacity\",\n opacity: { preset: \"quicker\", spring: { overshootClamping: true } }\n },\n ...contentProps,\n children: [\n /* @__PURE__ */ jsx(\n Tooltip.Arrow,\n {\n size,\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":";;;;;;;AAKA,MAAM,gBAAgB,oBACnB,EAAE,OAAO,UAAU,cAAc,UAAU,OAAO,GAAG,GAAG,gBAAgB,QAAQ;CAC/E;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;GACnB,iBAAiB;GACjB,cAAc;GACd,WAAW;GACX,YAAY;IACV,QAAQ;IACR,YAAY;IACZ,SAAS;KAAE,QAAQ;KAAW,QAAQ,EAAE,mBAAmB,KAAK;IAAE;GACpE;GACA,GAAG;GACH,UAAU,CACQ,oBACd,QAAQ,OACR;IACE;IACA,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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/tooltip",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.1348.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"files": [
|
|
@@ -35,20 +35,20 @@
|
|
|
35
35
|
"clean:build": "tamagui-build clean:build"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@tamagui/compose-refs": "3.0.0-beta.
|
|
39
|
-
"@tamagui/core": "3.0.0-beta.
|
|
40
|
-
"@tamagui/create-context": "3.0.0-beta.
|
|
41
|
-
"@tamagui/floating": "3.0.0-beta.
|
|
42
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
43
|
-
"@tamagui/polyfill-dev": "3.0.0-beta.
|
|
44
|
-
"@tamagui/popover": "3.0.0-beta.
|
|
45
|
-
"@tamagui/popper": "3.0.0-beta.
|
|
46
|
-
"@tamagui/stacks": "3.0.0-beta.
|
|
47
|
-
"@tamagui/text": "3.0.0-beta.
|
|
48
|
-
"@tamagui/use-controllable-state": "3.0.0-beta.
|
|
38
|
+
"@tamagui/compose-refs": "3.0.0-beta.1348.1",
|
|
39
|
+
"@tamagui/core": "3.0.0-beta.1348.1",
|
|
40
|
+
"@tamagui/create-context": "3.0.0-beta.1348.1",
|
|
41
|
+
"@tamagui/floating": "3.0.0-beta.1348.1",
|
|
42
|
+
"@tamagui/helpers": "3.0.0-beta.1348.1",
|
|
43
|
+
"@tamagui/polyfill-dev": "3.0.0-beta.1348.1",
|
|
44
|
+
"@tamagui/popover": "3.0.0-beta.1348.1",
|
|
45
|
+
"@tamagui/popper": "3.0.0-beta.1348.1",
|
|
46
|
+
"@tamagui/stacks": "3.0.0-beta.1348.1",
|
|
47
|
+
"@tamagui/text": "3.0.0-beta.1348.1",
|
|
48
|
+
"@tamagui/use-controllable-state": "3.0.0-beta.1348.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@tamagui/build": "3.0.0-beta.
|
|
51
|
+
"@tamagui/build": "3.0.0-beta.1348.1",
|
|
52
52
|
"react": "19.2.3",
|
|
53
53
|
"react-native": "0.86.2"
|
|
54
54
|
},
|
package/src/Tooltip.tsx
CHANGED
|
@@ -88,8 +88,6 @@ const TooltipArrow = createRefComponent<TamaguiElement, PopperArrowProps>(
|
|
|
88
88
|
|
|
89
89
|
export type TooltipProps = ScopedProps<
|
|
90
90
|
PopperProps & {
|
|
91
|
-
/** arrow size in px */
|
|
92
|
-
size?: number
|
|
93
91
|
open?: boolean
|
|
94
92
|
children?: React.ReactNode
|
|
95
93
|
onOpenChange?: (open: boolean) => void
|
|
@@ -164,8 +162,6 @@ const TooltipComponent = createRefComponent(function Tooltip(
|
|
|
164
162
|
disableAutoCloseOnScroll,
|
|
165
163
|
zIndex,
|
|
166
164
|
scope = TOOLTIP_SCOPE,
|
|
167
|
-
// arrow px for TooltipSimple; never forwarded to Popper
|
|
168
|
-
size: _size,
|
|
169
165
|
...restProps
|
|
170
166
|
} = props
|
|
171
167
|
const triggerRef = React.useRef<HTMLButtonElement>(null)
|
package/src/TooltipSimple.tsx
CHANGED
|
@@ -8,13 +8,15 @@ import { Tooltip } from './Tooltip'
|
|
|
8
8
|
|
|
9
9
|
export type TooltipSimpleProps = TooltipProps & {
|
|
10
10
|
disabled?: boolean
|
|
11
|
+
/** arrow size in px */
|
|
12
|
+
size?: number
|
|
11
13
|
label?: React.ReactNode
|
|
12
14
|
children?: React.ReactNode
|
|
13
15
|
contentProps?: YStackProps
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
export const TooltipSimple: React.FC<TooltipSimpleProps> = createRefComponent(
|
|
17
|
-
({ label, children, contentProps, disabled, ...tooltipProps }, ref) => {
|
|
19
|
+
({ label, children, contentProps, disabled, size = 7, ...tooltipProps }, ref) => {
|
|
18
20
|
'use no memo'
|
|
19
21
|
|
|
20
22
|
const child = React.Children.only(children)
|
|
@@ -63,7 +65,7 @@ export const TooltipSimple: React.FC<TooltipSimpleProps> = createRefComponent(
|
|
|
63
65
|
{...contentProps}
|
|
64
66
|
>
|
|
65
67
|
<Tooltip.Arrow
|
|
66
|
-
size={
|
|
68
|
+
size={size}
|
|
67
69
|
backgroundColor="background"
|
|
68
70
|
borderColor="border-color"
|
|
69
71
|
/>
|
package/types/Tooltip.d.ts
CHANGED
|
@@ -10,8 +10,6 @@ type ScopedProps<P> = Omit<P, 'scope'> & {
|
|
|
10
10
|
};
|
|
11
11
|
export type TooltipContentProps = ScopedProps<PopoverContentProps>;
|
|
12
12
|
export type TooltipProps = ScopedProps<PopperProps & {
|
|
13
|
-
/** arrow size in px */
|
|
14
|
-
size?: number;
|
|
15
13
|
open?: boolean;
|
|
16
14
|
children?: React.ReactNode;
|
|
17
15
|
onOpenChange?: (open: boolean) => void;
|
|
@@ -40,8 +38,6 @@ export declare const TooltipGroup: ({ children, delay, preventAnimation, timeout
|
|
|
40
38
|
}) => React.JSX.Element;
|
|
41
39
|
export declare const closeOpenTooltips: () => void;
|
|
42
40
|
export declare const Tooltip: ((props: Omit<PopperProps & {
|
|
43
|
-
/** arrow size in px */
|
|
44
|
-
size?: number;
|
|
45
41
|
open?: boolean;
|
|
46
42
|
children?: React.ReactNode;
|
|
47
43
|
onOpenChange?: (open: boolean) => void;
|
package/types/Tooltip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../src/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,uBAAuB,CAAA;AAE9B,OAAO,EAA4C,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAInD,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAkB,CAAA;AASzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGpE,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,MAAM,MAAM,aAAa,GAAG,MAAM,CAAA;AAElC,KAAK,WAAW,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,aAAa,CAAA;CAAE,CAAA;AAElE,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC,CAAA;AAuDlE,MAAM,MAAM,YAAY,GAAG,WAAW,CACpC,WAAW,GAAG;IACZ,
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../src/Tooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,uBAAuB,CAAA;AAE9B,OAAO,EAA4C,KAAK,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAInD,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,kBAAkB,CAAA;AASzB,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGpE,OAAO,KAAK,KAAK,MAAM,OAAO,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AAC,EAAE,OAAO,CAAA;KACtB;cACS,MAAM;aACP,MAAM;YAEX,MAAM,GACN;QACE,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;KACf;+BACsB,OAAO;IAClC;;;OAGG;aACM,MAAM;;YA/EgC,aAAa;;;;;;;;gBAAb,aAAa;;;;;CAsP9D,CAAA"}
|
package/types/TooltipSimple.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import type { TooltipProps } from './Tooltip';
|
|
4
4
|
export type TooltipSimpleProps = TooltipProps & {
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
/** arrow size in px */
|
|
7
|
+
size?: number;
|
|
6
8
|
label?: React.ReactNode;
|
|
7
9
|
children?: React.ReactNode;
|
|
8
10
|
contentProps?: YStackProps;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TooltipSimple.d.ts","sourceRoot":"","sources":["../src/TooltipSimple.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAG7C,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,YAAY,CAAC,EAAE,WAAW,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAmEtD,CAAA"}
|
|
1
|
+
{"version":3,"file":"TooltipSimple.d.ts","sourceRoot":"","sources":["../src/TooltipSimple.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAElD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AAG7C,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG;IAC9C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,YAAY,CAAC,EAAE,WAAW,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAmEtD,CAAA"}
|