From 4d9de02a5dd6770d1bce48e19dd5121ea799c533 Mon Sep 17 00:00:00 2001 From: Frederic Bahr Date: Wed, 22 Jan 2025 21:19:06 +0100 Subject: [PATCH] feat: add 'data' property to DriveStep for custom logic support Before it was not possible to pass custom data to the `DriveStep` interface. This limits the possiblities within a hook to execute custom logic based on the current step. Fixes #539 --- docs/src/content/guides/configuration.mdx | 3 +++ src/driver.ts | 1 + 2 files changed, 4 insertions(+) diff --git a/docs/src/content/guides/configuration.mdx b/docs/src/content/guides/configuration.mdx index ed56808..10e0834 100644 --- a/docs/src/content/guides/configuration.mdx +++ b/docs/src/content/guides/configuration.mdx @@ -258,6 +258,9 @@ type DriveStep = { // Whether to disable interaction with the highlighted element. (default: false) disableActiveInteraction?: boolean; + // Arbitrary data that you can pass to the step in order to support complex custom logic in hooks. + data?: Record; + // Callback when the current step is deselected, // about to be highlighted or highlighted. // Each callback receives the following parameters: diff --git a/src/driver.ts b/src/driver.ts index 6941dc4..af91ecf 100644 --- a/src/driver.ts +++ b/src/driver.ts @@ -20,6 +20,7 @@ export type DriveStep = { onDeselected?: DriverHook; popover?: Popover; disableActiveInteraction?: boolean; + data?: Record; }; export interface Driver {