diff --git a/src/components/index.tsx b/src/components/index.tsx index a2ad264d..bdf93795 100644 --- a/src/components/index.tsx +++ b/src/components/index.tsx @@ -35,7 +35,7 @@ class Joyride extends React.Component { constructor(props: Props) { super(props); - const { debug, getHelpers, run, stepIndex } = props; + const { debug, getHelpers, run = true, stepIndex } = props; this.store = createStore({ ...props, diff --git a/src/defaults.ts b/src/defaults.ts index 9f250806..5dcac480 100644 --- a/src/defaults.ts +++ b/src/defaults.ts @@ -1,8 +1,8 @@ import { noop } from '~/modules/helpers'; -import { Locale } from '~/types'; +import { FloaterProps, Locale, Props, Step } from '~/types'; -export const defaultFloaterProps = { +export const defaultFloaterProps: FloaterProps = { options: { preventOverflow: { boundariesElement: 'scrollParent', @@ -43,7 +43,7 @@ export const defaultStep = { showSkipButton: false, spotlightClicks: false, spotlightPadding: 10, -}; +} satisfies Omit; export const defaultProps = { continuous: false, @@ -64,4 +64,4 @@ export const defaultProps = { spotlightClicks: false, spotlightPadding: 10, steps: [], -}; +} satisfies Props; diff --git a/src/types/components.ts b/src/types/components.ts index 497b6cbd..ae7ae0de 100644 --- a/src/types/components.ts +++ b/src/types/components.ts @@ -178,7 +178,7 @@ export type Props = Simplify< * Run/stop the tour. * @default true */ - run: boolean; + run?: boolean; /** * The duration for scroll to element. * @default 300 @@ -378,3 +378,5 @@ export type TooltipRenderProps = Simplify< }; } >; + +export type { Props as FloaterProps } from 'react-floater'; diff --git a/test/__fixtures__/test-utils.ts b/test/__fixtures__/test-utils.ts index 3412b6e6..df70e9eb 100644 --- a/test/__fixtures__/test-utils.ts +++ b/test/__fixtures__/test-utils.ts @@ -6,7 +6,6 @@ import { queryHelpers, render, RenderOptions, - screen, within, } from '@testing-library/react'; @@ -41,7 +40,7 @@ const allQueries = { ...customQueries, }; -const customScreen = { ...screen, ...within(document.body, allQueries) }; +const customScreen = within(document.body, allQueries); const customWithin = (element: HTMLElement) => within(element, allQueries); const customRender = (ui: ReactElement, options?: Omit) => render(ui, { queries: allQueries, ...options });