diff --git a/src/deck-components/DialogCheckbox.tsx b/src/deck-components/DialogCheckbox.tsx new file mode 100644 index 0000000..b16068d --- /dev/null +++ b/src/deck-components/DialogCheckbox.tsx @@ -0,0 +1,33 @@ +import { FC, ReactNode } from 'react'; + +import { findModule } from '../webpack'; +import { DialogCommonProps } from './Dialog'; +import { FooterLegendProps } from './FooterLegend'; + +export interface DialogCheckboxProps extends DialogCommonProps, FooterLegendProps { + onChange?(checked: boolean): void; + label?: ReactNode; + description?: ReactNode; + disabled?: boolean; + tooltip?: string; + color?: string; + highlightColor?: string; + bottomSeparator?: 'standard' | 'thick' | 'none'; + controlled?: boolean; + checked?: boolean; + onClick?(evt: Event): void; +} + +export const DialogCheckbox = Object.values(findModule((m: any) => { + if (typeof m !== 'object') return false; + for (const prop in m) { + if (m[prop]?.prototype?.GetPanelElementProps) return true; + } + return false; +})).find((m: any) => + m.contextType && + m.prototype?.render.toString().includes('fallback:') && + m?.prototype?.SetChecked && + m?.prototype?.Toggle && + m?.prototype?.GetPanelElementProps +) as FC; diff --git a/src/deck-components/index.ts b/src/deck-components/index.ts index 3bb96c3..d235e0f 100755 --- a/src/deck-components/index.ts +++ b/src/deck-components/index.ts @@ -3,6 +3,7 @@ export * from './ButtonItem'; export * from './Carousel'; export * from './ControlsList'; export * from './Dialog'; +export * from './DialogCheckbox'; export * from './Dropdown'; export * from './Field'; export * from './Focusable';