From cf137c43b4962977650e6ce0fad554b6ae966e43 Mon Sep 17 00:00:00 2001 From: AAGaming Date: Fri, 26 Aug 2022 01:11:04 -0400 Subject: [PATCH] feat(components): add Carousel component --- src/deck-components/Carousel.ts | 28 ++++++++++++++++++++++++++++ src/deck-components/index.ts | 1 + 2 files changed, 29 insertions(+) create mode 100644 src/deck-components/Carousel.ts diff --git a/src/deck-components/Carousel.ts b/src/deck-components/Carousel.ts new file mode 100644 index 0000000..9eff157 --- /dev/null +++ b/src/deck-components/Carousel.ts @@ -0,0 +1,28 @@ +import { HTMLAttributes, ReactNode, RefAttributes, VFC } from "react"; +import { findModuleChild } from "../webpack"; + +export interface CarouselProps extends HTMLAttributes { + autoFocus?: boolean; + enableBumperPaging?: boolean; + fnDoesItemTakeFocus?: (...unknown: any[]) => boolean; + fnGetColumnWidth?: (...unknown: any[]) => number; + fnGetId?: (id: number) => number; + fnItemRenderer?: (id: number, ...unknown: any[]) => ReactNode; + fnUpdateArrows?: (...unknown: any[]) => any; + initialColumn?: number; + nHeight?: number; + nIndexLeftmost?: number; + nItemHeight?: number; + nItemMarginX?: number; + nNumItems?: number; + name?: string; + scrollToAlignment?: 'center'; +} + +export const Carousel = findModuleChild((m) => { + if (typeof m !== 'object') return undefined; + for (let prop in m) { + if (m[prop]?.render?.toString().includes("setFocusedColumn:")) + return m[prop]; + } +}) as VFC>; \ No newline at end of file diff --git a/src/deck-components/index.ts b/src/deck-components/index.ts index 9bbe83e..df06f99 100755 --- a/src/deck-components/index.ts +++ b/src/deck-components/index.ts @@ -1,5 +1,6 @@ export * from './Button'; export * from './ButtonItem'; +export * from './Carousel'; export * from './Dropdown'; export * from './Field'; export * from './Focusable';