2022-06-10 16:56:39 -04:00
|
|
|
import { HTMLAttributes, ReactNode, VFC } from "react";
|
2022-06-08 21:40:19 -04:00
|
|
|
import { findModuleChild } from "../webpack";
|
|
|
|
|
|
2022-06-10 16:56:39 -04:00
|
|
|
export interface FocusableProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
|
|
children: ReactNode;
|
|
|
|
|
"flow-children"?: string;
|
|
|
|
|
focusClassName?: string;
|
|
|
|
|
focusWithinClassName?: string;
|
|
|
|
|
onActivate?: () => void;
|
|
|
|
|
onCancel?: () => 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-06-08 21:40:19 -04:00
|
|
|
}) as VFC<FocusableProps>;
|