diff --git a/package.json b/package.json index 512afbca3..bbbf7b03d 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "@wagmi/connectors": "^5.1.10", "@wagmi/core": "^2.13.5", "bits-ui": "^0.21.16", + "driver.js": "^1.3.6", "estree-walker": "^3.0.3", "graphql": "^16.8.2", "indicatorts": "^2.2.2", @@ -109,6 +110,7 @@ "@wagmi/core": "^2.14.1", "autoprefixer": "^10.4.19", "bits-ui": "^1.3.4", + "driver.js": "^1.3.6", "eslint-config-prettier": "^10.1.2", "eslint-import-resolver-typescript": "^4.3.4", "eslint-plugin-import": "^2.31.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f7819cf1c..b44c181b0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -139,6 +139,9 @@ devDependencies: bits-ui: specifier: ^1.3.4 version: 1.3.4(svelte@5.35.4) + driver.js: + specifier: ^1.3.6 + version: 1.3.6 eslint-config-prettier: specifier: ^10.1.2 version: 10.1.2(eslint@9.28.0) @@ -5994,6 +5997,10 @@ packages: svelte-runes: 0.0.7(svelte@5.35.4) dev: false + /driver.js@1.3.6: + resolution: {integrity: sha512-g2nNuu+tWmPpuoyk3ffpT9vKhjPz4NrJzq6mkRDZIwXCrFhrKdDJ9TX5tJOBpvCTBrBYjgRQ17XlcQB15q4gMg==} + dev: true + /dunder-proto@1.0.1: resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==} engines: {node: '>= 0.4'} diff --git a/src/lib/ui/core/InteractiveTour/CustomPopover.svelte b/src/lib/ui/core/InteractiveTour/CustomPopover.svelte new file mode 100644 index 000000000..b61179897 --- /dev/null +++ b/src/lib/ui/core/InteractiveTour/CustomPopover.svelte @@ -0,0 +1,115 @@ + + +
+
+

{@html popover.title}

+ +
+ +
{@html popover.description}
+ + +
+ + diff --git a/src/lib/ui/core/InteractiveTour/index.ts b/src/lib/ui/core/InteractiveTour/index.ts new file mode 100644 index 000000000..3d56c99c7 --- /dev/null +++ b/src/lib/ui/core/InteractiveTour/index.ts @@ -0,0 +1,26 @@ +import type { Config } from 'driver.js' + +import { mount } from 'svelte' + +import CustomPopover from './CustomPopover.svelte' + +export async function interactiveTour(initialConfig: Config) { + await import('driver.js/dist/driver.css') + + const { driver: driverInstance } = await import('driver.js') + + return driverInstance({ + ...initialConfig, + + onPopoverRender: (popover, { config: _, state: _s, driver }) => { + popover.wrapper.innerHTML = '' + + mount(CustomPopover, { + target: popover.wrapper, + props: { + driver, + }, + }) + }, + }) +} diff --git a/src/stories/Design System - App UI/InteractiveTour/index.stories.ts b/src/stories/Design System - App UI/InteractiveTour/index.stories.ts new file mode 100644 index 000000000..f8a3ace3e --- /dev/null +++ b/src/stories/Design System - App UI/InteractiveTour/index.stories.ts @@ -0,0 +1,15 @@ +import type { Meta, StoryObj } from '@storybook/svelte' + +import Component from './index.svelte' + +const meta = { + component: Component, + parameters: { + layout: 'fullscreen', + }, +} satisfies Meta +type Story = StoryObj + +export default meta + +export const InteractiveTour: Story = {} diff --git a/src/stories/Design System - App UI/InteractiveTour/index.svelte b/src/stories/Design System - App UI/InteractiveTour/index.svelte new file mode 100644 index 000000000..be6a8fe18 --- /dev/null +++ b/src/stories/Design System - App UI/InteractiveTour/index.svelte @@ -0,0 +1,64 @@ + + +
+ + +
+
Feature 1
+
Feature 2
+
Feature 3
+
+