@tamagui/tooltip 1.0.0-beta.7 → 1.0.1-beta.100
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.js +55 -20
- package/dist/cjs/Tooltip.js.map +2 -2
- package/dist/cjs/Tooltip.native.js +44 -0
- package/dist/cjs/Tooltip.native.js.map +7 -0
- package/dist/esm/Tooltip.js +109 -45
- package/dist/esm/Tooltip.js.map +2 -2
- package/dist/esm/Tooltip.native.js +20 -0
- package/dist/esm/Tooltip.native.js.map +7 -0
- package/dist/jsx/Tooltip.js +42 -21
- package/dist/jsx/Tooltip.js.map +7 -0
- package/dist/jsx/Tooltip.native.js +20 -0
- package/dist/jsx/Tooltip.native.js.map +7 -0
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/index.js.map +7 -0
- package/package.json +17 -14
- package/src/Tooltip.native.tsx +22 -0
- package/src/Tooltip.tsx +213 -0
- package/src/index.tsx +1 -0
- package/types/Tooltip.d.ts +25 -30
- package/types/Tooltip.d.ts.map +1 -1
- package/types/Tooltip.native.d.ts +9 -0
- package/types/Tooltip.native.d.ts.map +1 -0
- package/types/index.d.ts +0 -0
- package/types/index.d.ts.map +0 -0
package/dist/cjs/Tooltip.js
CHANGED
|
@@ -21,7 +21,6 @@ var __spreadValues = (a, b) => {
|
|
|
21
21
|
return a;
|
|
22
22
|
};
|
|
23
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
25
24
|
var __objRest = (source, exclude) => {
|
|
26
25
|
var target = {};
|
|
27
26
|
for (var prop in source)
|
|
@@ -62,15 +61,40 @@ var import_popover = require("@tamagui/popover");
|
|
|
62
61
|
var import_popper = require("@tamagui/popper");
|
|
63
62
|
var import_text = require("@tamagui/text");
|
|
64
63
|
var React = __toESM(require("react"));
|
|
65
|
-
const TooltipContent = React.forwardRef((
|
|
64
|
+
const TooltipContent = React.forwardRef((_a, ref) => {
|
|
65
|
+
var _b = _a, { __scopePopover } = _b, props = __objRest(_b, ["__scopePopover"]);
|
|
66
|
+
const popperScope = (0, import_popover.usePopoverScope)(__scopePopover);
|
|
67
|
+
const popper = (0, import_popper.usePopperContext)("PopperContent", popperScope["__scopePopper"]);
|
|
66
68
|
return /* @__PURE__ */ React.createElement(import_popover.PopoverContent, __spreadValues({
|
|
69
|
+
disableRemoveScroll: true,
|
|
70
|
+
trapFocus: false,
|
|
71
|
+
padding: props.size || popper.size || "$2",
|
|
72
|
+
componentName: "TooltipContent",
|
|
67
73
|
pointerEvents: "none",
|
|
68
74
|
ref
|
|
69
75
|
}, props));
|
|
70
76
|
});
|
|
77
|
+
const TooltipArrow = React.forwardRef((props, ref) => {
|
|
78
|
+
return /* @__PURE__ */ React.createElement(import_popover.PopoverArrow, __spreadValues({
|
|
79
|
+
componentName: "TooltipArrow",
|
|
80
|
+
ref
|
|
81
|
+
}, props));
|
|
82
|
+
});
|
|
71
83
|
const TooltipGroup = import_react_dom_interactions.FloatingDelayGroup;
|
|
72
84
|
const Tooltip = (0, import_core.withStaticProperties)((props) => {
|
|
73
|
-
const _a = props, {
|
|
85
|
+
const _a = props, {
|
|
86
|
+
__scopePopover,
|
|
87
|
+
children,
|
|
88
|
+
restMs = 500,
|
|
89
|
+
delay: delayProp,
|
|
90
|
+
onOpenChange: onOpenChangeProp
|
|
91
|
+
} = _a, restProps = __objRest(_a, [
|
|
92
|
+
"__scopePopover",
|
|
93
|
+
"children",
|
|
94
|
+
"restMs",
|
|
95
|
+
"delay",
|
|
96
|
+
"onOpenChange"
|
|
97
|
+
]);
|
|
74
98
|
const popperScope = (0, import_popover.usePopoverScope)(__scopePopover);
|
|
75
99
|
const triggerRef = React.useRef(null);
|
|
76
100
|
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
@@ -79,14 +103,13 @@ const Tooltip = (0, import_core.withStaticProperties)((props) => {
|
|
|
79
103
|
const [open, setOpen] = React.useState(false);
|
|
80
104
|
const id = props.groupId;
|
|
81
105
|
const onOpenChange = React.useCallback((open2) => {
|
|
82
|
-
var _a2;
|
|
83
106
|
setOpen(open2);
|
|
84
107
|
if (open2) {
|
|
85
108
|
setCurrentId(id);
|
|
86
109
|
}
|
|
87
|
-
|
|
88
|
-
}, [id, setCurrentId]);
|
|
89
|
-
const useFloatingFn =
|
|
110
|
+
onOpenChangeProp == null ? void 0 : onOpenChangeProp(open2);
|
|
111
|
+
}, [id, setCurrentId, onOpenChangeProp]);
|
|
112
|
+
const useFloatingFn = (props2) => {
|
|
90
113
|
const floating = (0, import_react_dom_interactions.useFloating)(__spreadProps(__spreadValues({}, props2), {
|
|
91
114
|
open,
|
|
92
115
|
onOpenChange
|
|
@@ -102,7 +125,7 @@ const Tooltip = (0, import_core.withStaticProperties)((props) => {
|
|
|
102
125
|
getReferenceProps,
|
|
103
126
|
getFloatingProps
|
|
104
127
|
});
|
|
105
|
-
}
|
|
128
|
+
};
|
|
106
129
|
const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open]);
|
|
107
130
|
const voidFn = React.useCallback(() => {
|
|
108
131
|
}, [setOpen]);
|
|
@@ -119,30 +142,33 @@ const Tooltip = (0, import_core.withStaticProperties)((props) => {
|
|
|
119
142
|
onOpenToggle: voidFn,
|
|
120
143
|
hasCustomAnchor,
|
|
121
144
|
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
|
|
122
|
-
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), [])
|
|
123
|
-
modal: true
|
|
145
|
+
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), [])
|
|
124
146
|
}, children)));
|
|
125
147
|
}, {
|
|
126
148
|
Anchor: import_popover.PopoverAnchor,
|
|
127
|
-
Arrow:
|
|
128
|
-
Close: import_popover.PopoverClose,
|
|
149
|
+
Arrow: TooltipArrow,
|
|
129
150
|
Content: TooltipContent,
|
|
130
151
|
Trigger: import_popover.PopoverTrigger
|
|
131
152
|
});
|
|
132
153
|
Tooltip.displayName = "Tooltip";
|
|
133
|
-
const TooltipSimple =
|
|
134
|
-
var
|
|
154
|
+
const TooltipSimple = (_c) => {
|
|
155
|
+
var _d = _c, {
|
|
135
156
|
label,
|
|
136
157
|
children,
|
|
137
158
|
contentProps
|
|
138
|
-
} =
|
|
159
|
+
} = _d, tooltipProps = __objRest(_d, [
|
|
139
160
|
"label",
|
|
140
161
|
"children",
|
|
141
162
|
"contentProps"
|
|
142
163
|
]);
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
164
|
+
let context;
|
|
165
|
+
try {
|
|
166
|
+
context = (0, import_react_dom_interactions.useDelayGroupContext)();
|
|
167
|
+
} catch {
|
|
168
|
+
}
|
|
169
|
+
const contents = /* @__PURE__ */ React.createElement(Tooltip, __spreadValues({}, tooltipProps), /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
170
|
+
asChild: true
|
|
171
|
+
}, children), /* @__PURE__ */ React.createElement(Tooltip.Content, __spreadValues({
|
|
146
172
|
enterStyle: { x: 0, y: -10, opacity: 0, scale: 0.9 },
|
|
147
173
|
exitStyle: { x: 0, y: -10, opacity: 0, scale: 0.9 },
|
|
148
174
|
x: 0,
|
|
@@ -158,8 +184,17 @@ const TooltipSimple = /* @__PURE__ */ __name((_a) => {
|
|
|
158
184
|
}
|
|
159
185
|
}
|
|
160
186
|
]
|
|
161
|
-
}, contentProps), /* @__PURE__ */ React.createElement(Tooltip.Arrow, null), /* @__PURE__ */ React.createElement(import_text.Paragraph,
|
|
162
|
-
|
|
187
|
+
}, contentProps), /* @__PURE__ */ React.createElement(Tooltip.Arrow, null), /* @__PURE__ */ React.createElement(import_text.Paragraph, {
|
|
188
|
+
size: "$2",
|
|
189
|
+
lineHeight: "$1"
|
|
190
|
+
}, label)));
|
|
191
|
+
if (!context) {
|
|
192
|
+
return /* @__PURE__ */ React.createElement(TooltipGroup, {
|
|
193
|
+
delay: { open: 3e3, close: 100 }
|
|
194
|
+
}, contents);
|
|
195
|
+
}
|
|
196
|
+
return contents;
|
|
197
|
+
};
|
|
163
198
|
// Annotate the CommonJS export names for ESM import in node:
|
|
164
199
|
0 && (module.exports = {
|
|
165
200
|
Tooltip,
|
package/dist/cjs/Tooltip.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Tooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport {\n PopoverAnchor,\n PopoverArrow,\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport {\n FloatingOverrideContext,\n Popper,\n PopperProps,\n UseFloatingFn,\n usePopperContext,\n} from '@tamagui/popper'\nimport { SizableStackProps } from '@tamagui/stacks'\nimport { Paragraph } from '@tamagui/text'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n ({ __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>, ref: any) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n return (\n <PopoverContent\n disableRemoveScroll\n trapFocus={false}\n padding={props.size || popper.size || '$2'}\n componentName=\"TooltipContent\"\n pointerEvents=\"none\"\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nconst TooltipArrow = React.forwardRef((props: PopoverArrowProps, ref: any) => {\n return <PopoverArrow componentName=\"TooltipArrow\" ref={ref} {...props} />\n})\n\nexport type TooltipProps = PopperProps & {\n children?: React.ReactNode\n onOpenChange?: (open: boolean) => void\n groupId?: string\n restMs?: number\n delay?:\n | number\n | {\n open?: number\n close?: number\n }\n}\n\nexport const TooltipGroup = FloatingDelayGroup\n\nexport const Tooltip = withStaticProperties(\n ((props: ScopedProps<TooltipProps, 'Popover'>) => {\n const {\n __scopePopover,\n children,\n restMs = 500,\n delay: delayProp,\n onOpenChange: onOpenChangeProp,\n ...restProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const { delay: delayGroup, setCurrentId } = useDelayGroupContext()\n const delay = delayProp ?? delayGroup\n const [open, setOpen] = React.useState(false)\n const id = props.groupId\n\n // TODO useEvent when ready\n const onOpenChange = React.useCallback(\n (open) => {\n setOpen(open)\n if (open) {\n setCurrentId(id)\n }\n onOpenChangeProp?.(open)\n },\n [id, setCurrentId, onOpenChangeProp]\n )\n\n const useFloatingFn: UseFloatingFn = (props) => {\n const floating = useFloating({\n ...props,\n open,\n onOpenChange,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(floating.context, { delay, restMs }),\n useFocus(floating.context),\n useRole(floating.context, { role: 'tooltip' }),\n useDismiss(floating.context),\n useDelayGroup(floating.context, { id }),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n } as any\n }\n\n const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open])\n\n const voidFn = React.useCallback(() => {}, [setOpen])\n\n return (\n <FloatingOverrideContext.Provider value={useFloatingContext}>\n {/* default tooltip to a smaller size */}\n <Popper size=\"$2\" {...popperScope} {...restProps}>\n <__PopoverProviderInternal\n scope={__scopePopover}\n contentId={useId()}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={voidFn}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n >\n {children}\n </__PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n )\n }) as React.FC<TooltipProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: TooltipArrow,\n Content: TooltipContent,\n Trigger: PopoverTrigger,\n }\n)\n\nTooltip.displayName = 'Tooltip'\n\nexport type TooltipSimpleProps = TooltipProps & {\n label?: React.ReactNode\n children?: React.ReactNode\n contentProps?: SizableStackProps\n}\n\nexport const TooltipSimple: React.FC<TooltipSimpleProps> = ({\n label,\n children,\n contentProps,\n ...tooltipProps\n}) => {\n let context\n try {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n context = useDelayGroupContext()\n } catch {\n // ok\n }\n\n const contents = (\n <Tooltip {...tooltipProps}>\n <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>\n <Tooltip.Content\n enterStyle={{ x: 0, y: -10, opacity: 0, scale: 0.9 }}\n exitStyle={{ x: 0, y: -10, opacity: 0, scale: 0.9 }}\n x={0}\n scale={1}\n y={0}\n elevation=\"$1\"\n opacity={1}\n animation={[\n 'bouncy',\n {\n opacity: {\n overshootClamping: true,\n },\n },\n ]}\n {...contentProps}\n >\n <Tooltip.Arrow />\n <Paragraph size=\"$2\" lineHeight=\"$1\">\n {label}\n </Paragraph>\n </Tooltip.Content>\n </Tooltip>\n )\n\n if (!context) {\n return <TooltipGroup delay={{ open: 3000, close: 100 }}>{contents}</TooltipGroup>\n }\n\n return contents\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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D;AALsD,eAC1D;AAAA;AAAA,IACA;AAAA,IACA;AAAA,MAH0D,IAIvD,yBAJuD,IAIvD;AAAA,IAHH;AAAA,IACA;AAAA,IACA;AAAA;AAGA,MAAI;AACJ,MAAI;AAEF,cAAU,wDAAqB;AAAA,EACjC,QAAE;AAAA,EAEF;AAEA,QAAM,WACJ,oCAAC,4BAAY,eACX,oCAAC,QAAQ,SAAR;AAAA,IAAgB,SAAO;AAAA,KAAE,QAAS,GACnC,oCAAC,QAAQ,SAAR;AAAA,IACC,YAAY,EAAE,GAAG,GAAG,GAAG,KAAK,SAAS,GAAG,OAAO,IAAI;AAAA,IACnD,WAAW,EAAE,GAAG,GAAG,GAAG,KAAK,SAAS,GAAG,OAAO,IAAI;AAAA,IAClD,GAAG;AAAA,IACH,OAAO;AAAA,IACP,GAAG;AAAA,IACH,WAAU;AAAA,IACV,SAAS;AAAA,IACT,WAAW;AAAA,MACT;AAAA,MACA;AAAA,QACE,SAAS;AAAA,UACP,mBAAmB;AAAA,QACrB;AAAA,MACF;AAAA,IACF;AAAA,KACI,eAEJ,oCAAC,QAAQ,OAAR,IAAc,GACf,oCAAC;AAAA,IAAU,MAAK;AAAA,IAAK,YAAW;AAAA,KAC7B,KACH,CACF,CACF;AAGF,MAAI,CAAC,SAAS;AACZ,WAAO,oCAAC;AAAA,MAAa,OAAO,EAAE,MAAM,KAAM,OAAO,IAAI;AAAA,OAAI,QAAS;AAAA,EACpE;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var Tooltip_native_exports = {};
|
|
19
|
+
__export(Tooltip_native_exports, {
|
|
20
|
+
Tooltip: () => Tooltip,
|
|
21
|
+
TooltipSimple: () => TooltipSimple
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(Tooltip_native_exports);
|
|
24
|
+
var import_core = require("@tamagui/core");
|
|
25
|
+
const RenderChildren = (props) => {
|
|
26
|
+
return props.children;
|
|
27
|
+
};
|
|
28
|
+
const RenderNull = (props) => {
|
|
29
|
+
return null;
|
|
30
|
+
};
|
|
31
|
+
const Tooltip = (0, import_core.withStaticProperties)(RenderChildren, {
|
|
32
|
+
Anchor: RenderChildren,
|
|
33
|
+
Arrow: RenderNull,
|
|
34
|
+
Close: RenderNull,
|
|
35
|
+
Content: RenderNull,
|
|
36
|
+
Trigger: RenderChildren
|
|
37
|
+
});
|
|
38
|
+
const TooltipSimple = RenderChildren;
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
Tooltip,
|
|
42
|
+
TooltipSimple
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=Tooltip.native.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Tooltip.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import { withStaticProperties } from '@tamagui/core'\n\n// no output on native for now\n// could have an option to long-press or similar to show in a context menu/drawer\n\nconst RenderChildren = (props: any) => {\n return props.children\n}\n\nconst RenderNull = (props: any) => {\n return null\n}\n\nexport const Tooltip = withStaticProperties(RenderChildren, {\n Anchor: RenderChildren,\n Arrow: RenderNull,\n Close: RenderNull,\n Content: RenderNull,\n Trigger: RenderChildren,\n})\n\nexport const TooltipSimple = RenderChildren\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqC;AAKrC,MAAM,iBAAiB,CAAC,UAAe;AACrC,SAAO,MAAM;AACf;AAEA,MAAM,aAAa,CAAC,UAAe;AACjC,SAAO;AACT;AAEO,MAAM,UAAU,sCAAqB,gBAAgB;AAAA,EAC1D,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACX,CAAC;AAEM,MAAM,gBAAgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/esm/Tooltip.js
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
3
32
|
import "@tamagui/polyfill-dev";
|
|
4
33
|
import {
|
|
5
34
|
FloatingDelayGroup,
|
|
@@ -16,46 +45,71 @@ import { useId, withStaticProperties } from "@tamagui/core";
|
|
|
16
45
|
import {
|
|
17
46
|
PopoverAnchor,
|
|
18
47
|
PopoverArrow,
|
|
19
|
-
PopoverClose,
|
|
20
48
|
PopoverContent,
|
|
21
49
|
PopoverTrigger,
|
|
22
50
|
__PopoverProviderInternal,
|
|
23
51
|
usePopoverScope
|
|
24
52
|
} from "@tamagui/popover";
|
|
25
|
-
import {
|
|
53
|
+
import {
|
|
54
|
+
FloatingOverrideContext,
|
|
55
|
+
Popper,
|
|
56
|
+
usePopperContext
|
|
57
|
+
} from "@tamagui/popper";
|
|
26
58
|
import { Paragraph } from "@tamagui/text";
|
|
27
59
|
import * as React from "react";
|
|
28
|
-
const TooltipContent = React.forwardRef((
|
|
29
|
-
|
|
60
|
+
const TooltipContent = React.forwardRef((_a, ref) => {
|
|
61
|
+
var _b = _a, { __scopePopover } = _b, props = __objRest(_b, ["__scopePopover"]);
|
|
62
|
+
const popperScope = usePopoverScope(__scopePopover);
|
|
63
|
+
const popper = usePopperContext("PopperContent", popperScope["__scopePopper"]);
|
|
64
|
+
return /* @__PURE__ */ React.createElement(PopoverContent, __spreadValues({
|
|
65
|
+
disableRemoveScroll: true,
|
|
66
|
+
trapFocus: false,
|
|
67
|
+
padding: props.size || popper.size || "$2",
|
|
68
|
+
componentName: "TooltipContent",
|
|
30
69
|
pointerEvents: "none",
|
|
31
|
-
ref
|
|
32
|
-
|
|
33
|
-
|
|
70
|
+
ref
|
|
71
|
+
}, props));
|
|
72
|
+
});
|
|
73
|
+
const TooltipArrow = React.forwardRef((props, ref) => {
|
|
74
|
+
return /* @__PURE__ */ React.createElement(PopoverArrow, __spreadValues({
|
|
75
|
+
componentName: "TooltipArrow",
|
|
76
|
+
ref
|
|
77
|
+
}, props));
|
|
34
78
|
});
|
|
35
79
|
const TooltipGroup = FloatingDelayGroup;
|
|
36
80
|
const Tooltip = withStaticProperties((props) => {
|
|
37
|
-
const
|
|
81
|
+
const _a = props, {
|
|
82
|
+
__scopePopover,
|
|
83
|
+
children,
|
|
84
|
+
restMs = 500,
|
|
85
|
+
delay: delayProp,
|
|
86
|
+
onOpenChange: onOpenChangeProp
|
|
87
|
+
} = _a, restProps = __objRest(_a, [
|
|
88
|
+
"__scopePopover",
|
|
89
|
+
"children",
|
|
90
|
+
"restMs",
|
|
91
|
+
"delay",
|
|
92
|
+
"onOpenChange"
|
|
93
|
+
]);
|
|
38
94
|
const popperScope = usePopoverScope(__scopePopover);
|
|
39
95
|
const triggerRef = React.useRef(null);
|
|
40
96
|
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
41
97
|
const { delay: delayGroup, setCurrentId } = useDelayGroupContext();
|
|
42
|
-
const delay = delayProp
|
|
98
|
+
const delay = delayProp ?? delayGroup;
|
|
43
99
|
const [open, setOpen] = React.useState(false);
|
|
44
100
|
const id = props.groupId;
|
|
45
101
|
const onOpenChange = React.useCallback((open2) => {
|
|
46
|
-
var _a;
|
|
47
102
|
setOpen(open2);
|
|
48
103
|
if (open2) {
|
|
49
104
|
setCurrentId(id);
|
|
50
105
|
}
|
|
51
|
-
|
|
52
|
-
}, [id, setCurrentId]);
|
|
53
|
-
const useFloatingFn =
|
|
54
|
-
const floating = useFloating({
|
|
55
|
-
...props2,
|
|
106
|
+
onOpenChangeProp == null ? void 0 : onOpenChangeProp(open2);
|
|
107
|
+
}, [id, setCurrentId, onOpenChangeProp]);
|
|
108
|
+
const useFloatingFn = (props2) => {
|
|
109
|
+
const floating = useFloating(__spreadProps(__spreadValues({}, props2), {
|
|
56
110
|
open,
|
|
57
111
|
onOpenChange
|
|
58
|
-
});
|
|
112
|
+
}));
|
|
59
113
|
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
60
114
|
useHover(floating.context, { delay, restMs }),
|
|
61
115
|
useFocus(floating.context),
|
|
@@ -63,22 +117,19 @@ const Tooltip = withStaticProperties((props) => {
|
|
|
63
117
|
useDismiss(floating.context),
|
|
64
118
|
useDelayGroup(floating.context, { id })
|
|
65
119
|
]);
|
|
66
|
-
return {
|
|
67
|
-
...floating,
|
|
120
|
+
return __spreadProps(__spreadValues({}, floating), {
|
|
68
121
|
getReferenceProps,
|
|
69
122
|
getFloatingProps
|
|
70
|
-
};
|
|
71
|
-
}
|
|
123
|
+
});
|
|
124
|
+
};
|
|
72
125
|
const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open]);
|
|
73
126
|
const voidFn = React.useCallback(() => {
|
|
74
127
|
}, [setOpen]);
|
|
75
128
|
return /* @__PURE__ */ React.createElement(FloatingOverrideContext.Provider, {
|
|
76
129
|
value: useFloatingContext
|
|
77
|
-
}, /* @__PURE__ */ React.createElement(Popper, {
|
|
78
|
-
size: "$2"
|
|
79
|
-
|
|
80
|
-
...restProps
|
|
81
|
-
}, /* @__PURE__ */ React.createElement(__PopoverProviderInternal, {
|
|
130
|
+
}, /* @__PURE__ */ React.createElement(Popper, __spreadValues(__spreadValues({
|
|
131
|
+
size: "$2"
|
|
132
|
+
}, popperScope), restProps), /* @__PURE__ */ React.createElement(__PopoverProviderInternal, {
|
|
82
133
|
scope: __scopePopover,
|
|
83
134
|
contentId: useId(),
|
|
84
135
|
triggerRef,
|
|
@@ -87,28 +138,33 @@ const Tooltip = withStaticProperties((props) => {
|
|
|
87
138
|
onOpenToggle: voidFn,
|
|
88
139
|
hasCustomAnchor,
|
|
89
140
|
onCustomAnchorAdd: React.useCallback(() => setHasCustomAnchor(true), []),
|
|
90
|
-
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), [])
|
|
91
|
-
modal: true
|
|
141
|
+
onCustomAnchorRemove: React.useCallback(() => setHasCustomAnchor(false), [])
|
|
92
142
|
}, children)));
|
|
93
143
|
}, {
|
|
94
144
|
Anchor: PopoverAnchor,
|
|
95
|
-
Arrow:
|
|
96
|
-
Close: PopoverClose,
|
|
145
|
+
Arrow: TooltipArrow,
|
|
97
146
|
Content: TooltipContent,
|
|
98
147
|
Trigger: PopoverTrigger
|
|
99
148
|
});
|
|
100
149
|
Tooltip.displayName = "Tooltip";
|
|
101
|
-
const TooltipSimple =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
150
|
+
const TooltipSimple = (_c) => {
|
|
151
|
+
var _d = _c, {
|
|
152
|
+
label,
|
|
153
|
+
children,
|
|
154
|
+
contentProps
|
|
155
|
+
} = _d, tooltipProps = __objRest(_d, [
|
|
156
|
+
"label",
|
|
157
|
+
"children",
|
|
158
|
+
"contentProps"
|
|
159
|
+
]);
|
|
160
|
+
let context;
|
|
161
|
+
try {
|
|
162
|
+
context = useDelayGroupContext();
|
|
163
|
+
} catch {
|
|
164
|
+
}
|
|
165
|
+
const contents = /* @__PURE__ */ React.createElement(Tooltip, __spreadValues({}, tooltipProps), /* @__PURE__ */ React.createElement(Tooltip.Trigger, {
|
|
166
|
+
asChild: true
|
|
167
|
+
}, children), /* @__PURE__ */ React.createElement(Tooltip.Content, __spreadValues({
|
|
112
168
|
enterStyle: { x: 0, y: -10, opacity: 0, scale: 0.9 },
|
|
113
169
|
exitStyle: { x: 0, y: -10, opacity: 0, scale: 0.9 },
|
|
114
170
|
x: 0,
|
|
@@ -123,10 +179,18 @@ const TooltipSimple = /* @__PURE__ */ __name(({
|
|
|
123
179
|
overshootClamping: true
|
|
124
180
|
}
|
|
125
181
|
}
|
|
126
|
-
]
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
182
|
+
]
|
|
183
|
+
}, contentProps), /* @__PURE__ */ React.createElement(Tooltip.Arrow, null), /* @__PURE__ */ React.createElement(Paragraph, {
|
|
184
|
+
size: "$2",
|
|
185
|
+
lineHeight: "$1"
|
|
186
|
+
}, label)));
|
|
187
|
+
if (!context) {
|
|
188
|
+
return /* @__PURE__ */ React.createElement(TooltipGroup, {
|
|
189
|
+
delay: { open: 3e3, close: 100 }
|
|
190
|
+
}, contents);
|
|
191
|
+
}
|
|
192
|
+
return contents;
|
|
193
|
+
};
|
|
130
194
|
export {
|
|
131
195
|
Tooltip,
|
|
132
196
|
TooltipGroup,
|
package/dist/esm/Tooltip.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Tooltip.tsx"],
|
|
4
|
-
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport {\n PopoverAnchor,\n PopoverArrow,\n
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport {\n FloatingOverrideContext,\n Popper,\n PopperProps,\n UseFloatingFn,\n usePopperContext,\n} from '@tamagui/popper'\nimport { SizableStackProps } from '@tamagui/stacks'\nimport { Paragraph } from '@tamagui/text'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n ({ __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>, ref: any) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n return (\n <PopoverContent\n disableRemoveScroll\n trapFocus={false}\n padding={props.size || popper.size || '$2'}\n componentName=\"TooltipContent\"\n pointerEvents=\"none\"\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nconst TooltipArrow = React.forwardRef((props: PopoverArrowProps, ref: any) => {\n return <PopoverArrow componentName=\"TooltipArrow\" ref={ref} {...props} />\n})\n\nexport type TooltipProps = PopperProps & {\n children?: React.ReactNode\n onOpenChange?: (open: boolean) => void\n groupId?: string\n restMs?: number\n delay?:\n | number\n | {\n open?: number\n close?: number\n }\n}\n\nexport const TooltipGroup = FloatingDelayGroup\n\nexport const Tooltip = withStaticProperties(\n ((props: ScopedProps<TooltipProps, 'Popover'>) => {\n const {\n __scopePopover,\n children,\n restMs = 500,\n delay: delayProp,\n onOpenChange: onOpenChangeProp,\n ...restProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const { delay: delayGroup, setCurrentId } = useDelayGroupContext()\n const delay = delayProp ?? delayGroup\n const [open, setOpen] = React.useState(false)\n const id = props.groupId\n\n // TODO useEvent when ready\n const onOpenChange = React.useCallback(\n (open) => {\n setOpen(open)\n if (open) {\n setCurrentId(id)\n }\n onOpenChangeProp?.(open)\n },\n [id, setCurrentId, onOpenChangeProp]\n )\n\n const useFloatingFn: UseFloatingFn = (props) => {\n const floating = useFloating({\n ...props,\n open,\n onOpenChange,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(floating.context, { delay, restMs }),\n useFocus(floating.context),\n useRole(floating.context, { role: 'tooltip' }),\n useDismiss(floating.context),\n useDelayGroup(floating.context, { id }),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n } as any\n }\n\n const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open])\n\n const voidFn = React.useCallback(() => {}, [setOpen])\n\n return (\n <FloatingOverrideContext.Provider value={useFloatingContext}>\n {/* default tooltip to a smaller size */}\n <Popper size=\"$2\" {...popperScope} {...restProps}>\n <__PopoverProviderInternal\n scope={__scopePopover}\n contentId={useId()}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={voidFn}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n >\n {children}\n </__PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n )\n }) as React.FC<TooltipProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: TooltipArrow,\n Content: TooltipContent,\n Trigger: PopoverTrigger,\n }\n)\n\nTooltip.displayName = 'Tooltip'\n\nexport type TooltipSimpleProps = TooltipProps & {\n label?: React.ReactNode\n children?: React.ReactNode\n contentProps?: SizableStackProps\n}\n\nexport const TooltipSimple: React.FC<TooltipSimpleProps> = ({\n label,\n children,\n contentProps,\n ...tooltipProps\n}) => {\n let context\n try {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n context = useDelayGroupContext()\n } catch {\n // ok\n }\n\n const contents = (\n <Tooltip {...tooltipProps}>\n <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>\n <Tooltip.Content\n enterStyle={{ x: 0, y: -10, opacity: 0, scale: 0.9 }}\n exitStyle={{ x: 0, y: -10, opacity: 0, scale: 0.9 }}\n x={0}\n scale={1}\n y={0}\n elevation=\"$1\"\n opacity={1}\n animation={[\n 'bouncy',\n {\n opacity: {\n overshootClamping: true,\n },\n },\n ]}\n {...contentProps}\n >\n <Tooltip.Arrow />\n <Paragraph size=\"$2\" lineHeight=\"$1\">\n {label}\n </Paragraph>\n </Tooltip.Content>\n </Tooltip>\n )\n\n if (!context) {\n return <TooltipGroup delay={{ open: 3000, close: 100 }}>{contents}</TooltipGroup>\n }\n\n return contents\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;AAEA,MAAM,iBAAiB,MAAM,WAC3B,CAAC,IAA2E,QAAa;AAAxF,eAAE,qBAAF,IAAqB,kBAArB,IAAqB,CAAnB;AACD,QAAM,cAAc,gBAAgB,cAAc;AAClD,QAAM,SAAS,iBAAiB,iBAAiB,YAAY,gBAAgB;AAC7E,SACE,oCAAC;AAAA,IACC,qBAAmB;AAAA,IACnB,WAAW;AAAA,IACX,SAAS,MAAM,QAAQ,OAAO,QAAQ;AAAA,IACtC,eAAc;AAAA,IACd,eAAc;AAAA,IACd;AAAA,KACI,MACN;AAEJ,CACF;AAEA,MAAM,eAAe,MAAM,WAAW,CAAC,OAA0B,QAAa;AAC5E,SAAO,oCAAC;AAAA,IAAa,eAAc;AAAA,IAAe;AAAA,KAAc,MAAO;AACzE,CAAC;AAeM,MAAM,eAAe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EJ,oCAAC,QAAQ,OAAR,IAAc,GACf,oCAAC;AAAA,IAAU,MAAK;AAAA,IAAK,YAAW;AAAA,KAC7B,KACH,CACF,CACF;AAGF,MAAI,CAAC,SAAS;AACZ,WAAO,oCAAC;AAAA,MAAa,OAAO,EAAE,MAAM,KAAM,OAAO,IAAI;AAAA,OAAI,QAAS;AAAA,EACpE;AAEA,SAAO;AACT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { withStaticProperties } from "@tamagui/core";
|
|
2
|
+
const RenderChildren = (props) => {
|
|
3
|
+
return props.children;
|
|
4
|
+
};
|
|
5
|
+
const RenderNull = (props) => {
|
|
6
|
+
return null;
|
|
7
|
+
};
|
|
8
|
+
const Tooltip = withStaticProperties(RenderChildren, {
|
|
9
|
+
Anchor: RenderChildren,
|
|
10
|
+
Arrow: RenderNull,
|
|
11
|
+
Close: RenderNull,
|
|
12
|
+
Content: RenderNull,
|
|
13
|
+
Trigger: RenderChildren
|
|
14
|
+
});
|
|
15
|
+
const TooltipSimple = RenderChildren;
|
|
16
|
+
export {
|
|
17
|
+
Tooltip,
|
|
18
|
+
TooltipSimple
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Tooltip.native.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Tooltip.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import { withStaticProperties } from '@tamagui/core'\n\n// no output on native for now\n// could have an option to long-press or similar to show in a context menu/drawer\n\nconst RenderChildren = (props: any) => {\n return props.children\n}\n\nconst RenderNull = (props: any) => {\n return null\n}\n\nexport const Tooltip = withStaticProperties(RenderChildren, {\n Anchor: RenderChildren,\n Arrow: RenderNull,\n Close: RenderNull,\n Content: RenderNull,\n Trigger: RenderChildren,\n})\n\nexport const TooltipSimple = RenderChildren\n"],
|
|
5
|
+
"mappings": "AAAA;AAKA,MAAM,iBAAiB,CAAC,UAAe;AACrC,SAAO,MAAM;AACf;AAEA,MAAM,aAAa,CAAC,UAAe;AACjC,SAAO;AACT;AAEO,MAAM,UAAU,qBAAqB,gBAAgB;AAAA,EAC1D,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACX,CAAC;AAEM,MAAM,gBAAgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/jsx/Tooltip.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
1
|
import "@tamagui/polyfill-dev";
|
|
4
2
|
import {
|
|
5
3
|
FloatingDelayGroup,
|
|
@@ -16,21 +14,36 @@ import { useId, withStaticProperties } from "@tamagui/core";
|
|
|
16
14
|
import {
|
|
17
15
|
PopoverAnchor,
|
|
18
16
|
PopoverArrow,
|
|
19
|
-
PopoverClose,
|
|
20
17
|
PopoverContent,
|
|
21
18
|
PopoverTrigger,
|
|
22
19
|
__PopoverProviderInternal,
|
|
23
20
|
usePopoverScope
|
|
24
21
|
} from "@tamagui/popover";
|
|
25
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
FloatingOverrideContext,
|
|
24
|
+
Popper,
|
|
25
|
+
usePopperContext
|
|
26
|
+
} from "@tamagui/popper";
|
|
26
27
|
import { Paragraph } from "@tamagui/text";
|
|
27
28
|
import * as React from "react";
|
|
28
|
-
const TooltipContent = React.forwardRef((props, ref) => {
|
|
29
|
-
|
|
29
|
+
const TooltipContent = React.forwardRef(({ __scopePopover, ...props }, ref) => {
|
|
30
|
+
const popperScope = usePopoverScope(__scopePopover);
|
|
31
|
+
const popper = usePopperContext("PopperContent", popperScope["__scopePopper"]);
|
|
32
|
+
return <PopoverContent disableRemoveScroll trapFocus={false} padding={props.size || popper.size || "$2"} componentName="TooltipContent" pointerEvents="none" ref={ref} {...props} />;
|
|
33
|
+
});
|
|
34
|
+
const TooltipArrow = React.forwardRef((props, ref) => {
|
|
35
|
+
return <PopoverArrow componentName="TooltipArrow" ref={ref} {...props} />;
|
|
30
36
|
});
|
|
31
37
|
const TooltipGroup = FloatingDelayGroup;
|
|
32
38
|
const Tooltip = withStaticProperties((props) => {
|
|
33
|
-
const {
|
|
39
|
+
const {
|
|
40
|
+
__scopePopover,
|
|
41
|
+
children,
|
|
42
|
+
restMs = 500,
|
|
43
|
+
delay: delayProp,
|
|
44
|
+
onOpenChange: onOpenChangeProp,
|
|
45
|
+
...restProps
|
|
46
|
+
} = props;
|
|
34
47
|
const popperScope = usePopoverScope(__scopePopover);
|
|
35
48
|
const triggerRef = React.useRef(null);
|
|
36
49
|
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false);
|
|
@@ -39,14 +52,13 @@ const Tooltip = withStaticProperties((props) => {
|
|
|
39
52
|
const [open, setOpen] = React.useState(false);
|
|
40
53
|
const id = props.groupId;
|
|
41
54
|
const onOpenChange = React.useCallback((open2) => {
|
|
42
|
-
var _a;
|
|
43
55
|
setOpen(open2);
|
|
44
56
|
if (open2) {
|
|
45
57
|
setCurrentId(id);
|
|
46
58
|
}
|
|
47
|
-
|
|
48
|
-
}, [id, setCurrentId]);
|
|
49
|
-
const useFloatingFn =
|
|
59
|
+
onOpenChangeProp == null ? void 0 : onOpenChangeProp(open2);
|
|
60
|
+
}, [id, setCurrentId, onOpenChangeProp]);
|
|
61
|
+
const useFloatingFn = (props2) => {
|
|
50
62
|
const floating = useFloating({
|
|
51
63
|
...props2,
|
|
52
64
|
open,
|
|
@@ -64,27 +76,31 @@ const Tooltip = withStaticProperties((props) => {
|
|
|
64
76
|
getReferenceProps,
|
|
65
77
|
getFloatingProps
|
|
66
78
|
};
|
|
67
|
-
}
|
|
79
|
+
};
|
|
68
80
|
const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open]);
|
|
69
81
|
const voidFn = React.useCallback(() => {
|
|
70
82
|
}, [setOpen]);
|
|
71
|
-
return <FloatingOverrideContext.Provider value={useFloatingContext}><Popper size="$2" {...popperScope} {...restProps}><__PopoverProviderInternal scope={__scopePopover} contentId={useId()} triggerRef={triggerRef} open={open} onOpenChange={setOpen} onOpenToggle={voidFn} hasCustomAnchor={hasCustomAnchor} onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])} onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}
|
|
83
|
+
return <FloatingOverrideContext.Provider value={useFloatingContext}><Popper size="$2" {...popperScope} {...restProps}><__PopoverProviderInternal scope={__scopePopover} contentId={useId()} triggerRef={triggerRef} open={open} onOpenChange={setOpen} onOpenToggle={voidFn} hasCustomAnchor={hasCustomAnchor} onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])} onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}>{children}</__PopoverProviderInternal></Popper></FloatingOverrideContext.Provider>;
|
|
72
84
|
}, {
|
|
73
85
|
Anchor: PopoverAnchor,
|
|
74
|
-
Arrow:
|
|
75
|
-
Close: PopoverClose,
|
|
86
|
+
Arrow: TooltipArrow,
|
|
76
87
|
Content: TooltipContent,
|
|
77
88
|
Trigger: PopoverTrigger
|
|
78
89
|
});
|
|
79
90
|
Tooltip.displayName = "Tooltip";
|
|
80
|
-
const TooltipSimple =
|
|
91
|
+
const TooltipSimple = ({
|
|
81
92
|
label,
|
|
82
93
|
children,
|
|
83
94
|
contentProps,
|
|
84
95
|
...tooltipProps
|
|
85
96
|
}) => {
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
let context;
|
|
98
|
+
try {
|
|
99
|
+
context = useDelayGroupContext();
|
|
100
|
+
} catch {
|
|
101
|
+
}
|
|
102
|
+
const contents = <Tooltip {...tooltipProps}>
|
|
103
|
+
<Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
|
|
88
104
|
<Tooltip.Content enterStyle={{ x: 0, y: -10, opacity: 0, scale: 0.9 }} exitStyle={{ x: 0, y: -10, opacity: 0, scale: 0.9 }} x={0} scale={1} y={0} elevation="$1" opacity={1} animation={[
|
|
89
105
|
"bouncy",
|
|
90
106
|
{
|
|
@@ -94,12 +110,17 @@ const TooltipSimple = /* @__PURE__ */ __name(({
|
|
|
94
110
|
}
|
|
95
111
|
]} {...contentProps}>
|
|
96
112
|
<Tooltip.Arrow />
|
|
97
|
-
<Paragraph>{label}</Paragraph>
|
|
113
|
+
<Paragraph size="$2" lineHeight="$1">{label}</Paragraph>
|
|
98
114
|
</Tooltip.Content>
|
|
99
|
-
</Tooltip
|
|
100
|
-
|
|
115
|
+
</Tooltip>;
|
|
116
|
+
if (!context) {
|
|
117
|
+
return <TooltipGroup delay={{ open: 3e3, close: 100 }}>{contents}</TooltipGroup>;
|
|
118
|
+
}
|
|
119
|
+
return contents;
|
|
120
|
+
};
|
|
101
121
|
export {
|
|
102
122
|
Tooltip,
|
|
103
123
|
TooltipGroup,
|
|
104
124
|
TooltipSimple
|
|
105
125
|
};
|
|
126
|
+
//# sourceMappingURL=Tooltip.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Tooltip.tsx"],
|
|
4
|
+
"sourcesContent": ["import '@tamagui/polyfill-dev'\n\nimport {\n FloatingDelayGroup,\n useDelayGroup,\n useDelayGroupContext,\n useDismiss,\n useFloating,\n useFocus,\n useHover,\n useInteractions,\n useRole,\n} from '@floating-ui/react-dom-interactions'\nimport { useId, withStaticProperties } from '@tamagui/core'\nimport { ScopedProps } from '@tamagui/create-context'\nimport {\n PopoverAnchor,\n PopoverArrow,\n PopoverArrowProps,\n PopoverContent,\n PopoverContentProps,\n PopoverTrigger,\n __PopoverProviderInternal,\n usePopoverScope,\n} from '@tamagui/popover'\nimport {\n FloatingOverrideContext,\n Popper,\n PopperProps,\n UseFloatingFn,\n usePopperContext,\n} from '@tamagui/popper'\nimport { SizableStackProps } from '@tamagui/stacks'\nimport { Paragraph } from '@tamagui/text'\nimport * as React from 'react'\n\nconst TooltipContent = React.forwardRef(\n ({ __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>, ref: any) => {\n const popperScope = usePopoverScope(__scopePopover)\n const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])\n return (\n <PopoverContent\n disableRemoveScroll\n trapFocus={false}\n padding={props.size || popper.size || '$2'}\n componentName=\"TooltipContent\"\n pointerEvents=\"none\"\n ref={ref}\n {...props}\n />\n )\n }\n)\n\nconst TooltipArrow = React.forwardRef((props: PopoverArrowProps, ref: any) => {\n return <PopoverArrow componentName=\"TooltipArrow\" ref={ref} {...props} />\n})\n\nexport type TooltipProps = PopperProps & {\n children?: React.ReactNode\n onOpenChange?: (open: boolean) => void\n groupId?: string\n restMs?: number\n delay?:\n | number\n | {\n open?: number\n close?: number\n }\n}\n\nexport const TooltipGroup = FloatingDelayGroup\n\nexport const Tooltip = withStaticProperties(\n ((props: ScopedProps<TooltipProps, 'Popover'>) => {\n const {\n __scopePopover,\n children,\n restMs = 500,\n delay: delayProp,\n onOpenChange: onOpenChangeProp,\n ...restProps\n } = props\n const popperScope = usePopoverScope(__scopePopover)\n const triggerRef = React.useRef<HTMLButtonElement>(null)\n const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)\n const { delay: delayGroup, setCurrentId } = useDelayGroupContext()\n const delay = delayProp ?? delayGroup\n const [open, setOpen] = React.useState(false)\n const id = props.groupId\n\n // TODO useEvent when ready\n const onOpenChange = React.useCallback(\n (open) => {\n setOpen(open)\n if (open) {\n setCurrentId(id)\n }\n onOpenChangeProp?.(open)\n },\n [id, setCurrentId, onOpenChangeProp]\n )\n\n const useFloatingFn: UseFloatingFn = (props) => {\n const floating = useFloating({\n ...props,\n open,\n onOpenChange,\n })\n const { getReferenceProps, getFloatingProps } = useInteractions([\n useHover(floating.context, { delay, restMs }),\n useFocus(floating.context),\n useRole(floating.context, { role: 'tooltip' }),\n useDismiss(floating.context),\n useDelayGroup(floating.context, { id }),\n ])\n return {\n ...floating,\n getReferenceProps,\n getFloatingProps,\n } as any\n }\n\n const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open])\n\n const voidFn = React.useCallback(() => {}, [setOpen])\n\n return (\n <FloatingOverrideContext.Provider value={useFloatingContext}>\n {/* default tooltip to a smaller size */}\n <Popper size=\"$2\" {...popperScope} {...restProps}>\n <__PopoverProviderInternal\n scope={__scopePopover}\n contentId={useId()}\n triggerRef={triggerRef}\n open={open}\n onOpenChange={setOpen}\n onOpenToggle={voidFn}\n hasCustomAnchor={hasCustomAnchor}\n onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}\n onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}\n >\n {children}\n </__PopoverProviderInternal>\n </Popper>\n </FloatingOverrideContext.Provider>\n )\n }) as React.FC<TooltipProps>,\n {\n Anchor: PopoverAnchor,\n Arrow: TooltipArrow,\n Content: TooltipContent,\n Trigger: PopoverTrigger,\n }\n)\n\nTooltip.displayName = 'Tooltip'\n\nexport type TooltipSimpleProps = TooltipProps & {\n label?: React.ReactNode\n children?: React.ReactNode\n contentProps?: SizableStackProps\n}\n\nexport const TooltipSimple: React.FC<TooltipSimpleProps> = ({\n label,\n children,\n contentProps,\n ...tooltipProps\n}) => {\n let context\n try {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n context = useDelayGroupContext()\n } catch {\n // ok\n }\n\n const contents = (\n <Tooltip {...tooltipProps}>\n <Tooltip.Trigger asChild>{children}</Tooltip.Trigger>\n <Tooltip.Content\n enterStyle={{ x: 0, y: -10, opacity: 0, scale: 0.9 }}\n exitStyle={{ x: 0, y: -10, opacity: 0, scale: 0.9 }}\n x={0}\n scale={1}\n y={0}\n elevation=\"$1\"\n opacity={1}\n animation={[\n 'bouncy',\n {\n opacity: {\n overshootClamping: true,\n },\n },\n ]}\n {...contentProps}\n >\n <Tooltip.Arrow />\n <Paragraph size=\"$2\" lineHeight=\"$1\">\n {label}\n </Paragraph>\n </Tooltip.Content>\n </Tooltip>\n )\n\n if (!context) {\n return <TooltipGroup delay={{ open: 3000, close: 100 }}>{contents}</TooltipGroup>\n }\n\n return contents\n}\n"],
|
|
5
|
+
"mappings": "AAAA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;AAEA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA;AAAA;AAAA;AAAA;AAAA;AAQA;AACA;AAEA,MAAM,iBAAiB,MAAM,WAC3B,CAAC,EAAE,mBAAmB,SAAsD,QAAa;AACvF,QAAM,cAAc,gBAAgB,cAAc;AAClD,QAAM,SAAS,iBAAiB,iBAAiB,YAAY,gBAAgB;AAC7E,SACE,CAAC,eACC,oBACA,WAAW,OACX,SAAS,MAAM,QAAQ,OAAO,QAAQ,MACtC,cAAc,iBACd,cAAc,OACd,KAAK,SACD,OACN;AAEJ,CACF;AAEA,MAAM,eAAe,MAAM,WAAW,CAAC,OAA0B,QAAa;AAC5E,SAAO,CAAC,aAAa,cAAc,eAAe,KAAK,SAAS,OAAO;AACzE,CAAC;AAeM,MAAM,eAAe;AAErB,MAAM,UAAU,qBACpB,CAAC,UAAgD;AAChD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,OAAO;AAAA,IACP,cAAc;AAAA,OACX;AAAA,MACD;AACJ,QAAM,cAAc,gBAAgB,cAAc;AAClD,QAAM,aAAa,MAAM,OAA0B,IAAI;AACvD,QAAM,CAAC,iBAAiB,sBAAsB,MAAM,SAAS,KAAK;AAClE,QAAM,EAAE,OAAO,YAAY,iBAAiB,qBAAqB;AACjE,QAAM,QAAQ,gCAAa;AAC3B,QAAM,CAAC,MAAM,WAAW,MAAM,SAAS,KAAK;AAC5C,QAAM,KAAK,MAAM;AAGjB,QAAM,eAAe,MAAM,YACzB,CAAC,UAAS;AACR,YAAQ,KAAI;AACZ,QAAI,OAAM;AACR,mBA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AAAA,KACG;AAAA,MACC;AACJ,MAAI;AACJ,MAAI;AAEF,cAAU,qBAAqB;AAAA,EACjC,QAAE;AAAA,EAEF;AAEA,QAAM,WACJ,CAAC,YAAY;AAAA,IACX,CAAC,QAAQ,QAAQ,SAAS,SAAS,EAAlC,QAAQ;AAAA,IACT,CAAC,QAAQ,QACP,YAAY,EAAE,GAAG,GAAG,GAAG,KAAK,SAAS,GAAG,OAAO,IAAI,GACnD,WAAW,EAAE,GAAG,GAAG,GAAG,KAAK,SAAS,GAAG,OAAO,IAAI,GAClD,GAAG,GACH,OAAO,GACP,GAAG,GACH,UAAU,KACV,SAAS,GACT,WAAW;AAAA,MACT;AAAA,MACA;AAAA,QACE,SAAS;AAAA,UACP,mBAAmB;AAAA,QACrB;AAAA,MACF;AAAA,IACF,OACI;AAAA,MAEJ,CAAC,QAAQ,MAAM;AAAA,MACf,CAAC,UAAU,KAAK,KAAK,WAAW,MAC7B,MACH,EAFC;AAAA,IAGH,EAtBC,QAAQ;AAAA,EAuBX,EAzBC;AA4BH,MAAI,CAAC,SAAS;AACZ,WAAO,CAAC,aAAa,OAAO,EAAE,MAAM,KAAM,OAAO,IAAI,IAAI,SAAS,EAA1D;AAAA,EACV;AAEA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { withStaticProperties } from "@tamagui/core";
|
|
2
|
+
const RenderChildren = (props) => {
|
|
3
|
+
return props.children;
|
|
4
|
+
};
|
|
5
|
+
const RenderNull = (props) => {
|
|
6
|
+
return null;
|
|
7
|
+
};
|
|
8
|
+
const Tooltip = withStaticProperties(RenderChildren, {
|
|
9
|
+
Anchor: RenderChildren,
|
|
10
|
+
Arrow: RenderNull,
|
|
11
|
+
Close: RenderNull,
|
|
12
|
+
Content: RenderNull,
|
|
13
|
+
Trigger: RenderChildren
|
|
14
|
+
});
|
|
15
|
+
const TooltipSimple = RenderChildren;
|
|
16
|
+
export {
|
|
17
|
+
Tooltip,
|
|
18
|
+
TooltipSimple
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Tooltip.native.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/Tooltip.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import { withStaticProperties } from '@tamagui/core'\n\n// no output on native for now\n// could have an option to long-press or similar to show in a context menu/drawer\n\nconst RenderChildren = (props: any) => {\n return props.children\n}\n\nconst RenderNull = (props: any) => {\n return null\n}\n\nexport const Tooltip = withStaticProperties(RenderChildren, {\n Anchor: RenderChildren,\n Arrow: RenderNull,\n Close: RenderNull,\n Content: RenderNull,\n Trigger: RenderChildren,\n})\n\nexport const TooltipSimple = RenderChildren\n"],
|
|
5
|
+
"mappings": "AAAA;AAKA,MAAM,iBAAiB,CAAC,UAAe;AACrC,SAAO,MAAM;AACf;AAEA,MAAM,aAAa,CAAC,UAAe;AACjC,SAAO;AACT;AAEO,MAAM,UAAU,qBAAqB,gBAAgB;AAAA,EAC1D,QAAQ;AAAA,EACR,OAAO;AAAA,EACP,OAAO;AAAA,EACP,SAAS;AAAA,EACT,SAAS;AACX,CAAC;AAEM,MAAM,gBAAgB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/dist/jsx/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/tooltip",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"sideEffects":
|
|
3
|
+
"version": "1.0.1-beta.100",
|
|
4
|
+
"sideEffects": [
|
|
5
|
+
"*.css"
|
|
6
|
+
],
|
|
5
7
|
"source": "src/index.ts",
|
|
6
|
-
"
|
|
8
|
+
"types": "./types/index.d.ts",
|
|
7
9
|
"main": "dist/cjs",
|
|
8
10
|
"module": "dist/esm",
|
|
9
11
|
"module:jsx": "dist/jsx",
|
|
10
12
|
"files": [
|
|
13
|
+
"src",
|
|
11
14
|
"types",
|
|
12
15
|
"dist"
|
|
13
16
|
],
|
|
@@ -18,16 +21,16 @@
|
|
|
18
21
|
"clean:build": "tamagui-build clean:build"
|
|
19
22
|
},
|
|
20
23
|
"dependencies": {
|
|
21
|
-
"@floating-ui/react-dom-interactions": "^0.
|
|
22
|
-
"@tamagui/compose-refs": "^1.0.
|
|
23
|
-
"@tamagui/core": "^1.0.
|
|
24
|
-
"@tamagui/create-context": "^1.0.
|
|
25
|
-
"@tamagui/polyfill-dev": "^1.0.
|
|
26
|
-
"@tamagui/popover": "^1.0.
|
|
27
|
-
"@tamagui/popper": "^1.0.
|
|
28
|
-
"@tamagui/stacks": "^1.0.
|
|
29
|
-
"@tamagui/text": "^1.0.
|
|
30
|
-
"@tamagui/use-controllable-state": "^1.0.
|
|
24
|
+
"@floating-ui/react-dom-interactions": "^0.5.0",
|
|
25
|
+
"@tamagui/compose-refs": "^1.0.1-beta.100",
|
|
26
|
+
"@tamagui/core": "^1.0.1-beta.100",
|
|
27
|
+
"@tamagui/create-context": "^1.0.1-beta.100",
|
|
28
|
+
"@tamagui/polyfill-dev": "^1.0.1-beta.100",
|
|
29
|
+
"@tamagui/popover": "^1.0.1-beta.100",
|
|
30
|
+
"@tamagui/popper": "^1.0.1-beta.100",
|
|
31
|
+
"@tamagui/stacks": "^1.0.1-beta.100",
|
|
32
|
+
"@tamagui/text": "^1.0.1-beta.100",
|
|
33
|
+
"@tamagui/use-controllable-state": "^1.0.1-beta.100"
|
|
31
34
|
},
|
|
32
35
|
"peerDependencies": {
|
|
33
36
|
"react": "*",
|
|
@@ -35,7 +38,7 @@
|
|
|
35
38
|
"react-native": "*"
|
|
36
39
|
},
|
|
37
40
|
"devDependencies": {
|
|
38
|
-
"@tamagui/build": "^1.0.
|
|
41
|
+
"@tamagui/build": "^1.0.1-beta.100",
|
|
39
42
|
"@types/react-dom": "^18.0.3",
|
|
40
43
|
"@types/react-native": "^0.67.3",
|
|
41
44
|
"react": "*",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { withStaticProperties } from '@tamagui/core'
|
|
2
|
+
|
|
3
|
+
// no output on native for now
|
|
4
|
+
// could have an option to long-press or similar to show in a context menu/drawer
|
|
5
|
+
|
|
6
|
+
const RenderChildren = (props: any) => {
|
|
7
|
+
return props.children
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const RenderNull = (props: any) => {
|
|
11
|
+
return null
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const Tooltip = withStaticProperties(RenderChildren, {
|
|
15
|
+
Anchor: RenderChildren,
|
|
16
|
+
Arrow: RenderNull,
|
|
17
|
+
Close: RenderNull,
|
|
18
|
+
Content: RenderNull,
|
|
19
|
+
Trigger: RenderChildren,
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export const TooltipSimple = RenderChildren
|
package/src/Tooltip.tsx
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import '@tamagui/polyfill-dev'
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
FloatingDelayGroup,
|
|
5
|
+
useDelayGroup,
|
|
6
|
+
useDelayGroupContext,
|
|
7
|
+
useDismiss,
|
|
8
|
+
useFloating,
|
|
9
|
+
useFocus,
|
|
10
|
+
useHover,
|
|
11
|
+
useInteractions,
|
|
12
|
+
useRole,
|
|
13
|
+
} from '@floating-ui/react-dom-interactions'
|
|
14
|
+
import { useId, withStaticProperties } from '@tamagui/core'
|
|
15
|
+
import { ScopedProps } from '@tamagui/create-context'
|
|
16
|
+
import {
|
|
17
|
+
PopoverAnchor,
|
|
18
|
+
PopoverArrow,
|
|
19
|
+
PopoverArrowProps,
|
|
20
|
+
PopoverContent,
|
|
21
|
+
PopoverContentProps,
|
|
22
|
+
PopoverTrigger,
|
|
23
|
+
__PopoverProviderInternal,
|
|
24
|
+
usePopoverScope,
|
|
25
|
+
} from '@tamagui/popover'
|
|
26
|
+
import {
|
|
27
|
+
FloatingOverrideContext,
|
|
28
|
+
Popper,
|
|
29
|
+
PopperProps,
|
|
30
|
+
UseFloatingFn,
|
|
31
|
+
usePopperContext,
|
|
32
|
+
} from '@tamagui/popper'
|
|
33
|
+
import { SizableStackProps } from '@tamagui/stacks'
|
|
34
|
+
import { Paragraph } from '@tamagui/text'
|
|
35
|
+
import * as React from 'react'
|
|
36
|
+
|
|
37
|
+
const TooltipContent = React.forwardRef(
|
|
38
|
+
({ __scopePopover, ...props }: ScopedProps<PopoverContentProps, 'Popover'>, ref: any) => {
|
|
39
|
+
const popperScope = usePopoverScope(__scopePopover)
|
|
40
|
+
const popper = usePopperContext('PopperContent', popperScope['__scopePopper'])
|
|
41
|
+
return (
|
|
42
|
+
<PopoverContent
|
|
43
|
+
disableRemoveScroll
|
|
44
|
+
trapFocus={false}
|
|
45
|
+
padding={props.size || popper.size || '$2'}
|
|
46
|
+
componentName="TooltipContent"
|
|
47
|
+
pointerEvents="none"
|
|
48
|
+
ref={ref}
|
|
49
|
+
{...props}
|
|
50
|
+
/>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
const TooltipArrow = React.forwardRef((props: PopoverArrowProps, ref: any) => {
|
|
56
|
+
return <PopoverArrow componentName="TooltipArrow" ref={ref} {...props} />
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
export type TooltipProps = PopperProps & {
|
|
60
|
+
children?: React.ReactNode
|
|
61
|
+
onOpenChange?: (open: boolean) => void
|
|
62
|
+
groupId?: string
|
|
63
|
+
restMs?: number
|
|
64
|
+
delay?:
|
|
65
|
+
| number
|
|
66
|
+
| {
|
|
67
|
+
open?: number
|
|
68
|
+
close?: number
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export const TooltipGroup = FloatingDelayGroup
|
|
73
|
+
|
|
74
|
+
export const Tooltip = withStaticProperties(
|
|
75
|
+
((props: ScopedProps<TooltipProps, 'Popover'>) => {
|
|
76
|
+
const {
|
|
77
|
+
__scopePopover,
|
|
78
|
+
children,
|
|
79
|
+
restMs = 500,
|
|
80
|
+
delay: delayProp,
|
|
81
|
+
onOpenChange: onOpenChangeProp,
|
|
82
|
+
...restProps
|
|
83
|
+
} = props
|
|
84
|
+
const popperScope = usePopoverScope(__scopePopover)
|
|
85
|
+
const triggerRef = React.useRef<HTMLButtonElement>(null)
|
|
86
|
+
const [hasCustomAnchor, setHasCustomAnchor] = React.useState(false)
|
|
87
|
+
const { delay: delayGroup, setCurrentId } = useDelayGroupContext()
|
|
88
|
+
const delay = delayProp ?? delayGroup
|
|
89
|
+
const [open, setOpen] = React.useState(false)
|
|
90
|
+
const id = props.groupId
|
|
91
|
+
|
|
92
|
+
// TODO useEvent when ready
|
|
93
|
+
const onOpenChange = React.useCallback(
|
|
94
|
+
(open) => {
|
|
95
|
+
setOpen(open)
|
|
96
|
+
if (open) {
|
|
97
|
+
setCurrentId(id)
|
|
98
|
+
}
|
|
99
|
+
onOpenChangeProp?.(open)
|
|
100
|
+
},
|
|
101
|
+
[id, setCurrentId, onOpenChangeProp]
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
const useFloatingFn: UseFloatingFn = (props) => {
|
|
105
|
+
const floating = useFloating({
|
|
106
|
+
...props,
|
|
107
|
+
open,
|
|
108
|
+
onOpenChange,
|
|
109
|
+
})
|
|
110
|
+
const { getReferenceProps, getFloatingProps } = useInteractions([
|
|
111
|
+
useHover(floating.context, { delay, restMs }),
|
|
112
|
+
useFocus(floating.context),
|
|
113
|
+
useRole(floating.context, { role: 'tooltip' }),
|
|
114
|
+
useDismiss(floating.context),
|
|
115
|
+
useDelayGroup(floating.context, { id }),
|
|
116
|
+
])
|
|
117
|
+
return {
|
|
118
|
+
...floating,
|
|
119
|
+
getReferenceProps,
|
|
120
|
+
getFloatingProps,
|
|
121
|
+
} as any
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const useFloatingContext = React.useCallback(useFloatingFn, [id, delay, open])
|
|
125
|
+
|
|
126
|
+
const voidFn = React.useCallback(() => {}, [setOpen])
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<FloatingOverrideContext.Provider value={useFloatingContext}>
|
|
130
|
+
{/* default tooltip to a smaller size */}
|
|
131
|
+
<Popper size="$2" {...popperScope} {...restProps}>
|
|
132
|
+
<__PopoverProviderInternal
|
|
133
|
+
scope={__scopePopover}
|
|
134
|
+
contentId={useId()}
|
|
135
|
+
triggerRef={triggerRef}
|
|
136
|
+
open={open}
|
|
137
|
+
onOpenChange={setOpen}
|
|
138
|
+
onOpenToggle={voidFn}
|
|
139
|
+
hasCustomAnchor={hasCustomAnchor}
|
|
140
|
+
onCustomAnchorAdd={React.useCallback(() => setHasCustomAnchor(true), [])}
|
|
141
|
+
onCustomAnchorRemove={React.useCallback(() => setHasCustomAnchor(false), [])}
|
|
142
|
+
>
|
|
143
|
+
{children}
|
|
144
|
+
</__PopoverProviderInternal>
|
|
145
|
+
</Popper>
|
|
146
|
+
</FloatingOverrideContext.Provider>
|
|
147
|
+
)
|
|
148
|
+
}) as React.FC<TooltipProps>,
|
|
149
|
+
{
|
|
150
|
+
Anchor: PopoverAnchor,
|
|
151
|
+
Arrow: TooltipArrow,
|
|
152
|
+
Content: TooltipContent,
|
|
153
|
+
Trigger: PopoverTrigger,
|
|
154
|
+
}
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
Tooltip.displayName = 'Tooltip'
|
|
158
|
+
|
|
159
|
+
export type TooltipSimpleProps = TooltipProps & {
|
|
160
|
+
label?: React.ReactNode
|
|
161
|
+
children?: React.ReactNode
|
|
162
|
+
contentProps?: SizableStackProps
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export const TooltipSimple: React.FC<TooltipSimpleProps> = ({
|
|
166
|
+
label,
|
|
167
|
+
children,
|
|
168
|
+
contentProps,
|
|
169
|
+
...tooltipProps
|
|
170
|
+
}) => {
|
|
171
|
+
let context
|
|
172
|
+
try {
|
|
173
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
174
|
+
context = useDelayGroupContext()
|
|
175
|
+
} catch {
|
|
176
|
+
// ok
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
const contents = (
|
|
180
|
+
<Tooltip {...tooltipProps}>
|
|
181
|
+
<Tooltip.Trigger asChild>{children}</Tooltip.Trigger>
|
|
182
|
+
<Tooltip.Content
|
|
183
|
+
enterStyle={{ x: 0, y: -10, opacity: 0, scale: 0.9 }}
|
|
184
|
+
exitStyle={{ x: 0, y: -10, opacity: 0, scale: 0.9 }}
|
|
185
|
+
x={0}
|
|
186
|
+
scale={1}
|
|
187
|
+
y={0}
|
|
188
|
+
elevation="$1"
|
|
189
|
+
opacity={1}
|
|
190
|
+
animation={[
|
|
191
|
+
'bouncy',
|
|
192
|
+
{
|
|
193
|
+
opacity: {
|
|
194
|
+
overshootClamping: true,
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
]}
|
|
198
|
+
{...contentProps}
|
|
199
|
+
>
|
|
200
|
+
<Tooltip.Arrow />
|
|
201
|
+
<Paragraph size="$2" lineHeight="$1">
|
|
202
|
+
{label}
|
|
203
|
+
</Paragraph>
|
|
204
|
+
</Tooltip.Content>
|
|
205
|
+
</Tooltip>
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
if (!context) {
|
|
209
|
+
return <TooltipGroup delay={{ open: 3000, close: 100 }}>{contents}</TooltipGroup>
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
return contents
|
|
213
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Tooltip'
|
package/types/Tooltip.d.ts
CHANGED
|
@@ -21,45 +21,40 @@ export declare const TooltipGroup: ({ children, delay, }: {
|
|
|
21
21
|
}) => JSX.Element;
|
|
22
22
|
export declare const Tooltip: React.FC<TooltipProps> & {
|
|
23
23
|
Anchor: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
24
|
-
fullscreen?: boolean | undefined;
|
|
25
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
24
|
+
readonly fullscreen?: boolean | undefined;
|
|
25
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
26
26
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
27
|
-
fullscreen?: boolean | undefined;
|
|
28
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
27
|
+
readonly fullscreen?: boolean | undefined;
|
|
28
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
29
29
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
30
|
-
fullscreen?: boolean | undefined;
|
|
31
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
30
|
+
readonly fullscreen?: boolean | undefined;
|
|
31
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
32
32
|
}>> & React.RefAttributes<HTMLElement | import("react-native").View>>;
|
|
33
33
|
Arrow: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
34
|
-
fullscreen?: boolean | undefined;
|
|
35
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
34
|
+
readonly fullscreen?: boolean | undefined;
|
|
35
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
36
36
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
37
|
-
fullscreen?: boolean | undefined;
|
|
38
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
37
|
+
readonly fullscreen?: boolean | undefined;
|
|
38
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
39
39
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
40
|
-
fullscreen?: boolean | undefined;
|
|
41
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
42
|
-
}>> &
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
50
|
-
fullscreen?: boolean | undefined;
|
|
51
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
52
|
-
}>> & React.RefAttributes<HTMLElement | import("react-native").View>>;
|
|
53
|
-
Content: React.ForwardRefExoticComponent<import("@tamagui/popover").PopoverContentTypeProps & React.RefAttributes<unknown>>;
|
|
40
|
+
readonly fullscreen?: boolean | undefined;
|
|
41
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
42
|
+
}>> & {
|
|
43
|
+
offset?: number | undefined;
|
|
44
|
+
size?: import("@tamagui/core").SizeTokens | undefined;
|
|
45
|
+
} & React.RefAttributes<unknown>>;
|
|
46
|
+
Content: React.ForwardRefExoticComponent<import("@tamagui/popover").PopoverContentTypeProps & {
|
|
47
|
+
__scopePopover?: import("@tamagui/create-context").Scope<any>;
|
|
48
|
+
} & React.RefAttributes<unknown>>;
|
|
54
49
|
Trigger: React.ForwardRefExoticComponent<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
55
|
-
fullscreen?: boolean | undefined;
|
|
56
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
50
|
+
readonly fullscreen?: boolean | undefined;
|
|
51
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
57
52
|
} & import("@tamagui/core").MediaProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
58
|
-
fullscreen?: boolean | undefined;
|
|
59
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
53
|
+
readonly fullscreen?: boolean | undefined;
|
|
54
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
60
55
|
}>> & import("@tamagui/core").PseudoProps<Partial<Omit<import("react-native").ViewProps, "display" | "children"> & import("@tamagui/core").RNWViewProps & import("@tamagui/core").TamaguiComponentPropsBase & import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase> & import("@tamagui/core").WithShorthands<import("@tamagui/core").WithThemeValues<import("@tamagui/core").StackStylePropsBase>> & Omit<{}, "elevation" | "fullscreen"> & {
|
|
61
|
-
fullscreen?: boolean | undefined;
|
|
62
|
-
elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
56
|
+
readonly fullscreen?: boolean | undefined;
|
|
57
|
+
readonly elevation?: import("@tamagui/core").SizeTokens | undefined;
|
|
63
58
|
}>> & React.RefAttributes<HTMLElement | import("react-native").View>>;
|
|
64
59
|
};
|
|
65
60
|
export declare type TooltipSimpleProps = TooltipProps & {
|
package/types/Tooltip.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../src/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAyB9B,OAAO,
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../src/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,uBAAuB,CAAA;AAyB9B,OAAO,EAGL,WAAW,EAGZ,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAwB9B,oBAAY,YAAY,GAAG,WAAW,GAAG;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EACF,MAAM,GACN;QACE,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,KAAK,CAAC,EAAE,MAAM,CAAA;KACf,CAAA;CACN,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;iBAAqB,CAAA;AAE9C,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFnB,CAAA;AAID,oBAAY,kBAAkB,GAAG,YAAY,GAAG;IAC9C,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IACvB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,YAAY,CAAC,EAAE,iBAAiB,CAAA;CACjC,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAgDtD,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const Tooltip: ((props: any) => any) & {
|
|
2
|
+
Anchor: (props: any) => any;
|
|
3
|
+
Arrow: (props: any) => null;
|
|
4
|
+
Close: (props: any) => null;
|
|
5
|
+
Content: (props: any) => null;
|
|
6
|
+
Trigger: (props: any) => any;
|
|
7
|
+
};
|
|
8
|
+
export declare const TooltipSimple: (props: any) => any;
|
|
9
|
+
//# sourceMappingURL=Tooltip.native.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tooltip.native.d.ts","sourceRoot":"","sources":["../src/Tooltip.native.tsx"],"names":[],"mappings":"AAaA,eAAO,MAAM,OAAO,WARW,GAAG;oBAAH,GAAG;mBAIP,GAAG;mBAAH,GAAG;qBAAH,GAAG;qBAJC,GAAG;CAchC,CAAA;AAEF,eAAO,MAAM,aAAa,UAhBK,GAAG,QAgBS,CAAA"}
|
package/types/index.d.ts
CHANGED
|
File without changes
|
package/types/index.d.ts.map
CHANGED
|
File without changes
|