@numidev/react-joyride 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +93 -0
  3. package/dist/index.cjs +2677 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.cts +753 -0
  6. package/dist/index.d.mts +753 -0
  7. package/dist/index.mjs +2638 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +158 -0
  10. package/src/components/Arrow.tsx +138 -0
  11. package/src/components/Beacon.tsx +141 -0
  12. package/src/components/Floater.tsx +381 -0
  13. package/src/components/Loader.tsx +80 -0
  14. package/src/components/Overlay.tsx +167 -0
  15. package/src/components/Portal.tsx +17 -0
  16. package/src/components/Step.tsx +72 -0
  17. package/src/components/Tooltip/CloseButton.tsx +29 -0
  18. package/src/components/Tooltip/DefaultTooltip.tsx +82 -0
  19. package/src/components/Tooltip/index.tsx +163 -0
  20. package/src/components/TourRenderer.tsx +157 -0
  21. package/src/defaults.ts +64 -0
  22. package/src/global.d.ts +8 -0
  23. package/src/hooks/useControls.ts +219 -0
  24. package/src/hooks/useDebugLogger.ts +58 -0
  25. package/src/hooks/useEventEmitter.ts +55 -0
  26. package/src/hooks/useFocusTrap.ts +72 -0
  27. package/src/hooks/useJoyride.tsx +32 -0
  28. package/src/hooks/useLifecycleEffect.ts +512 -0
  29. package/src/hooks/usePortalElement.ts +49 -0
  30. package/src/hooks/usePropSync.ts +84 -0
  31. package/src/hooks/useScrollEffect.ts +217 -0
  32. package/src/hooks/useTargetPosition.ts +154 -0
  33. package/src/hooks/useTourEngine.ts +106 -0
  34. package/src/index.tsx +23 -0
  35. package/src/literals/index.ts +61 -0
  36. package/src/modules/changes.ts +20 -0
  37. package/src/modules/dom.ts +359 -0
  38. package/src/modules/helpers.tsx +230 -0
  39. package/src/modules/step.ts +156 -0
  40. package/src/modules/store.ts +215 -0
  41. package/src/modules/svg.ts +40 -0
  42. package/src/styles.ts +183 -0
  43. package/src/types/common.ts +315 -0
  44. package/src/types/components.ts +84 -0
  45. package/src/types/events.ts +89 -0
  46. package/src/types/floating.ts +60 -0
  47. package/src/types/index.ts +8 -0
  48. package/src/types/props.ts +124 -0
  49. package/src/types/state.ts +49 -0
  50. package/src/types/step.ts +108 -0
  51. package/src/types/utilities.ts +26 -0
@@ -0,0 +1,753 @@
1
+ 'use client';
2
+ import * as _$react_jsx_runtime0 from "react/jsx-runtime";
3
+ import { CSSProperties, ElementType, MouseEventHandler, ReactElement, ReactNode, RefObject, SVGAttributes } from "react";
4
+ import { AutoUpdateOptions, FlipOptions, Middleware, MiddlewareData, ShiftOptions, Strategy } from "@floating-ui/react-dom";
5
+
6
+ //#region src/literals/index.d.ts
7
+ declare const ACTIONS: {
8
+ readonly INIT: "init";
9
+ readonly START: "start";
10
+ readonly STOP: "stop";
11
+ readonly RESET: "reset";
12
+ readonly PREV: "prev";
13
+ readonly NEXT: "next";
14
+ readonly GO: "go";
15
+ readonly CLOSE: "close";
16
+ readonly SKIP: "skip";
17
+ readonly REPLAY: "replay";
18
+ readonly UPDATE: "update";
19
+ readonly COMPLETE: "complete";
20
+ };
21
+ declare const EVENTS: {
22
+ readonly TOUR_START: "tour:start";
23
+ readonly STEP_BEFORE_HOOK: "step:before_hook";
24
+ readonly STEP_BEFORE: "step:before";
25
+ readonly SCROLL_START: "scroll:start";
26
+ readonly SCROLL_END: "scroll:end";
27
+ readonly BEACON: "beacon";
28
+ readonly TOOLTIP: "tooltip";
29
+ readonly STEP_AFTER: "step:after";
30
+ readonly STEP_AFTER_HOOK: "step:after_hook";
31
+ readonly TOUR_END: "tour:end";
32
+ readonly TOUR_STATUS: "tour:status";
33
+ readonly TARGET_NOT_FOUND: "error:target_not_found";
34
+ readonly ERROR: "error";
35
+ };
36
+ declare const LIFECYCLE: {
37
+ readonly INIT: "init";
38
+ readonly READY: "ready";
39
+ readonly BEACON_BEFORE: "beacon_before";
40
+ readonly BEACON: "beacon";
41
+ readonly TOOLTIP_BEFORE: "tooltip_before";
42
+ readonly TOOLTIP: "tooltip";
43
+ readonly COMPLETE: "complete";
44
+ };
45
+ declare const ORIGIN: {
46
+ readonly BUTTON_BACK: "button_back";
47
+ readonly BUTTON_CLOSE: "button_close";
48
+ readonly BUTTON_PRIMARY: "button_primary";
49
+ readonly BUTTON_SKIP: "button_skip";
50
+ readonly KEYBOARD: "keyboard";
51
+ readonly OVERLAY: "overlay";
52
+ };
53
+ declare const STATUS: {
54
+ readonly IDLE: "idle";
55
+ readonly READY: "ready";
56
+ readonly WAITING: "waiting";
57
+ readonly RUNNING: "running";
58
+ readonly PAUSED: "paused";
59
+ readonly SKIPPED: "skipped";
60
+ readonly FINISHED: "finished";
61
+ };
62
+ declare const PORTAL_ELEMENT_ID = "react-joyride-portal";
63
+ //#endregion
64
+ //#region src/types/state.d.ts
65
+ /** Methods to programmatically control the tour. */
66
+ type Controls = {
67
+ /** Close the current step and advance to the next one. */close: (origin?: Origin | null) => void; /** Jump to a specific step by index. */
68
+ go: (nextIndex: number) => void; /** Get the current tour state. */
69
+ info: () => State; /** Advance to the next step. */
70
+ next: (origin?: Origin | null) => void; /** Open the tooltip for the current step. */
71
+ open: () => void; /** Go back to the previous step. */
72
+ prev: (origin?: Origin | null) => void; /** Replay the current step. Re-runs `before` and `after` hooks and re-emits step lifecycle events. */
73
+ replay: (origin?: Origin | null) => void; /** Reset the tour. Optionally restart from the beginning. */
74
+ reset: (restart?: boolean) => void; /** Skip the tour entirely. */
75
+ skip: (origin?: Extract<Origin, 'button_close' | 'button_skip'> | null) => void; /** Start the tour at an optional step index. */
76
+ start: (nextIndex?: number) => void; /** Stop the tour. Optionally advance to the next step before stopping. */
77
+ stop: (advance?: boolean) => void;
78
+ };
79
+ /** The internal tour state. */
80
+ type State = {
81
+ /** The action that triggered the state update. */action: Actions; /** Whether the tour is in controlled mode (using `stepIndex`). */
82
+ controlled: boolean; /** The current step index. */
83
+ index: number; /** The step's rendering phase. */
84
+ lifecycle: Lifecycle; /** The UI element that triggered the last action. */
85
+ origin: Origin | null; /** Whether the tour is scrolling to a target. */
86
+ scrolling: boolean; /** The total number of steps. */
87
+ size: number; /** The tour's current status. */
88
+ status: Status; /** Whether the tour is blocked waiting for a `before` hook or target to appear. */
89
+ waiting: boolean;
90
+ };
91
+ //#endregion
92
+ //#region src/types/utilities.d.ts
93
+ /** Generic record type. */
94
+ type AnyObject<T = any> = Record<string, T>;
95
+ /** Excludes arrays, functions, Map, and Set from a record type. */
96
+ type NarrowPlainObject<T extends Record<string, any>> = Exclude<T, Array<unknown> | Function | Map<unknown, unknown> | Set<unknown>>;
97
+ /** Makes all properties optional, with one level of depth for nested objects. */
98
+ type PartialDeep<T> = { [K in keyof T]?: T[K] extends object ? Partial<T[K]> : T[K] };
99
+ /** Generic record type with unknown values. */
100
+ type PlainObject<T = unknown> = Record<string, T>;
101
+ /** Makes specific keys required while keeping others unchanged. */
102
+ type SetRequired<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>;
103
+ /** Flattens intersection types for better IDE display. */
104
+ type Simplify<T> = { [K in keyof T]: T[K] } & {};
105
+ /** Extracts a union of all values from an object type. */
106
+ type ValueOf<T> = T[keyof T];
107
+ //#endregion
108
+ //#region src/types/components.d.ts
109
+ /** Props passed to a custom arrow component. */
110
+ type ArrowRenderProps = {
111
+ /** Width of the arrow base in pixels. */base: number; /** The computed placement of the tooltip. */
112
+ placement: Placement; /** Height of the arrow in pixels. */
113
+ size: number;
114
+ };
115
+ /** Props passed to a custom beacon component.
116
+ * Must render a span since it's placed inside a `<button>` wrapper.
117
+ */
118
+ type BeaconRenderProps = {
119
+ /** Whether the tour is in continuous mode. */continuous: boolean; /** The current step index. */
120
+ index: number; /** Whether this is the last step. */
121
+ isLastStep: boolean; /** The total number of steps. */
122
+ size: number; /** The current step data. */
123
+ step: StepMerged;
124
+ };
125
+ /** Props passed to a custom loader component. */
126
+ type LoaderRenderProps = {
127
+ /** The current step data. */step: StepMerged;
128
+ };
129
+ /** Props passed to a custom tooltip component. */
130
+ type TooltipRenderProps = Simplify<BeaconRenderProps & {
131
+ /** Props to spread on the back button. */backProps: {
132
+ 'aria-label': string;
133
+ 'data-action': string;
134
+ onClick: MouseEventHandler<HTMLElement>;
135
+ role: string;
136
+ title: string;
137
+ }; /** Props to spread on the close button. */
138
+ closeProps: {
139
+ 'aria-label': string;
140
+ 'data-action': string;
141
+ onClick: MouseEventHandler<HTMLElement>;
142
+ role: string;
143
+ title: string;
144
+ }; /** Methods to programmatically control the tour. */
145
+ controls: Controls; /** Props to spread on the next/last button. */
146
+ primaryProps: {
147
+ 'aria-label': string;
148
+ 'data-action': string;
149
+ onClick: MouseEventHandler<HTMLElement>;
150
+ role: string;
151
+ title: string;
152
+ }; /** Props to spread on the skip button. */
153
+ skipProps: {
154
+ 'aria-label': string;
155
+ 'data-action': string;
156
+ onClick: MouseEventHandler<HTMLElement>;
157
+ role: string;
158
+ title: string;
159
+ }; /** Props to spread on the tooltip container. */
160
+ tooltipProps: {
161
+ 'aria-modal': boolean;
162
+ role: string;
163
+ };
164
+ }>;
165
+ //#endregion
166
+ //#region src/types/floating.d.ts
167
+ /** Tooltip and beacon positioning configuration using Floating UI. */
168
+ interface FloatingOptions {
169
+ /**
170
+ * Options passed to autoUpdate (ancestorScroll, elementResize, animationFrame, etc).
171
+ */
172
+ autoUpdate?: Partial<AutoUpdateOptions>;
173
+ /**
174
+ * Beacon positioning config.
175
+ */
176
+ beaconOptions?: {
177
+ offset?: number;
178
+ };
179
+ /**
180
+ * Options for the flip middleware, or `false` to disable flipping.
181
+ * Defaults: crossAxis false, padding 20, smart fallbackPlacements for left/right.
182
+ */
183
+ flipOptions?: Partial<FlipOptions> | false;
184
+ /**
185
+ * Hide the arrow element.
186
+ * Centered placement already hides the arrow.
187
+ *
188
+ * @default false
189
+ */
190
+ hideArrow?: boolean;
191
+ /**
192
+ * Additional Floating UI middleware appended to defaults (offset, flip/autoPlacement, shift, arrow).
193
+ */
194
+ middleware?: Array<Middleware>;
195
+ /**
196
+ * Called after each position calculation.
197
+ */
198
+ onPosition?: (data: PositionData) => void;
199
+ /**
200
+ * Options for the shift middleware.
201
+ * Default: padding 10.
202
+ */
203
+ shiftOptions?: Partial<ShiftOptions>;
204
+ /**
205
+ * Positioning strategy.
206
+ * Defaults to 'fixed' when step.isFixed is true, 'absolute' otherwise.
207
+ */
208
+ strategy?: Strategy;
209
+ }
210
+ /** Computed position data returned by Floating UI after each calculation. */
211
+ interface PositionData {
212
+ middlewareData: MiddlewareData;
213
+ placement: Placement;
214
+ x: number;
215
+ y: number;
216
+ }
217
+ //#endregion
218
+ //#region src/types/props.d.ts
219
+ type Props = Simplify<SharedProps & {
220
+ /**
221
+ * The tour is played sequentially with the Next button.
222
+ * @default false
223
+ */
224
+ continuous?: boolean;
225
+ /**
226
+ * Log Joyride's actions to the console.
227
+ * @default false
228
+ */
229
+ debug?: boolean;
230
+ /**
231
+ * The initial step index for uncontrolled tours.
232
+ * Ignored when stepIndex is set (controlled mode).
233
+ * @default 0
234
+ */
235
+ initialStepIndex?: number;
236
+ /**
237
+ * A nonce value for inline styles (Content Security Policy).
238
+ */
239
+ nonce?: string;
240
+ /**
241
+ * A function called when Joyride fires an event.
242
+ */
243
+ onEvent?: EventHandler;
244
+ /**
245
+ * Default options for all steps.
246
+ */
247
+ options?: Partial<Options>;
248
+ /**
249
+ * Render all Joyride components inside a specific element.
250
+ */
251
+ portalElement?: SelectorOrElement;
252
+ /**
253
+ * Run/stop the tour.
254
+ * @default false
255
+ */
256
+ run?: boolean;
257
+ /**
258
+ * Scroll the page for the first step.
259
+ * @default false
260
+ */
261
+ scrollToFirstStep?: boolean;
262
+ /**
263
+ * Setting a number here will turn Joyride into `controlled` mode.
264
+ * You'll have to keep an internal state by yourself and update it with the events in `onEvent`.
265
+ */
266
+ stepIndex?: number;
267
+ /**
268
+ * The tour's steps.
269
+ */
270
+ steps: Array<Step>;
271
+ }>;
272
+ /** Shared configuration inherited by both `Props` and `Step`. */
273
+ type SharedProps = {
274
+ /**
275
+ * Custom Arrow component.
276
+ */
277
+ arrowComponent?: ElementType<ArrowRenderProps>;
278
+ /**
279
+ * Custom Beacon component.
280
+ */
281
+ beaconComponent?: ElementType<BeaconRenderProps>;
282
+ /**
283
+ * Options for the floating tooltip positioning.
284
+ */
285
+ floatingOptions?: Partial<FloatingOptions>;
286
+ /**
287
+ * Custom Loader component. Set to `null` to disable.
288
+ */
289
+ loaderComponent?: ElementType<LoaderRenderProps> | null;
290
+ /**
291
+ * The strings used in the tooltip.
292
+ */
293
+ locale?: Locale;
294
+ /**
295
+ * Override the styling of the Tooltip.
296
+ */
297
+ styles?: PartialDeep<Styles>;
298
+ /**
299
+ * Custom Tooltip component.
300
+ */
301
+ tooltipComponent?: ElementType<TooltipRenderProps>;
302
+ };
303
+ /** Return value of the `useJoyride` hook. */
304
+ type UseJoyrideReturn = {
305
+ /** Methods to programmatically control the tour. */controls: Controls; /** Steps that failed during the current tour run (target not found, before hook errors). Clears on start/reset. */
306
+ failures: StepFailure[]; /** Subscribe to a specific event type. Returns an unsubscribe function. */
307
+ on: (eventType: Events, handler: EventHandler) => () => void; /** The current tour state. */
308
+ state: State; /** The current merged step, or null if no step is active. */
309
+ step: StepMerged | null; /** The tour React element to render. */
310
+ Tour: ReactElement | null;
311
+ };
312
+ /** A step that failed during the tour. */
313
+ interface StepFailure {
314
+ reason: FailureReason;
315
+ step: StepMerged;
316
+ }
317
+ //#endregion
318
+ //#region src/types/step.d.ts
319
+ /** A CSS selector string, an HTMLElement, or null. */
320
+ type SelectorOrElement = string | null | HTMLElement;
321
+ /** A single step in the tour, provided by the user. */
322
+ type Step = Simplify<SharedProps & Partial<Options> & {
323
+ /**
324
+ * The placement of the beacon. It will use the `placement` if nothing is passed.
325
+ */
326
+ beaconPlacement?: Placement;
327
+ /**
328
+ * The tooltip's body.
329
+ */
330
+ content: ReactNode;
331
+ /**
332
+ * Additional data you can add to the step.
333
+ */
334
+ data?: any;
335
+ /**
336
+ * A unique identifier for the step.
337
+ */
338
+ id?: string;
339
+ /**
340
+ * Force the step to be fixed.
341
+ * @default false
342
+ */
343
+ isFixed?: boolean;
344
+ /**
345
+ * The placement of the beacon and tooltip. It will re-position itself if there's no space available.
346
+ * @default bottom
347
+ */
348
+ placement?: Placement | 'auto' | 'center';
349
+ /**
350
+ * An optional element to scroll to instead of the target.
351
+ * The spotlight and tooltip will still use `target`.
352
+ */
353
+ scrollTarget?: StepTarget;
354
+ /**
355
+ * An optional element to highlight instead of the target.
356
+ * The tooltip will still anchor to `target`.
357
+ */
358
+ spotlightTarget?: StepTarget;
359
+ /**
360
+ * The target for the step.
361
+ * It can be a CSS selector, an HTMLElement, a React ref, or a function that returns an element.
362
+ */
363
+ target: StepTarget;
364
+ /**
365
+ * The tooltip's title.
366
+ */
367
+ title?: ReactNode;
368
+ }>;
369
+ /** A normalized step with all defaults applied. */
370
+ type StepMerged = Simplify<SetRequired<Step, 'arrowBase' | 'arrowColor' | 'arrowSize' | 'arrowSpacing' | 'backgroundColor' | 'beaconSize' | 'beaconTrigger' | 'beforeTimeout' | 'buttons' | 'closeButtonAction' | 'skipBeacon' | 'dismissKeyAction' | 'disableFocusTrap' | 'hideOverlay' | 'skipScroll' | 'blockTargetInteraction' | 'isFixed' | 'loaderDelay' | 'locale' | 'offset' | 'overlayClickAction' | 'overlayColor' | 'placement' | 'primaryColor' | 'scrollDuration' | 'scrollOffset' | 'showProgress' | 'spotlightRadius' | 'targetWaitTimeout' | 'textColor' | 'zIndex'> & {
371
+ spotlightPadding: Required<SpotlightPadding>;
372
+ styles: Styles;
373
+ }>;
374
+ type StepTarget = string | HTMLElement | RefObject<HTMLElement | null> | (() => HTMLElement | null);
375
+ //#endregion
376
+ //#region src/types/events.d.ts
377
+ /** The payload passed to the `onEvent` callback. Extends `TourData` with event-specific fields. */
378
+ type EventData = Simplify<TourData & {
379
+ /**
380
+ * The error that occurred (only populated for ERROR events).
381
+ */
382
+ error: Error | null;
383
+ /**
384
+ * Scroll data (only populated for SCROLL_START/SCROLL_END events).
385
+ */
386
+ scroll: ScrollData | null;
387
+ /**
388
+ * Whether the tour is currently scrolling to a target.
389
+ */
390
+ scrolling: boolean;
391
+ /**
392
+ * The type of the event.
393
+ */
394
+ type: Events;
395
+ /**
396
+ * Whether the tour is blocked waiting for a before hook or target to appear.
397
+ */
398
+ waiting: boolean;
399
+ }>;
400
+ /** Callback signature for the `onEvent` prop. */
401
+ type EventHandler = (data: EventData, controls: Controls) => void;
402
+ /** Scroll position details for `scroll:start` and `scroll:end` events. */
403
+ type ScrollData = {
404
+ /**
405
+ * The scroll duration in milliseconds.
406
+ */
407
+ duration: number;
408
+ /**
409
+ * The element being scrolled.
410
+ */
411
+ element: Element;
412
+ /**
413
+ * The scroll position before scrolling.
414
+ */
415
+ initial: number;
416
+ /**
417
+ * The computed scroll destination.
418
+ */
419
+ target: number;
420
+ };
421
+ /** Base event payload with tour state at the time of the event. */
422
+ interface TourData {
423
+ /**
424
+ * The action that triggered the state update.
425
+ */
426
+ action: Actions;
427
+ /**
428
+ * Whether the tour is in `controlled` mode (using the `stepIndex` prop).
429
+ */
430
+ controlled: boolean;
431
+ /**
432
+ * The current step's index.
433
+ */
434
+ index: number;
435
+ /**
436
+ * The step's rendering phase.
437
+ */
438
+ lifecycle: Lifecycle;
439
+ /**
440
+ * The UI element that triggered the action (if available).
441
+ */
442
+ origin: Origin | null;
443
+ /**
444
+ * The total number of steps.
445
+ */
446
+ size: number;
447
+ /**
448
+ * The tour's current status.
449
+ */
450
+ status: Status;
451
+ /**
452
+ * The current step's data.
453
+ */
454
+ step: StepMerged;
455
+ }
456
+ //#endregion
457
+ //#region src/types/common.d.ts
458
+ /** The action that triggered the state update. */
459
+ type Actions = ValueOf<typeof ACTIONS>;
460
+ /** A hook that runs after a step completes. Fire-and-forget. */
461
+ type AfterHook = (data: TourData) => void;
462
+ /** A hook that runs before a step is shown. The tour waits for the promise to resolve. */
463
+ type BeforeHook = (data: TourData) => Promise<void>;
464
+ /** The buttons to show in the tooltip. */
465
+ type ButtonType = 'back' | 'close' | 'primary' | 'skip';
466
+ /** The event type passed to the `onEvent` callback. */
467
+ type Events = ValueOf<typeof EVENTS>;
468
+ /** The reason a step failed during the tour. */
469
+ type FailureReason = 'before_hook' | 'target_not_found';
470
+ /** The rendering phase of the current step. */
471
+ type Lifecycle = ValueOf<typeof LIFECYCLE>;
472
+ /** The UI element that triggered the action. */
473
+ type Origin = ValueOf<typeof ORIGIN>;
474
+ /** Tooltip and beacon placement positions. */
475
+ type Placement = 'top' | 'top-start' | 'top-end' | 'bottom' | 'bottom-start' | 'bottom-end' | 'left' | 'left-start' | 'left-end' | 'right' | 'right-start' | 'right-end';
476
+ /** The current state of the tour. */
477
+ type Status = ValueOf<typeof STATUS>;
478
+ /** Tooltip button and navigation labels. */
479
+ interface Locale {
480
+ /**
481
+ * Label for the back button.
482
+ * @default 'Back'
483
+ */
484
+ back?: ReactNode;
485
+ /**
486
+ * Label for the close button.
487
+ * @default 'Close'
488
+ */
489
+ close?: ReactNode;
490
+ /**
491
+ * Label for the last button.
492
+ * @default 'Last'
493
+ */
494
+ last?: ReactNode;
495
+ /**
496
+ * Label for the next button.
497
+ * @default 'Next'
498
+ */
499
+ next?: ReactNode;
500
+ /**
501
+ * Label for the next button with `showProgress`.
502
+ * Use the `{current}` and `{total}` placeholders to display the current step and the total steps.
503
+ * @default 'Next ({current} of {total})'
504
+ */
505
+ nextWithProgress?: ReactNode;
506
+ /**
507
+ * Label for the open button.
508
+ * @default 'Open the dialog'
509
+ */
510
+ open?: ReactNode;
511
+ /**
512
+ * Label for the skip button.
513
+ * @default 'Skip'
514
+ */
515
+ skip?: ReactNode;
516
+ }
517
+ /** Step options for behavior, theming, and layout. Shared between Props and Step. */
518
+ interface Options {
519
+ /**
520
+ * A hook that runs after the step completes (user clicked next, prev, close, or skip).
521
+ * Fire-and-forget — does not block the tour.
522
+ */
523
+ after?: AfterHook;
524
+ /**
525
+ * Width of the arrow base edge in pixels.
526
+ * @default 32
527
+ */
528
+ arrowBase: number;
529
+ /**
530
+ * Arrow fill color.
531
+ * @default '#ffffff'
532
+ */
533
+ arrowColor: string;
534
+ /**
535
+ * Height/depth of the arrow (tip to base edge) in pixels.
536
+ * @default 16
537
+ */
538
+ arrowSize: number;
539
+ /**
540
+ * The distance between the arrow and the edge of the tooltip.
541
+ * @default 12
542
+ */
543
+ arrowSpacing: number;
544
+ /**
545
+ * Tooltip background color.
546
+ * @default '#ffffff'
547
+ */
548
+ backgroundColor: string;
549
+ /**
550
+ * Beacon diameter in pixels.
551
+ * @default 36
552
+ */
553
+ beaconSize: number;
554
+ /**
555
+ * The interaction that triggers the beacon to show the tooltip.
556
+ * @default 'click'
557
+ */
558
+ beaconTrigger: 'click' | 'hover';
559
+ /**
560
+ * A hook that runs before the step is shown.
561
+ * The tour waits for the returned promise to resolve and shows the loader while waiting (after `loaderDelay`).
562
+ * Max duration capped by `beforeTimeout`.
563
+ */
564
+ before?: BeforeHook;
565
+ /**
566
+ * Max time (ms) to wait for a `before` hook to resolve. 0 = no timeout.
567
+ * @default 5000
568
+ */
569
+ beforeTimeout: number;
570
+ /**
571
+ * Block pointer events on the highlighted element through the spotlight cutout.
572
+ * @default false
573
+ */
574
+ blockTargetInteraction: boolean;
575
+ /**
576
+ * The buttons to show in the tooltip.
577
+ * @default ['back', 'close', 'primary']
578
+ */
579
+ buttons: ButtonType[];
580
+ /**
581
+ * The action to take when the close button is clicked.
582
+ * - `'close'`: Advances to the next step (default behavior).
583
+ * - `'skip'`: Ends the tour entirely.
584
+ * - `'replay'`: Replays the current step.
585
+ * @default 'close'
586
+ */
587
+ closeButtonAction: 'close' | 'skip' | 'replay';
588
+ /**
589
+ * Disable the focus trap for the tooltip.
590
+ * @default false
591
+ */
592
+ disableFocusTrap: boolean;
593
+ /**
594
+ * The action to take when the ESC key is pressed.
595
+ * - `'close'`: Closes the step (shows beacon on next step in continuous mode).
596
+ * - `'next'`: Advances to the next step (skips beacon in continuous mode).
597
+ * - `'replay'`: Replays the current step.
598
+ * - `false`: Disables ESC key.
599
+ * @default 'close'
600
+ */
601
+ dismissKeyAction: 'close' | 'next' | 'replay' | false;
602
+ /**
603
+ * Don't show the overlay.
604
+ * @default false
605
+ */
606
+ hideOverlay: boolean;
607
+ /**
608
+ * Delay (ms) before showing the loader while the tour is waiting.
609
+ * @default 300
610
+ */
611
+ loaderDelay: number;
612
+ /**
613
+ * The distance in pixels between the tooltip and the spotlight.
614
+ * @default 10
615
+ */
616
+ offset: number;
617
+ /**
618
+ * The action to take when the overlay is clicked.
619
+ * - `'close'`: Closes the step (fires a CLOSE action).
620
+ * - `'next'`: Advances to the next step (ends the tour on the last step).
621
+ * - `'replay'`: Replays the current step.
622
+ * - `false`: Disables overlay click.
623
+ * @default 'close'
624
+ */
625
+ overlayClickAction: 'close' | 'next' | 'replay' | false;
626
+ /**
627
+ * Overlay backdrop color.
628
+ * @default '#00000080'
629
+ */
630
+ overlayColor: string;
631
+ /**
632
+ * Primary button and beacon color.
633
+ * @default '#000000'
634
+ */
635
+ primaryColor: string;
636
+ /**
637
+ * The scroll animation duration in milliseconds.
638
+ * @default 300
639
+ */
640
+ scrollDuration: number;
641
+ /**
642
+ * The scroll distance from the element scrollTop value.
643
+ * @default 20
644
+ */
645
+ scrollOffset: number;
646
+ /**
647
+ * Show the progress (1 of 5) in the tooltip.
648
+ * @default false
649
+ */
650
+ showProgress: boolean;
651
+ /**
652
+ * Don't show the Beacon before the tooltip.
653
+ * @default false
654
+ */
655
+ skipBeacon: boolean;
656
+ /**
657
+ * Skip scrolling to the target.
658
+ * @default false
659
+ */
660
+ skipScroll: boolean;
661
+ /**
662
+ * The padding of the spotlight.
663
+ * Accepts a number for equal padding on all sides, or an object with `top`, `right`, `bottom`, `left`.
664
+ * @default 10
665
+ */
666
+ spotlightPadding: number | SpotlightPadding;
667
+ /**
668
+ * The border radius of the spotlight cutout in pixels.
669
+ * @default 4
670
+ */
671
+ spotlightRadius: number;
672
+ /**
673
+ * Max time (ms) to wait for the target to appear. 0 = no waiting.
674
+ * @default 1000
675
+ */
676
+ targetWaitTimeout: number;
677
+ /**
678
+ * Tooltip text color.
679
+ * @default '#000000'
680
+ */
681
+ textColor: string;
682
+ /**
683
+ * Tooltip width in pixels or CSS string.
684
+ * @default 380
685
+ */
686
+ width?: string | number;
687
+ /**
688
+ * z-index for the overlay and tooltip.
689
+ * @default 100
690
+ */
691
+ zIndex: number;
692
+ }
693
+ /** Padding around the spotlight cutout in pixels. */
694
+ interface SpotlightPadding {
695
+ bottom?: number;
696
+ left?: number;
697
+ right?: number;
698
+ top?: number;
699
+ }
700
+ /** CSS styles for all Joyride UI elements. */
701
+ interface Styles {
702
+ /** Arrow element styles. */
703
+ arrow: CSSProperties;
704
+ /** Beacon visual styles (size, border-radius). Applied to the default beacon content. */
705
+ beacon: CSSProperties;
706
+ /** Beacon inner pulse element styles. */
707
+ beaconInner: CSSProperties;
708
+ /** Beacon outer ring element styles. */
709
+ beaconOuter: CSSProperties;
710
+ /** Beacon wrapper button styles (interaction, layout). */
711
+ beaconWrapper: CSSProperties;
712
+ /** Back button styles. */
713
+ buttonBack: CSSProperties;
714
+ /** Close button styles. */
715
+ buttonClose: CSSProperties;
716
+ /** Next/Last button styles. */
717
+ buttonPrimary: CSSProperties;
718
+ /** Skip button styles. */
719
+ buttonSkip: CSSProperties;
720
+ /** Floating container styles. */
721
+ floater: CSSProperties;
722
+ /** Loader wrapper styles. */
723
+ loader: CSSProperties;
724
+ /** Overlay backdrop styles. */
725
+ overlay: CSSProperties;
726
+ /** Spotlight styles (SVG Path). */
727
+ spotlight: SVGAttributes<SVGPathElement>;
728
+ /** Tooltip wrapper styles. */
729
+ tooltip: CSSProperties;
730
+ /** Tooltip inner container styles. */
731
+ tooltipContainer: CSSProperties;
732
+ /** Tooltip body content styles. */
733
+ tooltipContent: CSSProperties;
734
+ /** Tooltip footer styles. */
735
+ tooltipFooter: CSSProperties;
736
+ /** Tooltip footer spacer styles. */
737
+ tooltipFooterSpacer: CSSProperties;
738
+ /** Tooltip title styles. */
739
+ tooltipTitle: CSSProperties;
740
+ }
741
+ //#endregion
742
+ //#region src/defaults.d.ts
743
+ declare const defaultOptions: Required<Omit<Options, 'after' | 'before'>>;
744
+ declare const defaultLocale: Locale;
745
+ //#endregion
746
+ //#region src/hooks/useJoyride.d.ts
747
+ declare function useJoyride(props: Props): UseJoyrideReturn;
748
+ //#endregion
749
+ //#region src/index.d.ts
750
+ declare function Joyride(props: Props): _$react_jsx_runtime0.JSX.Element | null;
751
+ //#endregion
752
+ export { ACTIONS, Actions, AfterHook, AnyObject, ArrowRenderProps, BeaconRenderProps, BeforeHook, ButtonType, Controls, EVENTS, EventData, EventHandler, Events, FailureReason, FloatingOptions, Joyride, LIFECYCLE, Lifecycle, LoaderRenderProps, Locale, NarrowPlainObject, ORIGIN, Options, Origin, PORTAL_ELEMENT_ID, PartialDeep, Placement, PlainObject, PositionData, Props, STATUS, ScrollData, SelectorOrElement, SetRequired, SharedProps, Simplify, SpotlightPadding, State, Status, Step, StepFailure, StepMerged, StepTarget, Styles, TooltipRenderProps, TourData, UseJoyrideReturn, ValueOf, defaultLocale, defaultOptions, useJoyride };
753
+ //# sourceMappingURL=index.d.cts.map