88
99import { css } from '@emotion/react' ;
1010import { UseEuiTheme } from '../../../services' ;
11- import { euiRangeVariables } from './range.styles' ;
1211import { euiFontSize , mathWithUnits } from '../../../global_styling' ;
12+ import { _popoverArrowStyles } from '../../../services/popover' ;
13+ import { euiRangeVariables } from './range.styles' ;
1314
1415export const euiRangeTooltipStyles = ( euiThemeContext : UseEuiTheme ) => {
1516 const range = euiRangeVariables ( euiThemeContext ) ;
@@ -32,13 +33,15 @@ export const euiRangeTooltipStyles = (euiThemeContext: UseEuiTheme) => {
3233
3334export const euiRangeTooltipValueStyles = ( euiThemeContext : UseEuiTheme ) => {
3435 const range = euiRangeVariables ( euiThemeContext ) ;
35- const { euiTheme } = euiThemeContext ;
36-
37- const arrowSize = euiTheme . size . m ;
38- const arrowSizeInt = parseInt ( arrowSize , 10 ) ;
39- const arrowMinusSize = `${ ( arrowSizeInt / 2 - 1 ) * - 1 } px` ; // Shift arrow 1px more than half its size to account for border radius
36+ const { euiTheme, colorMode } = euiThemeContext ;
4037
4138 const toolTipBackgroundColor = euiTheme . components . tooltipBackground ;
39+ const borderColor =
40+ colorMode === 'DARK' ? toolTipBackgroundColor : 'transparent' ;
41+
42+ const arrowSize = euiTheme . size . m ;
43+ const arrowOffset = euiTheme . size . l ;
44+ const arrowStyles = _popoverArrowStyles ( euiThemeContext , arrowSize ) ;
4245
4346 return {
4447 euiRangeTooltip__value : css `
@@ -47,42 +50,39 @@ export const euiRangeTooltipValueStyles = (euiThemeContext: UseEuiTheme) => {
4750 max-inline-size: ${ mathWithUnits ( euiTheme . size . base , ( x ) => x * 16 ) } ;
4851 padding-block: ${ euiTheme . size . xxs } ;
4952 padding-inline: ${ euiTheme . size . s } ;
50- transform: translateX ( 0 ) translateY (-50% );
53+ transform: translateY (-50% );
5154
5255 ${ euiFontSize ( euiThemeContext , 's' ) }
5356 line-height: ${ euiFontSize ( euiThemeContext , 's' ) . lineHeight } ;
5457 color: ${ euiTheme . colors . ghost } ;
5558 background-color: ${ toolTipBackgroundColor } ;
5659 border: ${ euiTheme . border . width . thin } solid ${ toolTipBackgroundColor } ;
60+ border: ${ euiTheme . border . width . thin } solid ${ borderColor } ;
5761 border-radius: ${ euiTheme . border . radius . small } ;
5862
5963 & ::befor e {
6064 content: '' ;
61- position: absolute;
62- inset-block-end: 50% ;
63- inline-size: ${ arrowSize } ;
64- block-size: ${ arrowSize } ;
65- transform-origin: center;
66- transform: translateY (50% ) rotateZ (45deg );
67- background-color: ${ toolTipBackgroundColor } ;
68- border-radius: ${ mathWithUnits (
69- euiTheme . border . radius . small ,
70- ( x ) => x / 2
71- ) } ;
65+ ${ arrowStyles . _arrowStyles }
66+ inset-block-start: 50% ;
67+ margin-block-start: ${ mathWithUnits ( arrowSize , ( x ) => x / - 2 ) } ;
68+ background-color: inherit;
69+ border: inherit;
7270 }
7371 ` ,
7472 left : css `
75- margin- inline-end: ${ euiTheme . size . l } ;
73+ margin- inline-end: ${ arrowOffset } ;
7674
7775 & ::befor e {
78- inset- inline-end: ${ arrowMinusSize } ;
76+ ${ arrowStyles . positions . left }
77+ inset- inline-start: 100% ;
7978 }
8079 ` ,
8180 right : css `
82- margin- inline-start: ${ euiTheme . size . l } ;
81+ margin- inline-start: ${ arrowOffset } ;
8382
8483 & ::befor e {
85- inset- inline-start: ${ arrowMinusSize } ;
84+ ${ arrowStyles . positions . right }
85+ inset- inline-end: 100% ;
8686 }
8787 ` ,
8888 hasTicks : css `
0 commit comments