@@ -20,7 +20,6 @@ import {
2020 EuiFlexGroup ,
2121 EuiFlexItem ,
2222 EuiToolTip ,
23- EuiButtonIconProps ,
2423} from '@elastic/eui' ;
2524import type { CoreStart } from '@kbn/core/public' ;
2625import { css } from '@emotion/react' ;
@@ -63,25 +62,25 @@ export const getSharedActions = ({
6362 core : Pick < CoreStart , 'overlays' | 'analytics' | 'i18n' | 'theme' | 'userProfile' > ;
6463 customRemoveModalText ?: { title ?: string ; description ?: string } ;
6564} ) => [
66- getOpenLayerSettingsAction ( {
67- hasLayerSettings,
68- openLayerSettings,
69- } ) ,
70- getCloneLayerAction ( {
71- execute : onCloneLayer ,
72- layerIndex,
73- activeVisualization,
74- isTextBasedLanguage,
75- } ) ,
76- getRemoveLayerAction ( {
77- execute : onRemoveLayer ,
78- layerIndex,
79- layerType,
80- isOnlyLayer,
81- core,
82- customModalText : customRemoveModalText ,
83- } ) ,
84- ] ;
65+ getOpenLayerSettingsAction ( {
66+ hasLayerSettings,
67+ openLayerSettings,
68+ } ) ,
69+ getCloneLayerAction ( {
70+ execute : onCloneLayer ,
71+ layerIndex,
72+ activeVisualization,
73+ isTextBasedLanguage,
74+ } ) ,
75+ getRemoveLayerAction ( {
76+ execute : onRemoveLayer ,
77+ layerIndex,
78+ layerType,
79+ isOnlyLayer,
80+ core,
81+ customModalText : customRemoveModalText ,
82+ } ) ,
83+ ] ;
8584
8685/** @internal **/
8786const InContextMenuActions = ( props : LayerActionsProps ) => {
@@ -102,6 +101,16 @@ const InContextMenuActions = (props: LayerActionsProps) => {
102101 }
103102 } , [ isPopoverOpen ] ) ;
104103
104+ // `neutral` and `risk` variants belong to `severity` so they're not
105+ // available in `euiTheme.colors` directly
106+ const getColorFromTheme = useCallback (
107+ ( color : LayerAction [ 'color' ] ) =>
108+ color === 'risk' || color === 'neutral'
109+ ? euiTheme . colors . severity [ color ]
110+ : euiTheme . colors [ color ! ] ,
111+ [ euiTheme ]
112+ ) ;
113+
105114 return (
106115 < EuiOutsideClickDetector onOutsideClick = { closePopover } >
107116 < EuiPopover
@@ -144,16 +153,14 @@ const InContextMenuActions = (props: LayerActionsProps) => {
144153 } }
145154 { ...( i . color
146155 ? {
147- css : css `
148- color : ${ euiTheme . colors [ i . color as keyof EuiButtonIconProps [ 'color' ] ] } ;
156+ css : css `
157+ color : ${ getColorFromTheme ( i . color ) } ;
149158 & : hover {
150- text-decoration-color : ${ euiTheme . colors [
151- i . color as keyof EuiButtonIconProps [ 'color' ]
152- ] } !important ;
159+ text-decoration-color : ${ getColorFromTheme ( i . color ) } !important ;
153160 }
154161 ` ,
155- size : 's' , // need to be explicit here as css prop will disable the default small size
156- }
162+ size : 's' , // need to be explicit here as css prop will disable the default small size
163+ }
157164 : { } ) }
158165 >
159166 < EuiText size = { 's' } color = { i . color } >
0 commit comments