Skip to content

Commit

Permalink
fix(tooltip): export useTooltip hook in types
Browse files Browse the repository at this point in the history
  • Loading branch information
wyze authored and plouc committed Nov 9, 2020
1 parent c446b46 commit 7eb1b30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/pie/src/PieSlice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const PieSlice = <RawDatum, >({
const handleMouseLeave = useCallback(
event => {
onMouseLeave?.(datum, event)
hideTooltip(event)
hideTooltip()
},
[onMouseLeave, hideTooltip, datum]
)
Expand Down
12 changes: 12 additions & 0 deletions packages/tooltip/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,16 @@ declare module '@nivo/tooltip' {
| 'bottom-left'
| 'left'
| 'cross'

export type TooltipAnchor = 'top' | 'right' | 'bottom' | 'left' | 'center'

export function useTooltip(): {
showTooltipAt: (
content: JSX.Element,
position: [number, number],
anchor?: TooltipAnchor
) => void
showTooltipFromEvent: <Event>(content: JSX.Element, event: Event) => void
hideTooltip: () => void
}
}

0 comments on commit 7eb1b30

Please sign in to comment.