Files
decky-frontend-lib/src/deck-components/Focusable.tsx

22 lines
772 B
TypeScript
Raw Normal View History

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
export interface FocusableProps extends HTMLAttributes<HTMLDivElement>, FooterLegendProps {
children: ReactNode;
2022-10-24 20:33:40 -04:00
'flow-children'?: string;
focusClassName?: string;
focusWithinClassName?: string;
onActivate?: (e: CustomEvent) => void;
onCancel?: (e: CustomEvent) => void;
2022-06-08 21:40:19 -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>>;