forked from SteamDeckHomebrew/decky-frontend-lib
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8794ef
commit a99fb4a
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { ReactNode, VFC } from 'react'; | ||
|
||
import { CommonUIModule } from '../webpack'; | ||
|
||
export interface SingleDropdownOption { | ||
data: number; | ||
label: string; | ||
|
||
options?: never; | ||
} | ||
|
||
export interface MultiDropdownOption { | ||
label: string; | ||
options: DropdownOption[]; | ||
|
||
data?: never; | ||
} | ||
|
||
export type DropdownOption = SingleDropdownOption | MultiDropdownOption; | ||
|
||
export interface DropdownProps { | ||
rgOptions: DropdownOption[]; | ||
selectedOption: number | null; | ||
disabled?: boolean; | ||
onMenuWillOpen?(showMenu: () => void): void; | ||
onMenuOpened?(): void; | ||
onChange?(data: SingleDropdownOption): void; | ||
contextMenuPositionOptions?: any; | ||
menuLabel?: string; | ||
strDefaultLabel?: string; | ||
renderButtonValue?(element: ReactNode): ReactNode; | ||
focusable?: boolean; | ||
} | ||
|
||
export const Dropdown = Object.values(CommonUIModule).find( | ||
(mod: any) => mod?.prototype?.SetSelectedOption && mod?.prototype?.BuildMenu, | ||
) as VFC<DropdownProps>; | ||
|
||
export interface DropdownItemProps extends DropdownProps { | ||
label?: string; | ||
tooltip?: string; | ||
description?: string; | ||
layout?: 'below'; | ||
bottomSeparator?: boolean; | ||
indentLevel?: number; | ||
} | ||
|
||
export const DropdownItem = Object.values(CommonUIModule).find((mod: any) => | ||
mod?.toString()?.includes('"dropDownControlRef","description"'), | ||
) as VFC<DropdownItemProps>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters