@asd20/ui 3.2.963 → 3.2.965

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.
@@ -1,247 +0,0 @@
1
- <template>
2
- <div class="asd20-tour-guide">
3
- <v-tour
4
- :steps="steps"
5
- :callbacks="{
6
- onStart: onStart,
7
- onNextStep: onNextStep,
8
- onPreviousStep: onPreviousStep,
9
- onStop: onStop,
10
- }"
11
- :name="name"
12
- >
13
- <template slot-scope="tour">
14
- <transition name="fade">
15
- <template v-for="(step, index) of tour.steps">
16
- <v-step
17
- v-if="tour.currentStep === index"
18
- :key="index"
19
- :step="step"
20
- :previous-step="tour.previousStep"
21
- :next-step="tour.nextStep"
22
- :stop="tour.stop"
23
- :is-first="tour.isFirst"
24
- :is-last="tour.isLast"
25
- :labels="tour.labels"
26
- >
27
- <template>
28
- <div slot="actions" class="v-step__actions">
29
- <asd20-button
30
- v-if="!tour.isFirst"
31
- transparent
32
- horizontal
33
- class="btn btn-primary"
34
- label="Previous"
35
- @click.native="tour.previousStep"
36
- />
37
- <asd20-button
38
- :label="tour.isLast ? 'Finish' : 'Skip Tour'"
39
- transparent
40
- horizontal
41
- class="btn btn-primary"
42
- @click.native="tour.stop"
43
- />
44
- <asd20-button
45
- v-if="!tour.isLast"
46
- transparent
47
- horizontal
48
- class="btn btn-primary"
49
- label="Next"
50
- @click.native="tour.nextStep"
51
- />
52
- </div>
53
- </template>
54
- </v-step>
55
- </template>
56
- </transition>
57
- </template>
58
- </v-tour>
59
- <asd20-modal
60
- v-if="useIntro"
61
- class="intro-modal"
62
- :open="showIntro"
63
- :title="introTitle"
64
- icon="info"
65
- dismissable
66
- windowed
67
- @dismiss="showIntro = false"
68
- >
69
- <Asd20Viewport padded scrollable>
70
- <slot name="intro" />
71
-
72
- <asd20-button
73
- transparent
74
- bordered
75
- horizontal
76
- label="Take a Tour"
77
- @click.native="
78
- showIntro = false
79
- $tours[name].start()
80
- "
81
- />
82
- </Asd20Viewport>
83
- </asd20-modal>
84
- </div>
85
- </template>
86
-
87
- <script>
88
- import Vue from 'vue'
89
- import Asd20Modal from '../../molecules/Asd20Modal'
90
- import Asd20Viewport from '../../atoms/Asd20Viewport'
91
- import VueTour from 'vue-tour'
92
- import 'vue-tour/dist/vue-tour.css'
93
-
94
- const safeCall = (obj, funcName, ...args) => {
95
- if (
96
- obj !== undefined &&
97
- obj &&
98
- obj.hasOwnProperty(funcName) &&
99
- typeof obj[funcName] === 'function'
100
- )
101
- obj[funcName](...args)
102
- }
103
-
104
- Vue.use(VueTour)
105
-
106
- export default {
107
- name: 'App',
108
- components: { Asd20Modal, Asd20Viewport },
109
- data: () => ({
110
- showIntro: false,
111
- }),
112
- props: {
113
- name: { type: String, default: 'tour' },
114
- steps: { type: Array, default: () => [] },
115
- callbacks: {
116
- type: Object,
117
- default: null,
118
- },
119
- useIntro: { type: Boolean, default: false },
120
- introTitle: { type: String, default: 'Tour' },
121
- },
122
-
123
- methods: {
124
- onStart() {
125
- const curStepEl = document.querySelector(this.steps[0].target)
126
- const curStepElParent = curStepEl.parentNode
127
-
128
- //Add the active class for the first step
129
- curStepEl.classList.add('tour-active')
130
- curStepElParent.classList.add('tour-active-parent')
131
- safeCall(this.callbacks, 'onStart')
132
- },
133
- onNextStep(step) {
134
- const curStepEl = document.querySelector(this.steps[step].target)
135
- const curStepElParent = curStepEl.parentNode
136
- const nextStepEl = document.querySelector(this.steps[step + 1].target)
137
- const nextStepElParent = nextStepEl.parentNode
138
-
139
- //Add active class to next step and remove from current.
140
- curStepEl.classList.remove('tour-active')
141
- curStepElParent.classList.remove('tour-active-parent')
142
- nextStepEl.classList.add('tour-active')
143
- nextStepElParent.classList.add('tour-active-parent')
144
- safeCall(this.callbacks, 'onNextStep', step)
145
- },
146
- onPreviousStep(step) {
147
- const curStepEl = document.querySelector(this.steps[step].target)
148
- const prevStepEl = document.querySelector(this.steps[step - 1].target)
149
- const curStepElParent = curStepEl.parentNode
150
- const prevStepElParent = prevStepEl.parentNode
151
-
152
- //Add active step to previous and remove from current.
153
- curStepEl.classList.remove('tour-active')
154
- curStepElParent.classList.remove('tour-active-parent')
155
- prevStepEl.classList.add('tour-active')
156
- prevStepElParent.classList.add('tour-active-parent')
157
- safeCall(this.callbacks, 'onPreviousStep', step)
158
- },
159
- onStop() {
160
- document.querySelector(`.tour-active`).classList.remove('tour-active')
161
- document
162
- .querySelector(`.tour-active-parent`)
163
- .classList.remove('tour-active-parent')
164
- safeCall(this.callbacks, 'onStop')
165
- },
166
- },
167
- }
168
- </script>
169
-
170
- <style lang="scss" scoped>
171
- @import '../../../design/_variables.scss';
172
-
173
- .asd20-tour-guide {
174
- &::v-deep .v-tour .v-step {
175
- z-index: 10001;
176
- background: white;
177
- color: var(--website-card__reverse-background-color);
178
- border-radius: 0;
179
- box-shadow: 0 0 0 1px var(--color__tertiary),
180
- 0 0 2rem 0 var(--color__secondary);
181
- filter: none;
182
- }
183
-
184
- &::v-deep .v-step__actions {
185
- display: flex;
186
- margin: 0 -1rem -1rem -1rem;
187
- :first-child {
188
- margin-right: auto;
189
- }
190
- :last-child {
191
- margin-right: 0;
192
- margin-left: auto;
193
- }
194
- }
195
-
196
- &::v-deep .v-tour .v-step__header {
197
- background: transparent;
198
- border-bottom: 1px solid var(--color__tertiary);
199
- margin-bottom: space(1);
200
- padding: space(0.5) space(1);
201
- border-radius: 0;
202
- color: var(--color__primary);
203
- font-size: 1.125rem;
204
- font-weight: bold;
205
- }
206
-
207
- &::v-deep .v-tour .v-step .v-step__arrow {
208
- border-width: 0.75rem;
209
- }
210
-
211
- &::v-deep .v-tour .v-step[x-placement^='right'] .v-step__arrow {
212
- left: -1.5rem;
213
- border-right-color: var(--website-page__background-color);
214
- }
215
- &::v-deep .v-tour .v-step[x-placement^='left'] .v-step__arrow {
216
- right: -1.5rem;
217
- border-left-color: var(--website-page__background-color);
218
- }
219
- &::v-deep .v-tour .v-step[x-placement^='top'] .v-step__arrow {
220
- bottom: -1.5rem;
221
- border-top-color: var(--website-page__background-color);
222
- }
223
- &::v-deep .v-tour .v-step[x-placement^='bottom'] .v-step__arrow {
224
- top: -1.5rem;
225
- border-bottom-color: var(--website-page__background-color);
226
- }
227
-
228
- .fade-enter-active,
229
- .fade-leave-active {
230
- transition: opacity 0.5s;
231
- }
232
- .fade-enter,
233
- .fade-leave-to {
234
- opacity: 0;
235
- }
236
- }
237
-
238
- @media (min-width: 1024px) {
239
- .asd20-tour-guide .intro-modal {
240
- &::v-deep .asd20-modal {
241
- align-self: center;
242
- flex-grow: 0;
243
- max-width: 50vw;
244
- }
245
- }
246
- }
247
- </style>