import { ReactNode } from 'react'; import type { Styles } from '@cleartrip/ct-design-types'; import type { IModalProps } from '@cleartrip/ct-design-modal'; /** * Legacy close-affordance config preserved from aldenui. Each flag * maps to a specific actionButton variant + alignment on the * underlying Modal: * - `isBack` → back arrow, aligned left * - `showCloseIcon`→ cross icon, aligned right * - `isCenter` → cross icon, centered * * TODO(deprecate): callers should set `actionButtonType` and * `actionButtonAlignment` on the inherited `IModalProps` surface * directly. The overlayCloseIcon shim is retained for API parity with * aldenui consumers and will be removed once downstream migrates. */ export type OverlayCloseIconProps = { show: boolean; isBack?: boolean; isCenter?: boolean; isTop?: boolean; showCloseIcon?: boolean; }; /** * `styleConfig` slots exposed by `Dialog`. These are forwarded onto * the Modal's own `styleConfig` — `root` lands on the outer modal * positioner, `modalWrapperStyles` on the inner content container. * `modalContentStyles` is accepted for aldenui parity but intentionally * mirrors `modalWrapperStyles` (both point at the same Modal slot). */ export interface IStyleConfigProps { /** * Styles applied to the modal's root slot (outer positioner). */ root?: Styles[]; /** * Styles applied to the modal's inner content slot. Alias for * `modalWrapperStyles` — retained for aldenui parity. */ modalContentStyles?: Styles[]; /** * Styles applied to the modal's inner content slot (padding / * width / background overrides). */ modalWrapperStyles?: Styles[]; } /** * Props for the `Dialog` component. Extends `IModalProps` directly so * every Modal-level control (variant, placement, blur, size, * actionButtonType, etc.) is available unchanged at the Dialog call * site. */ export interface IDialogProps extends IModalProps { /** * `styleConfig` slots for fine-grained style overrides forwarded to * the underlying Modal. */ styleConfig?: IStyleConfigProps; /** * Legacy close-icon configuration. See `OverlayCloseIconProps` for * how each flag maps onto Modal's `actionButton*` surface. */ overlayCloseIcon?: OverlayCloseIconProps; /** * Whether clicking the backdrop should invoke `onClose`. Defaults * to the Modal default when omitted. */ allowBackdropClose?: boolean; } /** * Props for `DialogContent`, the top slot inside a Dialog body that * renders the header icon, title, and supporting description. */ export interface IDialogContentProps { /** * Optional icon displayed above the title. Accepts any ReactNode so * callers can supply an SVG, Image, or a themed wrapper component. */ headIcon?: ReactNode; /** * Title rendered below `headIcon`. Required. */ title: ReactNode; /** * Optional supporting copy rendered beneath the title. */ description?: ReactNode; /** * `styleConfig` slot for the outer DialogContent wrapper. */ styleConfig?: { root?: Styles[]; }; } /** * Row vs. column flex layout for the DialogAction button group. * `row` is typically used for 2-action confirmations ("Cancel" / * "Confirm"); `column` stacks actions for the common 3+ vertical * list layout. */ import { DialogAlignmentTypes, DialogTypes } from './constants'; export type DialogAlignmentType = `${DialogAlignmentTypes}`; export type DialogType = `${DialogTypes}`; /** * A single entry in `DialogAction`'s `actionButtons` list. */ export interface IDialogAction { /** * Label rendered inside the action. Accepts any ReactNode so * callers can supply i18n-wrapped strings, icons, or composed * content. */ label: ReactNode; /** * Invoked when the action is pressed. Receives the raw DOM event * on web; the native implementation invokes it with no arguments. */ onClick: (e?: Event) => void; /** * Typography `color` variant applied to the label. Defaults to the * Typography default when omitted. */ type?: DialogType; /** * `styleConfig` slot for the per-button wrapper. */ styleConfig?: { root?: Styles[] }; } /** * Props for `DialogAction`, the bottom slot inside a Dialog that * renders the stacked or inline action buttons. */ export interface IDialogActionProps { /** * Flex direction for the action row. Defaults to `'column'` to * match the aldenui vertical stack. */ alignment?: DialogAlignmentType; /** * Ordered list of actions to render. Empty array is a no-op. */ actionButtons: IDialogAction[]; /** * `styleConfig` slot for the outer DialogAction wrapper. */ styleConfig?: { root?: Styles[]; }; } // --------------------------------------------------------------------- // Legacy aliases retained so existing type imports keep compiling while // downstream consumers migrate to the `I*Props` naming. // --------------------------------------------------------------------- /** @deprecated use `IDialogProps` */ export type DialogProps = IDialogProps; /** @deprecated use `IDialogContentProps` */ export type DialogContentProps = IDialogContentProps; /** @deprecated use `IDialogActionProps` */ export type DialogActionProps = IDialogActionProps; /** @deprecated use `IDialogAction` */ export type DialogAction = IDialogAction;