Skip to content

Commit

Permalink
Fix types and defaults
Browse files Browse the repository at this point in the history
- set Props "run" to be optional.
  • Loading branch information
gilbarbara committed Sep 9, 2024
1 parent e813ebd commit 568bafd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/components/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Joyride extends React.Component<Props, State> {
constructor(props: Props) {
super(props);

const { debug, getHelpers, run, stepIndex } = props;
const { debug, getHelpers, run = true, stepIndex } = props;

this.store = createStore({
...props,
Expand Down
8 changes: 4 additions & 4 deletions src/defaults.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down Expand Up @@ -43,7 +43,7 @@ export const defaultStep = {
showSkipButton: false,
spotlightClicks: false,
spotlightPadding: 10,
};
} satisfies Omit<Step, 'content' | 'target'>;

export const defaultProps = {
continuous: false,
Expand All @@ -64,4 +64,4 @@ export const defaultProps = {
spotlightClicks: false,
spotlightPadding: 10,
steps: [],
};
} satisfies Props;
4 changes: 3 additions & 1 deletion src/types/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -378,3 +378,5 @@ export type TooltipRenderProps = Simplify<
};
}
>;

export type { Props as FloaterProps } from 'react-floater';

0 comments on commit 568bafd

Please sign in to comment.