import React, { createContext, FC, ReactNode } from 'react'; export type ComponentSettingsProps = { assetRoot?: string; portalClassName?: string; portalStyle?: object; getActiveElement?: () => HTMLElement | null; children?: ReactNode; }; function getDocumentActiveElement() { return document.activeElement as HTMLElement | null; } export const ComponentSettingsContext = createContext< ComponentSettingsProps & Required> >({ getActiveElement: getDocumentActiveElement }); /** * */ export const ComponentSettings: FC = (props) => { const { assetRoot, portalClassName, portalStyle, getActiveElement = getDocumentActiveElement, children, } = props; return ( {children} ); };