@aladinbs/react-guided-tour 1.2.0 → 1.3.0
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/README.md +76 -1
- package/dist/components/TourPopover.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +7 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -161,7 +161,8 @@ Individual step configuration:
|
|
|
161
161
|
interface TourStep {
|
|
162
162
|
id: string; // Unique step identifier
|
|
163
163
|
title: string; // Step title
|
|
164
|
-
content
|
|
164
|
+
content?: string; // Step description (optional if contentHtml provided)
|
|
165
|
+
contentHtml?: string; // Rich HTML content (takes precedence over content)
|
|
165
166
|
target?: string; // CSS selector for target element
|
|
166
167
|
placement?: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
167
168
|
action?: TourAction; // Automated action to perform
|
|
@@ -465,6 +466,80 @@ const tourConfig: TourConfig = {
|
|
|
465
466
|
- Clicking previous navigates to the immediately preceding step
|
|
466
467
|
- Button is disabled when navigation is not possible (e.g., during step transitions)
|
|
467
468
|
|
|
469
|
+
### Rich HTML Content
|
|
470
|
+
|
|
471
|
+
Create engaging tour content with HTML formatting, links, and interactive elements:
|
|
472
|
+
|
|
473
|
+
```tsx
|
|
474
|
+
const tourConfig: TourConfig = {
|
|
475
|
+
id: "html-content-tour",
|
|
476
|
+
steps: [
|
|
477
|
+
{
|
|
478
|
+
id: "welcome",
|
|
479
|
+
title: "Welcome!",
|
|
480
|
+
contentHtml: `
|
|
481
|
+
<p>Welcome to our <strong>amazing</strong> application!</p>
|
|
482
|
+
<p>This tour will show you:</p>
|
|
483
|
+
<ul>
|
|
484
|
+
<li>🎯 <strong>Key features</strong></li>
|
|
485
|
+
<li>📚 <a href="https://docs.example.com" target="_blank" style="color: #3b82f6;">Documentation</a></li>
|
|
486
|
+
<li>💡 <em>Pro tips</em> and best practices</li>
|
|
487
|
+
</ul>
|
|
488
|
+
<blockquote style="border-left: 3px solid #3b82f6; padding-left: 12px; margin: 12px 0; font-style: italic;">
|
|
489
|
+
"Great onboarding creates loyal users!"
|
|
490
|
+
</blockquote>
|
|
491
|
+
<p><small>💡 Try selecting this text or clicking the link above!</small></p>
|
|
492
|
+
`,
|
|
493
|
+
placement: "center",
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
id: "features",
|
|
497
|
+
title: "Rich Content Features",
|
|
498
|
+
contentHtml: `
|
|
499
|
+
<div style="background: #f8fafc; padding: 12px; border-radius: 8px; margin: 8px 0;">
|
|
500
|
+
<h4 style="margin: 0 0 8px 0; color: #1e293b;">✨ What you can include:</h4>
|
|
501
|
+
<ul style="margin: 0; padding-left: 20px;">
|
|
502
|
+
<li><strong>Bold</strong> and <em>italic</em> text</li>
|
|
503
|
+
<li><a href="#" onclick="alert('Link clicked!')">Interactive links</a></li>
|
|
504
|
+
<li><code style="background: #e2e8f0; padding: 2px 4px; border-radius: 4px;">Code snippets</code></li>
|
|
505
|
+
<li>Lists, quotes, and custom styling</li>
|
|
506
|
+
</ul>
|
|
507
|
+
</div>
|
|
508
|
+
<p>All content is <span style="background: yellow; padding: 2px;">selectable</span> and interactive!</p>
|
|
509
|
+
`,
|
|
510
|
+
target: "#my-element",
|
|
511
|
+
},
|
|
512
|
+
],
|
|
513
|
+
};
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
**HTML Content Features:**
|
|
517
|
+
|
|
518
|
+
- **Rich Formatting**: Use HTML tags for bold, italic, lists, quotes, and more
|
|
519
|
+
- **Clickable Links**: External links open in new tabs, internal links work normally
|
|
520
|
+
- **Text Selection**: Users can select and copy text from tour content
|
|
521
|
+
- **Interactive Elements**: Buttons, forms, and other interactive HTML elements work
|
|
522
|
+
- **Custom Styling**: Apply inline styles or CSS classes for custom appearance
|
|
523
|
+
- **Code Snippets**: Include formatted code examples with syntax highlighting
|
|
524
|
+
- **Media Content**: Embed images, videos, or other media (ensure proper sizing)
|
|
525
|
+
|
|
526
|
+
**Content Priority:**
|
|
527
|
+
- If both `content` and `contentHtml` are provided, `contentHtml` takes precedence
|
|
528
|
+
- Either `content` or `contentHtml` is required (at least one must be provided)
|
|
529
|
+
- HTML content is rendered using `dangerouslySetInnerHTML` - ensure content is safe
|
|
530
|
+
|
|
531
|
+
**Security Considerations:**
|
|
532
|
+
- Only use trusted HTML content to prevent XSS attacks
|
|
533
|
+
- Sanitize user-generated content before using in `contentHtml`
|
|
534
|
+
- Consider using a library like DOMPurify for content sanitization in production
|
|
535
|
+
|
|
536
|
+
**Best Practices:**
|
|
537
|
+
- Keep HTML content concise and focused
|
|
538
|
+
- Use semantic HTML elements for better accessibility
|
|
539
|
+
- Test links and interactive elements thoroughly
|
|
540
|
+
- Ensure content is responsive and works on different screen sizes
|
|
541
|
+
- Use consistent styling that matches your application's design system
|
|
542
|
+
|
|
468
543
|
### Custom Integrations
|
|
469
544
|
|
|
470
545
|
Extend the tour system with custom integrations:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TourPopover.d.ts","sourceRoot":"","sources":["../../src/components/TourPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAOjF,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"TourPopover.d.ts","sourceRoot":"","sources":["../../src/components/TourPopover.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAOjF,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,8CAyXtB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
4
4
|
interface TourStep {
|
|
5
5
|
id: string;
|
|
6
6
|
title: string;
|
|
7
|
-
content
|
|
7
|
+
content?: string;
|
|
8
|
+
contentHtml?: string;
|
|
8
9
|
target?: string;
|
|
9
10
|
placement?: 'top' | 'bottom' | 'left' | 'right' | 'center';
|
|
10
11
|
action?: TourAction;
|
package/dist/index.esm.js
CHANGED
|
@@ -1759,11 +1759,16 @@ const TourPopover = React.memo(function TourPopover({ className }) {
|
|
|
1759
1759
|
fontSize: '16px',
|
|
1760
1760
|
fontWeight: '600',
|
|
1761
1761
|
color: theme.textColor || '#1f2937',
|
|
1762
|
-
}, children: popoverConfig.title || step?.title })), jsxRuntimeExports.jsx("div", { style: {
|
|
1762
|
+
}, children: popoverConfig.title || step?.title })), (step?.contentHtml || step?.content || popoverConfig.content) && (jsxRuntimeExports.jsx("div", { style: {
|
|
1763
1763
|
margin: '0 0 16px 0',
|
|
1764
1764
|
lineHeight: '1.5',
|
|
1765
1765
|
color: theme.textColor || '#374151',
|
|
1766
|
-
|
|
1766
|
+
userSelect: 'text', // Enable text selection
|
|
1767
|
+
cursor: 'text',
|
|
1768
|
+
}, children: step?.contentHtml ? (jsxRuntimeExports.jsx("div", { dangerouslySetInnerHTML: { __html: step.contentHtml }, style: {
|
|
1769
|
+
// Ensure links and interactive elements work
|
|
1770
|
+
pointerEvents: 'auto',
|
|
1771
|
+
} })) : (popoverConfig.content || step?.content) }))] }), jsxRuntimeExports.jsxs("div", { style: {
|
|
1767
1772
|
display: 'flex',
|
|
1768
1773
|
justifyContent: 'space-between',
|
|
1769
1774
|
alignItems: 'center',
|