12
12
13
13
import { ActionButton } from '@react-spectrum/button' ;
14
14
import { Dialog , DialogTrigger } from '@react-spectrum/dialog' ;
15
+ import { FocusableRef } from '@react-types/shared' ;
15
16
import HelpOutline from '@spectrum-icons/workflow/HelpOutline' ;
16
17
import helpStyles from './contextualhelp.css' ;
17
18
import InfoOutline from '@spectrum-icons/workflow/InfoOutline' ;
@@ -22,12 +23,13 @@ import {SlotProvider} from '@react-spectrum/utils';
22
23
import { SpectrumContextualHelpProps } from '@react-types/contextualhelp' ;
23
24
import { useMessageFormatter } from '@react-aria/i18n' ;
24
25
25
- function ContextualHelp ( props : SpectrumContextualHelpProps ) {
26
+ function ContextualHelp ( props : SpectrumContextualHelpProps , ref : FocusableRef < HTMLButtonElement > ) {
26
27
let {
27
28
variant = 'help' ,
28
29
placement = 'bottom start' ,
29
30
children,
30
- ...otherProps } = props ;
31
+ ...otherProps
32
+ } = props ;
31
33
32
34
let formatMessage = useMessageFormatter ( intlMessages ) ;
33
35
@@ -41,6 +43,7 @@ function ContextualHelp(props: SpectrumContextualHelpProps) {
41
43
return (
42
44
< DialogTrigger type = "popover" placement = { placement } hideArrow { ...otherProps } >
43
45
< ActionButton
46
+ ref = { ref }
44
47
UNSAFE_className = { helpStyles [ 'react-spectrum-ContextualHelp-button' ] }
45
48
isQuiet
46
49
aria-label = { formatMessage ( 'open' ) } >
@@ -51,12 +54,12 @@ function ContextualHelp(props: SpectrumContextualHelpProps) {
51
54
{ children }
52
55
</ Dialog >
53
56
</ SlotProvider >
54
-
55
57
</ DialogTrigger >
56
58
) ;
57
59
}
58
60
59
61
/**
60
62
* Contextual help shows a user extra information about the state of an adjacent component, or a total view.
61
63
*/
62
- export { ContextualHelp } ;
64
+ let _ContextualHelp = React . forwardRef ( ContextualHelp ) ;
65
+ export { _ContextualHelp as ContextualHelp } ;
0 commit comments