import type React from 'react'; /** * Placement for the tour step arrow. Matches the placement values used by positioning libraries * (e.g. @floating-ui) so web/mobile can pass through their placement directly. */ export type TourStepArrowPlacement = | 'top' | 'top-start' | 'top-end' | 'right' | 'right-start' | 'right-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end'; /** * Arrow coordinates and offsets for the tour step arrow. Matches the shape provided by arrow * middleware (e.g. @floating-ui) so web/mobile can pass through their arrow data directly. */ export type TourStepArrowData = { x?: number; y?: number; centerOffset?: number; alignmentOffset?: number; }; /** * @deprecated Import from `@coinbase/cds-web` or `@coinbase/cds-mobile` instead. This will be removed in a future major release. * @deprecationExpectedRemoval v10 */ export type TourStepArrowComponentProps = { /** Arrow coordinates and offsets for positioning the arrow element. */ arrow?: TourStepArrowData; /** Placement of the arrow relative to the floating element. */ placement: TourStepArrowPlacement; style?: Record; }; /** * The TourStepArrowComponent forwards a ref to the underlying element. * This is required for the positioning library to work correctly. * @deprecated Import from `@coinbase/cds-web` or `@coinbase/cds-mobile` instead. This will be removed in a future major release. * @deprecationExpectedRemoval v10 */ export type TourStepArrowComponent = React.ForwardRefExoticComponent< TourStepArrowComponentProps & { ref?: React.Ref; } >; export type TourStepComponent = React.FC>; export type TourScrollOptions = { behavior?: ScrollBehavior; marginX?: number; marginY?: number; }; export type TourStepValue = { /** * The tour step id. */ id: TourStepId; /** * The Component to render for this tour step. */ Component: TourStepComponent; /** * The TourStepArrowComponent to render for this tour step. */ ArrowComponent?: TourStepArrowComponent; /** * Disabling the tour step causes it to be skipped when calling `goNextTourStep()` or `goPreviousTourStep()`. */ disabled?: boolean; /** * Hides the overlay when the tour is active. */ hideOverlay?: boolean; /** * Callback function fired as this step becomes active. This step's `onActive` will fire simultaneously with the previously active step's `onInactive`. */ onActive?: () => void | Promise; /** * Callback function fired right before this step becomes active. This step's `onBeforeActive` will fire simultaneously with the previously active step's `onBeforeInactive`. */ onBeforeActive?: () => void | Promise; /** * Callback function fired as this step becomes inactive. This step's `onInactive` will fire simultaneously with the new active step's `onActive`. */ onInactive?: () => void | Promise; /** * Callback function fired right before this step becomes inactive. This step's `onBeforeInactive` will fire simultaneously with the new active step's `onBeforeActive`. */ onBeforeInactive?: () => void | Promise; /** * Padding to add around the edges of the TourMask's content mask. */ tourMaskPadding?: string | number; /** * Corner radius for the TourMask's content mask. Uses SVG rect element's `rx` and `ry` attributes https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/rx. */ tourMaskBorderRadius?: string | number; /** * Add styles to the TourStepArrowComponent for this tour step. Use `styles.arrow` instead. * @deprecated Use Tour's `styles.stepArrow` prop instead. This will be removed in a future major release. * @deprecationExpectedRemoval v10 */ arrowStyle?: Record; /** * Web only. Disables automatically scrolling to this TourStep when it becomes active. */ disableAutoScroll?: boolean; /** * Web only. Controls the scrolling behavior and margins when calling element.scrollTo() to scroll to an active TourStep target. */ scrollOptions?: TourScrollOptions; }; export type TourOptions = { steps: TourStepValue[]; activeTourStep: TourStepValue | null; onChange: (tourStep: TourStepValue | null) => void; }; /** * API returned by useTour and provided via TourContext. * @template TourStepId - Step id string literal type. * @template TTarget - Type of the active step's target element (e.g. HTMLElement for web, View for react-native). Defaults to unknown. */ export type TourApi = Omit< TourOptions, 'onChange' > & { /** The target element of the currently active tour step. */ activeTourStepTarget: TTarget | null; /** Set the target element of the currently active tour step. */ setActiveTourStepTarget: (target: TTarget | null) => void; setActiveTourStep: (tourStepId: TourStepId | null) => void; startTour: (tourStepId?: TourStepId) => void; stopTour: () => void; goNextTourStep: () => void; goPreviousTourStep: () => void; }; /** * A controlled hook for managing tour state, such as the currently active tour step. * @see {@link https://linear.app/coinbase/issue/CDS-1878 CDS-1878} for planned refactor to make this API platform agnostic. */ export declare const useTour: ({ steps, activeTourStep, onChange, }: TourOptions) => TourApi; //# sourceMappingURL=useTour.d.ts.map