Skip to content

Commit

Permalink
feat(components): remove HorizontalFocus, add Focusable
Browse files Browse the repository at this point in the history
  • Loading branch information
AAGaming00 committed Jun 10, 2022
1 parent 33aaf56 commit 9beab5f
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/deck-components/Focusable.tsx
Original file line number Diff line number Diff line change
@@ -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<HTMLDivElement> {
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<FocusableProps>;

0 comments on commit 9beab5f

Please sign in to comment.