@vuesimple/vs-toast 1.4.15 → 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.
@@ -1,916 +0,0 @@
1
- import Vue from 'vue';
2
-
3
- //
4
- //
5
- //
6
- //
7
- //
8
- //
9
- //
10
- //
11
- //
12
- //
13
- //
14
- //
15
- //
16
- //
17
- //
18
- //
19
- //
20
- //
21
- //
22
- //
23
- //
24
- //
25
- //
26
- //
27
- //
28
- //
29
- //
30
- //
31
- //
32
- //
33
- //
34
- //
35
- //
36
- //
37
- //
38
- //
39
- //
40
- //
41
- //
42
- //
43
- //
44
- //
45
- //
46
- //
47
- //
48
- //
49
- //
50
- //
51
- //
52
- //
53
- //
54
- //
55
- //
56
- //
57
- //
58
- //
59
- //
60
- //
61
- //
62
- //
63
- //
64
- //
65
- //
66
- //
67
- //
68
- //
69
- //
70
- //
71
- //
72
- //
73
- //
74
- //
75
- //
76
- //
77
- //
78
- //
79
- //
80
- //
81
- //
82
- //
83
- //
84
- //
85
- //
86
- //
87
- //
88
- //
89
- //
90
- //
91
- //
92
- //
93
- //
94
- //
95
- //
96
- //
97
- //
98
- //
99
- //
100
- //
101
- //
102
- //
103
- //
104
- //
105
- //
106
- //
107
- //
108
- //
109
- //
110
- //
111
- //
112
- //
113
-
114
- var script = {
115
- name: 'VsAlert',
116
-
117
- props: {
118
- // Variants: success, warning, error, info, secondary
119
- variant: {
120
- type: String,
121
- required: true,
122
- validator: value => ['success', 'error', 'info', 'warning', 'secondary'].includes(value.toLowerCase()),
123
- },
124
- showClose: {
125
- type: Boolean,
126
- default: false,
127
- },
128
- title: {
129
- type: String,
130
- },
131
- noBg: {
132
- type: Boolean,
133
- default: false,
134
- },
135
- small: {
136
- type: Boolean,
137
- default: false,
138
- },
139
- toast: {
140
- type: Boolean,
141
- default: false,
142
- },
143
- },
144
-
145
- computed: {
146
- classList() {
147
- return [
148
- `vs-alert-${this.variant}`,
149
- { 'vs-alert--no-bg': this.noBg },
150
- { 'vs-alert--small': this.small },
151
- { 'vs-alert--toast': this.toast },
152
- { 'vs-alert--is-close': this.showClose },
153
- ];
154
- },
155
- },
156
- };
157
-
158
- function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
159
- if (typeof shadowMode !== 'boolean') {
160
- createInjectorSSR = createInjector;
161
- createInjector = shadowMode;
162
- shadowMode = false;
163
- }
164
- // Vue.extend constructor export interop.
165
- const options = typeof script === 'function' ? script.options : script;
166
- // render functions
167
- if (template && template.render) {
168
- options.render = template.render;
169
- options.staticRenderFns = template.staticRenderFns;
170
- options._compiled = true;
171
- // functional template
172
- if (isFunctionalTemplate) {
173
- options.functional = true;
174
- }
175
- }
176
- // scopedId
177
- if (scopeId) {
178
- options._scopeId = scopeId;
179
- }
180
- let hook;
181
- if (moduleIdentifier) {
182
- // server build
183
- hook = function (context) {
184
- // 2.3 injection
185
- context =
186
- context || // cached call
187
- (this.$vnode && this.$vnode.ssrContext) || // stateful
188
- (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext); // functional
189
- // 2.2 with runInNewContext: true
190
- if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
191
- context = __VUE_SSR_CONTEXT__;
192
- }
193
- // inject component styles
194
- if (style) {
195
- style.call(this, createInjectorSSR(context));
196
- }
197
- // register component module identifier for async chunk inference
198
- if (context && context._registeredComponents) {
199
- context._registeredComponents.add(moduleIdentifier);
200
- }
201
- };
202
- // used by ssr in case component is cached and beforeCreate
203
- // never gets called
204
- options._ssrRegister = hook;
205
- }
206
- else if (style) {
207
- hook = shadowMode
208
- ? function (context) {
209
- style.call(this, createInjectorShadow(context, this.$root.$options.shadowRoot));
210
- }
211
- : function (context) {
212
- style.call(this, createInjector(context));
213
- };
214
- }
215
- if (hook) {
216
- if (options.functional) {
217
- // register for functional component in vue file
218
- const originalRender = options.render;
219
- options.render = function renderWithStyleInjection(h, context) {
220
- hook.call(context);
221
- return originalRender(h, context);
222
- };
223
- }
224
- else {
225
- // inject component registration as beforeCreate hook
226
- const existing = options.beforeCreate;
227
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
228
- }
229
- }
230
- return script;
231
- }
232
-
233
- const isOldIE = typeof navigator !== 'undefined' &&
234
- /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
235
- function createInjector(context) {
236
- return (id, style) => addStyle(id, style);
237
- }
238
- let HEAD;
239
- const styles = {};
240
- function addStyle(id, css) {
241
- const group = isOldIE ? css.media || 'default' : id;
242
- const style = styles[group] || (styles[group] = { ids: new Set(), styles: [] });
243
- if (!style.ids.has(id)) {
244
- style.ids.add(id);
245
- let code = css.source;
246
- if (css.map) {
247
- // https://developer.chrome.com/devtools/docs/javascript-debugging
248
- // this makes source maps inside style tags work properly in Chrome
249
- code += '\n/*# sourceURL=' + css.map.sources[0] + ' */';
250
- // http://stackoverflow.com/a/26603875
251
- code +=
252
- '\n/*# sourceMappingURL=data:application/json;base64,' +
253
- btoa(unescape(encodeURIComponent(JSON.stringify(css.map)))) +
254
- ' */';
255
- }
256
- if (!style.element) {
257
- style.element = document.createElement('style');
258
- style.element.type = 'text/css';
259
- if (css.media)
260
- style.element.setAttribute('media', css.media);
261
- if (HEAD === undefined) {
262
- HEAD = document.head || document.getElementsByTagName('head')[0];
263
- }
264
- HEAD.appendChild(style.element);
265
- }
266
- if ('styleSheet' in style.element) {
267
- style.styles.push(code);
268
- style.element.styleSheet.cssText = style.styles
269
- .filter(Boolean)
270
- .join('\n');
271
- }
272
- else {
273
- const index = style.ids.size - 1;
274
- const textNode = document.createTextNode(code);
275
- const nodes = style.element.childNodes;
276
- if (nodes[index])
277
- style.element.removeChild(nodes[index]);
278
- if (nodes.length)
279
- style.element.insertBefore(textNode, nodes[index]);
280
- else
281
- style.element.appendChild(textNode);
282
- }
283
- }
284
- }
285
-
286
- /* script */
287
- const __vue_script__ = script;
288
-
289
- /* template */
290
- var __vue_render__ = function() {
291
- var _vm = this;
292
- var _h = _vm.$createElement;
293
- var _c = _vm._self._c || _h;
294
- return _c(
295
- "div",
296
- { class: ["vs-alert", _vm.classList] },
297
- [
298
- _c(
299
- "span",
300
- { staticClass: "vs-alert-icon__wrapper" },
301
- [
302
- _vm._t("icon", [
303
- _vm.variant === "success"
304
- ? _c(
305
- "svg",
306
- {
307
- attrs: {
308
- xmlns: "http://www.w3.org/2000/svg",
309
- width: "16",
310
- height: "16",
311
- viewBox: "0 0 16 16",
312
- role: "presentation",
313
- focussable: "false"
314
- }
315
- },
316
- [
317
- _c(
318
- "g",
319
- {
320
- attrs: {
321
- fill: "none",
322
- stroke: "var(--vs-alert-success-icon)"
323
- }
324
- },
325
- [
326
- _c("path", {
327
- attrs: {
328
- "stroke-linecap": "round",
329
- "stroke-linejoin": "round",
330
- d: "M4 9l2.5 2.5 5-5"
331
- }
332
- }),
333
- _vm._v(" "),
334
- _c("circle", {
335
- attrs: { cx: "7.5", cy: "8.5", r: "7" }
336
- })
337
- ]
338
- )
339
- ]
340
- )
341
- : _vm._e(),
342
- _vm._v(" "),
343
- _vm.variant === "warning"
344
- ? _c(
345
- "svg",
346
- {
347
- attrs: {
348
- xmlns: "http://www.w3.org/2000/svg",
349
- width: "16",
350
- height: "16",
351
- viewBox: "0 0 16 16",
352
- role: "presentation",
353
- focussable: "false"
354
- }
355
- },
356
- [
357
- _c("path", {
358
- attrs: {
359
- fill: "none",
360
- stroke: "var(--vs-alert-warning-icon)",
361
- "stroke-linecap": "round",
362
- d:
363
- "M.88 13.77L7.06 1.86c.19-.36.7-.36.89 0l6.18 11.91c.17.33-.07.73-.44.73H1.32c-.37 0-.61-.4-.44-.73zM7.5 6v3.5"
364
- }
365
- }),
366
- _vm._v(" "),
367
- _c("circle", {
368
- attrs: { cx: "7.5", cy: "12", r: "1", fill: "#ad5918" }
369
- })
370
- ]
371
- )
372
- : _vm._e(),
373
- _vm._v(" "),
374
- _vm.variant === "error"
375
- ? _c(
376
- "svg",
377
- {
378
- attrs: {
379
- xmlns: "http://www.w3.org/2000/svg",
380
- width: "16",
381
- height: "16",
382
- viewBox: "0 0 16 16",
383
- role: "presentation",
384
- focussable: "false"
385
- }
386
- },
387
- [
388
- _c(
389
- "g",
390
- {
391
- attrs: {
392
- fill: "none",
393
- stroke: "var(--vs-alert-error-icon)"
394
- }
395
- },
396
- [
397
- _c("circle", {
398
- attrs: { cx: "7.5", cy: "8.5", r: "7" }
399
- }),
400
- _vm._v(" "),
401
- _c("path", {
402
- attrs: { "stroke-linecap": "round", d: "M7.5 4.5V9" }
403
- })
404
- ]
405
- ),
406
- _vm._v(" "),
407
- _c("circle", {
408
- attrs: {
409
- cx: "7.5",
410
- cy: "12",
411
- r: "1",
412
- fill: "var(--vs-alert-error-icon)"
413
- }
414
- })
415
- ]
416
- )
417
- : _vm._e(),
418
- _vm._v(" "),
419
- _vm.variant === "info"
420
- ? _c(
421
- "svg",
422
- {
423
- attrs: {
424
- xmlns: "http://www.w3.org/2000/svg",
425
- width: "16",
426
- height: "16",
427
- viewBox: "0 0 16 16",
428
- role: "presentation",
429
- focussable: "false"
430
- }
431
- },
432
- [
433
- _c(
434
- "g",
435
- { attrs: { stroke: "var(--vs-alert-info-icon)" } },
436
- [
437
- _c("circle", {
438
- attrs: { cx: "7.5", cy: "8.5", r: "7", fill: "none" }
439
- }),
440
- _vm._v(" "),
441
- _c("path", {
442
- attrs: { "stroke-linecap": "round", d: "M7.5 12.5V8" }
443
- })
444
- ]
445
- ),
446
- _vm._v(" "),
447
- _c("circle", {
448
- attrs: {
449
- cx: "7.5",
450
- cy: "5",
451
- r: "1",
452
- fill: "var(--vs-alert-info-icon)"
453
- }
454
- })
455
- ]
456
- )
457
- : _vm._e(),
458
- _vm._v(" "),
459
- _vm.variant === "secondary"
460
- ? _c(
461
- "svg",
462
- {
463
- attrs: {
464
- xmlns: "http://www.w3.org/2000/svg",
465
- width: "16",
466
- height: "16",
467
- viewBox: "0 0 16 16",
468
- role: "presentation",
469
- focussable: "false"
470
- }
471
- },
472
- [
473
- _c(
474
- "g",
475
- { attrs: { stroke: "var(--vs-alert-secondary-icon)" } },
476
- [
477
- _c("circle", {
478
- attrs: { cx: "7.5", cy: "8.5", r: "7", fill: "none" }
479
- }),
480
- _vm._v(" "),
481
- _c("path", {
482
- attrs: { "stroke-linecap": "round", d: "M7.5 12.5V8" }
483
- })
484
- ]
485
- ),
486
- _vm._v(" "),
487
- _c("circle", {
488
- attrs: {
489
- cx: "7.5",
490
- cy: "5",
491
- r: "1",
492
- fill: "var(--vs-alert-secondary-icon)"
493
- }
494
- })
495
- ]
496
- )
497
- : _vm._e()
498
- ])
499
- ],
500
- 2
501
- ),
502
- _vm._v(" "),
503
- _c(
504
- "div",
505
- { staticClass: "vs-alert__heading" },
506
- [_vm._t("title", [_vm.title ? [_vm._v(_vm._s(_vm.title))] : _vm._e()])],
507
- 2
508
- ),
509
- _vm._v(" "),
510
- _vm._t("default"),
511
- _vm._v(" "),
512
- _vm.showClose
513
- ? _c(
514
- "button",
515
- {
516
- class: ["vs-alert-button", _vm.variant],
517
- attrs: { "aria-label": "Close" },
518
- on: {
519
- click: function($event) {
520
- return _vm.$emit("close", true)
521
- }
522
- }
523
- },
524
- [
525
- _c(
526
- "svg",
527
- {
528
- attrs: {
529
- xmlns: "http://www.w3.org/2000/svg",
530
- width: "12",
531
- height: "12",
532
- viewBox: "0 0 12 12",
533
- role: "presentation",
534
- focusable: "false"
535
- }
536
- },
537
- [
538
- _c("path", {
539
- attrs: {
540
- stroke: "currentColor",
541
- "stroke-linecap": "round",
542
- d: "M3 9l6-6m0 6L3 3"
543
- }
544
- })
545
- ]
546
- )
547
- ]
548
- )
549
- : _vm._e()
550
- ],
551
- 2
552
- )
553
- };
554
- var __vue_staticRenderFns__ = [];
555
- __vue_render__._withStripped = true;
556
-
557
- /* style */
558
- const __vue_inject_styles__ = function (inject) {
559
- if (!inject) return
560
- inject("data-v-98c9a0d8_0", { source: ".vs-alert {\n --vs-alert-success-bc: #aecfc2;\n --vs-alert-success-bg: #edf8f4;\n --vs-alert-success-color: #186146;\n --vs-alert-success-icon: #038153;\n --vs-alert-warning-bc: #fed6a8;\n --vs-alert-warning-bg: #fff7ed;\n --vs-alert-warning-color: #ad5918;\n --vs-alert-warning-icon: #ad5918;\n --vs-alert-error-bc: #f5b5ba;\n --vs-alert-error-bg: #fff0f1;\n --vs-alert-error-color: #8c232c;\n --vs-alert-error-icon: #cc3340;\n --vs-alert-info-bc: #adcce4;\n --vs-alert-info-bg: #edf7ff;\n --vs-alert-info-color: #1f73b7;\n --vs-alert-info-icon: #337fbd;\n --vs-alert-secondary-bc: #d8dcde;\n --vs-alert-secondary-bg: #f8f9f9;\n --vs-alert-secondary-color: #68737d;\n --vs-alert-secondary-icon: #68737d;\n position: relative;\n border-radius: 4px;\n padding: 20px 20px 20px 40px;\n line-height: 1.42857;\n font-size: 14px;\n}\n.vs-alert-icon__wrapper svg {\n position: absolute;\n left: 15px;\n margin-top: 1px;\n}\n.vs-alert__heading {\n font-weight: 600;\n filter: brightness(85%);\n}\n.vs-alert-button {\n display: block;\n position: absolute;\n top: 15px;\n right: 10px;\n transition: background-color 0.1s ease-in-out 0s, color 0.25s ease-in-out 0s;\n border: none;\n background-color: transparent;\n cursor: pointer;\n padding: 0px;\n width: 28px;\n height: 28px;\n overflow: hidden;\n color: #333333;\n font-size: 0px;\n user-select: none;\n}\n.vs-alert-button.success {\n color: var(--vs-alert-success-color);\n}\n.vs-alert-button.warning {\n color: var(--vs-alert-warning-color);\n}\n.vs-alert-button.error {\n color: var(--vs-alert-error-color);\n}\n.vs-alert-button.info {\n color: var(--vs-alert-info-color);\n}\n.vs-alert-button.secondary {\n color: var(--vs-alert-secondary-color);\n}\n.vs-alert-success {\n border: 1px solid var(--vs-alert-success-bc);\n background-color: var(--vs-alert-success-bg);\n color: var(--vs-alert-success-color);\n}\n.vs-alert-warning {\n border: 1px solid var(--vs-alert-warning-bc);\n background-color: var(--vs-alert-warning-bg);\n color: var(--vs-alert-warning-color);\n}\n.vs-alert-error {\n border: 1px solid var(--vs-alert-error-bc);\n background-color: var(--vs-alert-error-bg);\n color: var(--vs-alert-error-color);\n}\n.vs-alert-info {\n border: 1px solid var(--vs-alert-info-bc);\n background-color: var(--vs-alert-info-bg);\n color: var(--vs-alert-info-color);\n}\n.vs-alert-secondary {\n border: 1px solid var(--vs-alert-secondary-bc);\n background-color: var(--vs-alert-secondary-bg);\n color: var(--vs-alert-secondary-color);\n}\n.vs-alert.vs-alert--small:not(.vs-alert--is-close) {\n padding: 12px 20px 12px 40px;\n}\n.vs-alert.vs-alert--is-close:not(.vs-alert--small) {\n padding: 20px 40px;\n}\n.vs-alert.vs-alert--is-close.vs-alert--small {\n padding: 12px 40px;\n}\n.vs-alert.vs-alert--is-close.vs-alert--small .vs-alert-button {\n top: 8px;\n}\n.vs-alert--no-bg {\n background-color: transparent;\n border-color: transparent;\n padding: 0 22px;\n font-size: 13px;\n}\n.vs-alert--no-bg .vs-alert-icon__wrapper svg {\n left: 0;\n margin-top: 0;\n}\n.vs-alert--no-bg.vs-alert-warning {\n color: var(--vs-alert-warning-icon);\n}\n.vs-alert--no-bg.vs-alert-error {\n color: var(--vs-alert-error-icon);\n}\n.vs-alert--toast {\n background-color: transparent;\n border: solid 1px #d8dcde;\n color: #2f3941;\n box-shadow: rgba(23, 73, 77, 0.15) 0px 20px 28px 0px;\n padding: 15px 40px;\n}\n.vs-alert--toast .vs-alert__heading {\n filter: brightness(100%);\n}\n.vs-alert--toast.vs-alert-success .vs-alert__heading {\n color: var(--vs-alert-success-icon);\n}\n.vs-alert--toast.vs-alert-warning .vs-alert__heading {\n color: var(--vs-alert-warning-icon);\n}\n.vs-alert--toast.vs-alert-error .vs-alert__heading {\n color: var(--vs-alert-error-icon);\n}\n.vs-alert--toast.vs-alert-info .vs-alert__heading {\n color: var(--vs-alert-info-icon);\n}\n.vs-alert--toast.vs-alert-secondary .vs-alert__heading {\n color: var(--vs-alert-secondary-icon);\n}\n.vs-alert--toast .vs-alert-button {\n color: #68737d;\n top: 10px;\n}", map: undefined, media: undefined });
561
-
562
- };
563
- /* scoped */
564
- const __vue_scope_id__ = undefined;
565
- /* module identifier */
566
- const __vue_module_identifier__ = undefined;
567
- /* functional template */
568
- const __vue_is_functional_template__ = false;
569
- /* style inject SSR */
570
-
571
- /* style inject shadow dom */
572
-
573
-
574
-
575
- const __vue_component__ = /*#__PURE__*/normalizeComponent(
576
- { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ },
577
- __vue_inject_styles__,
578
- __vue_script__,
579
- __vue_scope_id__,
580
- __vue_is_functional_template__,
581
- __vue_module_identifier__,
582
- false,
583
- createInjector,
584
- undefined,
585
- undefined
586
- );
587
-
588
- //
589
-
590
- var script$1 = {
591
- name: 'VsToast',
592
-
593
- props: {
594
- type: {
595
- type: String,
596
- default: 'toast',
597
- },
598
- /**
599
- * Toast title
600
- */
601
- title: {
602
- type: String,
603
- },
604
- /**
605
- * Toast message
606
- */
607
- message: {
608
- type: String,
609
- },
610
- /**
611
- * Toast Variants (same as vs-alert)
612
- * Variants: success, warning, error, info, secondary
613
- */
614
- variant: {
615
- type: String,
616
- },
617
- /**
618
- * Show Toast Close Icon
619
- */
620
- showClose: {
621
- type: Boolean,
622
- default: true,
623
- },
624
- /**
625
- * Position of toast:
626
- * top-left, top-center, top-right, bottom-left, bottom-center, bottom-right
627
- */
628
- position: {
629
- type: String,
630
- default: 'top-center',
631
- validator: value =>
632
- ['top-left', 'top-center', 'top-right', 'bottom-left', 'bottom-center', 'bottom-right'].includes(
633
- value.toLowerCase(),
634
- ),
635
- },
636
- /**
637
- * Animation name:
638
- * vs-toast--transition-{animation}
639
- */
640
- animation: {
641
- type: String,
642
- },
643
- /**
644
- * Toast Timeout
645
- */
646
- timeout: {
647
- type: Number,
648
- default: 5000,
649
- },
650
- /**
651
- * Whether toast should close automatically or not
652
- */
653
- isSticky: {
654
- type: Boolean,
655
- default: false,
656
- },
657
- },
658
-
659
- components: {
660
- VsAlert: __vue_component__,
661
- },
662
-
663
- data() {
664
- return {
665
- isOpen: false,
666
- timerId: null,
667
- isMouseHovered: false,
668
- isTimedOut: false,
669
- };
670
- },
671
-
672
- computed: {
673
- /**
674
- * Main Class List
675
- * @returns {String} class
676
- */
677
- classList() {
678
- return [`vs-toast--${this.position}`];
679
- },
680
-
681
- /**
682
- * Toggle Transition Class
683
- * @returns {String} class
684
- */
685
- toggleTransition() {
686
- const position = this.position.split('-')[0];
687
- // If custom animation
688
- if (this.animation) {
689
- return `vs-toast--transition-${this.animation}`;
690
- }
691
- if (position === 'top') {
692
- return 'vs-toast--transition-slide-down';
693
- }
694
- return 'vs-toast--transition-slide-up';
695
- },
696
- },
697
-
698
- methods: {
699
- /**
700
- * Open Toast
701
- * If timer exists: reset and open
702
- */
703
- async open(options = {}) {
704
- if (Object.keys(options).length !== 0) {
705
- if (this.isOpen) {
706
- this.close();
707
- this.$nextTick(() => this.open(options));
708
- return;
709
- }
710
- options = { ...this.$props, ...options };
711
- Object.keys(options).forEach(field => (this[field] = options[field]));
712
- }
713
-
714
- if (this.timerId) {
715
- await this.close();
716
- }
717
- this.isOpen = true;
718
- this.isTimedOut = false;
719
- if (!this.isSticky) {
720
- this.timerId = setTimeout(async () => {
721
- if (!this.isMouseHovered) {
722
- await this.close();
723
- }
724
- this.isTimedOut = true;
725
- }, this.timeout);
726
- }
727
- },
728
-
729
- /**
730
- * Close Toast
731
- * Clear timerId and clearTimeout
732
- */
733
- close() {
734
- if (this.timerId) {
735
- clearTimeout(this.timerId);
736
- this.timerId = null;
737
- }
738
- this.isOpen = false;
739
- return new Promise(resolve =>
740
- setTimeout(() => {
741
- this.$emit('input', this.isOpen);
742
- resolve();
743
- }, 10),
744
- );
745
- },
746
-
747
- /**
748
- * On mouse hover on toast
749
- * Close only if timedOut and not hovered
750
- */
751
- mouseHover(value = false) {
752
- this.isMouseHovered = value;
753
- if (this.isTimedOut && !this.isMouseHovered) {
754
- this.close();
755
- }
756
- },
757
-
758
- /**
759
- * Emitted after transition is done and opened
760
- */
761
- onEnter() {
762
- this.$emit('reveal');
763
- },
764
-
765
- /**
766
- * Emitted after transition is done and closes
767
- */
768
- onLeave() {
769
- this.$emit('hide');
770
- },
771
- },
772
- };
773
-
774
- /* script */
775
- const __vue_script__$1 = script$1;
776
-
777
- /* template */
778
- var __vue_render__$1 = function() {
779
- var _vm = this;
780
- var _h = _vm.$createElement;
781
- var _c = _vm._self._c || _h;
782
- return _c(
783
- "transition",
784
- {
785
- attrs: { name: _vm.toggleTransition },
786
- on: { "after-enter": _vm.onEnter, "after-leave": _vm.onLeave }
787
- },
788
- [
789
- _vm.isOpen
790
- ? _c(
791
- "div",
792
- {
793
- class: ["vs-toast", _vm.classList],
794
- attrs: { role: "status" },
795
- on: {
796
- mouseover: function($event) {
797
- return _vm.mouseHover(true)
798
- },
799
- mouseleave: function($event) {
800
- return _vm.mouseHover(false)
801
- }
802
- }
803
- },
804
- [
805
- _vm._t(
806
- "custom",
807
- [
808
- _c(
809
- "vs-alert",
810
- {
811
- attrs: {
812
- title: _vm.title,
813
- variant: _vm.variant,
814
- "show-close": _vm.showClose,
815
- toast: _vm.type === "toast"
816
- },
817
- on: { close: _vm.close }
818
- },
819
- [_vm._t("default", [_vm._v(_vm._s(_vm.message))])],
820
- 2
821
- )
822
- ],
823
- { close: _vm.close }
824
- )
825
- ],
826
- 2
827
- )
828
- : _vm._e()
829
- ]
830
- )
831
- };
832
- var __vue_staticRenderFns__$1 = [];
833
- __vue_render__$1._withStripped = true;
834
-
835
- /* style */
836
- const __vue_inject_styles__$1 = function (inject) {
837
- if (!inject) return
838
- inject("data-v-b5577bc8_0", { source: ".vs-toast {\n position: fixed;\n width: 350px;\n max-width: 350px;\n background-color: #ffffff;\n z-index: 9999;\n font-family: inherit;\n text-align: left;\n}\n.vs-toast .vs-alert {\n padding: 15px 40px;\n}\n.vs-toast .vs-alert .vs-alert-button {\n top: 10px;\n}\n.vs-toast--top-center {\n left: calc(50% - 175px);\n top: 5px;\n}\n.vs-toast--top-left {\n left: 5px;\n top: 5px;\n}\n.vs-toast--top-right {\n right: 5px;\n top: 5px;\n}\n.vs-toast--bottom-center {\n left: calc(50% - 175px);\n bottom: 5px;\n}\n.vs-toast--bottom-left {\n left: 5px;\n bottom: 5px;\n}\n.vs-toast--bottom-right {\n right: 5px;\n bottom: 5px;\n}\n.vs-toast--transition-slide-down-enter-active, .vs-toast--transition-slide-down-leave-active {\n transition: 0.3s all ease-in-out;\n}\n.vs-toast--transition-slide-down-enter-to, .vs-toast--transition-slide-down-leave {\n opacity: 1;\n transform: translateY(0px);\n}\n.vs-toast--transition-slide-down-enter, .vs-toast--transition-slide-down-leave-to {\n opacity: 0;\n transform: translateY(-30px);\n}\n.vs-toast--transition-slide-up-enter-active, .vs-toast--transition-slide-up-leave-active {\n transition: 0.3s all ease-in-out;\n}\n.vs-toast--transition-slide-up-enter-to, .vs-toast--transition-slide-up-leave {\n opacity: 1;\n transform: translateY(0px);\n}\n.vs-toast--transition-slide-up-enter, .vs-toast--transition-slide-up-leave-to {\n opacity: 0;\n transform: translateY(30px);\n}", map: undefined, media: undefined });
839
-
840
- };
841
- /* scoped */
842
- const __vue_scope_id__$1 = undefined;
843
- /* module identifier */
844
- const __vue_module_identifier__$1 = undefined;
845
- /* functional template */
846
- const __vue_is_functional_template__$1 = false;
847
- /* style inject SSR */
848
-
849
- /* style inject shadow dom */
850
-
851
-
852
-
853
- const __vue_component__$1 = /*#__PURE__*/normalizeComponent(
854
- { render: __vue_render__$1, staticRenderFns: __vue_staticRenderFns__$1 },
855
- __vue_inject_styles__$1,
856
- __vue_script__$1,
857
- __vue_scope_id__$1,
858
- __vue_is_functional_template__$1,
859
- __vue_module_identifier__$1,
860
- false,
861
- createInjector,
862
- undefined,
863
- undefined
864
- );
865
-
866
- const variant = ['success', 'warning', 'error', 'info', 'secondary'];
867
-
868
- const defaultOptions = {
869
- title: '',
870
- message: '',
871
- variant: 'success',
872
- position: 'top-center',
873
- type: 'toast',
874
- timeout: 5000,
875
- showClose: true,
876
- isSticky: false,
877
- };
878
-
879
- let toastCmp = null;
880
-
881
- function createToastCmp() {
882
- const cmp = new Vue(__vue_component__$1);
883
- document.body.appendChild(cmp.$mount().$el);
884
- return cmp;
885
- }
886
-
887
- function getToastCmp() {
888
- if (!toastCmp) {
889
- toastCmp = createToastCmp();
890
- }
891
- return toastCmp;
892
- }
893
-
894
- function show(options = {}) {
895
- getToastCmp().open({ ...defaultOptions, ...options });
896
- }
897
-
898
- function close() {
899
- getToastCmp().close();
900
- }
901
-
902
- function createShorthands() {
903
- const shorthands = {};
904
- variant.forEach(variant => (shorthands[variant] = (message, options = {}) => show({ variant, message, ...options })));
905
- return shorthands;
906
- }
907
-
908
- var index = {
909
- show,
910
- close,
911
- getToastCmp,
912
- defaultOptions,
913
- ...createShorthands(),
914
- };
915
-
916
- export default index;