@aladinbs/react-guided-tour 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.
- package/LICENSE +21 -0
- package/README.md +581 -0
- package/dist/components/TourOverlay.d.ts +5 -0
- package/dist/components/TourOverlay.d.ts.map +1 -0
- package/dist/components/TourPopover.d.ts +5 -0
- package/dist/components/TourPopover.d.ts.map +1 -0
- package/dist/components/TourProvider.d.ts +15 -0
- package/dist/components/TourProvider.d.ts.map +1 -0
- package/dist/components/TourRunner.d.ts +5 -0
- package/dist/components/TourRunner.d.ts.map +1 -0
- package/dist/core/TourActions.d.ts +15 -0
- package/dist/core/TourActions.d.ts.map +1 -0
- package/dist/core/TourEngine.d.ts +35 -0
- package/dist/core/TourEngine.d.ts.map +1 -0
- package/dist/core/TourStorage.d.ts +14 -0
- package/dist/core/TourStorage.d.ts.map +1 -0
- package/dist/hooks/useTourEngine.d.ts +21 -0
- package/dist/hooks/useTourEngine.d.ts.map +1 -0
- package/dist/hooks/useTourHighlight.d.ts +8 -0
- package/dist/hooks/useTourHighlight.d.ts.map +1 -0
- package/dist/index.d.ts +326 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +2097 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2116 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/NavigationIntegration.d.ts +24 -0
- package/dist/integrations/NavigationIntegration.d.ts.map +1 -0
- package/dist/integrations/TabIntegration.d.ts +19 -0
- package/dist/integrations/TabIntegration.d.ts.map +1 -0
- package/dist/integrations/WizardIntegration.d.ts +23 -0
- package/dist/integrations/WizardIntegration.d.ts.map +1 -0
- package/dist/types/index.d.ts +137 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/utils/positioning.d.ts +10 -0
- package/dist/utils/positioning.d.ts.map +1 -0
- package/package.json +75 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 React Guided Tour
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,581 @@
|
|
|
1
|
+
# React Guided Tour
|
|
2
|
+
|
|
3
|
+
A modern, flexible React TypeScript tour guide library with advanced highlighting and interaction capabilities. Built for React 19 with a clean, modular architecture that supports complex user onboarding flows.
|
|
4
|
+
|
|
5
|
+
## ✨ Features
|
|
6
|
+
|
|
7
|
+
- 🎯 **Smart Element Targeting** - Flexible element selection with CSS selectors or direct element references
|
|
8
|
+
- 🎨 **Modern UI Design** - Beautiful, customizable popover with smooth animations
|
|
9
|
+
- 🔧 **Pluggable Architecture** - Extensible integration system for tabs, wizards, and navigation
|
|
10
|
+
- 📱 **Responsive Positioning** - Intelligent popover placement that adapts to viewport constraints
|
|
11
|
+
- 🎭 **Theme Support** - Comprehensive theming with light/dark mode compatibility
|
|
12
|
+
- 💾 **State Persistence** - localStorage integration to remember tour completion and progress
|
|
13
|
+
- ⚡ **Performance Optimized** - Framework-agnostic core with efficient React integration
|
|
14
|
+
- 🎪 **Action System** - Automated interactions (clicks, navigation, tab switching)
|
|
15
|
+
- 🔄 **Event System** - Rich event hooks for tour lifecycle management
|
|
16
|
+
- 🎯 **TypeScript First** - Full type safety with comprehensive type definitions
|
|
17
|
+
|
|
18
|
+
## 🚀 Quick Start
|
|
19
|
+
|
|
20
|
+
### Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install react-guided-tour
|
|
24
|
+
# or
|
|
25
|
+
yarn add react-guided-tour
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Running the Example
|
|
29
|
+
|
|
30
|
+
To see the tour library in action with a complete demo:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Clone or navigate to the project
|
|
34
|
+
cd react-guided-tour
|
|
35
|
+
|
|
36
|
+
# Install dependencies for the main library
|
|
37
|
+
npm install
|
|
38
|
+
|
|
39
|
+
# Build the library
|
|
40
|
+
npm run build
|
|
41
|
+
|
|
42
|
+
# Navigate to the example directory
|
|
43
|
+
cd example
|
|
44
|
+
|
|
45
|
+
# Install example dependencies
|
|
46
|
+
npm install
|
|
47
|
+
|
|
48
|
+
# Start the development server
|
|
49
|
+
npm run dev
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The example will be available at `http://localhost:3000` and includes:
|
|
53
|
+
- Interactive tour with multiple steps
|
|
54
|
+
- Tab switching demonstrations
|
|
55
|
+
- Wizard navigation examples
|
|
56
|
+
- Sidebar interactions
|
|
57
|
+
- Modern UI showcase
|
|
58
|
+
|
|
59
|
+
### Basic Usage
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import React from 'react';
|
|
63
|
+
import { TourProvider, TourRunner, TourConfig } from 'react-guided-tour';
|
|
64
|
+
|
|
65
|
+
const tourConfig: TourConfig = {
|
|
66
|
+
id: 'welcome-tour',
|
|
67
|
+
steps: [
|
|
68
|
+
{
|
|
69
|
+
id: 'welcome',
|
|
70
|
+
title: 'Welcome!',
|
|
71
|
+
content: 'Let\'s take a quick tour of the application.',
|
|
72
|
+
placement: 'center',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: 'header',
|
|
76
|
+
title: 'Navigation',
|
|
77
|
+
content: 'This is the main navigation header.',
|
|
78
|
+
target: '[data-tour="header"]',
|
|
79
|
+
placement: 'bottom',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
id: 'sidebar',
|
|
83
|
+
title: 'Sidebar Menu',
|
|
84
|
+
content: 'Access different sections from here.',
|
|
85
|
+
target: '.sidebar',
|
|
86
|
+
placement: 'right',
|
|
87
|
+
action: {
|
|
88
|
+
type: 'click',
|
|
89
|
+
target: '.sidebar-toggle',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
function App() {
|
|
96
|
+
return (
|
|
97
|
+
<TourProvider config={tourConfig}>
|
|
98
|
+
<div className="app">
|
|
99
|
+
<header data-tour="header">My App</header>
|
|
100
|
+
<aside className="sidebar">...</aside>
|
|
101
|
+
<main>...</main>
|
|
102
|
+
|
|
103
|
+
{/* Tour UI */}
|
|
104
|
+
<TourRunner />
|
|
105
|
+
</div>
|
|
106
|
+
</TourProvider>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Starting a Tour
|
|
112
|
+
|
|
113
|
+
```tsx
|
|
114
|
+
import { useTour } from 'react-guided-tour';
|
|
115
|
+
|
|
116
|
+
function StartTourButton() {
|
|
117
|
+
const { start, state } = useTour();
|
|
118
|
+
|
|
119
|
+
return (
|
|
120
|
+
<button onClick={start} disabled={state.isRunning}>
|
|
121
|
+
Start Tour
|
|
122
|
+
</button>
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## 📖 API Reference
|
|
128
|
+
|
|
129
|
+
### TourConfig
|
|
130
|
+
|
|
131
|
+
The main configuration object for defining your tour:
|
|
132
|
+
|
|
133
|
+
```tsx
|
|
134
|
+
interface TourConfig {
|
|
135
|
+
id: string; // Unique tour identifier
|
|
136
|
+
steps: TourStep[]; // Array of tour steps
|
|
137
|
+
theme?: TourTheme; // Custom theme configuration
|
|
138
|
+
onStart?: () => void; // Called when tour starts
|
|
139
|
+
onComplete?: () => void; // Called when tour completes
|
|
140
|
+
onSkip?: () => void; // Called when tour is skipped
|
|
141
|
+
onStepChange?: (step: TourStep, index: number) => void;
|
|
142
|
+
allowKeyboardNavigation?: boolean; // Enable keyboard controls
|
|
143
|
+
allowClickOutside?: boolean; // Allow clicking outside to close
|
|
144
|
+
showProgress?: boolean; // Show step progress indicator
|
|
145
|
+
storage?: {
|
|
146
|
+
key?: string; // localStorage key (default: 'tour-{id}')
|
|
147
|
+
remember?: boolean; // Persist tour progress and completion state
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### TourStep
|
|
153
|
+
|
|
154
|
+
Individual step configuration:
|
|
155
|
+
|
|
156
|
+
```tsx
|
|
157
|
+
interface TourStep {
|
|
158
|
+
id: string; // Unique step identifier
|
|
159
|
+
title: string; // Step title
|
|
160
|
+
content: string; // Step description
|
|
161
|
+
target?: string; // CSS selector for target element
|
|
162
|
+
placement?: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
163
|
+
action?: TourAction; // Automated action to perform
|
|
164
|
+
highlight?: HighlightConfig; // Custom highlight styling
|
|
165
|
+
popover?: PopoverConfig; // Custom popover configuration
|
|
166
|
+
beforeStep?: () => Promise<void> | void; // Pre-step hook
|
|
167
|
+
afterStep?: () => Promise<void> | void; // Post-step hook
|
|
168
|
+
canSkip?: boolean; // Allow skipping this step
|
|
169
|
+
waitForElement?: boolean; // Wait for target element to appear
|
|
170
|
+
waitTimeout?: number; // Timeout for element waiting (ms)
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### TourAction
|
|
175
|
+
|
|
176
|
+
Automated actions that can be performed during tour steps:
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
interface TourAction {
|
|
180
|
+
type: 'click' | 'navigate' | 'highlight' | 'tab-switch' | 'wizard-step' | 'custom';
|
|
181
|
+
target?: string; // Target selector or URL
|
|
182
|
+
value?: any; // Action-specific value
|
|
183
|
+
handler?: () => Promise<void> | void; // Custom action handler
|
|
184
|
+
delay?: number; // Delay before action (ms)
|
|
185
|
+
}
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### TourTheme
|
|
189
|
+
|
|
190
|
+
Comprehensive theming options:
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
193
|
+
interface TourTheme {
|
|
194
|
+
primaryColor?: string; // Primary brand color
|
|
195
|
+
backgroundColor?: string; // Popover background
|
|
196
|
+
textColor?: string; // Text color
|
|
197
|
+
borderRadius?: string; // Border radius
|
|
198
|
+
fontFamily?: string; // Font family
|
|
199
|
+
fontSize?: string; // Font size
|
|
200
|
+
zIndex?: number; // Z-index for tour elements
|
|
201
|
+
overlay?: {
|
|
202
|
+
backgroundColor?: string; // Overlay background
|
|
203
|
+
opacity?: number; // Overlay opacity
|
|
204
|
+
};
|
|
205
|
+
highlight?: {
|
|
206
|
+
borderColor?: string; // Highlight border color
|
|
207
|
+
borderWidth?: string; // Highlight border width
|
|
208
|
+
glowColor?: string; // Highlight glow color
|
|
209
|
+
animation?: string; // Highlight animation
|
|
210
|
+
};
|
|
211
|
+
popover?: {
|
|
212
|
+
backgroundColor?: string; // Popover background
|
|
213
|
+
borderColor?: string; // Popover border
|
|
214
|
+
shadow?: string; // Popover shadow
|
|
215
|
+
maxWidth?: string; // Maximum width
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## 🎯 Advanced Usage
|
|
221
|
+
|
|
222
|
+
### Custom Actions
|
|
223
|
+
|
|
224
|
+
Create custom actions for complex interactions:
|
|
225
|
+
|
|
226
|
+
```tsx
|
|
227
|
+
const tourConfig: TourConfig = {
|
|
228
|
+
id: 'advanced-tour',
|
|
229
|
+
steps: [
|
|
230
|
+
{
|
|
231
|
+
id: 'custom-action',
|
|
232
|
+
title: 'Custom Action',
|
|
233
|
+
content: 'This step performs a custom action.',
|
|
234
|
+
action: {
|
|
235
|
+
type: 'custom',
|
|
236
|
+
handler: async () => {
|
|
237
|
+
// Custom logic here
|
|
238
|
+
await someAsyncOperation();
|
|
239
|
+
updateApplicationState();
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
};
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### Tab Integration
|
|
248
|
+
|
|
249
|
+
Automatically switch between tabs:
|
|
250
|
+
|
|
251
|
+
```tsx
|
|
252
|
+
{
|
|
253
|
+
id: 'tab-demo',
|
|
254
|
+
title: 'Switch Tabs',
|
|
255
|
+
content: 'Watch as we switch to the Projects tab.',
|
|
256
|
+
target: '[data-tab="projects"]',
|
|
257
|
+
action: {
|
|
258
|
+
type: 'tab-switch',
|
|
259
|
+
target: '[data-tab="projects"]',
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Wizard Integration
|
|
265
|
+
|
|
266
|
+
Navigate through multi-step wizards:
|
|
267
|
+
|
|
268
|
+
```tsx
|
|
269
|
+
{
|
|
270
|
+
id: 'wizard-step',
|
|
271
|
+
title: 'Wizard Navigation',
|
|
272
|
+
content: 'Navigate to step 2 of the wizard.',
|
|
273
|
+
target: '.wizard',
|
|
274
|
+
action: {
|
|
275
|
+
type: 'wizard-step',
|
|
276
|
+
target: '.wizard',
|
|
277
|
+
value: 2, // Step index
|
|
278
|
+
},
|
|
279
|
+
}
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Custom Integrations
|
|
283
|
+
|
|
284
|
+
Extend the tour system with custom integrations:
|
|
285
|
+
|
|
286
|
+
```tsx
|
|
287
|
+
import { Integration, TourAction } from 'react-guided-tour';
|
|
288
|
+
|
|
289
|
+
class CustomIntegration implements Integration {
|
|
290
|
+
name = 'custom-integration';
|
|
291
|
+
|
|
292
|
+
canHandle(action: TourAction): boolean {
|
|
293
|
+
return action.type === 'my-custom-action';
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
async execute(action: TourAction, element?: HTMLElement): Promise<void> {
|
|
297
|
+
// Custom integration logic
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// Register the integration
|
|
302
|
+
const { engine } = useTourEngine(config);
|
|
303
|
+
engine.actions.registerIntegration(new CustomIntegration());
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### State Persistence with localStorage
|
|
307
|
+
|
|
308
|
+
The tour system automatically saves completion and progress state to localStorage when enabled:
|
|
309
|
+
|
|
310
|
+
```tsx
|
|
311
|
+
const tourConfig: TourConfig = {
|
|
312
|
+
id: 'my-app-tour',
|
|
313
|
+
storage: {
|
|
314
|
+
remember: true, // Enable localStorage persistence
|
|
315
|
+
key: 'my-custom-tour-key', // Optional custom key
|
|
316
|
+
},
|
|
317
|
+
steps: [
|
|
318
|
+
// ... your steps
|
|
319
|
+
],
|
|
320
|
+
};
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
**What gets saved:**
|
|
324
|
+
- Tour completion status (`isCompleted: true`)
|
|
325
|
+
- Tour skip status (`isSkipped: true`)
|
|
326
|
+
- Completion/skip timestamps
|
|
327
|
+
- Current step progress
|
|
328
|
+
- Completed and skipped step IDs
|
|
329
|
+
|
|
330
|
+
**Checking tour state:**
|
|
331
|
+
```tsx
|
|
332
|
+
function MyComponent() {
|
|
333
|
+
const { engine, state } = useTour();
|
|
334
|
+
|
|
335
|
+
// Check if user has completed or skipped the tour
|
|
336
|
+
const shouldShowTour = engine.shouldShowTour();
|
|
337
|
+
const isCompleted = state.isCompleted;
|
|
338
|
+
const isSkipped = state.isSkipped;
|
|
339
|
+
|
|
340
|
+
return (
|
|
341
|
+
<div>
|
|
342
|
+
{shouldShowTour ? (
|
|
343
|
+
<button onClick={() => engine.start()}>
|
|
344
|
+
Start Tour
|
|
345
|
+
</button>
|
|
346
|
+
) : (
|
|
347
|
+
<div>
|
|
348
|
+
{isCompleted && <span>✓ Tour Completed</span>}
|
|
349
|
+
{isSkipped && <span>Tour Skipped</span>}
|
|
350
|
+
<button onClick={() => engine.resetTourState()}>
|
|
351
|
+
Reset Tour
|
|
352
|
+
</button>
|
|
353
|
+
</div>
|
|
354
|
+
)}
|
|
355
|
+
</div>
|
|
356
|
+
);
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
**Resetting tour state:**
|
|
361
|
+
```tsx
|
|
362
|
+
// Clear localStorage and reset tour state
|
|
363
|
+
engine.resetTourState();
|
|
364
|
+
|
|
365
|
+
// Or manually clear just the localStorage
|
|
366
|
+
engine.storage.clearState();
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Event Handling
|
|
370
|
+
|
|
371
|
+
Listen to tour events:
|
|
372
|
+
|
|
373
|
+
```tsx
|
|
374
|
+
function MyTourComponent() {
|
|
375
|
+
const { engine } = useTour();
|
|
376
|
+
|
|
377
|
+
useEffect(() => {
|
|
378
|
+
const handleStepChange = (data: { step: TourStep; index: number }) => {
|
|
379
|
+
console.log('Step changed:', data.step.id);
|
|
380
|
+
// Analytics tracking
|
|
381
|
+
analytics.track('tour_step_viewed', {
|
|
382
|
+
step_id: data.step.id,
|
|
383
|
+
step_index: data.index,
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
engine.on('step-change', handleStepChange);
|
|
388
|
+
|
|
389
|
+
return () => {
|
|
390
|
+
engine.off('step-change', handleStepChange);
|
|
391
|
+
};
|
|
392
|
+
}, [engine]);
|
|
393
|
+
|
|
394
|
+
return <TourRunner />;
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Conditional Steps
|
|
399
|
+
|
|
400
|
+
Show steps based on conditions:
|
|
401
|
+
|
|
402
|
+
```tsx
|
|
403
|
+
const tourConfig: TourConfig = {
|
|
404
|
+
id: 'conditional-tour',
|
|
405
|
+
steps: [
|
|
406
|
+
{
|
|
407
|
+
id: 'conditional-step',
|
|
408
|
+
title: 'Conditional Step',
|
|
409
|
+
content: 'This step only shows if condition is met.',
|
|
410
|
+
target: '.feature',
|
|
411
|
+
beforeStep: async () => {
|
|
412
|
+
const hasFeature = await checkFeatureAvailability();
|
|
413
|
+
if (!hasFeature) {
|
|
414
|
+
throw new Error('Feature not available'); // Skip step
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
},
|
|
418
|
+
],
|
|
419
|
+
};
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
## 🎨 Styling
|
|
423
|
+
|
|
424
|
+
### CSS Custom Properties
|
|
425
|
+
|
|
426
|
+
The tour system uses CSS custom properties for easy theming:
|
|
427
|
+
|
|
428
|
+
```css
|
|
429
|
+
:root {
|
|
430
|
+
--tour-primary-color: #3b82f6;
|
|
431
|
+
--tour-background-color: #ffffff;
|
|
432
|
+
--tour-text-color: #1f2937;
|
|
433
|
+
--tour-border-radius: 12px;
|
|
434
|
+
--tour-highlight-color: #3b82f6;
|
|
435
|
+
--tour-overlay-color: rgba(0, 0, 0, 0.5);
|
|
436
|
+
--tour-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
### Custom CSS Classes
|
|
441
|
+
|
|
442
|
+
Add custom styling with CSS classes:
|
|
443
|
+
|
|
444
|
+
```css
|
|
445
|
+
.tour-popover {
|
|
446
|
+
/* Custom popover styles */
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.tour-popover[data-placement="top"] {
|
|
450
|
+
/* Top placement specific styles */
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.tour-highlight {
|
|
454
|
+
/* Custom highlight styles */
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
@keyframes custom-highlight-pulse {
|
|
458
|
+
0%, 100% { opacity: 1; }
|
|
459
|
+
50% { opacity: 0.7; }
|
|
460
|
+
}
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
## 🔧 Integration Examples
|
|
464
|
+
|
|
465
|
+
### React Router Integration
|
|
466
|
+
|
|
467
|
+
```tsx
|
|
468
|
+
import { useNavigate } from 'react-router-dom';
|
|
469
|
+
|
|
470
|
+
const tourConfig: TourConfig = {
|
|
471
|
+
steps: [
|
|
472
|
+
{
|
|
473
|
+
id: 'navigate-to-page',
|
|
474
|
+
title: 'Navigation',
|
|
475
|
+
content: 'Let\'s go to the dashboard.',
|
|
476
|
+
action: {
|
|
477
|
+
type: 'navigate',
|
|
478
|
+
target: '/dashboard',
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
],
|
|
482
|
+
};
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### Material-UI Integration
|
|
486
|
+
|
|
487
|
+
```tsx
|
|
488
|
+
// Works automatically with Material-UI components
|
|
489
|
+
{
|
|
490
|
+
id: 'mui-tab',
|
|
491
|
+
title: 'Material-UI Tab',
|
|
492
|
+
content: 'Switch to the second tab.',
|
|
493
|
+
target: '.MuiTab-root[aria-selected="false"]',
|
|
494
|
+
action: {
|
|
495
|
+
type: 'tab-switch',
|
|
496
|
+
target: '.MuiTab-root[aria-selected="false"]',
|
|
497
|
+
},
|
|
498
|
+
}
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
### Ant Design Integration
|
|
502
|
+
|
|
503
|
+
```tsx
|
|
504
|
+
// Works with Ant Design components
|
|
505
|
+
{
|
|
506
|
+
id: 'antd-step',
|
|
507
|
+
title: 'Ant Design Stepper',
|
|
508
|
+
content: 'Navigate through the steps.',
|
|
509
|
+
target: '.ant-steps-item',
|
|
510
|
+
action: {
|
|
511
|
+
type: 'wizard-step',
|
|
512
|
+
target: '.ant-steps',
|
|
513
|
+
value: 1,
|
|
514
|
+
},
|
|
515
|
+
}
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
## 📱 Responsive Design
|
|
519
|
+
|
|
520
|
+
The tour system automatically adapts to different screen sizes:
|
|
521
|
+
|
|
522
|
+
- **Mobile**: Popovers adjust to smaller screens
|
|
523
|
+
- **Tablet**: Optimized touch interactions
|
|
524
|
+
- **Desktop**: Full feature set with keyboard navigation
|
|
525
|
+
|
|
526
|
+
## ♿ Accessibility
|
|
527
|
+
|
|
528
|
+
Built with accessibility in mind:
|
|
529
|
+
|
|
530
|
+
- **Keyboard Navigation**: Arrow keys, Enter, Escape
|
|
531
|
+
- **Screen Reader Support**: ARIA labels and descriptions
|
|
532
|
+
- **Focus Management**: Proper focus trapping and restoration
|
|
533
|
+
- **High Contrast**: Respects user color preferences
|
|
534
|
+
|
|
535
|
+
## 🔍 Troubleshooting
|
|
536
|
+
|
|
537
|
+
### Common Issues
|
|
538
|
+
|
|
539
|
+
**Tour doesn't start:**
|
|
540
|
+
- Ensure `TourProvider` wraps your app
|
|
541
|
+
- Check that `TourRunner` is rendered
|
|
542
|
+
- Verify tour configuration is valid
|
|
543
|
+
|
|
544
|
+
**Elements not highlighting:**
|
|
545
|
+
- Check CSS selectors are correct
|
|
546
|
+
- Ensure target elements exist in DOM
|
|
547
|
+
- Use `waitForElement: true` for dynamic content
|
|
548
|
+
|
|
549
|
+
**Actions not working:**
|
|
550
|
+
- Verify action type is supported
|
|
551
|
+
- Check target selectors
|
|
552
|
+
- Register custom integrations if needed
|
|
553
|
+
|
|
554
|
+
### Debug Mode
|
|
555
|
+
|
|
556
|
+
Enable debug logging:
|
|
557
|
+
|
|
558
|
+
```tsx
|
|
559
|
+
const tourConfig: TourConfig = {
|
|
560
|
+
// ... other config
|
|
561
|
+
debug: true, // Enable debug logging
|
|
562
|
+
};
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
## 🤝 Contributing
|
|
566
|
+
|
|
567
|
+
We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.
|
|
568
|
+
|
|
569
|
+
## 📄 License
|
|
570
|
+
|
|
571
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
572
|
+
|
|
573
|
+
## 🙏 Acknowledgments
|
|
574
|
+
|
|
575
|
+
- Inspired by modern onboarding libraries
|
|
576
|
+
- Built with React 19 and TypeScript
|
|
577
|
+
- Designed for developer experience and user delight
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
**Made with ❤️ for the React community**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourOverlay.d.ts","sourceRoot":"","sources":["../../src/components/TourOverlay.tsx"],"names":[],"mappings":"AAIA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,gBAAgB,kDA4E1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourPopover.d.ts","sourceRoot":"","sources":["../../src/components/TourPopover.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,WAAW,CAAC,EAAE,SAAS,EAAE,EAAE,gBAAgB,kDAkT1D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { TourConfig, TourTheme } from '../types';
|
|
3
|
+
import { UseTourEngineReturn } from '../hooks/useTourEngine';
|
|
4
|
+
interface TourContextValue extends UseTourEngineReturn {
|
|
5
|
+
config: TourConfig;
|
|
6
|
+
theme: TourTheme;
|
|
7
|
+
}
|
|
8
|
+
export interface TourProviderProps {
|
|
9
|
+
config: TourConfig;
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function TourProvider({ config, children }: TourProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare function useTour(): TourContextValue;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=TourProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourProvider.d.ts","sourceRoot":"","sources":["../../src/components/TourProvider.tsx"],"names":[],"mappings":"AAAA,OAAc,EAA6B,SAAS,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAiB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,UAAU,gBAAiB,SAAQ,mBAAmB;IACpD,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,SAAS,CAAC;CAClB;AAID,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB;AA4BD,wBAAgB,YAAY,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,iBAAiB,2CAenE;AAED,wBAAgB,OAAO,IAAI,gBAAgB,CAM1C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourRunner.d.ts","sourceRoot":"","sources":["../../src/components/TourRunner.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,UAAU,CAAC,EAAE,SAAS,EAAE,EAAE,eAAe,kDAaxD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { TourAction, Integration } from '../types';
|
|
2
|
+
export declare class TourActions {
|
|
3
|
+
private integrations;
|
|
4
|
+
registerIntegration(integration: Integration): void;
|
|
5
|
+
unregisterIntegration(name: string): void;
|
|
6
|
+
execute(action: TourAction, element?: HTMLElement): Promise<void>;
|
|
7
|
+
private findIntegration;
|
|
8
|
+
private executeDefault;
|
|
9
|
+
private handleClick;
|
|
10
|
+
private handleNavigate;
|
|
11
|
+
private sleep;
|
|
12
|
+
getRegisteredIntegrations(): string[];
|
|
13
|
+
hasIntegration(name: string): boolean;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=TourActions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TourActions.d.ts","sourceRoot":"","sources":["../../src/core/TourActions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEnD,qBAAa,WAAW;IACtB,OAAO,CAAC,YAAY,CAAuC;IAEpD,mBAAmB,CAAC,WAAW,EAAE,WAAW,GAAG,IAAI;IAInD,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAInC,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB9E,OAAO,CAAC,eAAe;YAST,cAAc;YA2Bd,WAAW;YA2BX,cAAc;IAqB5B,OAAO,CAAC,KAAK;IAIN,yBAAyB,IAAI,MAAM,EAAE;IAIrC,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;CAG7C"}
|