import RCTour from '@rc-component/tour'; import classNames from 'classnames'; import React, { useContext } from 'react'; import type { ConfigConsumerProps } from '../config-provider'; import { ConfigContext } from '../config-provider'; import theme from '../theme'; import getPlacements from '../_util/placements'; import type { TourProps, TourStepProps } from './interface'; import panelRender from './panelRender'; import PurePanel from './PurePanel'; import useStyle from './style'; const Tour: React.FC & { _InternalPanelDoNotUseOrYouWillBeFired: typeof PurePanel } = ( props, ) => { const { prefixCls: customizePrefixCls, steps, current, type, rootClassName, indicatorsRender, ...restProps } = props; const { getPrefixCls, direction } = useContext(ConfigContext); const prefixCls = getPrefixCls('tour', customizePrefixCls); const [wrapSSR, hashId] = useStyle(prefixCls); const { token } = theme.useToken(); const builtinPlacements = getPlacements({ arrowPointAtCenter: true, autoAdjustOverflow: true, offset: token.marginXXS, arrowWidth: token.sizePopupArrow, }); const customClassName = classNames( { [`${prefixCls}-rtl`]: direction === 'rtl', }, hashId, rootClassName, ); const mergedRenderPanel = (stepProps: TourStepProps, stepCurrent: number) => panelRender(stepProps, stepCurrent, type, indicatorsRender); return wrapSSR( , ); }; if (process.env.NODE_ENV !== 'production') { Tour.displayName = 'Tour'; } Tour._InternalPanelDoNotUseOrYouWillBeFired = PurePanel; export default Tour;