@@ -29,11 +29,18 @@ import {
2929 SecondaryAuthenticationMode ,
3030 SecondaryAuthenticatorType ,
3131} from "../../types" ;
32- import { TooltipIcon } from "../../Tooltip" ;
32+ import { TooltipIcon , useTooltipTargetElement } from "../../Tooltip" ;
3333import ShowLoading from "../../ShowLoading" ;
3434import ShowError from "../../ShowError" ;
3535import styles from "./ProjectWizardScreen.module.scss" ;
3636
37+ const TOOLTIP_HOST_STYLES = {
38+ root : {
39+ display : "inline-block" ,
40+ position : "relative" ,
41+ } ,
42+ } as const ;
43+
3744type Step1Answer = "password" | "oob_otp_email" ;
3845type Step2Answer = SecondaryAuthenticationMode ;
3946type Step3Answer = SecondaryAuthenticatorType ;
@@ -98,6 +105,13 @@ function Step1(props: StepProps) {
98105 [ navigate ]
99106 ) ;
100107
108+ const { id, setRef, targetElement } = useTooltipTargetElement ( ) ;
109+ const tooltipProps = useMemo ( ( ) => {
110+ return {
111+ targetElement,
112+ } ;
113+ } , [ targetElement ] ) ;
114+
101115 const options : IChoiceGroupOption [ ] = useMemo ( ( ) => {
102116 return [
103117 {
@@ -109,15 +123,18 @@ function Step1(props: StepProps) {
109123 text : renderToString ( "ProjectWizardScreen.step1.option.oob-otp-email" ) ,
110124 onRenderField : ( props , render ) => {
111125 return (
112- < TooltipHost
113- className = { styles . optionWithTooltip }
114- content = { renderToString (
115- "ProjectWizardScreen.step1.tooltip.oob-otp-email"
116- ) }
117- >
126+ < >
118127 { render ! ( props ) }
119- < TooltipIcon />
120- </ TooltipHost >
128+ < TooltipHost
129+ styles = { TOOLTIP_HOST_STYLES }
130+ tooltipProps = { tooltipProps }
131+ content = { renderToString (
132+ "ProjectWizardScreen.step1.tooltip.oob-otp-email"
133+ ) }
134+ >
135+ < TooltipIcon id = { id } setRef = { setRef } />
136+ </ TooltipHost >
137+ </ >
121138 ) ;
122139 } ,
123140 } ,
@@ -134,7 +151,7 @@ function Step1(props: StepProps) {
134151 disabled : true ,
135152 } ,
136153 ] ;
137- } , [ renderToString ] ) ;
154+ } , [ renderToString , id , setRef , tooltipProps ] ) ;
138155
139156 const onChange = useCallback (
140157 ( _e , option ) => {
0 commit comments