|
4 | 4 | arrow, |
5 | 5 | autoUpdate, |
6 | 6 | flip, |
| 7 | + FloatingPortal, |
7 | 8 | offset, |
8 | 9 | shift, |
9 | 10 | useFloating, |
@@ -121,46 +122,49 @@ export const Tooltip: React.FC<TooltipProps> = (props) => { |
121 | 122 | > |
122 | 123 | {children} |
123 | 124 | </TooltipWrapper> |
124 | | - <ThemeProvider theme={theme || solvedThemes.dark}> |
125 | | - <AnimatePresence> |
126 | | - {isOpen && ( |
127 | | - <React.Fragment> |
128 | | - <RenderComponent |
129 | | - {...getFloatingProps({ |
130 | | - ref: floating, |
131 | | - style: { |
132 | | - position: strategy, |
133 | | - top: y || 0, |
134 | | - left: x || 0, |
135 | | - }, |
136 | | - })} |
137 | | - {...cardProps} |
138 | | - transition={{ duration: 0.2, ease: 'easeInOut' }} |
139 | | - initial={{ opacity: 0, y: 0, scale: 0.9 }} |
140 | | - animate={{ opacity: 1, y: 8, scale: 1 }} |
141 | | - exit={{ opacity: 0, y: 0, scale: 0.9 }} |
142 | | - > |
143 | | - {title} |
144 | | - <Arrow |
145 | | - ref={arrowRef} |
146 | | - style={ |
147 | | - arrowPosition === 'bottom' |
148 | | - ? { |
149 | | - left: arrowX ?? undefined, |
150 | | - [arrowPosition]: -16, |
151 | | - transform: `scaleY(-1)`, |
152 | | - } |
153 | | - : { |
154 | | - top: arrowY !== null ? (arrowY || 0) - 16 : undefined, |
155 | | - left: arrowX ?? undefined, |
156 | | - } |
157 | | - } |
158 | | - /> |
159 | | - </RenderComponent> |
160 | | - </React.Fragment> |
161 | | - )} |
162 | | - </AnimatePresence> |
163 | | - </ThemeProvider> |
| 125 | + <FloatingPortal> |
| 126 | + <ThemeProvider theme={theme || solvedThemes.dark}> |
| 127 | + <AnimatePresence> |
| 128 | + {isOpen && ( |
| 129 | + <React.Fragment> |
| 130 | + <RenderComponent |
| 131 | + {...getFloatingProps({ |
| 132 | + ref: floating, |
| 133 | + style: { |
| 134 | + position: strategy, |
| 135 | + top: y || 0, |
| 136 | + left: x || 0, |
| 137 | + }, |
| 138 | + })} |
| 139 | + {...cardProps} |
| 140 | + transition={{ duration: 0.2, ease: 'easeInOut' }} |
| 141 | + initial={{ opacity: 0, y: 0, scale: 0.9 }} |
| 142 | + animate={{ opacity: 1, y: 8, scale: 1 }} |
| 143 | + exit={{ opacity: 0, y: 0, scale: 0.9 }} |
| 144 | + > |
| 145 | + {title} |
| 146 | + <Arrow |
| 147 | + ref={arrowRef} |
| 148 | + style={ |
| 149 | + arrowPosition === 'bottom' |
| 150 | + ? { |
| 151 | + left: arrowX ?? undefined, |
| 152 | + [arrowPosition]: -16, |
| 153 | + transform: `scaleY(-1)`, |
| 154 | + } |
| 155 | + : { |
| 156 | + top: |
| 157 | + arrowY !== null ? (arrowY || 0) - 16 : undefined, |
| 158 | + left: arrowX ?? undefined, |
| 159 | + } |
| 160 | + } |
| 161 | + /> |
| 162 | + </RenderComponent> |
| 163 | + </React.Fragment> |
| 164 | + )} |
| 165 | + </AnimatePresence> |
| 166 | + </ThemeProvider> |
| 167 | + </FloatingPortal> |
164 | 168 | </React.Fragment> |
165 | 169 | ) |
166 | 170 | } |
0 commit comments