-
Notifications
You must be signed in to change notification settings - Fork 589
Expand file tree
/
Copy pathcomponents.ts
More file actions
84 lines (78 loc) · 2.24 KB
/
components.ts
File metadata and controls
84 lines (78 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import type { MouseEventHandler } from 'react';
import type { Controls } from '~/types/state';
import type { Placement } from './common';
import type { StepMerged } from './step';
import type { Simplify } from './utilities';
/** Props passed to a custom arrow component. */
export type ArrowRenderProps = {
/** Width of the arrow base in pixels. */
base: number;
/** The computed placement of the tooltip. */
placement: Placement;
/** Height of the arrow in pixels. */
size: number;
};
/** Props passed to a custom beacon component.
* Must render a span since it's placed inside a `<button>` wrapper.
*/
export type BeaconRenderProps = {
/** Whether the tour is in continuous mode. */
continuous: boolean;
/** The current step index. */
index: number;
/** Whether this is the last step. */
isLastStep: boolean;
/** The total number of steps. */
size: number;
/** The current step data. */
step: StepMerged;
};
/** Props passed to a custom loader component. */
export type LoaderRenderProps = {
/** The current step data. */
step: StepMerged;
};
/** Props passed to a custom tooltip component. */
export type TooltipRenderProps = Simplify<
BeaconRenderProps & {
/** Props to spread on the back button. */
backProps: {
'aria-label': string;
'data-action': string;
onClick: MouseEventHandler<HTMLElement>;
role: string;
title: string;
};
/** Props to spread on the close button. */
closeProps: {
'aria-label': string;
'data-action': string;
onClick: MouseEventHandler<HTMLElement>;
role: string;
title: string;
};
/** Methods to programmatically control the tour. */
controls: Controls;
/** Props to spread on the next/last button. */
primaryProps: {
'aria-label': string;
'data-action': string;
onClick: MouseEventHandler<HTMLElement>;
role: string;
title: string;
};
/** Props to spread on the skip button. */
skipProps: {
'aria-label': string;
'data-action': string;
onClick: MouseEventHandler<HTMLElement>;
role: string;
title: string;
};
/** Props to spread on the tooltip container. */
tooltipProps: {
'aria-modal': boolean;
role: string;
};
}
>;