import { createContext , useContext } from "react" ; import { isNil } from "../../shared" ; type StyleContextType = Record < string , any > ; export const StyleContext = createContext < StyleContextType > ( undefined ) ; export const StyleProvider = StyleContext . Provider ; export function useStyleContext ( ) { return useContext ( StyleContext ) ; } export function useStyleProps < TReturn > ( key ) { const context = useStyleContext ( ) ; if ( ! isNil ( context ) ) { const props = ! isNil ( key ) ? context [ key ] ?? { } : { } ; return [ props , true ] ; } return [ { } as TReturn , false ] ; }