22 * (c) Copyright 2024 Palantir Technologies Inc. All rights reserved.
33 */
44
5- import * as React from "react" ;
5+ import { useCallback , useRef , useState } from "react" ;
66
77import { mergeRefs , Utils } from "../common" ;
88
@@ -35,13 +35,13 @@ export function useInteractiveAttributes<E extends HTMLElement>(
3535 const { defaultTabIndex, disabledTabIndex } = options ;
3636 const { active, onClick, onFocus, onKeyDown, onKeyUp, onBlur, tabIndex = defaultTabIndex } = props ;
3737 // the current key being pressed
38- const [ currentKeyPressed , setCurrentKeyPressed ] = React . useState < string | undefined > ( ) ;
38+ const [ currentKeyPressed , setCurrentKeyPressed ] = useState < string | undefined > ( ) ;
3939 // whether the button is in "active" state
40- const [ isActive , setIsActive ] = React . useState ( false ) ;
40+ const [ isActive , setIsActive ] = useState ( false ) ;
4141 // our local ref for the interactive element, merged with the consumer's own ref in this hook's return value
42- const elementRef = React . useRef < E | null > ( null ) ;
42+ const elementRef = useRef < E | null > ( null ) ;
4343
44- const handleBlur = React . useCallback (
44+ const handleBlur = useCallback (
4545 ( e : React . FocusEvent < E > ) => {
4646 if ( isActive ) {
4747 setIsActive ( false ) ;
@@ -52,7 +52,7 @@ export function useInteractiveAttributes<E extends HTMLElement>(
5252 [ isActive , onBlur ] ,
5353 ) ;
5454
55- const handleKeyDown = React . useCallback (
55+ const handleKeyDown = useCallback (
5656 ( e : React . KeyboardEvent < E > ) => {
5757 if ( Utils . isKeyboardClick ( e ) ) {
5858 e . preventDefault ( ) ;
@@ -67,7 +67,7 @@ export function useInteractiveAttributes<E extends HTMLElement>(
6767 [ currentKeyPressed , onKeyDown ] ,
6868 ) ;
6969
70- const handleKeyUp = React . useCallback (
70+ const handleKeyUp = useCallback (
7171 ( e : React . KeyboardEvent < E > ) => {
7272 if ( Utils . isKeyboardClick ( e ) ) {
7373 setIsActive ( false ) ;
0 commit comments