66 * Side Public License, v 1.
77 */
88
9- import React , { useState , useCallback } from 'react' ;
9+ import React , { useState } from 'react' ;
1010import type { Meta , StoryObj } from '@storybook/react' ;
1111import { disableStorybookControls } from '../../../../.storybook/utils' ;
1212
13- import { useEuiTheme } from '../../../services' ;
1413import {
1514 EuiButtonGroup ,
1615 EuiButtonGroupProps ,
@@ -125,37 +124,7 @@ export const MultiSelection: Story = {
125124} ;
126125
127126export const WithTooltips : Story = {
128- render : function Render ( { options, ...args } : EuiButtonGroupProps ) {
129- const { euiTheme } = useEuiTheme ( ) ;
130- const [ toolTipHidden , forceToolTipHidden ] = useState ( false ) ;
131- const forceHiddenToolTip = useCallback ( ( ) => forceToolTipHidden ( true ) , [ ] ) ;
132- const resetVisibility = useCallback ( ( ) => forceToolTipHidden ( false ) , [ ] ) ;
133-
134- if ( options [ 2 ] . toolTipProps ) {
135- options [ 2 ] . toolTipProps = {
136- ...options [ 2 ] . toolTipProps ,
137- // Example of how a consumer could force hiding the tooltip
138- // via `toolTipProps`, state, and custom CSS
139- anchorProps : {
140- onClick : forceHiddenToolTip ,
141- onBlurCapture : resetVisibility ,
142- onMouseEnter : resetVisibility ,
143- onMouseLeave : forceHiddenToolTip ,
144- } ,
145- css : [
146- {
147- transition : `opacity ${ euiTheme . animation . normal } ${ euiTheme . animation . resistance } ` ,
148- animationFillMode : 'none !important' ,
149- } ,
150- toolTipHidden
151- ? { opacity : '0 !important' , pointerEvents : 'none' }
152- : { opacity : '1' } ,
153- ] ,
154- } ;
155- }
156-
157- return < EuiButtonGroupMulti options = { options } { ...args } /> ;
158- } ,
127+ render : ( { ...args } ) => < EuiButtonGroupMulti { ...args } /> ,
159128 args : {
160129 legend : 'EuiButtonGroup - tooltip UI testing' ,
161130 isIconOnly : true , // Start example with icons to demonstrate usefulness of tooltips
@@ -175,9 +144,10 @@ export const WithTooltips: Story = {
175144 id : 'customToolTipProps' ,
176145 iconType : 'securitySignalDetected' ,
177146 label : 'Custom tooltip' ,
178- toolTipContent : 'Custom tooltip position and click behavior ' ,
147+ toolTipContent : 'Custom tooltip position and delay ' ,
179148 toolTipProps : {
180149 position : 'right' ,
150+ delay : 'regular' ,
181151 title : 'Hello world' ,
182152 } ,
183153 // Consumers could also opt to hide titles if preferred
0 commit comments