@uxland/primary-shell 7.28.0 → 7.29.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.
@@ -1,64 +0,0 @@
1
- import React from "react";
2
- import { createRoot, Root } from "react-dom/client";
3
- import "./styles.css";
4
-
5
- interface NavigationTooltipProps {
6
- text: string;
7
- itemAbsoluteY: number;
8
- }
9
-
10
- const NavigationTooltip: React.FC<NavigationTooltipProps> = ({ text, itemAbsoluteY }) => {
11
- const itemHeight = 51;
12
- const centerY = itemAbsoluteY + itemHeight / 2;
13
-
14
- const style = {
15
- left: "73px", // 60px (sidebar width) + 13px offset
16
- top: `${centerY}px`,
17
- };
18
-
19
- return (
20
- <div className="tooltip-overlay">
21
- <div className="navigation-tooltip" style={style}>
22
- <dss-icon icon="info" size="md" />
23
- {text}
24
- <div className="arrow" />
25
- </div>
26
- </div>
27
- );
28
- };
29
-
30
- export default NavigationTooltip;
31
-
32
- // Singleton root to manage the tooltip rendering
33
- let tooltipRoot: Root | null = null;
34
- let tooltipContainer: HTMLDivElement | null = null;
35
-
36
- export const renderNavigationTooltip = (text: string, itemAbsoluteY: number) => {
37
- // Clean up existing tooltip if any
38
- if (tooltipRoot && tooltipContainer) {
39
- tooltipRoot.unmount();
40
- if (document.body.contains(tooltipContainer)) {
41
- document.body.removeChild(tooltipContainer);
42
- }
43
- }
44
-
45
- // Create new container
46
- tooltipContainer = document.createElement("div");
47
- document.body.appendChild(tooltipContainer);
48
-
49
- // Create root and render
50
- tooltipRoot = createRoot(tooltipContainer);
51
- tooltipRoot.render(<NavigationTooltip text={text} itemAbsoluteY={itemAbsoluteY} />);
52
-
53
- // Auto-remove after 5 seconds
54
- setTimeout(() => {
55
- if (tooltipRoot && tooltipContainer) {
56
- tooltipRoot.unmount();
57
- if (document.body.contains(tooltipContainer)) {
58
- document.body.removeChild(tooltipContainer);
59
- }
60
- tooltipRoot = null;
61
- tooltipContainer = null;
62
- }
63
- }, 5000);
64
- };