nucleus-core-ts 0.10.209 → 0.10.210

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/.build-ok CHANGED
@@ -1 +1 @@
1
- 0.10.209
1
+ 0.10.210
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import gsap from 'gsap';
4
- import { useRef, useState } from 'react';
4
+ import { useEffect, useEffectEvent, useRef, useState } from 'react';
5
5
  import { createPortal } from 'react-dom';
6
6
  import { cn } from '../../../utils/cn';
7
7
  import { fixedFrame, overlayHost, placeInFrame } from '../../../utils/overlayHost';
@@ -170,6 +170,21 @@ export function Tooltip({ children, content, placement = 'top', trigger = 'hover
170
170
  onComplete: ()=>setVisible(false)
171
171
  });
172
172
  };
173
+ // The bubble is placed once in viewport coordinates: a scroll (of the page or any scrolling container) would leave it
174
+ // hanging over unrelated content, so any scroll while it is open closes it; the next hover or focus opens it again.
175
+ const closeOnScroll = useEffectEvent(()=>hide());
176
+ useEffect(()=>{
177
+ if (!visible) return undefined;
178
+ window.addEventListener('scroll', closeOnScroll, {
179
+ capture: true,
180
+ passive: true
181
+ });
182
+ return ()=>window.removeEventListener('scroll', closeOnScroll, {
183
+ capture: true
184
+ });
185
+ }, [
186
+ visible
187
+ ]);
173
188
  const events = {};
174
189
  if (trigger === 'hover') {
175
190
  events.onMouseEnter = show;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nucleus-core-ts",
3
- "version": "0.10.209",
3
+ "version": "0.10.210",
4
4
  "description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
5
5
  "author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",