ui(component): Tooltip component ui-next (#4635)

Co-authored-by: sedghi <ar.sedghi@gmail.com>
This commit is contained in:
Dan Rukasandsedghi authored and GitHub committed 2025-01-08 13:10:57 -05:00
1 parent 03ad79eaed
commit b54f2075ec
18 files changed
+342 -100

No files matched your search

@@ -0,0 +1,15 @@
---
title: General
---
## HTML Template Update
We have modified the `template.html` file so if you are using a custom template, you will need to update it.
Here are the key changes needed in the migration:
1. Added `window.PUBLIC_URL` declaration:
```javascript
window.PUBLIC_URL = '<%= PUBLIC_URL %>';
```
Was added before the `<!-- EXTENSIONS -->` comment block.
@@ -1,6 +1,5 @@
---
sidebar_position: 2
sidebar_label: Icons
title: Icons
---
## Migration Guide: Icon Component Updates
@@ -0,0 +1,62 @@
---
title: Tooltip
---
## Tooltip Updates
### Changes:
- Updated Tooltip structure to use `Tooltip`, `TooltipTrigger`, and `TooltipContent`.
- Removed deprecated `TooltipClipboard` and inline `content`/`position` properties.
### Migration Steps:
1. Replace imports:
```tsx
// Before
import { Tooltip } from '@ohif/ui';
import { TooltipClipboard } from '@ohif/ui';
// After
import { Tooltip, TooltipTrigger, TooltipContent } from '@ohif/ui-next';
```
2. Update Tooltip usage:
```tsx
// Before
<Tooltip content={<div>Tooltip Message</div>} position="bottom-left">
<Component />
</Tooltip>
// After
<Tooltip>
<TooltipTrigger asChild>
<Component />
</TooltipTrigger>
<TooltipContent side="bottom">
Tooltip Message
</TooltipContent>
</Tooltip>
```
3. TooltipClipboard Replacement:
The `TooltipClipboard` component has been removed. Instead, use the `Clipboard` component inside `TooltipContent` for copying text functionality.
#### Before:
```tsx
<TooltipClipboard>{text}</TooltipClipboard>
```
#### After:
```tsx
<Tooltip>
<TooltipTrigger asChild>
<span className="cursor-pointer truncate">{text}</span>
</TooltipTrigger>
<TooltipContent side="bottom">
<div className="flex items-center justify-between gap-2">
{text}
<Clipboard>{text}</Clipboard>
</div>
</TooltipContent>
</Tooltip>
```
@@ -4,3 +4,6 @@ sidebar_label: 3.9 -> 3.10 beta
---
# Migration Guide
## General