2022-10-24 20:33:40 -04:00
|
|
|
import { HTMLAttributes, ReactNode, RefAttributes, VFC } from 'react';
|
|
|
|
|
|
|
|
|
|
import { findModuleChild } from '../webpack';
|
|
|
|
|
import { FooterLegendProps } from './FooterLegend';
|
2022-06-08 21:40:19 -04:00
|
|
|
|
2022-08-26 01:12:21 -04:00
|
|
|
export interface FocusableProps extends HTMLAttributes<HTMLDivElement>, FooterLegendProps {
|
2022-06-10 16:56:39 -04:00
|
|
|
children: ReactNode;
|
2022-10-24 20:33:40 -04:00
|
|
|
'flow-children'?: string;
|
2022-06-10 16:56:39 -04:00
|
|
|
focusClassName?: string;
|
|
|
|
|
focusWithinClassName?: string;
|
2022-06-16 17:26:31 -04:00
|
|
|
onActivate?: (e: CustomEvent) => void;
|
|
|
|
|
onCancel?: (e: CustomEvent) => void;
|
2022-06-08 21:40:19 -04:00
|
|
|
}
|
|
|
|
|
|
2022-06-10 16:56:39 -04:00
|
|
|
export const Focusable = findModuleChild((m) => {
|
|
|
|
|
if (typeof m !== 'object') return undefined;
|
|
|
|
|
for (let prop in m) {
|
|
|
|
|
if (m[prop]?.render?.toString()?.includes('["flow-children","onActivate","onCancel","focusClassName",'))
|
|
|
|
|
return m[prop];
|
|
|
|
|
}
|
2022-10-24 20:33:40 -04:00
|
|
|
}) as VFC<FocusableProps & RefAttributes<HTMLDivElement>>;
|