@weni/unnnic-system 2.6.1 → 2.7.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.
@@ -0,0 +1,216 @@
1
+ import UnnnicTour from '../components/Tour/Tour.vue';
2
+ import UnnnicCard from '../components/Card/Card.vue';
3
+
4
+ export default {
5
+ title: 'Example/Tour',
6
+ component: UnnnicTour,
7
+ argTypes: {},
8
+ render: (args) => ({
9
+ components: {
10
+ UnnnicTour,
11
+ UnnnicCard,
12
+ },
13
+ setup() {
14
+ return { args };
15
+ },
16
+ data() {
17
+ return {
18
+ attachedElementsLoaded: false,
19
+ };
20
+ },
21
+ methods: {
22
+ startTour() {
23
+ this.$refs.tour.start();
24
+ },
25
+ handleTourStep(step) {
26
+ this.$refs.tour.start();
27
+ this.$refs.tour.handleStep(step);
28
+ },
29
+ },
30
+ mounted() {
31
+ this.$nextTick(() => {
32
+ args.steps[0].attachedElement = this.$refs.step1.$el;
33
+ args.steps[1].attachedElement = this.$refs.step2.$el;
34
+ args.steps[2].attachedElement = this.$refs.step3.$el;
35
+ args.steps[3].attachedElement = this.$refs.step4.$el;
36
+ this.attachedElementsLoaded = true;
37
+ });
38
+ },
39
+ template: `
40
+ <div style="height: 50%; width: 30%; border: 1px solid #ccc; padding: 16px; margin: auto">
41
+ <button @click="startTour">Start tour</button>
42
+ <button @click="handleTourStep(3)">Go to step 3</button>
43
+ <UnnnicCard
44
+ type="default"
45
+ title="This is the title"
46
+ description="This is the description"
47
+ ref="step1"
48
+ />
49
+ <UnnnicCard
50
+ type="default"
51
+ title="This is the title"
52
+ description="This is the description"
53
+ ref="step2"
54
+ />
55
+ <UnnnicCard
56
+ type="default"
57
+ title="This is the title"
58
+ description="This is the description"
59
+ ref="step3"
60
+ />
61
+ <UnnnicCard
62
+ type="default"
63
+ title="This is the title"
64
+ description="This is the description"
65
+ ref="step4"
66
+ />
67
+ <unnnic-tour v-if="attachedElementsLoaded" v-bind="args" ref="tour" />
68
+ </div>
69
+ `,
70
+ }),
71
+ };
72
+
73
+ export const Default = {
74
+ args: {
75
+ steps: [
76
+ {
77
+ title: 'Step 1',
78
+ description:
79
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dapibus euismod nibh vel elementum. Integer nisi lectus, hendrerit aliquet tellus nec, volutpat porttitor erat. Vivamus tincidunt sit amet ex non. ',
80
+ attachedElement: null,
81
+ popoverPosition: 'right',
82
+ },
83
+ {
84
+ title: 'Step 2',
85
+ description:
86
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec luctus dui orci. ',
87
+ attachedElement: null,
88
+ popoverPosition: 'bottom',
89
+ },
90
+ {
91
+ title: 'Step 3',
92
+ description:
93
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed condimentum accumsan erat, at bibendum nisi mollis et. Aliquam venenatis tristique.',
94
+ attachedElement: null,
95
+ popoverPosition: 'left',
96
+ },
97
+ {
98
+ title: 'Step 4',
99
+ description:
100
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Mauris ex purus, ullamcorper sed nunc eu. ',
101
+ attachedElement: null,
102
+ popoverPosition: 'top',
103
+ },
104
+ ],
105
+ },
106
+ };
107
+
108
+ export const WithPadding = {
109
+ args: {
110
+ steps: [
111
+ {
112
+ title: 'Step 1',
113
+ description:
114
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dapibus euismod nibh vel elementum. Integer nisi lectus, hendrerit aliquet tellus nec, volutpat porttitor erat. Vivamus tincidunt sit amet ex non. ',
115
+ attachedElement: null,
116
+ popoverPosition: 'right',
117
+ padding: {
118
+ vertical: 20,
119
+ horizontal: 20,
120
+ },
121
+ },
122
+ ],
123
+ },
124
+ render: (args) => ({
125
+ components: {
126
+ UnnnicTour,
127
+ UnnnicCard,
128
+ },
129
+ setup() {
130
+ return { args };
131
+ },
132
+ data() {
133
+ return {
134
+ attachedElementsLoaded: false,
135
+ };
136
+ },
137
+ methods: {
138
+ startTour() {
139
+ this.$refs.tour.start();
140
+ },
141
+ },
142
+ mounted() {
143
+ this.$nextTick(() => {
144
+ args.steps[0].attachedElement = this.$refs.step1.$el;
145
+ this.attachedElementsLoaded = true;
146
+ });
147
+ },
148
+ template: `
149
+ <div style="height: 50%; width: 30%; border: 1px solid #ccc; padding: 16px; margin: auto">
150
+ <button @click="startTour">Start tour</button>
151
+ <UnnnicCard
152
+ type="default"
153
+ title="This is the title"
154
+ description="This is the description"
155
+ ref="step1"
156
+ />
157
+ <unnnic-tour v-if="attachedElementsLoaded" v-bind="args" ref="tour" />
158
+ </div>
159
+ `,
160
+ }),
161
+ };
162
+
163
+ export const WithNegativePadding = {
164
+ args: {
165
+ steps: [
166
+ {
167
+ title: 'Step 1',
168
+ description:
169
+ 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec dapibus euismod nibh vel elementum. Integer nisi lectus, hendrerit aliquet tellus nec, volutpat porttitor erat. Vivamus tincidunt sit amet ex non. ',
170
+ attachedElement: null,
171
+ popoverPosition: 'right',
172
+ padding: {
173
+ vertical: -30,
174
+ horizontal: -10,
175
+ },
176
+ },
177
+ ],
178
+ },
179
+ render: (args) => ({
180
+ components: {
181
+ UnnnicTour,
182
+ UnnnicCard,
183
+ },
184
+ setup() {
185
+ return { args };
186
+ },
187
+ data() {
188
+ return {
189
+ attachedElementsLoaded: false,
190
+ };
191
+ },
192
+ methods: {
193
+ startTour() {
194
+ this.$refs.tour.start();
195
+ },
196
+ },
197
+ mounted() {
198
+ this.$nextTick(() => {
199
+ args.steps[0].attachedElement = this.$refs.step1.$el;
200
+ this.attachedElementsLoaded = true;
201
+ });
202
+ },
203
+ template: `
204
+ <div style="height: 50%; width: 30%; border: 1px solid #ccc; padding: 16px; margin: auto">
205
+ <button @click="startTour">Start tour</button>
206
+ <UnnnicCard
207
+ type="default"
208
+ title="This is the title"
209
+ description="This is the description"
210
+ ref="step1"
211
+ />
212
+ <unnnic-tour v-if="attachedElementsLoaded" v-bind="args" ref="tour" />
213
+ </div>
214
+ `,
215
+ }),
216
+ };