@ruc-lib/tour-guide 2.0.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 +192 -0
- package/esm2020/index.mjs +4 -0
- package/esm2020/lib/model/default-config.model.mjs +26 -0
- package/esm2020/lib/model/tour-guide.model.mjs +2 -0
- package/esm2020/lib/ruclib-tour-guide/ruclib-tour-guide.component.mjs +382 -0
- package/esm2020/lib/ruclib-tour-guide.module.mjs +20 -0
- package/esm2020/ruc-lib-tour-guide.mjs +5 -0
- package/fesm2015/ruc-lib-tour-guide.mjs +438 -0
- package/fesm2015/ruc-lib-tour-guide.mjs.map +1 -0
- package/fesm2020/ruc-lib-tour-guide.mjs +431 -0
- package/fesm2020/ruc-lib-tour-guide.mjs.map +1 -0
- package/index.d.ts +3 -0
- package/lib/model/default-config.model.d.ts +16 -0
- package/lib/model/tour-guide.model.d.ts +26 -0
- package/lib/ruclib-tour-guide/ruclib-tour-guide.component.d.ts +148 -0
- package/lib/ruclib-tour-guide.module.d.ts +10 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# ruclib-tour-guide
|
|
2
|
+
|
|
3
|
+
A component for creating a tour guide that provides information and guidance about a specific feature or functionality to the user.
|
|
4
|
+
|
|
5
|
+
# Installation guide
|
|
6
|
+
|
|
7
|
+
To use the Tour Guide component, you can install the entire RUC library or just this specific component.
|
|
8
|
+
|
|
9
|
+
### Install the Entire Library
|
|
10
|
+
```bash
|
|
11
|
+
npm install @uxpractice/ruc-lib
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Install Individual Component
|
|
15
|
+
|
|
16
|
+
If you only need the Tour Guide component
|
|
17
|
+
```bash
|
|
18
|
+
npm install @uxpractice/tour-guide
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
### 1. Import the Module
|
|
23
|
+
In your Angular module file (e.g., `app.module.ts`), import the `RuclibTourGuideModule`:
|
|
24
|
+
|
|
25
|
+
```typescript
|
|
26
|
+
import { RuclibTourGuideModule } from '@uxpractice/tour-guide';
|
|
27
|
+
import { AppComponent } from './app.component';
|
|
28
|
+
import { NgModule } from '@angular/core';
|
|
29
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
30
|
+
|
|
31
|
+
@NgModule({
|
|
32
|
+
declarations: [AppComponent],
|
|
33
|
+
imports: [
|
|
34
|
+
BrowserModule,
|
|
35
|
+
RuclibTourGuideModule
|
|
36
|
+
],
|
|
37
|
+
providers: [],
|
|
38
|
+
bootstrap: [AppComponent]
|
|
39
|
+
})
|
|
40
|
+
export class AppModule {}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Use the Component
|
|
44
|
+
In your component's template, use the `<uxp-ruc-tour-guide>` selector and pass the configuration object to the `rucInputData` input.
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<uxp-ruc-tour-guide
|
|
48
|
+
[rucInputData]="tourGuideConfig"
|
|
49
|
+
[customTheme]="customTheme"
|
|
50
|
+
(rucEvent)="passEvent($event)"
|
|
51
|
+
[dataSource]="tourGuideData">
|
|
52
|
+
</uxp-ruc-tour-guide>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## API Reference
|
|
56
|
+
|
|
57
|
+
### Component Inputs
|
|
58
|
+
|
|
59
|
+
| Input | Type | Description |
|
|
60
|
+
|----------------|--------------------|---------------------------------------------------|
|
|
61
|
+
| `rucInputData` | `tourGuideConfig` | The main configuration object for the tour guide. |
|
|
62
|
+
| `customTheme` | `string` | An optional CSS class for custom theming. |
|
|
63
|
+
| `dataSource` | `tourGuideData` | An optional CSS class for custom theming. |
|
|
64
|
+
|
|
65
|
+
### Component Outputs
|
|
66
|
+
|
|
67
|
+
| Output | Type | Description |
|
|
68
|
+
|-----------|-----------|---------------------------------------------------|
|
|
69
|
+
| `rucEvent`| `any` | Emits events related to tour guide actions (e.g., 'skip', 'next', 'finish'). |
|
|
70
|
+
|
|
71
|
+
### `tourGuideConfig`
|
|
72
|
+
This is the main configuration object for the Tour Guide component.
|
|
73
|
+
|
|
74
|
+
| Property | Type | Description |
|
|
75
|
+
|--------------------------|---------------------------------------------------------------------|-----------------------------------------------------------------------|
|
|
76
|
+
| `type` | `'simple' \| 'advance'` | Type of tour guide (e.g., 'simple', 'advance'). |
|
|
77
|
+
| `showSkipButton` | `boolean` | To toggle the visibility of the skip button. |
|
|
78
|
+
| `buttonsFontSize` | `string` | Configure the font size of buttons. |
|
|
79
|
+
| `titleFontSize` | `string` | Configure the font size of the title. |
|
|
80
|
+
| `contentFontSize` | `string` | Configure the font size of the main content. |
|
|
81
|
+
| `buttonsAlignment` | `'start' \| 'center' \| 'end' \| 'space-between' \| 'space-around'` | Change the alignment of buttons. |
|
|
82
|
+
| `stepCountAlignment` | `'start' | 'center' | 'end'` | Change the alignment of step count. |
|
|
83
|
+
| `stepCountStartText` | `string` | Text to display at the start of the step count (e.g., 'Step'). |
|
|
84
|
+
| `stepCountMiddleText` | `string` | Text to display in the middle of the step count (e.g., 'of'). |
|
|
85
|
+
| `skipButtonText` | `string` | Text for the skip button. |
|
|
86
|
+
| `prevButtonText` | `string` | Text for the previous button. |
|
|
87
|
+
| `nextButtonText` | `string` | Text for the next button. |
|
|
88
|
+
| `finishButtonText` | `string` | Text for the finish button. |
|
|
89
|
+
| `highlightBorderColor` | `string` | Color of the highlight border around the guided element. |
|
|
90
|
+
| `highlightBorderWidth` | `string` | Width of the highlight border around the guided element. |
|
|
91
|
+
| `defaultPopupWidth` | `string` | Default width of the tour guide popup. |
|
|
92
|
+
|
|
93
|
+
### `tourGuideData`
|
|
94
|
+
This array of objects defines the content for each step of the tour guide.
|
|
95
|
+
|
|
96
|
+
| Property | Type | Description |
|
|
97
|
+
|------------|-------------------------------------------------------------|-----------------------------------------------------------------------|
|
|
98
|
+
| `title` | `string` | Title of the tour guide step. |
|
|
99
|
+
| `content` | `string` | Main content/description for the tour guide step. |
|
|
100
|
+
| `selector` | `string` (Only for `'advance'` type) | CSS selector for the element to highlight in 'advance' mode. |
|
|
101
|
+
| `position` | `'top' \| 'bottom' \| 'left' \| 'right' \| 'auto'` | Position of the popup relative to the highlighted element. |
|
|
102
|
+
| `shape` | `'' \| 'rounded' \| 'rectangle' \| 'circle'` | Shape of the description popup. |
|
|
103
|
+
| `width` | `string` | Custom width for the popup of the current step. |
|
|
104
|
+
|
|
105
|
+
## Example Configuration
|
|
106
|
+
|
|
107
|
+
Here's an example of how to configure the Tour Guide component in your component's TypeScript file.
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { Component } from '@angular/core';
|
|
111
|
+
import { TourGuideConfig, TourGuideData } from '@uxpractice/tour-guide';
|
|
112
|
+
|
|
113
|
+
@Component({
|
|
114
|
+
selector: 'app-root',
|
|
115
|
+
templateUrl: './app.component.html',
|
|
116
|
+
})
|
|
117
|
+
export class AppComponent {
|
|
118
|
+
tourGuideConfig: TourGuideConfig = {
|
|
119
|
+
type: 'advance',
|
|
120
|
+
showSkipButton: true,
|
|
121
|
+
buttonsFontSize: '14px',
|
|
122
|
+
titleFontSize: '18px',
|
|
123
|
+
contentFontSize: '14px',
|
|
124
|
+
buttonsAlignment: 'end',
|
|
125
|
+
stepCountAlignment: 'center',
|
|
126
|
+
stepCountStartText: 'Step',
|
|
127
|
+
stepCountMiddleText: 'of',
|
|
128
|
+
skipButtonText: 'Skip Tour',
|
|
129
|
+
prevButtonText: 'Previous',
|
|
130
|
+
nextButtonText: 'Next',
|
|
131
|
+
finishButtonText: 'Finish',
|
|
132
|
+
highlightBorderColor: '#007bff',
|
|
133
|
+
highlightBorderWidth: '3px',
|
|
134
|
+
defaultPopupWidth: '300px'
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
tourGuideData: TourGuideData[] = [
|
|
138
|
+
{
|
|
139
|
+
title: 'Welcome to Our App!',
|
|
140
|
+
content: 'This tour will guide you through the main features.',
|
|
141
|
+
selector: '', // No specific selector for the first step
|
|
142
|
+
position: 'auto',
|
|
143
|
+
shape: 'rounded',
|
|
144
|
+
width: '350px'
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
title: 'Navigation Bar',
|
|
148
|
+
content: 'This is where you can navigate to different sections of the application.',
|
|
149
|
+
selector: '#navbar', // Replace with your actual selector
|
|
150
|
+
position: 'bottom',
|
|
151
|
+
shape: 'rectangle',
|
|
152
|
+
width: '300px'
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
title: 'User Profile',
|
|
156
|
+
content: 'Click here to view and manage your profile settings.',
|
|
157
|
+
selector: '#user-profile-icon', // Replace with your actual selector
|
|
158
|
+
position: 'left',
|
|
159
|
+
shape: 'circle',
|
|
160
|
+
width: '280px'
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
title: 'Main Content Area',
|
|
164
|
+
content: 'All your important data and features are displayed here.',
|
|
165
|
+
selector: '#main-content', // Replace with your actual selector
|
|
166
|
+
position: 'top',
|
|
167
|
+
shape: 'rounded',
|
|
168
|
+
width: '400px'
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
title: 'Notifications',
|
|
172
|
+
content: 'Stay updated with the latest notifications.',
|
|
173
|
+
selector: '#notifications-bell', // Replace with your actual selector
|
|
174
|
+
position: 'right',
|
|
175
|
+
shape: 'rectangle',
|
|
176
|
+
width: '250px'
|
|
177
|
+
}
|
|
178
|
+
];
|
|
179
|
+
|
|
180
|
+
passEvent(event: any) {
|
|
181
|
+
console.log('Tour Guide Event:', event);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Contribution
|
|
187
|
+
|
|
188
|
+
Contributions are welcome! Feel free to open issues or pull requests for any enhancements or fixes.
|
|
189
|
+
|
|
190
|
+
## Acknowledgements
|
|
191
|
+
|
|
192
|
+
Thank you for choosing the Tour Guide component. If you have any feedback or suggestions, please let us know!
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from './lib/ruclib-tour-guide.module';
|
|
2
|
+
export * from './lib/ruclib-tour-guide/ruclib-tour-guide.component';
|
|
3
|
+
export * from './lib/model/tour-guide.model';
|
|
4
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxnQ0FBZ0MsQ0FBQztBQUMvQyxjQUFjLHFEQUFxRCxDQUFDO0FBQ3BFLGNBQWMsOEJBQThCLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL2xpYi9ydWNsaWItdG91ci1ndWlkZS5tb2R1bGUnO1xyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9ydWNsaWItdG91ci1ndWlkZS9ydWNsaWItdG91ci1ndWlkZS5jb21wb25lbnQnO1xyXG5leHBvcnQgKiBmcm9tICcuL2xpYi9tb2RlbC90b3VyLWd1aWRlLm1vZGVsJzsiXX0=
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const defaultTourGuideConfig = {
|
|
2
|
+
type: "advance",
|
|
3
|
+
showSkipButton: true,
|
|
4
|
+
buttonsFontSize: "14px",
|
|
5
|
+
titleFontSize: '16px',
|
|
6
|
+
contentFontSize: '14px',
|
|
7
|
+
buttonsAlignment: 'end',
|
|
8
|
+
stepCountAlignment: 'start',
|
|
9
|
+
stepCountStartText: 'Step',
|
|
10
|
+
stepCountMiddleText: 'of',
|
|
11
|
+
skipButtonText: 'Skip',
|
|
12
|
+
prevButtonText: 'Back',
|
|
13
|
+
nextButtonText: 'Next',
|
|
14
|
+
finishButtonText: 'Finish',
|
|
15
|
+
highlightBorderColor: '#007bff',
|
|
16
|
+
highlightBorderWidth: '2px',
|
|
17
|
+
defaultPopupWidth: '250px',
|
|
18
|
+
};
|
|
19
|
+
export const DEFAULT_VALUES = {
|
|
20
|
+
arrowRight: 'ArrowRight',
|
|
21
|
+
arrowLeft: 'ArrowLeft',
|
|
22
|
+
escape: 'Escape',
|
|
23
|
+
popup: { width: 300, height: 150, top: 0, left: 0, padding: 10, safeMargin: 64 },
|
|
24
|
+
startTourButtonLabel: 'Start Tour Guide'
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGVmYXVsdC1jb25maWcubW9kZWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbGliL21vZGVsL2RlZmF1bHQtY29uZmlnLm1vZGVsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLE1BQU0sQ0FBQyxNQUFNLHNCQUFzQixHQUFvQjtJQUNuRCxJQUFJLEVBQUUsU0FBUztJQUNmLGNBQWMsRUFBRSxJQUFJO0lBQ3BCLGVBQWUsRUFBRSxNQUFNO0lBQ3ZCLGFBQWEsRUFBRSxNQUFNO0lBQ3JCLGVBQWUsRUFBRSxNQUFNO0lBQ3ZCLGdCQUFnQixFQUFFLEtBQUs7SUFDdkIsa0JBQWtCLEVBQUUsT0FBTztJQUMzQixrQkFBa0IsRUFBRSxNQUFNO0lBQzFCLG1CQUFtQixFQUFFLElBQUk7SUFDekIsY0FBYyxFQUFFLE1BQU07SUFDdEIsY0FBYyxFQUFFLE1BQU07SUFDdEIsY0FBYyxFQUFFLE1BQU07SUFDdEIsZ0JBQWdCLEVBQUUsUUFBUTtJQUMxQixvQkFBb0IsRUFBRSxTQUFTO0lBQy9CLG9CQUFvQixFQUFFLEtBQUs7SUFDM0IsaUJBQWlCLEVBQUUsT0FBTztDQUM3QixDQUFBO0FBRUQsTUFBTSxDQUFDLE1BQU0sY0FBYyxHQUFHO0lBQzFCLFVBQVUsRUFBRSxZQUFZO0lBQ3hCLFNBQVMsRUFBRSxXQUFXO0lBQ3RCLE1BQU0sRUF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