@payfit/unity-components
Version:
23 lines (22 loc) • 1.16 kB
TypeScript
import { UnityIcon } from '@payfit/unity-icons';
import { PropsWithChildren } from 'react';
import { ButtonProps } from '../../../button/Button.js';
type ButtonVariant = 'close' | 'confirm' | 'danger';
type OnPressParameters = Parameters<NonNullable<ButtonProps['onPress']>>[0];
export type DialogButtonProps<T extends ButtonVariant> = Omit<ButtonProps, 'variant' | 'color'> & {
/** the different variants for the button */
variant: T;
/** the icon, it is a discouraged practice, except for `danger` variant which has a `WarningCircleOutlined` as default */
icon?: UnityIcon;
isLoading?: T extends 'close' ? never : ButtonProps['isLoading'];
onPress?: T extends 'close' ? ButtonProps['onPress'] : ButtonProps['onPress'] | ((e: OnPressParameters) => Promise<OnPressParameters>);
};
/**
* A `DialogButton` is a button which has to be included into `DialogActions` container
*
*/
declare const DialogButton: {
<T extends ButtonVariant>({ children, variant, onPress, isLoading, icon, ...props }: PropsWithChildren<DialogButtonProps<T>>): import("react/jsx-runtime").JSX.Element;
displayName: string;
};
export { DialogButton };