import { ExcludedProps } from "@vitality-ds/system"; import type { LucideIcon } from "lucide-react"; import { ButtonProps } from "../Button/types"; import { valueof } from "../helpers/logic/type-helpers"; type AllowedVariantKeys = "custom" | "transactional" | "passive" | "warning" | "destructive" | "acknowledgement"; type VariantOptionType = { titleIcon: boolean; forcedIcon: React.FunctionComponent | null; actionsAllowed: boolean; primaryActionVariant: valueof>; primaryActionText: string | boolean; secondaryActionsAllowed: boolean; cancelActionAllowed: boolean; headerCloseAllowed: boolean; }; export type VariantOptionsType = { [K in AllowedVariantKeys]: VariantOptionType; }; export type DialogActionButtonType = Omit & { label: string; }; export type HeaderPropsType = { /** * The title of the dialog */ title: string; /** * The subtitle of the dialog, space provided will collapse if not provided */ subtitle?: string; /** * The icon shown to the left of the title. title and subtitle pushed against left padding if not provided. */ icon?: LucideIcon | React.FunctionComponent; /** * The function run when the close button is pressed. By passing this function to this prop the close button is rendered, otherwise the button is not rendered. */ closeButtonOnClick?: () => unknown; }; export type ContentPropsType = { /** * renders either the ReactNode passed or renders the string inside a vitality Typography component. */ content: JSX.Element; }; export type ActionsPropsType = { /** * Allows the control of the Primary button's `onClick` function and `label` */ primaryButtonProps: DialogActionButtonType; /** * Allows the control of the Secondary button's `onClick` function and `label` */ secondaryButtonProps?: DialogActionButtonType; /** * Allows the control of the Tertiary button's `onClick` function and `label` */ tertiaryButtonProps?: DialogActionButtonType; /** * Allows the control of the Cancel button's `onClick` function and `label` */ cancelButtonProps?: DialogActionButtonType; }; export type VariantType = { /** * */ variant?: AllowedVariantKeys; }; export type DialogProps = ExcludedProps & ContentPropsType & VariantType & { /** * Controls the maximum width the dialog content can fill. * @default "md" */ width?: "sm" | "md" | "lg"; /** * Controls the props associated with the header: `title`, `subtitle`, `closeButtonOnClick`, and `icon` */ headerProps: HeaderPropsType; /** * Controls the props associated with the actions: `primaryButtonProps`, `secondaryButtonProps`, `tertiaryButtonProps`, and `cancelButtonProps` */ actionsProps?: ActionsPropsType; }; export {};