Skip to content

Commit c362d09

Browse files
committed
chore: remove ToolTipContent and deprecated html prop
1 parent 97095a4 commit c362d09

File tree

10 files changed

+0
-74
lines changed

10 files changed

+0
-74
lines changed

src/components/Tooltip/TooltipTypes.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ export type PositionStrategy = 'absolute' | 'fixed'
2727
export type DataAttribute =
2828
| 'place'
2929
| 'content'
30-
| 'html'
3130
| 'variant'
3231
| 'offset'
3332
| 'wrapper'

src/components/TooltipContent/TooltipContent.tsx

Lines changed: 0 additions & 9 deletions
This file was deleted.

src/components/TooltipContent/TooltipContentTypes.d.ts

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/components/TooltipContent/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/components/TooltipController/TooltipController.tsx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import type {
1212
TooltipRefProps,
1313
} from 'components/Tooltip/TooltipTypes'
1414
import { useTooltip } from 'components/TooltipProvider'
15-
import { TooltipContent } from 'components/TooltipContent'
1615
import { cssSupports } from 'utils'
1716
import clsx from 'clsx'
1817
import type { ITooltipController } from './TooltipControllerTypes'
@@ -24,7 +23,6 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
2423
anchorId,
2524
anchorSelect,
2625
content,
27-
html,
2826
render,
2927
className,
3028
classNameArrow,
@@ -66,7 +64,6 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
6664
ref,
6765
) => {
6866
const [tooltipContent, setTooltipContent] = useState(content)
69-
const [tooltipHtml, setTooltipHtml] = useState(html)
7067
const [tooltipPlace, setTooltipPlace] = useState(place)
7168
const [tooltipVariant, setTooltipVariant] = useState(variant)
7269
const [tooltipOffset, setTooltipOffset] = useState(offset)
@@ -107,9 +104,6 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
107104
content: (value) => {
108105
setTooltipContent(value ?? content)
109106
},
110-
html: (value) => {
111-
setTooltipHtml(value ?? html)
112-
},
113107
variant: (value) => {
114108
setTooltipVariant((value as VariantType) ?? variant)
115109
},
@@ -154,10 +148,6 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
154148
setTooltipContent(content)
155149
}, [content])
156150

157-
useEffect(() => {
158-
setTooltipHtml(html)
159-
}, [html])
160-
161151
useEffect(() => {
162152
setTooltipPlace(place)
163153
}, [place])
@@ -326,9 +316,6 @@ const TooltipController = React.forwardRef<TooltipRefProps, ITooltipController>(
326316
} else if (tooltipContent) {
327317
renderedContent = tooltipContent
328318
}
329-
if (tooltipHtml) {
330-
renderedContent = <TooltipContent content={tooltipHtml} />
331-
}
332319

333320
const props: ITooltip = {
334321
forwardRef: ref,

src/components/TooltipController/TooltipControllerTypes.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ export interface ITooltipController {
1818
className?: string
1919
classNameArrow?: string
2020
content?: string
21-
/**
22-
* @deprecated Use `children` or `render` instead
23-
*/
24-
html?: string
2521
render?: (render: { content: string | null; activeAnchor: HTMLElement | null }) => ChildrenType
2622
place?: PlacesType
2723
offset?: number

src/components/TooltipProvider/TooltipProviderTypes.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export interface ITooltipWrapper {
3030

3131
place?: ITooltipController['place']
3232
content?: ITooltipController['content']
33-
html?: ITooltipController['html']
3433
variant?: ITooltipController['variant']
3534
offset?: ITooltipController['offset']
3635
wrapper?: ITooltipController['wrapper']

src/components/TooltipProvider/TooltipWrapper.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const TooltipWrapper = ({
1313
className,
1414
place,
1515
content,
16-
html,
1716
variant,
1817
offset,
1918
wrapper,
@@ -38,7 +37,6 @@ const TooltipWrapper = ({
3837
className={clsx('react-tooltip-wrapper', className)}
3938
data-tooltip-place={place}
4039
data-tooltip-content={content}
41-
data-tooltip-html={html}
4240
data-tooltip-variant={variant}
4341
data-tooltip-offset={offset}
4442
data-tooltip-wrapper={wrapper}

src/test/__snapshots__/tooltip-props.spec.js.snap

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -122,33 +122,6 @@ exports[`tooltip props tooltip with float 1`] = `
122122
</div>
123123
`;
124124

125-
exports[`tooltip props tooltip with html 1`] = `
126-
<div>
127-
<span
128-
data-tooltip-id="example-html"
129-
>
130-
Lorem Ipsum
131-
</span>
132-
<div
133-
class="react-tooltip react-tooltip__place-top react-tooltip__show"
134-
id="example-html"
135-
role="tooltip"
136-
style="left: 5px; top: -10px;"
137-
>
138-
<span>
139-
<div>
140-
Hello World!
141-
<div />
142-
</div>
143-
</span>
144-
<div
145-
class="react-tooltip-arrow"
146-
style="left: -1px; bottom: -4px;"
147-
/>
148-
</div>
149-
</div>
150-
`;
151-
152125
exports[`tooltip props tooltip with place 1`] = `
153126
<div>
154127
<span

src/test/tooltip-props.spec.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,6 @@ describe('tooltip props', () => {
5757
expect(container).toMatchSnapshot()
5858
})
5959

60-
test('tooltip with html', async () => {
61-
const { container } = render(<TooltipProps id="example-html" html="<div>Hello World!<div>" />)
62-
const anchorElement = screen.getByText('Lorem Ipsum')
63-
64-
await userEvent.hover(anchorElement)
65-
66-
const tooltip = await screen.findByRole('tooltip')
67-
expect(tooltip).toHaveAttribute('style')
68-
69-
expect(tooltip).toBeInTheDocument()
70-
expect(container).toMatchSnapshot()
71-
})
72-
7360
test('clickable tooltip', async () => {
7461
const id = 'example-clickable'
7562

0 commit comments

Comments
 (0)