import { BoxProps, ElementProps, Factory, MantineColor, StylesApiProps } from '../../core'; import { type PortalProps } from '../Portal'; import { type TransitionOverride } from '../Transition'; import { TourLabels } from './Tour.context'; import { TourBeacon, type TourBeaconProps } from './TourBeacon/TourBeacon'; import { TourBody, type TourBodyProps } from './TourBody/TourBody'; import { TourCloseButton, type TourCloseButtonProps } from './TourCloseButton/TourCloseButton'; import { TourNavigation, type TourNavigationProps } from './TourNavigation/TourNavigation'; import { TourOverlay, type TourOverlayProps } from './TourOverlay/TourOverlay'; import { TourRoot, type TourRootProps } from './TourRoot/TourRoot'; import { TourStep, type TourStepProps } from './TourStep/TourStep'; import { TourTitle, type TourTitleProps } from './TourTitle/TourTitle'; import { TourTooltip, type TourTooltipProps } from './TourTooltip/TourTooltip'; export type TourStylesNames = 'root' | 'overlay' | 'spotlight' | 'tooltip' | 'title' | 'body' | 'navigation' | 'closeButton' | 'stepCounter' | 'beacon' | 'beaconPulse' | 'navigationButton'; export type TourCssVariables = { root: '--tour-z-index' | '--tour-overlay-color' | '--tour-tooltip-radius' | '--tour-tooltip-shadow' | '--tour-beacon-size' | '--tour-beacon-color' | '--tour-color'; }; export interface TourProps extends BoxProps, StylesApiProps, ElementProps<'div'> { /** Whether the tour is active @default false */ active?: boolean; /** Called when the tour is closed */ onClose?: () => void; /** Controlled current step index */ step?: number; /** Uncontrolled default step index @default 0 */ defaultStep?: number; /** Called when step changes */ onStepChange?: (step: number) => void; /** Called when a step opens */ onStepOpen?: (step: number) => void; /** Called when a step closes */ onStepClose?: (step: number) => void; /** Tour mode @default "guided" */ mode?: 'guided' | 'beacon'; /** Whether to display the overlay @default true */ withOverlay?: boolean; /** Whether pointer events pass through the spotlight cutout to the target element, the rest of the overlay keeps blocking clicks @default false */ withOverlayInteraction?: boolean; /** Whether to display the close button @default true */ withCloseButton?: boolean; /** Whether keyboard navigation is enabled in guided mode @default true */ withKeyboardNavigation?: boolean; /** Whether to scroll target elements into view @default true */ withScrollIntoView?: boolean; /** Custom scroll handler */ scrollToHandler?: (element: HTMLElement) => void; /** Padding around the spotlight cutout in px @default 8 */ spotlightPadding?: number; /** Border radius of the spotlight cutout in px @default 4 */ spotlightRadius?: number; /** Whether pressing Escape closes the tour @default true */ closeOnEscape?: boolean; /** Whether clicking the overlay closes the tour, with `withOverlayInteraction` only clicks outside the spotlight cutout close it @default false */ closeOnOverlayClick?: boolean; /** Labels for tour UI elements */ labels?: Partial; /** Whether to render inside a portal @default true */ withinPortal?: boolean; /** Props passed to the Portal component */ portalProps?: Omit; /** z-index of the tour @default 10000 */ zIndex?: string | number; /** Transition props for the tooltip @default { duration: 200, transition: 'pop' } */ transitionProps?: TransitionOverride; /** Duration of the tooltip position transition between steps in ms @default 300 */ stepTransitionDuration?: number; /** Max width of the tooltip, tooltip always takes this width if viewport allows @default 360 */ maxWidth?: number; /** Tour step overlay color @default "rgba(0, 0, 0, 0.5)" */ overlayColor?: string; /** Key of `theme.colors` or any valid CSS color, controls beacon color and `Tour.Navigation` next button color @default theme.primaryColor */ color?: MantineColor; /** Key of `theme.shadows` or any valid CSS box-shadow value, controls the tooltip shadow @default 'md' */ tooltipShadow?: string; /** Tour steps – `Tour.Step` elements must be direct children (arrays are supported, Fragments and wrapper components are not) */ children?: React.ReactNode; } export type TourFactory = Factory<{ props: TourProps; ref: HTMLDivElement; stylesNames: TourStylesNames; vars: TourCssVariables; staticComponents: { Root: typeof TourRoot; Step: typeof TourStep; Overlay: typeof TourOverlay; Tooltip: typeof TourTooltip; Title: typeof TourTitle; Body: typeof TourBody; Navigation: typeof TourNavigation; Beacon: typeof TourBeacon; CloseButton: typeof TourCloseButton; }; }>; export declare const Tour: import("../..").MantineComponent<{ props: TourProps; ref: HTMLDivElement; stylesNames: TourStylesNames; vars: TourCssVariables; staticComponents: { Root: typeof TourRoot; Step: typeof TourStep; Overlay: typeof TourOverlay; Tooltip: typeof TourTooltip; Title: typeof TourTitle; Body: typeof TourBody; Navigation: typeof TourNavigation; Beacon: typeof TourBeacon; CloseButton: typeof TourCloseButton; }; }>; export declare namespace Tour { type Props = TourProps; type StylesNames = TourStylesNames; type CssVariables = TourCssVariables; type Factory = TourFactory; namespace Root { type Props = TourRootProps; } namespace Step { type Props = TourStepProps; } namespace Overlay { type Props = TourOverlayProps; } namespace Tooltip { type Props = TourTooltipProps; } namespace Title { type Props = TourTitleProps; } namespace Body { type Props = TourBodyProps; } namespace CloseButton { type Props = TourCloseButtonProps; } namespace Navigation { type Props = TourNavigationProps; } namespace Beacon { type Props = TourBeaconProps; } }