Skip to content

Commit

Permalink
fix(tooltip): Bugfix/2490 tooltip theme (#2552)
Browse files Browse the repository at this point in the history
* Issue #2490
extend tooltip theme to allow customization of TooltipWrapper component

* Issue #2490
extend tooltip theme to allow customization of TooltipWrapper component
  • Loading branch information
gtibrett authored Apr 23, 2024
1 parent 831d28d commit 6a9defe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export type CompleteTheme = {
text: TextStyle
}
tooltip: {
wrapper: Partial<React.CSSProperties>
container: Partial<React.CSSProperties>
basic: Partial<React.CSSProperties>
chip: Partial<React.CSSProperties>
Expand Down
8 changes: 4 additions & 4 deletions packages/tooltip/src/TooltipWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { TooltipStateContextDataVisible } from './context'

const TOOLTIP_OFFSET = 14

const tooltipStyle = {
pointerEvents: 'none' as CSSProperties['pointerEvents'],
position: 'absolute' as CSSProperties['position'],
const tooltipStyle: Partial<CSSProperties> = {
pointerEvents: 'none',
position: 'absolute',
zIndex: 10,
top: 0,
left: 0,
Expand Down Expand Up @@ -78,7 +78,7 @@ export const TooltipWrapper = memo<PropsWithChildren<TooltipWrapperProps>>(

const style = {
...tooltipStyle,
...theme.tooltip,
...theme.tooltip.wrapper,
transform: animatedProps.transform ?? translate(x, y),
opacity: animatedProps.transform ? 1 : 0,
}
Expand Down
1 change: 1 addition & 0 deletions website/src/components/guides/theming/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const annotationsDefaults: CompleteTheme['annotations'] = {
}

const tooltipDefaults: CompleteTheme['tooltip'] = {
wrapper: {},
container: {
background: '#ffffff',
color: extendedTheme.text.fill,
Expand Down

0 comments on commit 6a9defe

Please sign in to comment.