@toolr/ui-design 0.1.10 → 0.1.11

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.
@@ -26,7 +26,7 @@ import { useAccentColor } from '../lib/accent-context.ts'
26
26
  export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size' | 'type'> {
27
27
  value: string
28
28
  onChange: (value: string) => void
29
- type?: 'text' | 'search' | 'password'
29
+ type?: 'text' | 'search' | 'password' | 'email'
30
30
  debounceMs?: number
31
31
  error?: boolean | string
32
32
  variant?: 'filled' | 'outline'
@@ -247,6 +247,29 @@ export function Tooltip({
247
247
  return () => window.removeEventListener('scroll', handleScroll, true)
248
248
  }, [trigger, isVisible, position, align])
249
249
 
250
+ // Dismiss hover tooltips on scroll, keyboard, click elsewhere, or window blur to prevent orphans
251
+ useEffect(() => {
252
+ if (trigger !== 'hover' || !isVisible) return
253
+ const dismiss = () => setIsVisible(false)
254
+ window.addEventListener('scroll', dismiss, true)
255
+ window.addEventListener('keydown', dismiss)
256
+ window.addEventListener('pointerdown', dismiss)
257
+ window.addEventListener('blur', dismiss)
258
+ return () => {
259
+ window.removeEventListener('scroll', dismiss, true)
260
+ window.removeEventListener('keydown', dismiss)
261
+ window.removeEventListener('pointerdown', dismiss)
262
+ window.removeEventListener('blur', dismiss)
263
+ }
264
+ }, [trigger, isVisible])
265
+
266
+ // Clear pending hide timeout on unmount
267
+ useEffect(() => {
268
+ return () => {
269
+ if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current)
270
+ }
271
+ }, [])
272
+
250
273
  const resolvedPos = position === 'auto' ? actualPosition : position
251
274
  const arrowClasses = getArrowClasses(resolvedPos, align)
252
275
 
package/dist/index.d.ts CHANGED
@@ -400,7 +400,7 @@ declare function Toggle({ checked, onChange, disabled, size, className, accentCo
400
400
  interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'size' | 'type'> {
401
401
  value: string;
402
402
  onChange: (value: string) => void;
403
- type?: 'text' | 'search' | 'password';
403
+ type?: 'text' | 'search' | 'password' | 'email';
404
404
  debounceMs?: number;
405
405
  error?: boolean | string;
406
406
  variant?: 'filled' | 'outline';
package/dist/index.js CHANGED
@@ -566,6 +566,25 @@ function Tooltip({
566
566
  window.addEventListener("scroll", handleScroll, true);
567
567
  return () => window.removeEventListener("scroll", handleScroll, true);
568
568
  }, [trigger, isVisible, position, align]);
569
+ useEffect2(() => {
570
+ if (trigger !== "hover" || !isVisible) return;
571
+ const dismiss = () => setIsVisible(false);
572
+ window.addEventListener("scroll", dismiss, true);
573
+ window.addEventListener("keydown", dismiss);
574
+ window.addEventListener("pointerdown", dismiss);
575
+ window.addEventListener("blur", dismiss);
576
+ return () => {
577
+ window.removeEventListener("scroll", dismiss, true);
578
+ window.removeEventListener("keydown", dismiss);
579
+ window.removeEventListener("pointerdown", dismiss);
580
+ window.removeEventListener("blur", dismiss);
581
+ };
582
+ }, [trigger, isVisible]);
583
+ useEffect2(() => {
584
+ return () => {
585
+ if (hideTimeoutRef.current) clearTimeout(hideTimeoutRef.current);
586
+ };
587
+ }, []);
569
588
  const resolvedPos = position === "auto" ? actualPosition : position;
570
589
  const arrowClasses = getArrowClasses(resolvedPos, align);
571
590
  const tooltipContent = /* @__PURE__ */ jsxs3(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolr/ui-design",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",