@vuesimple/vs-toast 1.4.18 → 3.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/src/vs-toast.vue CHANGED
@@ -8,8 +8,14 @@
8
8
  @mouseleave="mouseHover(false)"
9
9
  >
10
10
  <slot name="custom" :close="close">
11
- <vs-alert :title="title" :variant="variant" :show-close="showClose" @close="close" :toast="type === 'toast'">
12
- <slot>{{ message }}</slot>
11
+ <vs-alert
12
+ :title="_title"
13
+ :variant="_variant"
14
+ :show-close="_showClose"
15
+ @close="close"
16
+ :toast="_type === 'toast'"
17
+ >
18
+ <slot>{{ _message }}</slot>
13
19
  </vs-alert>
14
20
  </slot>
15
21
  </div>
@@ -98,6 +104,7 @@
98
104
  timerId: null,
99
105
  isMouseHovered: false,
100
106
  isTimedOut: false,
107
+ _position: 'top-center',
101
108
  };
102
109
  },
103
110
 
@@ -107,7 +114,7 @@
107
114
  * @returns {String} class
108
115
  */
109
116
  classList() {
110
- return [`vs-toast--${this.position}`];
117
+ return [`vs-toast--${this._position}`];
111
118
  },
112
119
 
113
120
  /**
@@ -115,10 +122,10 @@
115
122
  * @returns {String} class
116
123
  */
117
124
  toggleTransition() {
118
- const position = this.position.split('-')[0];
125
+ const position = this._position?.split('-')?.[0] || '';
119
126
  // If custom animation
120
- if (this.animation) {
121
- return `vs-toast--transition-${this.animation}`;
127
+ if (this._animation) {
128
+ return `vs-toast--transition-${this._animation}`;
122
129
  }
123
130
  if (position === 'top') {
124
131
  return 'vs-toast--transition-slide-down';
@@ -140,7 +147,7 @@
140
147
  return;
141
148
  }
142
149
  options = { ...this.$props, ...options };
143
- Object.keys(options).forEach(field => (this[field] = options[field]));
150
+ Object.keys(options).forEach(field => (this[`_${field}`] = options[field] || ''));
144
151
  }
145
152
 
146
153
  if (this.timerId) {
@@ -148,13 +155,13 @@
148
155
  }
149
156
  this.isOpen = true;
150
157
  this.isTimedOut = false;
151
- if (!this.isSticky) {
158
+ if (!this._isSticky) {
152
159
  this.timerId = setTimeout(async () => {
153
160
  if (!this.isMouseHovered) {
154
161
  await this.close();
155
162
  }
156
163
  this.isTimedOut = true;
157
- }, this.timeout);
164
+ }, this._timeout);
158
165
  }
159
166
  },
160
167
 
@@ -262,13 +269,13 @@
262
269
  transition: 0.3s all ease-in-out;
263
270
  }
264
271
 
265
- &--transition-slide-down-enter-to,
266
- &--transition-slide-down-leave {
272
+ &--transition-slide-down-enter-from,
273
+ &--transition-slide-down-leave-to {
267
274
  opacity: 1;
268
275
  transform: translateY(0px);
269
276
  }
270
277
 
271
- &--transition-slide-down-enter,
278
+ &--transition-slide-down-enter-from,
272
279
  &--transition-slide-down-leave-to {
273
280
  opacity: 0;
274
281
  transform: translateY(-30px);
@@ -280,13 +287,13 @@
280
287
  transition: 0.3s all ease-in-out;
281
288
  }
282
289
 
283
- &--transition-slide-up-enter-to,
284
- &--transition-slide-up-leave {
290
+ &--transition-slide-up-enter-from,
291
+ &--transition-slide-up-leave-to {
285
292
  opacity: 1;
286
293
  transform: translateY(0px);
287
294
  }
288
295
 
289
- &--transition-slide-up-enter,
296
+ &--transition-slide-up-enter-from,
290
297
  &--transition-slide-up-leave-to {
291
298
  opacity: 0;
292
299
  transform: translateY(30px);