2022-05-10 23:38:10 +02:00
|
|
|
import { FC } from 'react';
|
|
|
|
|
|
|
|
|
|
import { CommonUIModule } from '../webpack';
|
|
|
|
|
|
|
|
|
|
interface ButtonProps {
|
2022-05-25 20:26:30 -04:00
|
|
|
className?: string;
|
|
|
|
|
noFocusRing?: boolean;
|
2022-05-10 23:38:10 +02:00
|
|
|
disabled?: boolean;
|
2022-05-25 20:26:30 -04:00
|
|
|
onClick?(e: MouseEvent): void;
|
|
|
|
|
onPointerDown?(e: PointerEvent): void;
|
|
|
|
|
onPointerUp?(e: PointerEvent): void;
|
|
|
|
|
onPointerCancel?(e: PointerEvent): void;
|
|
|
|
|
onMouseDown?(e: PointerEvent): void;
|
|
|
|
|
onMouseUp?(e: MouseEvent): void;
|
|
|
|
|
onTouchStart?(e: TouchEvent): void;
|
|
|
|
|
onTouchEnd?(e: TouchEvent): void;
|
|
|
|
|
onTouchCancel?(e: TouchEvent): void;
|
|
|
|
|
onSubmit?(e: SubmitEvent): void;
|
2022-05-10 23:38:10 +02:00
|
|
|
}
|
|
|
|
|
|
2022-05-26 13:28:35 +02:00
|
|
|
export const DialogButton = Object.values(CommonUIModule).find(
|
2022-05-26 10:15:32 +02:00
|
|
|
(mod: any) =>
|
|
|
|
|
mod?.render?.toString()?.includes('Object.assign({type:"button"') &&
|
|
|
|
|
mod?.render?.toString()?.includes('DialogButton'),
|
2022-05-25 20:26:30 -04:00
|
|
|
) as any;
|
|
|
|
|
|
|
|
|
|
// Button isn't exported, so call DialogButton to grab it
|
|
|
|
|
|
2022-05-26 10:15:32 +02:00
|
|
|
export const Button = DialogButton!.render({}).type as FC<ButtonProps>; // its actually a forwarded ref but that doesn't really matter in usage
|