import { InteractiveStateChange } from './index' ; export const stateChanged = ( { state , prevState , } ) : boolean => state . hover !== prevState . hover || state . active !== prevState . active || state . focus !== prevState . focus ; interface ElementTagNameAndType { ( element ) : boolean ; } export const enterKeyTrigger = ( { tagName , type } ) => tagName !== 'SELECT' && ( tagName !== 'INPUT' || ( type !== 'checkbox' && type !== 'radio' ) ) ; export const spaceKeyTrigger = ( { tagName , type } ) => [ 'BUTTON' , 'SELECT' ] . includes ( tagName as string ) || ( tagName === 'INPUT' && [ 'checkbox' , 'radio' , 'submit' ] . includes ( type as string ) ) ; export const elementSupportsDisabled = ( { tagName } ) => [ 'BUTTON' , 'INPUT' , 'SELECT' , 'TEXTAREA' , 'FIELDSET' ] . includes ( tagName as string ) ; interface CursorPointer { ( element , hasOnClickHandler ) : boolean ; } export const cursorPointer = ( { tagName , type } , hasOnClickHandler ) => [ 'BUTTON' , 'A' , 'AREA' , 'SELECT' ] . includes ( tagName as string ) || ( tagName === 'INPUT' && [ 'checkbox' , 'radio' , 'submit' ] . includes ( type as string ) ) || ( tagName !== 'INPUT' && tagName !== 'TEXTAREA' && hasOnClickHandler ) ; export const classNameToString = ( className ) => typeof className === 'string' || ( typeof className === 'object' && className !== null ) || typeof className === 'number' || typeof className === 'bigint' ? String ( className ) : '' ; let pendingUserSelectReset = false ; export const setUserSelectNone = ( ) : void => { pendingUserSelectReset = false ; document . body . style . userSelect = 'none' ; document . body . style . webkitUserSelect = 'none' ; } ; export const resetUserSelect = ( ) : void => { pendingUserSelectReset = true ; window . setTimeout ( ( ) => { if ( pendingUserSelectReset ) { document . body . style . userSelect = '' ; document . body . style . webkitUserSelect = '' ; } } , 250 ) ; } ;