@vuesimple/vs-modal 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.
- package/README.md +8 -13
- package/build/vite.config.js +33 -0
- package/dist/index.js +341 -0
- package/dist/index.min.js +1 -0
- package/dist/index.umd.js +1 -0
- package/package.json +8 -14
- package/src/index.js +4 -23
- package/src/vs-modal.vue +3 -3
- package/dist/vs-modal.esm.js +0 -811
- package/dist/vs-modal.min.js +0 -1
- package/dist/vs-modal.umd.js +0 -821
package/README.md
CHANGED
|
@@ -31,10 +31,6 @@ Code Sandbox: [Link](https://codesandbox.io/s/vs-modal-n2wwm)
|
|
|
31
31
|
npm i @vuesimple/vs-modal
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
```bash
|
|
35
|
-
yarn add @vuesimple/vs-modal
|
|
36
|
-
```
|
|
37
|
-
|
|
38
34
|
<br />
|
|
39
35
|
|
|
40
36
|
### 🚀 Usage
|
|
@@ -42,9 +38,7 @@ yarn add @vuesimple/vs-modal
|
|
|
42
38
|
```html
|
|
43
39
|
<template>
|
|
44
40
|
<button size="sm" @click="openModal('modal1')">Basic Modal</button>
|
|
45
|
-
<vs-modal ref="modal1" title="Funny, Modal Works 🥳">
|
|
46
|
-
Hello Peeps from vs-modal!!
|
|
47
|
-
</vs-modal>
|
|
41
|
+
<vs-modal ref="modal1" title="Funny, Modal Works 🥳"> Hello Peeps from vs-modal!! </vs-modal>
|
|
48
42
|
|
|
49
43
|
<button size="sm" @click="openModal('backdrop-modal')">Basic Modal (with blur backdrop)</button>
|
|
50
44
|
<vs-modal ref="backdrop-modal" backdropBlur title="Funny, Modal Works 🥳">
|
|
@@ -81,12 +75,15 @@ yarn add @vuesimple/vs-modal
|
|
|
81
75
|
<script src="https://unpkg.com/@vuesimple/vs-modal@<version>/dist/vs-modal.min.js"></script>
|
|
82
76
|
```
|
|
83
77
|
|
|
78
|
+
```javascript
|
|
79
|
+
// Main/Entry file
|
|
80
|
+
app.use(VsModal);
|
|
81
|
+
```
|
|
82
|
+
|
|
84
83
|
```html
|
|
85
84
|
<template>
|
|
86
85
|
<button size="sm" @click="openModal('modal1')">Basic Modal</button>
|
|
87
|
-
<vs-modal ref="modal1" title="Funny, Modal Works 🥳">
|
|
88
|
-
Hello Peeps from vs-modal!!
|
|
89
|
-
</vs-modal>
|
|
86
|
+
<vs-modal ref="modal1" title="Funny, Modal Works 🥳"> Hello Peeps from vs-modal!! </vs-modal>
|
|
90
87
|
</template>
|
|
91
88
|
|
|
92
89
|
<script>
|
|
@@ -140,9 +137,7 @@ After installation,
|
|
|
140
137
|
<button size="sm" @click="openModal('modal1')">Basic Modal</button>
|
|
141
138
|
|
|
142
139
|
<client-only>
|
|
143
|
-
<vs-modal ref="modal1" title="Funny, Modal Works 🥳">
|
|
144
|
-
Hello Peeps from V-Simple-Modal!!
|
|
145
|
-
</vs-modal>
|
|
140
|
+
<vs-modal ref="modal1" title="Funny, Modal Works 🥳"> Hello Peeps from V-Simple-Modal!! </vs-modal>
|
|
146
141
|
</client-only>
|
|
147
142
|
</template>
|
|
148
143
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import vue from '@vitejs/plugin-vue';
|
|
2
|
+
import VitePluginStyleInject from 'vite-plugin-style-inject';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
plugins: [vue(), VitePluginStyleInject()],
|
|
6
|
+
build: {
|
|
7
|
+
// separate css file or not
|
|
8
|
+
cssCodeSplit: false,
|
|
9
|
+
lib: {
|
|
10
|
+
entry: './src/index.js',
|
|
11
|
+
formats: ['es', 'umd', 'iife'],
|
|
12
|
+
name: 'VsModal',
|
|
13
|
+
fileName: format => {
|
|
14
|
+
if (format === 'es') {
|
|
15
|
+
return 'index.js';
|
|
16
|
+
}
|
|
17
|
+
if (format === 'umd') {
|
|
18
|
+
return 'index.umd.js';
|
|
19
|
+
}
|
|
20
|
+
return 'index.min.js';
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
rollupOptions: {
|
|
24
|
+
// Not to bundle vue core in this plugin
|
|
25
|
+
external: ['vue'],
|
|
26
|
+
output: {
|
|
27
|
+
globals: {
|
|
28
|
+
vue: 'Vue',
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".vs-focus-container__focus-redirector,.vs-focus-container__last-focusable{opacity:0;position:absolute}.vs-focus-container__content{outline:none}.vs-modal{font-size:.875em}.vs-modal.is-aligned-top .vs-modal__wrapper{vertical-align:initial}.vs-modal.is-aligned-top.has-footer .vs-modal__body,.vs-modal.has-footer .vs-modal__body{max-height:calc(100vh - 125px)}.vs-modal:not(.has-footer) .vs-modal__body{padding:21px 24px}.vs-modal--is-open{overflow:hidden}.vs-modal.is-backdrop-blur{backdrop-filter:blur(3px)}.vs-modal__mask{display:table;position:fixed;z-index:800;top:0;left:0;width:100%;height:100vh;transition:opacity .3s ease;background-color:#33333380}.vs-modal__wrapper{display:table-cell;overflow-x:hidden;text-align:center;vertical-align:middle}.vs-modal__wrapper.has-dummy-scrollbar{overflow-y:scroll}.vs-modal__container{display:inline-block;position:relative;width:530px;max-width:100vw;max-height:100vh;margin:0 auto;padding:0;overflow:hidden;transition:all .3s ease;border-radius:3px;outline:none;background-color:#fff;box-shadow:0 2px 8px #33333354;text-align:initial}.vs-modal__header{display:flex;position:relative;z-index:1;align-items:center;min-height:55px;padding:0 24px}.vs-modal__header-text{display:flex;flex-grow:1;align-items:center;margin:0;font-size:1.125em;font-weight:400}.vs-modal__close-button button{position:absolute;z-index:100;top:20px;right:20px;background:none;border:none;text-align:right;margin:0;padding:0;cursor:pointer}.vs-modal__close-button button img{width:12px;height:12px}.vs-modal__body{max-height:calc(100vh - 55px);padding:16px 24px;overflow-y:auto}.vs-modal__footer{display:flex;align-items:center;justify-content:flex-end;height:70px;padding:0 24px}.vs-modal--size-s>.vs-modal__wrapper>.vs-modal__container{width:320px}.vs-modal--size-l>.vs-modal__wrapper>.vs-modal__container{width:850px}.vs-modal--size-fullscreen>.vs-modal__wrapper>.vs-modal__container{width:100vw;border-radius:0}.vs-modal--size-fullscreen>.vs-modal__wrapper>.vs-modal__container .vs-modal__body{height:100vh;max-height:100vh}.vs-modal--size-auto>.vs-modal__wrapper>.vs-modal__container{width:initial}.vs-modal--transition-fade-enter-from,.vs-modal--transition-fade-leave-active,.vs-modal--transition-slide-up-enter-from,.vs-modal--transition-slide-up-leave-active{opacity:0}.vs-modal--transition-slide-up-enter-from .vs-modal__container,.vs-modal--transition-slide-up-leave-active .vs-modal__container{transform:translateY(20px)}.vs-modal--transition-slide-down-enter-from,.vs-modal--transition-slide-down-leave-active{opacity:0}.vs-modal--transition-slide-down-enter-from .vs-modal__container,.vs-modal--transition-slide-down-leave-active .vs-modal__container{transform:translateY(-20px)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();import { openBlock as i, createBlock as b, resolveDynamicComponent as E, withCtx as p, createElementBlock as l, createCommentVNode as c, createElementVNode as a, renderSlot as f, resolveComponent as w, Transition as M, withDirectives as S, normalizeClass as v, withModifiers as A, normalizeStyle as T, createVNode as x, withKeys as R, toDisplayString as V, vShow as I } from "vue";
|
|
2
|
+
const C = (e, t) => {
|
|
3
|
+
const s = e.__vccOpts || e;
|
|
4
|
+
for (const [r, o] of t)
|
|
5
|
+
s[r] = o;
|
|
6
|
+
return s;
|
|
7
|
+
}, z = {
|
|
8
|
+
name: "VsFocusContainer",
|
|
9
|
+
props: {
|
|
10
|
+
containFocus: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: !0
|
|
13
|
+
},
|
|
14
|
+
focusRedirector: Function,
|
|
15
|
+
disabled: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: !1
|
|
18
|
+
},
|
|
19
|
+
tag: {
|
|
20
|
+
type: String,
|
|
21
|
+
default: "div"
|
|
22
|
+
},
|
|
23
|
+
lazy: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !1
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
computed: {
|
|
29
|
+
renderRedirector() {
|
|
30
|
+
return this.disabled ? !1 : this.lazy ? this.containFocus : !0;
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
focus() {
|
|
35
|
+
this.$refs.content.focus();
|
|
36
|
+
},
|
|
37
|
+
redirectFocus(e, t) {
|
|
38
|
+
if (!this.containFocus) {
|
|
39
|
+
this.$emit("focus-overflow", e, t);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (e.stopPropagation(), this.focusRedirector) {
|
|
43
|
+
this.focusRedirector(e, t);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
t.isTabbingForward ? this.$refs.content.focus() : this.$refs.lastFocusable.focus();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, K = {
|
|
50
|
+
ref: "content",
|
|
51
|
+
class: "vs-focus-container__content",
|
|
52
|
+
tabindex: "-1"
|
|
53
|
+
}, N = {
|
|
54
|
+
key: 1,
|
|
55
|
+
ref: "lastFocusable",
|
|
56
|
+
class: "vs-focus-container__last-focusable",
|
|
57
|
+
tabindex: "-1"
|
|
58
|
+
};
|
|
59
|
+
function j(e, t, s, r, o, n) {
|
|
60
|
+
return i(), b(E(s.tag), { class: "vs-focus-container" }, {
|
|
61
|
+
default: p(() => [
|
|
62
|
+
n.renderRedirector ? (i(), l("span", {
|
|
63
|
+
key: 0,
|
|
64
|
+
class: "vs-focus-container__focus-redirector",
|
|
65
|
+
tabindex: "0",
|
|
66
|
+
onFocus: t[0] || (t[0] = (d) => n.redirectFocus(d, { isTabbingForward: !1 }))
|
|
67
|
+
}, null, 32)) : c("", !0),
|
|
68
|
+
a("div", K, [
|
|
69
|
+
f(e.$slots, "default")
|
|
70
|
+
], 512),
|
|
71
|
+
!s.disabled && s.containFocus ? (i(), l("span", N, null, 512)) : c("", !0),
|
|
72
|
+
n.renderRedirector ? (i(), l("span", {
|
|
73
|
+
key: 2,
|
|
74
|
+
class: "vs-focus-container__focus-redirector",
|
|
75
|
+
tabindex: "0",
|
|
76
|
+
onFocus: t[1] || (t[1] = (d) => n.redirectFocus(d, { isTabbingForward: !0 }))
|
|
77
|
+
}, null, 32)) : c("", !0)
|
|
78
|
+
]),
|
|
79
|
+
_: 3
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
const H = /* @__PURE__ */ C(z, [["render", j]]), O = /^\s+|\s+$/g, B = /\s+/g;
|
|
83
|
+
function L(e) {
|
|
84
|
+
return e && typeof e == "object" && typeof e.nodeName == "string" && e.nodeType === 1;
|
|
85
|
+
}
|
|
86
|
+
function F(e) {
|
|
87
|
+
return typeof HTMLElement == "object" ? e instanceof HTMLElement : L(e);
|
|
88
|
+
}
|
|
89
|
+
function h(e) {
|
|
90
|
+
return F(e) ? (e.getAttribute("class") || "").replace(O, "").split(B) : [];
|
|
91
|
+
}
|
|
92
|
+
function m(e) {
|
|
93
|
+
return typeof e == "string" ? e.replace(O, "").split(B) : e;
|
|
94
|
+
}
|
|
95
|
+
function _(e, t) {
|
|
96
|
+
F(e) && e.setAttribute("class", m(t).join(" "));
|
|
97
|
+
}
|
|
98
|
+
function k(e, t) {
|
|
99
|
+
const s = h(e);
|
|
100
|
+
return m(t).forEach((o) => {
|
|
101
|
+
const n = s.indexOf(o);
|
|
102
|
+
n !== -1 && s.splice(n, 1);
|
|
103
|
+
}), _(e, s), s;
|
|
104
|
+
}
|
|
105
|
+
function U(e, t) {
|
|
106
|
+
const s = k(e, t), r = m(t);
|
|
107
|
+
return s.push(...r), _(e, s), s;
|
|
108
|
+
}
|
|
109
|
+
function y(e, t) {
|
|
110
|
+
const s = h(e);
|
|
111
|
+
return m(t).every((o) => s.indexOf(o) !== -1);
|
|
112
|
+
}
|
|
113
|
+
const g = {
|
|
114
|
+
add: U,
|
|
115
|
+
remove: k,
|
|
116
|
+
contains: y,
|
|
117
|
+
has: y,
|
|
118
|
+
set: _,
|
|
119
|
+
get: h
|
|
120
|
+
}, q = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAGFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABWNxwqAAAAB3RSTlMAJeTmmCIcbPbyAQAAAOtJREFUSMeF1ksKwjAURuE6cF50BY4cC4oLEHQquAVXYIVs3wiFn3C4nA76SG+/PpLc2+l9fk7lsr3dp0c71QH79p2ubZmr85t+sgshCHTh1UIQaJe+DkFgmddNBZyyLYGRIAACAAgA2SeAAwI5OowBu/WaEJ95AI4BQBD4N6xEgFyQFsSTYDgJAmgkkFYCIACAAABiAEgAABGgIAIURICCCFAQAEAQYIDewh9SX9M/lH5q7yztbh8wOuR80Oqw94mjU88nr05/TyCagjyJaRr0RKqp2JO5lgMvKFqStKhpWbTC6qVZi7v+HvwAcK2oz9BduqwAAAAASUVORK5CYII=";
|
|
121
|
+
const D = {
|
|
122
|
+
name: "VsModal",
|
|
123
|
+
components: {
|
|
124
|
+
VsFocusContainer: H
|
|
125
|
+
},
|
|
126
|
+
props: {
|
|
127
|
+
title: {
|
|
128
|
+
type: String,
|
|
129
|
+
default: "Modal title"
|
|
130
|
+
},
|
|
131
|
+
alignTop: {
|
|
132
|
+
type: Boolean,
|
|
133
|
+
default: !1
|
|
134
|
+
},
|
|
135
|
+
alignTopMargin: {
|
|
136
|
+
type: Number,
|
|
137
|
+
default: 60
|
|
138
|
+
},
|
|
139
|
+
size: {
|
|
140
|
+
type: String,
|
|
141
|
+
default: "m"
|
|
142
|
+
},
|
|
143
|
+
role: {
|
|
144
|
+
type: String,
|
|
145
|
+
default: "dialog"
|
|
146
|
+
},
|
|
147
|
+
transition: {
|
|
148
|
+
type: String,
|
|
149
|
+
default: "slide-up"
|
|
150
|
+
},
|
|
151
|
+
removeHeader: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: !1
|
|
154
|
+
},
|
|
155
|
+
removeCloseButton: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: !1
|
|
158
|
+
},
|
|
159
|
+
preventShift: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
default: !1
|
|
162
|
+
},
|
|
163
|
+
dismissible: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
default: !0
|
|
166
|
+
},
|
|
167
|
+
dismissOn: {
|
|
168
|
+
type: String,
|
|
169
|
+
default: "backdrop esc close-button"
|
|
170
|
+
},
|
|
171
|
+
backdropBlur: {
|
|
172
|
+
type: Boolean,
|
|
173
|
+
default: !1
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
data() {
|
|
177
|
+
return {
|
|
178
|
+
isOpen: !1,
|
|
179
|
+
lastFocusedElement: null
|
|
180
|
+
};
|
|
181
|
+
},
|
|
182
|
+
computed: {
|
|
183
|
+
classes() {
|
|
184
|
+
return [
|
|
185
|
+
`vs-modal--size-${this.size}`,
|
|
186
|
+
{ "has-footer": this.hasFooter },
|
|
187
|
+
{ "is-open": this.isOpen },
|
|
188
|
+
{ "is-aligned-top": this.alignTop },
|
|
189
|
+
{ "is-backdrop-blur": this.backdropBlur }
|
|
190
|
+
];
|
|
191
|
+
},
|
|
192
|
+
alignTopStyle() {
|
|
193
|
+
return this.alignTop ? { "padding-top": `${this.alignTopMargin}px` } : null;
|
|
194
|
+
},
|
|
195
|
+
toggleTransition() {
|
|
196
|
+
return `vs-modal--transition-${this.transition}`;
|
|
197
|
+
},
|
|
198
|
+
hasFooter() {
|
|
199
|
+
return Boolean(this.$slots.footer);
|
|
200
|
+
},
|
|
201
|
+
dismissOnBackdrop() {
|
|
202
|
+
return this.dismissOn.indexOf("backdrop") > -1;
|
|
203
|
+
},
|
|
204
|
+
dismissOnCloseButton() {
|
|
205
|
+
return this.dismissOn.indexOf("close-button") > -1;
|
|
206
|
+
},
|
|
207
|
+
dismissOnEsc() {
|
|
208
|
+
return this.dismissOn.indexOf("esc") > -1;
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
watch: {
|
|
212
|
+
isOpen() {
|
|
213
|
+
this.$nextTick(() => {
|
|
214
|
+
this[this.isOpen ? "onOpen" : "onClose"]();
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
beforeDestroy() {
|
|
219
|
+
this.isOpen && this.returnFocus();
|
|
220
|
+
},
|
|
221
|
+
methods: {
|
|
222
|
+
open() {
|
|
223
|
+
this.isOpen = !0;
|
|
224
|
+
},
|
|
225
|
+
close() {
|
|
226
|
+
!this.dismissible || (this.isOpen = !1);
|
|
227
|
+
},
|
|
228
|
+
redirectFocus() {
|
|
229
|
+
this.$refs.focusContainer.focus();
|
|
230
|
+
},
|
|
231
|
+
returnFocus() {
|
|
232
|
+
this.lastFocusedElement && this.lastFocusedElement.focus();
|
|
233
|
+
},
|
|
234
|
+
onBackdropClick() {
|
|
235
|
+
this.dismissOnBackdrop ? this.close() : this.redirectFocus();
|
|
236
|
+
},
|
|
237
|
+
onEsc() {
|
|
238
|
+
this.dismissOnEsc && this.close();
|
|
239
|
+
},
|
|
240
|
+
onOpen() {
|
|
241
|
+
this.lastFocusedElement = document.activeElement, this.$refs.focusContainer.focus(), g.add(document.body, "vs-modal--is-open"), this.incrementOpenModalCount(), this.$emit("open");
|
|
242
|
+
},
|
|
243
|
+
onClose() {
|
|
244
|
+
this.$emit("close"), this.returnFocus();
|
|
245
|
+
},
|
|
246
|
+
onEnter() {
|
|
247
|
+
this.$emit("reveal");
|
|
248
|
+
},
|
|
249
|
+
onLeave() {
|
|
250
|
+
this.$emit("hide"), this.decrementOpenModalCount() === 0 && g.remove(document.body, "vs-modal--is-open");
|
|
251
|
+
},
|
|
252
|
+
getOpenModalCount() {
|
|
253
|
+
const e = document.body.getAttribute("data-open-modals");
|
|
254
|
+
return e === void 0 ? 0 : Number(e);
|
|
255
|
+
},
|
|
256
|
+
setOpenModalCount(e) {
|
|
257
|
+
const t = Math.max(0, e);
|
|
258
|
+
return t === 0 ? document.body.removeAttribute("data-open-modals") : document.body.setAttribute("data-open-modals", t), t;
|
|
259
|
+
},
|
|
260
|
+
incrementOpenModalCount() {
|
|
261
|
+
return this.setOpenModalCount(this.getOpenModalCount() + 1);
|
|
262
|
+
},
|
|
263
|
+
decrementOpenModalCount() {
|
|
264
|
+
return this.setOpenModalCount(this.getOpenModalCount() - 1);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}, Q = ["role"], Y = {
|
|
268
|
+
key: 0,
|
|
269
|
+
class: "vs-modal__header"
|
|
270
|
+
}, J = { class: "vs-modal__header-text" }, G = { class: "vs-modal__close-button" }, $ = /* @__PURE__ */ a("img", {
|
|
271
|
+
src: q,
|
|
272
|
+
alt: "close"
|
|
273
|
+
}, null, -1), P = [
|
|
274
|
+
$
|
|
275
|
+
], W = { class: "vs-modal__body" }, Z = {
|
|
276
|
+
key: 1,
|
|
277
|
+
class: "vs-modal__footer"
|
|
278
|
+
};
|
|
279
|
+
function X(e, t, s, r, o, n) {
|
|
280
|
+
const d = w("vs-focus-container");
|
|
281
|
+
return i(), b(M, {
|
|
282
|
+
name: n.toggleTransition,
|
|
283
|
+
onAfterEnter: n.onEnter,
|
|
284
|
+
onAfterLeave: n.onLeave
|
|
285
|
+
}, {
|
|
286
|
+
default: p(() => [
|
|
287
|
+
S(a("div", {
|
|
288
|
+
class: v(["vs-modal vs-modal__mask", n.classes]),
|
|
289
|
+
role: s.role,
|
|
290
|
+
onClick: t[2] || (t[2] = A((...u) => n.onBackdropClick && n.onBackdropClick(...u), ["self"]))
|
|
291
|
+
}, [
|
|
292
|
+
a("div", {
|
|
293
|
+
class: v(["vs-modal__wrapper", { "has-dummy-scrollbar": s.preventShift }]),
|
|
294
|
+
style: T(n.alignTopStyle),
|
|
295
|
+
onClick: t[1] || (t[1] = A((...u) => n.onBackdropClick && n.onBackdropClick(...u), ["self"]))
|
|
296
|
+
}, [
|
|
297
|
+
x(d, {
|
|
298
|
+
ref: "focusContainer",
|
|
299
|
+
class: "vs-modal__container",
|
|
300
|
+
tabindex: "-1",
|
|
301
|
+
onKeydown: R(A(n.onEsc, ["stop"]), ["native", "esc"])
|
|
302
|
+
}, {
|
|
303
|
+
default: p(() => [
|
|
304
|
+
s.removeHeader ? c("", !0) : (i(), l("div", Y, [
|
|
305
|
+
f(e.$slots, "header", {}, () => [
|
|
306
|
+
a("h2", J, V(s.title), 1)
|
|
307
|
+
])
|
|
308
|
+
])),
|
|
309
|
+
a("div", G, [
|
|
310
|
+
f(e.$slots, "close", {}, () => [
|
|
311
|
+
n.dismissOnCloseButton && !s.removeCloseButton && s.dismissible ? (i(), l("button", {
|
|
312
|
+
key: 0,
|
|
313
|
+
onClick: t[0] || (t[0] = (...u) => n.close && n.close(...u))
|
|
314
|
+
}, P)) : c("", !0)
|
|
315
|
+
])
|
|
316
|
+
]),
|
|
317
|
+
a("div", W, [
|
|
318
|
+
f(e.$slots, "default")
|
|
319
|
+
]),
|
|
320
|
+
n.hasFooter ? (i(), l("div", Z, [
|
|
321
|
+
f(e.$slots, "footer")
|
|
322
|
+
])) : c("", !0)
|
|
323
|
+
]),
|
|
324
|
+
_: 3
|
|
325
|
+
}, 8, ["onKeydown"])
|
|
326
|
+
], 6)
|
|
327
|
+
], 10, Q), [
|
|
328
|
+
[I, o.isOpen]
|
|
329
|
+
])
|
|
330
|
+
]),
|
|
331
|
+
_: 3
|
|
332
|
+
}, 8, ["name", "onAfterEnter", "onAfterLeave"]);
|
|
333
|
+
}
|
|
334
|
+
const ee = /* @__PURE__ */ C(D, [["render", X]]), se = {
|
|
335
|
+
install(e) {
|
|
336
|
+
e.component("VsModal", ee);
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
export {
|
|
340
|
+
se as default
|
|
341
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".vs-focus-container__focus-redirector,.vs-focus-container__last-focusable{opacity:0;position:absolute}.vs-focus-container__content{outline:none}.vs-modal{font-size:.875em}.vs-modal.is-aligned-top .vs-modal__wrapper{vertical-align:initial}.vs-modal.is-aligned-top.has-footer .vs-modal__body,.vs-modal.has-footer .vs-modal__body{max-height:calc(100vh - 125px)}.vs-modal:not(.has-footer) .vs-modal__body{padding:21px 24px}.vs-modal--is-open{overflow:hidden}.vs-modal.is-backdrop-blur{backdrop-filter:blur(3px)}.vs-modal__mask{display:table;position:fixed;z-index:800;top:0;left:0;width:100%;height:100vh;transition:opacity .3s ease;background-color:#33333380}.vs-modal__wrapper{display:table-cell;overflow-x:hidden;text-align:center;vertical-align:middle}.vs-modal__wrapper.has-dummy-scrollbar{overflow-y:scroll}.vs-modal__container{display:inline-block;position:relative;width:530px;max-width:100vw;max-height:100vh;margin:0 auto;padding:0;overflow:hidden;transition:all .3s ease;border-radius:3px;outline:none;background-color:#fff;box-shadow:0 2px 8px #33333354;text-align:initial}.vs-modal__header{display:flex;position:relative;z-index:1;align-items:center;min-height:55px;padding:0 24px}.vs-modal__header-text{display:flex;flex-grow:1;align-items:center;margin:0;font-size:1.125em;font-weight:400}.vs-modal__close-button button{position:absolute;z-index:100;top:20px;right:20px;background:none;border:none;text-align:right;margin:0;padding:0;cursor:pointer}.vs-modal__close-button button img{width:12px;height:12px}.vs-modal__body{max-height:calc(100vh - 55px);padding:16px 24px;overflow-y:auto}.vs-modal__footer{display:flex;align-items:center;justify-content:flex-end;height:70px;padding:0 24px}.vs-modal--size-s>.vs-modal__wrapper>.vs-modal__container{width:320px}.vs-modal--size-l>.vs-modal__wrapper>.vs-modal__container{width:850px}.vs-modal--size-fullscreen>.vs-modal__wrapper>.vs-modal__container{width:100vw;border-radius:0}.vs-modal--size-fullscreen>.vs-modal__wrapper>.vs-modal__container .vs-modal__body{height:100vh;max-height:100vh}.vs-modal--size-auto>.vs-modal__wrapper>.vs-modal__container{width:initial}.vs-modal--transition-fade-enter-from,.vs-modal--transition-fade-leave-active,.vs-modal--transition-slide-up-enter-from,.vs-modal--transition-slide-up-leave-active{opacity:0}.vs-modal--transition-slide-up-enter-from .vs-modal__container,.vs-modal--transition-slide-up-leave-active .vs-modal__container{transform:translateY(20px)}.vs-modal--transition-slide-down-enter-from,.vs-modal--transition-slide-down-leave-active{opacity:0}.vs-modal--transition-slide-down-enter-from .vs-modal__container,.vs-modal--transition-slide-down-leave-active .vs-modal__container{transform:translateY(-20px)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();var VsModal=function(e){"use strict";const z="",f=(t,s)=>{const o=t.__vccOpts||t;for(const[i,r]of s)o[i]=r;return o},y={name:"VsFocusContainer",props:{containFocus:{type:Boolean,default:!0},focusRedirector:Function,disabled:{type:Boolean,default:!1},tag:{type:String,default:"div"},lazy:{type:Boolean,default:!1}},computed:{renderRedirector(){return this.disabled?!1:this.lazy?this.containFocus:!0}},methods:{focus(){this.$refs.content.focus()},redirectFocus(t,s){if(!this.containFocus){this.$emit("focus-overflow",t,s);return}if(t.stopPropagation(),this.focusRedirector){this.focusRedirector(t,s);return}s.isTabbingForward?this.$refs.content.focus():this.$refs.lastFocusable.focus()}}},C={ref:"content",class:"vs-focus-container__content",tabindex:"-1"},b={key:1,ref:"lastFocusable",class:"vs-focus-container__last-focusable",tabindex:"-1"};function B(t,s,o,i,r,n){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.tag),{class:"vs-focus-container"},{default:e.withCtx(()=>[n.renderRedirector?(e.openBlock(),e.createElementBlock("span",{key:0,class:"vs-focus-container__focus-redirector",tabindex:"0",onFocus:s[0]||(s[0]=a=>n.redirectFocus(a,{isTabbingForward:!1}))},null,32)):e.createCommentVNode("",!0),e.createElementVNode("div",C,[e.renderSlot(t.$slots,"default")],512),!o.disabled&&o.containFocus?(e.openBlock(),e.createElementBlock("span",b,null,512)):e.createCommentVNode("",!0),n.renderRedirector?(e.openBlock(),e.createElementBlock("span",{key:2,class:"vs-focus-container__focus-redirector",tabindex:"0",onFocus:s[1]||(s[1]=a=>n.redirectFocus(a,{isTabbingForward:!0}))},null,32)):e.createCommentVNode("",!0)]),_:3})}const k=f(y,[["render",B]]),m=/^\s+|\s+$/g,A=/\s+/g;function O(t){return t&&typeof t=="object"&&typeof t.nodeName=="string"&&t.nodeType===1}function p(t){return typeof HTMLElement=="object"?t instanceof HTMLElement:O(t)}function d(t){return p(t)?(t.getAttribute("class")||"").replace(m,"").split(A):[]}function c(t){return typeof t=="string"?t.replace(m,"").split(A):t}function u(t,s){p(t)&&t.setAttribute("class",c(s).join(" "))}function h(t,s){const o=d(t);return c(s).forEach(r=>{const n=o.indexOf(r);n!==-1&&o.splice(n,1)}),u(t,o),o}function E(t,s){const o=h(t,s),i=c(s);return o.push(...i),u(t,o),o}function _(t,s){const o=d(t);return c(s).every(r=>o.indexOf(r)!==-1)}const g={add:E,remove:h,contains:_,has:_,set:u,get:d},F="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAGFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABWNxwqAAAAB3RSTlMAJeTmmCIcbPbyAQAAAOtJREFUSMeF1ksKwjAURuE6cF50BY4cC4oLEHQquAVXYIVs3wiFn3C4nA76SG+/PpLc2+l9fk7lsr3dp0c71QH79p2ubZmr85t+sgshCHTh1UIQaJe+DkFgmddNBZyyLYGRIAACAAgA2SeAAwI5OowBu/WaEJ95AI4BQBD4N6xEgFyQFsSTYDgJAmgkkFYCIACAAABiAEgAABGgIAIURICCCFAQAEAQYIDewh9SX9M/lH5q7yztbh8wOuR80Oqw94mjU88nr05/TyCagjyJaRr0RKqp2JO5lgMvKFqStKhpWbTC6qVZi7v+HvwAcK2oz9BduqwAAAAASUVORK5CYII=",K="",w={name:"VsModal",components:{VsFocusContainer:k},props:{title:{type:String,default:"Modal title"},alignTop:{type:Boolean,default:!1},alignTopMargin:{type:Number,default:60},size:{type:String,default:"m"},role:{type:String,default:"dialog"},transition:{type:String,default:"slide-up"},removeHeader:{type:Boolean,default:!1},removeCloseButton:{type:Boolean,default:!1},preventShift:{type:Boolean,default:!1},dismissible:{type:Boolean,default:!0},dismissOn:{type:String,default:"backdrop esc close-button"},backdropBlur:{type:Boolean,default:!1}},data(){return{isOpen:!1,lastFocusedElement:null}},computed:{classes(){return[`vs-modal--size-${this.size}`,{"has-footer":this.hasFooter},{"is-open":this.isOpen},{"is-aligned-top":this.alignTop},{"is-backdrop-blur":this.backdropBlur}]},alignTopStyle(){return this.alignTop?{"padding-top":`${this.alignTopMargin}px`}:null},toggleTransition(){return`vs-modal--transition-${this.transition}`},hasFooter(){return Boolean(this.$slots.footer)},dismissOnBackdrop(){return this.dismissOn.indexOf("backdrop")>-1},dismissOnCloseButton(){return this.dismissOn.indexOf("close-button")>-1},dismissOnEsc(){return this.dismissOn.indexOf("esc")>-1}},watch:{isOpen(){this.$nextTick(()=>{this[this.isOpen?"onOpen":"onClose"]()})}},beforeDestroy(){this.isOpen&&this.returnFocus()},methods:{open(){this.isOpen=!0},close(){!this.dismissible||(this.isOpen=!1)},redirectFocus(){this.$refs.focusContainer.focus()},returnFocus(){this.lastFocusedElement&&this.lastFocusedElement.focus()},onBackdropClick(){this.dismissOnBackdrop?this.close():this.redirectFocus()},onEsc(){this.dismissOnEsc&&this.close()},onOpen(){this.lastFocusedElement=document.activeElement,this.$refs.focusContainer.focus(),g.add(document.body,"vs-modal--is-open"),this.incrementOpenModalCount(),this.$emit("open")},onClose(){this.$emit("close"),this.returnFocus()},onEnter(){this.$emit("reveal")},onLeave(){this.$emit("hide"),this.decrementOpenModalCount()===0&&g.remove(document.body,"vs-modal--is-open")},getOpenModalCount(){const t=document.body.getAttribute("data-open-modals");return t===void 0?0:Number(t)},setOpenModalCount(t){const s=Math.max(0,t);return s===0?document.body.removeAttribute("data-open-modals"):document.body.setAttribute("data-open-modals",s),s},incrementOpenModalCount(){return this.setOpenModalCount(this.getOpenModalCount()+1)},decrementOpenModalCount(){return this.setOpenModalCount(this.getOpenModalCount()-1)}}},M=["role"],S={key:0,class:"vs-modal__header"},V={class:"vs-modal__header-text"},T={class:"vs-modal__close-button"},N=[e.createElementVNode("img",{src:F,alt:"close"},null,-1)],x={class:"vs-modal__body"},v={key:1,class:"vs-modal__footer"};function R(t,s,o,i,r,n){const a=e.resolveComponent("vs-focus-container");return e.openBlock(),e.createBlock(e.Transition,{name:n.toggleTransition,onAfterEnter:n.onEnter,onAfterLeave:n.onLeave},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["vs-modal vs-modal__mask",n.classes]),role:o.role,onClick:s[2]||(s[2]=e.withModifiers((...l)=>n.onBackdropClick&&n.onBackdropClick(...l),["self"]))},[e.createElementVNode("div",{class:e.normalizeClass(["vs-modal__wrapper",{"has-dummy-scrollbar":o.preventShift}]),style:e.normalizeStyle(n.alignTopStyle),onClick:s[1]||(s[1]=e.withModifiers((...l)=>n.onBackdropClick&&n.onBackdropClick(...l),["self"]))},[e.createVNode(a,{ref:"focusContainer",class:"vs-modal__container",tabindex:"-1",onKeydown:e.withKeys(e.withModifiers(n.onEsc,["stop"]),["native","esc"])},{default:e.withCtx(()=>[o.removeHeader?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",S,[e.renderSlot(t.$slots,"header",{},()=>[e.createElementVNode("h2",V,e.toDisplayString(o.title),1)])])),e.createElementVNode("div",T,[e.renderSlot(t.$slots,"close",{},()=>[n.dismissOnCloseButton&&!o.removeCloseButton&&o.dismissible?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:s[0]||(s[0]=(...l)=>n.close&&n.close(...l))},N)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",x,[e.renderSlot(t.$slots,"default")]),n.hasFooter?(e.openBlock(),e.createElementBlock("div",v,[e.renderSlot(t.$slots,"footer")])):e.createCommentVNode("",!0)]),_:3},8,["onKeydown"])],6)],10,M),[[e.vShow,r.isOpen]])]),_:3},8,["name","onAfterEnter","onAfterLeave"])}const I=f(w,[["render",R]]);return{install(t){t.component("VsModal",I)}}}(Vue);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){ try {var elementStyle = document.createElement('style'); elementStyle.appendChild(document.createTextNode(".vs-focus-container__focus-redirector,.vs-focus-container__last-focusable{opacity:0;position:absolute}.vs-focus-container__content{outline:none}.vs-modal{font-size:.875em}.vs-modal.is-aligned-top .vs-modal__wrapper{vertical-align:initial}.vs-modal.is-aligned-top.has-footer .vs-modal__body,.vs-modal.has-footer .vs-modal__body{max-height:calc(100vh - 125px)}.vs-modal:not(.has-footer) .vs-modal__body{padding:21px 24px}.vs-modal--is-open{overflow:hidden}.vs-modal.is-backdrop-blur{backdrop-filter:blur(3px)}.vs-modal__mask{display:table;position:fixed;z-index:800;top:0;left:0;width:100%;height:100vh;transition:opacity .3s ease;background-color:#33333380}.vs-modal__wrapper{display:table-cell;overflow-x:hidden;text-align:center;vertical-align:middle}.vs-modal__wrapper.has-dummy-scrollbar{overflow-y:scroll}.vs-modal__container{display:inline-block;position:relative;width:530px;max-width:100vw;max-height:100vh;margin:0 auto;padding:0;overflow:hidden;transition:all .3s ease;border-radius:3px;outline:none;background-color:#fff;box-shadow:0 2px 8px #33333354;text-align:initial}.vs-modal__header{display:flex;position:relative;z-index:1;align-items:center;min-height:55px;padding:0 24px}.vs-modal__header-text{display:flex;flex-grow:1;align-items:center;margin:0;font-size:1.125em;font-weight:400}.vs-modal__close-button button{position:absolute;z-index:100;top:20px;right:20px;background:none;border:none;text-align:right;margin:0;padding:0;cursor:pointer}.vs-modal__close-button button img{width:12px;height:12px}.vs-modal__body{max-height:calc(100vh - 55px);padding:16px 24px;overflow-y:auto}.vs-modal__footer{display:flex;align-items:center;justify-content:flex-end;height:70px;padding:0 24px}.vs-modal--size-s>.vs-modal__wrapper>.vs-modal__container{width:320px}.vs-modal--size-l>.vs-modal__wrapper>.vs-modal__container{width:850px}.vs-modal--size-fullscreen>.vs-modal__wrapper>.vs-modal__container{width:100vw;border-radius:0}.vs-modal--size-fullscreen>.vs-modal__wrapper>.vs-modal__container .vs-modal__body{height:100vh;max-height:100vh}.vs-modal--size-auto>.vs-modal__wrapper>.vs-modal__container{width:initial}.vs-modal--transition-fade-enter-from,.vs-modal--transition-fade-leave-active,.vs-modal--transition-slide-up-enter-from,.vs-modal--transition-slide-up-leave-active{opacity:0}.vs-modal--transition-slide-up-enter-from .vs-modal__container,.vs-modal--transition-slide-up-leave-active .vs-modal__container{transform:translateY(20px)}.vs-modal--transition-slide-down-enter-from,.vs-modal--transition-slide-down-leave-active{opacity:0}.vs-modal--transition-slide-down-enter-from .vs-modal__container,.vs-modal--transition-slide-down-leave-active .vs-modal__container{transform:translateY(-20px)}")); document.head.appendChild(elementStyle);} catch(e) {console.error('vite-plugin-css-injected-by-js', e);} })();(function(e,c){typeof exports=="object"&&typeof module<"u"?module.exports=c(require("vue")):typeof define=="function"&&define.amd?define(["vue"],c):(e=typeof globalThis<"u"?globalThis:e||self,e.VsModal=c(e.Vue))})(this,function(e){"use strict";const c="",m=(t,s)=>{const o=t.__vccOpts||t;for(const[r,i]of s)o[r]=i;return o},g={name:"VsFocusContainer",props:{containFocus:{type:Boolean,default:!0},focusRedirector:Function,disabled:{type:Boolean,default:!1},tag:{type:String,default:"div"},lazy:{type:Boolean,default:!1}},computed:{renderRedirector(){return this.disabled?!1:this.lazy?this.containFocus:!0}},methods:{focus(){this.$refs.content.focus()},redirectFocus(t,s){if(!this.containFocus){this.$emit("focus-overflow",t,s);return}if(t.stopPropagation(),this.focusRedirector){this.focusRedirector(t,s);return}s.isTabbingForward?this.$refs.content.focus():this.$refs.lastFocusable.focus()}}},b={ref:"content",class:"vs-focus-container__content",tabindex:"-1"},B={key:1,ref:"lastFocusable",class:"vs-focus-container__last-focusable",tabindex:"-1"};function k(t,s,o,r,i,n){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.tag),{class:"vs-focus-container"},{default:e.withCtx(()=>[n.renderRedirector?(e.openBlock(),e.createElementBlock("span",{key:0,class:"vs-focus-container__focus-redirector",tabindex:"0",onFocus:s[0]||(s[0]=l=>n.redirectFocus(l,{isTabbingForward:!1}))},null,32)):e.createCommentVNode("",!0),e.createElementVNode("div",b,[e.renderSlot(t.$slots,"default")],512),!o.disabled&&o.containFocus?(e.openBlock(),e.createElementBlock("span",B,null,512)):e.createCommentVNode("",!0),n.renderRedirector?(e.openBlock(),e.createElementBlock("span",{key:2,class:"vs-focus-container__focus-redirector",tabindex:"0",onFocus:s[1]||(s[1]=l=>n.redirectFocus(l,{isTabbingForward:!0}))},null,32)):e.createCommentVNode("",!0)]),_:3})}const O=m(g,[["render",k]]),A=/^\s+|\s+$/g,p=/\s+/g;function E(t){return t&&typeof t=="object"&&typeof t.nodeName=="string"&&t.nodeType===1}function h(t){return typeof HTMLElement=="object"?t instanceof HTMLElement:E(t)}function u(t){return h(t)?(t.getAttribute("class")||"").replace(A,"").split(p):[]}function d(t){return typeof t=="string"?t.replace(A,"").split(p):t}function f(t,s){h(t)&&t.setAttribute("class",d(s).join(" "))}function _(t,s){const o=u(t);return d(s).forEach(i=>{const n=o.indexOf(i);n!==-1&&o.splice(n,1)}),f(t,o),o}function F(t,s){const o=_(t,s),r=d(s);return o.push(...r),f(t,o),o}function y(t,s){const o=u(t);return d(s).every(i=>o.indexOf(i)!==-1)}const C={add:F,remove:_,contains:y,has:y,set:f,get:u},w="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABABAMAAABYR2ztAAAAGFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABWNxwqAAAAB3RSTlMAJeTmmCIcbPbyAQAAAOtJREFUSMeF1ksKwjAURuE6cF50BY4cC4oLEHQquAVXYIVs3wiFn3C4nA76SG+/PpLc2+l9fk7lsr3dp0c71QH79p2ubZmr85t+sgshCHTh1UIQaJe+DkFgmddNBZyyLYGRIAACAAgA2SeAAwI5OowBu/WaEJ95AI4BQBD4N6xEgFyQFsSTYDgJAmgkkFYCIACAAABiAEgAABGgIAIURICCCFAQAEAQYIDewh9SX9M/lH5q7yztbh8wOuR80Oqw94mjU88nr05/TyCagjyJaRr0RKqp2JO5lgMvKFqStKhpWbTC6qVZi7v+HvwAcK2oz9BduqwAAAAASUVORK5CYII=",j="",M={name:"VsModal",components:{VsFocusContainer:O},props:{title:{type:String,default:"Modal title"},alignTop:{type:Boolean,default:!1},alignTopMargin:{type:Number,default:60},size:{type:String,default:"m"},role:{type:String,default:"dialog"},transition:{type:String,default:"slide-up"},removeHeader:{type:Boolean,default:!1},removeCloseButton:{type:Boolean,default:!1},preventShift:{type:Boolean,default:!1},dismissible:{type:Boolean,default:!0},dismissOn:{type:String,default:"backdrop esc close-button"},backdropBlur:{type:Boolean,default:!1}},data(){return{isOpen:!1,lastFocusedElement:null}},computed:{classes(){return[`vs-modal--size-${this.size}`,{"has-footer":this.hasFooter},{"is-open":this.isOpen},{"is-aligned-top":this.alignTop},{"is-backdrop-blur":this.backdropBlur}]},alignTopStyle(){return this.alignTop?{"padding-top":`${this.alignTopMargin}px`}:null},toggleTransition(){return`vs-modal--transition-${this.transition}`},hasFooter(){return Boolean(this.$slots.footer)},dismissOnBackdrop(){return this.dismissOn.indexOf("backdrop")>-1},dismissOnCloseButton(){return this.dismissOn.indexOf("close-button")>-1},dismissOnEsc(){return this.dismissOn.indexOf("esc")>-1}},watch:{isOpen(){this.$nextTick(()=>{this[this.isOpen?"onOpen":"onClose"]()})}},beforeDestroy(){this.isOpen&&this.returnFocus()},methods:{open(){this.isOpen=!0},close(){!this.dismissible||(this.isOpen=!1)},redirectFocus(){this.$refs.focusContainer.focus()},returnFocus(){this.lastFocusedElement&&this.lastFocusedElement.focus()},onBackdropClick(){this.dismissOnBackdrop?this.close():this.redirectFocus()},onEsc(){this.dismissOnEsc&&this.close()},onOpen(){this.lastFocusedElement=document.activeElement,this.$refs.focusContainer.focus(),C.add(document.body,"vs-modal--is-open"),this.incrementOpenModalCount(),this.$emit("open")},onClose(){this.$emit("close"),this.returnFocus()},onEnter(){this.$emit("reveal")},onLeave(){this.$emit("hide"),this.decrementOpenModalCount()===0&&C.remove(document.body,"vs-modal--is-open")},getOpenModalCount(){const t=document.body.getAttribute("data-open-modals");return t===void 0?0:Number(t)},setOpenModalCount(t){const s=Math.max(0,t);return s===0?document.body.removeAttribute("data-open-modals"):document.body.setAttribute("data-open-modals",s),s},incrementOpenModalCount(){return this.setOpenModalCount(this.getOpenModalCount()+1)},decrementOpenModalCount(){return this.setOpenModalCount(this.getOpenModalCount()-1)}}},S=["role"],V={key:0,class:"vs-modal__header"},T={class:"vs-modal__header-text"},x={class:"vs-modal__close-button"},N=[e.createElementVNode("img",{src:w,alt:"close"},null,-1)],v={class:"vs-modal__body"},R={key:1,class:"vs-modal__footer"};function I(t,s,o,r,i,n){const l=e.resolveComponent("vs-focus-container");return e.openBlock(),e.createBlock(e.Transition,{name:n.toggleTransition,onAfterEnter:n.onEnter,onAfterLeave:n.onLeave},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["vs-modal vs-modal__mask",n.classes]),role:o.role,onClick:s[2]||(s[2]=e.withModifiers((...a)=>n.onBackdropClick&&n.onBackdropClick(...a),["self"]))},[e.createElementVNode("div",{class:e.normalizeClass(["vs-modal__wrapper",{"has-dummy-scrollbar":o.preventShift}]),style:e.normalizeStyle(n.alignTopStyle),onClick:s[1]||(s[1]=e.withModifiers((...a)=>n.onBackdropClick&&n.onBackdropClick(...a),["self"]))},[e.createVNode(l,{ref:"focusContainer",class:"vs-modal__container",tabindex:"-1",onKeydown:e.withKeys(e.withModifiers(n.onEsc,["stop"]),["native","esc"])},{default:e.withCtx(()=>[o.removeHeader?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",V,[e.renderSlot(t.$slots,"header",{},()=>[e.createElementVNode("h2",T,e.toDisplayString(o.title),1)])])),e.createElementVNode("div",x,[e.renderSlot(t.$slots,"close",{},()=>[n.dismissOnCloseButton&&!o.removeCloseButton&&o.dismissible?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:s[0]||(s[0]=(...a)=>n.close&&n.close(...a))},N)):e.createCommentVNode("",!0)])]),e.createElementVNode("div",v,[e.renderSlot(t.$slots,"default")]),n.hasFooter?(e.openBlock(),e.createElementBlock("div",R,[e.renderSlot(t.$slots,"footer")])):e.createCommentVNode("",!0)]),_:3},8,["onKeydown"])],6)],10,S),[[e.vShow,i.isOpen]])]),_:3},8,["name","onAfterEnter","onAfterLeave"])}const z=m(M,[["render",I]]);return{install(t){t.component("VsModal",z)}}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vuesimple/vs-modal",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "A simple vue modal. Perfect for all your modal/ dialogs scenarios.",
|
|
5
5
|
"main": "dist/vs-modal.umd.js",
|
|
6
6
|
"module": "dist/vs-modal.esm.js",
|
|
@@ -9,20 +9,14 @@
|
|
|
9
9
|
"./sfc": "src/vs-modal.vue"
|
|
10
10
|
},
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "rm -rfv dist &&
|
|
13
|
-
"build:umd": "rollup --config build/rollup.config.js --format umd --file dist/vs-modal.umd.js",
|
|
14
|
-
"build:es": "rollup --config build/rollup.config.js --format es --file dist/vs-modal.esm.js",
|
|
15
|
-
"build:unpkg": "rollup --config build/rollup.config.js --format iife --file dist/vs-modal.min.js"
|
|
12
|
+
"build": "rm -rfv dist && vite build --config build/vite.config.js"
|
|
16
13
|
},
|
|
17
14
|
"devDependencies": {
|
|
18
|
-
"@
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"rollup-plugin-vue": "5.1.9",
|
|
24
|
-
"vue": "2.6.10",
|
|
25
|
-
"vue-template-compiler": "2.6.10"
|
|
15
|
+
"@vitejs/plugin-vue": "^3.0.1",
|
|
16
|
+
"sass": "^1.54.4",
|
|
17
|
+
"vite": "^3.0.5",
|
|
18
|
+
"vite-plugin-style-inject": "0.0.1",
|
|
19
|
+
"vue": "^3.2.37"
|
|
26
20
|
},
|
|
27
21
|
"private": false,
|
|
28
22
|
"repository": {
|
|
@@ -51,5 +45,5 @@
|
|
|
51
45
|
"url": "https://github.com/ashwinkshenoy/vue-simple/issues"
|
|
52
46
|
},
|
|
53
47
|
"homepage": "https://github.com/ashwinkshenoy/vue-simple/tree/master/packages/vs-modal",
|
|
54
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "c666ac905df7e5b10f9198cd056cdd3fa88e212e"
|
|
55
49
|
}
|
package/src/index.js
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
// Import vue component
|
|
2
1
|
import VsModal from './vs-modal.vue';
|
|
3
2
|
|
|
4
|
-
// Declare install function executed by Vue.use()
|
|
5
|
-
export function install(Vue) {
|
|
6
|
-
if (install.installed) return;
|
|
7
|
-
install.installed = true;
|
|
8
|
-
Vue.component('VsModal', VsModal);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Create module definition for Vue.use()
|
|
12
3
|
const plugin = {
|
|
13
|
-
install
|
|
4
|
+
install(Vue) {
|
|
5
|
+
Vue.component('VsModal', VsModal);
|
|
6
|
+
},
|
|
14
7
|
};
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
let GlobalVue = null;
|
|
18
|
-
if (typeof window !== 'undefined') {
|
|
19
|
-
GlobalVue = window.Vue;
|
|
20
|
-
} else if (typeof global !== 'undefined') {
|
|
21
|
-
GlobalVue = global.Vue;
|
|
22
|
-
}
|
|
23
|
-
if (GlobalVue) {
|
|
24
|
-
GlobalVue.use(plugin);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// To allow use as module (npm/webpack/etc.) export component
|
|
28
|
-
export default VsModal;
|
|
9
|
+
export default plugin;
|
package/src/vs-modal.vue
CHANGED
|
@@ -457,12 +457,12 @@
|
|
|
457
457
|
}
|
|
458
458
|
|
|
459
459
|
// Transitions
|
|
460
|
-
&--transition-fade-enter,
|
|
460
|
+
&--transition-fade-enter-from,
|
|
461
461
|
&--transition-fade-leave-active {
|
|
462
462
|
opacity: 0;
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
-
&--transition-slide-up-enter,
|
|
465
|
+
&--transition-slide-up-enter-from,
|
|
466
466
|
&--transition-slide-up-leave-active {
|
|
467
467
|
opacity: 0;
|
|
468
468
|
|
|
@@ -471,7 +471,7 @@
|
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
473
|
|
|
474
|
-
&--transition-slide-down-enter,
|
|
474
|
+
&--transition-slide-down-enter-from,
|
|
475
475
|
&--transition-slide-down-leave-active {
|
|
476
476
|
opacity: 0;
|
|
477
477
|
|