@anaralabs/lector 3.5.12 → 3.5.14

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.
@@ -97,7 +97,7 @@ declare interface AnnotationState {
97
97
  setAnnotations: (annotations: Annotation[]) => void;
98
98
  }
99
99
 
100
- export declare const AnnotationTooltip: ({ annotation, children, renderTooltipContent, hoverTooltipContent, onOpenChange, className, hoverClassName, isOpen: controlledIsOpen, hoverIsOpen: controlledHoverIsOpen, }: AnnotationTooltipProps) => JSX.Element;
100
+ export declare const AnnotationTooltip: ({ annotation, children, renderTooltipContent, hoverTooltipContent, onOpenChange, className, focusedOpenId, focusedHoverOpenId, hoverClassName, isOpen: controlledIsOpen, hoverIsOpen: controlledHoverIsOpen, }: AnnotationTooltipProps) => JSX.Element;
101
101
 
102
102
  export declare type AnnotationTooltipContentProps = {
103
103
  annotation: Annotation;
@@ -112,6 +112,8 @@ declare interface AnnotationTooltipProps {
112
112
  hoverTooltipContent?: React.ReactNode;
113
113
  onOpenChange?: (open: boolean) => void;
114
114
  isOpen?: boolean;
115
+ focusedOpenId?: string;
116
+ focusedHoverOpenId?: string;
115
117
  className?: string;
116
118
  hoverClassName?: string;
117
119
  hoverIsOpen?: boolean;
package/dist/index.js CHANGED
@@ -274,6 +274,8 @@ var AnnotationTooltip = ({
274
274
  hoverTooltipContent,
275
275
  onOpenChange,
276
276
  className,
277
+ focusedOpenId,
278
+ focusedHoverOpenId,
277
279
  hoverClassName,
278
280
  isOpen: controlledIsOpen,
279
281
  hoverIsOpen: controlledHoverIsOpen
@@ -315,6 +317,8 @@ var AnnotationTooltip = ({
315
317
  }
316
318
  }, [controlledIsOpen, isOpen, setIsOpen]);
317
319
  const handleMouseEnter = useCallback(() => {
320
+ if (focusedOpenId && focusedOpenId !== annotation.id) return;
321
+ if (focusedHoverOpenId && focusedHoverOpenId !== annotation.id) return;
318
322
  if (hoverTooltipContent) {
319
323
  if (closeTimeoutRef.current) {
320
324
  clearTimeout(closeTimeoutRef.current);
@@ -333,6 +337,8 @@ var AnnotationTooltip = ({
333
337
  closeTimeoutRef.current = setTimeout(closeTooltip, 100);
334
338
  }, [hoverTooltipContent, closeTooltip]);
335
339
  const handleTooltipMouseEnter = useCallback(() => {
340
+ if (focusedOpenId && focusedOpenId !== annotation.id) return;
341
+ if (focusedHoverOpenId && focusedHoverOpenId !== annotation.id) return;
336
342
  isMouseInTooltipRef.current = true;
337
343
  if (closeTimeoutRef.current) {
338
344
  clearTimeout(closeTimeoutRef.current);
@@ -502,6 +508,8 @@ var AnnotationHighlightLayer = ({
502
508
  annotation,
503
509
  className: tooltipClassName,
504
510
  hoverClassName: hoverTooltipClassName,
511
+ focusedOpenId: focusedAnnotationId,
512
+ focusedHoverOpenId: focusedHoverAnnotationId,
505
513
  isOpen: focusedAnnotationId === annotation.id,
506
514
  hoverIsOpen: focusedHoverAnnotationId === annotation.id,
507
515
  onOpenChange: (open) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anaralabs/lector",
3
- "version": "3.5.12",
3
+ "version": "3.5.14",
4
4
  "description": "Headless PDF viewer for React",
5
5
  "author": "andrewdr (https://github.com/andrewdoro)",
6
6
  "license": "MIT",