From 9beab5f7e913f2ef2a8a3047046a524d3007c3b8 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Fri, 10 Jun 2022 16:56:39 -0400 Subject: [PATCH] feat(components): remove HorizontalFocus, add Focusable --- src/deck-components/Focusable.tsx | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/deck-components/Focusable.tsx b/src/deck-components/Focusable.tsx index 01ffeb8..371ce65 100644 --- a/src/deck-components/Focusable.tsx +++ b/src/deck-components/Focusable.tsx @@ -1,15 +1,19 @@ -import { ReactNode, VFC } from "react"; +import { HTMLAttributes, ReactNode, VFC } from "react"; import { findModuleChild } from "../webpack"; -export interface FocusableProps { - children: ReactNode; +export interface FocusableProps extends HTMLAttributes { + children: ReactNode; + "flow-children"?: string; + focusClassName?: string; + focusWithinClassName?: string; + onActivate?: () => void; + onCancel?: () => void; } -export const HorizontalFocus = findModuleChild(m => { - if (typeof m !== "object") return undefined; - for (let prop in m) { - if (m[prop]?.toString()?.includes('"children","alignItems","spacing"')) { - return m[prop]; - } - } +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]; + } }) as VFC; \ No newline at end of file