@cloud-ru/ds-truncate-string 1.0.24-preview-2df639a4.0 → 1.1.0

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.
@@ -32,10 +32,6 @@ export function TruncateStringMiddle({
32
32
  const truncatedTextElementRef = useRef<HTMLElement>(null);
33
33
 
34
34
  useEffect(() => {
35
- if (hideTooltip) {
36
- return;
37
- }
38
-
39
35
  const setTruncate = throttle(() => {
40
36
  setTruncatedString(
41
37
  truncateStringMiddle({
@@ -44,7 +40,7 @@ export function TruncateStringMiddle({
44
40
  text,
45
41
  }),
46
42
  );
47
- setShowTooltip(isEllipsisActive(textElementRef.current));
43
+ setShowTooltip(!hideTooltip && isEllipsisActive(textElementRef.current));
48
44
  }, 50);
49
45
 
50
46
  setTruncate();
@@ -63,6 +59,7 @@ export function TruncateStringMiddle({
63
59
  return () => {
64
60
  cancelAnimationFrame(rafId);
65
61
  observer?.disconnect();
62
+ setTruncate.cancel();
66
63
  };
67
64
  }, [showTooltip, text, hideTooltip]);
68
65
 
@@ -71,7 +68,12 @@ export function TruncateStringMiddle({
71
68
  <span ref={textElementRef} className={styles.fullText} data-test-id={TEST_IDS.fullText}>
72
69
  {text}
73
70
  </span>
74
- <span ref={truncatedTextElementRef} className={styles.truncatedText} data-test-id={TEST_IDS.truncatedText}>
71
+ <span
72
+ aria-hidden
73
+ ref={truncatedTextElementRef}
74
+ className={styles.truncatedText}
75
+ data-test-id={TEST_IDS.truncatedText}
76
+ >
75
77
  {truncatedString}
76
78
  </span>
77
79
  </>
@@ -81,7 +83,6 @@ export function TruncateStringMiddle({
81
83
  <span className={cn(styles.wrapper, className)} {...extractSupportProps(rest)}>
82
84
  {showTooltip && !hideTooltip ? (
83
85
  <Tooltip
84
- data-test-id={TEST_IDS.truncateStringMiddleTooltip}
85
86
  tip={text}
86
87
  placement={placement}
87
88
  hoverDelayOpen={500}