Skip to content

Commit

Permalink
Version bump & build
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathanjms committed Jun 30, 2023
1 parent 95cd98b commit 5841dad
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 30 deletions.
2 changes: 1 addition & 1 deletion dist/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 31 additions & 27 deletions dist/vue-modal.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { openBlock as l, createElementBlock as d, createVNode as m, Transition as f, withCtx as k, createCommentVNode as u, withDirectives as C, normalizeStyle as p, createElementVNode as o, normalizeClass as r, renderSlot as c, toDisplayString as y, vShow as g } from "vue";
import { openBlock as l, createElementBlock as d, createVNode as m, Transition as f, withCtx as y, createCommentVNode as u, withDirectives as C, normalizeStyle as p, createElementVNode as s, normalizeClass as r, renderSlot as c, toDisplayString as k, vShow as g } from "vue";
const B = (t, e) => {
const n = t.__vccOpts || t;
for (const [h, s] of e)
n[h] = s;
for (const [h, o] of e)
n[h] = o;
return n;
}, b = {
}, w = {
name: "VueModal",
props: {
confirmButtonText: {
Expand Down Expand Up @@ -58,6 +58,10 @@ const B = (t, e) => {
maxHeight: {
type: String,
default: "75%"
},
escClosesModal: {
type: Boolean,
default: !0
}
},
data() {
Expand All @@ -67,9 +71,6 @@ const B = (t, e) => {
};
},
created() {
window.addEventListener("keydown", (t) => {
(t.key === "Escape" || t.key === "Esc" || t.key === 27) && this.handleOutsideClick();
});
},
watch: {
show(t) {
Expand Down Expand Up @@ -128,7 +129,7 @@ const B = (t, e) => {
this.$emit("cancel"), this.closeOnButtonClick && this.closeModal();
},
closeModal() {
this.show = !1;
this.show = !1, window.removeEventListener("keydown", this.handleEsc);
},
handleOutsideClick() {
this.closeOnOutsideClick && this.cancelButtonClicked();
Expand All @@ -137,15 +138,18 @@ const B = (t, e) => {
this.$emit("confirm"), this.closeOnButtonClick && this.closeModal();
},
openModal() {
this.initiated = !0, this.show = !0;
window.addEventListener("keydown", this.handleEsc), this.initiated = !0, this.show = !0;
},
handleEsc(t) {
(t.key === "Escape" || t.key === "Esc" || t.key === 27) && this.escClosesModal && this.handleOutsideClick();
}
}
}, w = { class: "model-content" }, x = { class: "d-block" }, _ = { class: "buttons-footer" };
function v(t, e, n, h, s, i) {
}, b = { class: "model-content" }, x = { class: "d-block" }, _ = { class: "buttons-footer" };
function v(t, e, n, h, o, i) {
return l(), d("div", null, [
m(f, { name: i.backdropTransition }, {
default: k(() => [
s.show ? (l(), d("div", {
default: y(() => [
o.show ? (l(), d("div", {
key: 0,
class: "modal-backdrop",
onClick: e[0] || (e[0] = (...a) => i.handleOutsideClick && i.handleOutsideClick(...a))
Expand All @@ -154,53 +158,53 @@ function v(t, e, n, h, s, i) {
_: 1
}, 8, ["name"]),
m(f, { name: i.modalTransition }, {
default: k(() => [
s.initiated ? C((l(), d("div", {
default: y(() => [
o.initiated ? C((l(), d("div", {
key: 0,
class: "modal",
style: p({ width: i.computedWidth, "max-height": i.computedMaxHeight })
}, [
o("header", {
s("header", {
class: r(i.headerClass)
}, [
c(t.$slots, "header", {}, void 0, !0)
], 2),
o("div", w, [
o("section", null, [
s("div", b, [
s("section", null, [
c(t.$slots, "body", {}, void 0, !0)
])
]),
o("footer", {
s("footer", {
class: r(i.footerClass)
}, [
o("div", x, [
s("div", x, [
c(t.$slots, "footer", {}, void 0, !0)
]),
o("div", _, [
s("div", _, [
c(t.$slots, "buttons", {}, () => [
o("button", {
s("button", {
type: "button",
class: r(n.cancelButtonClass),
onClick: e[1] || (e[1] = (...a) => i.cancelButtonClicked && i.cancelButtonClicked(...a))
}, y(n.cancelButtonText), 3),
}, k(n.cancelButtonText), 3),
n.showConfirmButton ? (l(), d("button", {
key: 0,
type: "button",
class: r(n.confirmButtonClass),
onClick: e[2] || (e[2] = (...a) => i.confirm && i.confirm(...a))
}, y(n.confirmButtonText), 3)) : u("", !0)
}, k(n.confirmButtonText), 3)) : u("", !0)
], !0)
])
], 2)
], 4)), [
[g, s.show]
[g, o.show]
]) : u("", !0)
]),
_: 3
}, 8, ["name"])
]);
}
const M = /* @__PURE__ */ B(b, [["render", v], ["__scopeId", "data-v-3a19ad3a"]]);
const O = /* @__PURE__ */ B(w, [["render", v], ["__scopeId", "data-v-8c6374f0"]]);
export {
M as VueModal
O as VueModal
};
2 changes: 1 addition & 1 deletion dist/vue-modal.umd.cjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
(function(a,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],t):(a=typeof globalThis<"u"?globalThis:a||self,t(a.VueModal={},a.Vue))})(this,function(a,t){"use strict";const y="",r=(e,n)=>{const o=e.__vccOpts||e;for(const[d,s]of n)o[d]=s;return o},c={name:"VueModal",props:{confirmButtonText:{type:String,default:"Confirm"},confirmButtonClass:{type:String,default:"btn btn-primary btn-large"},closeOnOutsideClick:{type:Boolean,default:!0},showConfirmButton:{type:Boolean,default:!0},cancelButtonText:{type:String,default:"Cancel"},cancelButtonClass:{type:String,default:"btn btn-danger btn-large mr-2"},closeOnButtonClick:{type:Boolean,default:!0},animation:{type:String,default:"zoom"},timeout:{type:Number,default:0},stickyFooter:{type:Boolean,default:!1},stickyHeader:{type:Boolean,default:!1},width:{type:String,default:"700px"},maxHeight:{type:String,default:"75%"}},data(){return{initiated:!1,show:!1}},created(){window.addEventListener("keydown",e=>{(e.key==="Escape"||e.key==="Esc"||e.key===27)&&this.handleOutsideClick()})},watch:{show(e){e&&this.timeout>0&&setTimeout(()=>{this.closeModal()},this.timeout)}},computed:{animate(){return["zoom","bounce","fade"].includes(this.animation)},modalTransition(){return this.animate?this.animation:""},backdropTransition(){return this.animate?"fade":""},headerClass(){return this.stickyHeader?"--sticky":""},footerClass(){return this.stickyFooter?"--sticky":""},computedWidth(){const e=["px","%","em","rem"];for(let n=0;n<e.length;n++)if(this.width.endsWith(e[n]))return this.width;return isNaN(this.width)?"700px":this.width+"px"},computedMaxHeight(){const e=["px","%","em","rem"];for(let n=0;n<e.length;n++)if(this.maxHeight.endsWith(e[n]))return this.maxHeight;return isNaN(this.maxHeight)?"75%":this.maxHeight+"px"}},methods:{cancelButtonClicked(){this.$emit("cancel"),this.closeOnButtonClick&&this.closeModal()},closeModal(){this.show=!1},handleOutsideClick(){this.closeOnOutsideClick&&this.cancelButtonClicked()},confirm(){this.$emit("confirm"),this.closeOnButtonClick&&this.closeModal()},openModal(){this.initiated=!0,this.show=!0}}},m={class:"model-content"},h={class:"d-block"},u={class:"buttons-footer"};function f(e,n,o,d,s,i){return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(t.Transition,{name:i.backdropTransition},{default:t.withCtx(()=>[s.show?(t.openBlock(),t.createElementBlock("div",{key:0,class:"modal-backdrop",onClick:n[0]||(n[0]=(...l)=>i.handleOutsideClick&&i.handleOutsideClick(...l))})):t.createCommentVNode("",!0)]),_:1},8,["name"]),t.createVNode(t.Transition,{name:i.modalTransition},{default:t.withCtx(()=>[s.initiated?t.withDirectives((t.openBlock(),t.createElementBlock("div",{key:0,class:"modal",style:t.normalizeStyle({width:i.computedWidth,"max-height":i.computedMaxHeight})},[t.createElementVNode("header",{class:t.normalizeClass(i.headerClass)},[t.renderSlot(e.$slots,"header",{},void 0,!0)],2),t.createElementVNode("div",m,[t.createElementVNode("section",null,[t.renderSlot(e.$slots,"body",{},void 0,!0)])]),t.createElementVNode("footer",{class:t.normalizeClass(i.footerClass)},[t.createElementVNode("div",h,[t.renderSlot(e.$slots,"footer",{},void 0,!0)]),t.createElementVNode("div",u,[t.renderSlot(e.$slots,"buttons",{},()=>[t.createElementVNode("button",{type:"button",class:t.normalizeClass(o.cancelButtonClass),onClick:n[1]||(n[1]=(...l)=>i.cancelButtonClicked&&i.cancelButtonClicked(...l))},t.toDisplayString(o.cancelButtonText),3),o.showConfirmButton?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:t.normalizeClass(o.confirmButtonClass),onClick:n[2]||(n[2]=(...l)=>i.confirm&&i.confirm(...l))},t.toDisplayString(o.confirmButtonText),3)):t.createCommentVNode("",!0)],!0)])],2)],4)),[[t.vShow,s.show]]):t.createCommentVNode("",!0)]),_:3},8,["name"])])}const k=r(c,[["render",f],["__scopeId","data-v-3a19ad3a"]]);a.VueModal=k,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.VueModal={},s.Vue))})(this,function(s,e){"use strict";const y="",r=(t,n)=>{const o=t.__vccOpts||t;for(const[d,l]of n)o[d]=l;return o},c={name:"VueModal",props:{confirmButtonText:{type:String,default:"Confirm"},confirmButtonClass:{type:String,default:"btn btn-primary btn-large"},closeOnOutsideClick:{type:Boolean,default:!0},showConfirmButton:{type:Boolean,default:!0},cancelButtonText:{type:String,default:"Cancel"},cancelButtonClass:{type:String,default:"btn btn-danger btn-large mr-2"},closeOnButtonClick:{type:Boolean,default:!0},animation:{type:String,default:"zoom"},timeout:{type:Number,default:0},stickyFooter:{type:Boolean,default:!1},stickyHeader:{type:Boolean,default:!1},width:{type:String,default:"700px"},maxHeight:{type:String,default:"75%"},escClosesModal:{type:Boolean,default:!0}},data(){return{initiated:!1,show:!1}},created(){},watch:{show(t){t&&this.timeout>0&&setTimeout(()=>{this.closeModal()},this.timeout)}},computed:{animate(){return["zoom","bounce","fade"].includes(this.animation)},modalTransition(){return this.animate?this.animation:""},backdropTransition(){return this.animate?"fade":""},headerClass(){return this.stickyHeader?"--sticky":""},footerClass(){return this.stickyFooter?"--sticky":""},computedWidth(){const t=["px","%","em","rem"];for(let n=0;n<t.length;n++)if(this.width.endsWith(t[n]))return this.width;return isNaN(this.width)?"700px":this.width+"px"},computedMaxHeight(){const t=["px","%","em","rem"];for(let n=0;n<t.length;n++)if(this.maxHeight.endsWith(t[n]))return this.maxHeight;return isNaN(this.maxHeight)?"75%":this.maxHeight+"px"}},methods:{cancelButtonClicked(){this.$emit("cancel"),this.closeOnButtonClick&&this.closeModal()},closeModal(){this.show=!1,window.removeEventListener("keydown",this.handleEsc)},handleOutsideClick(){this.closeOnOutsideClick&&this.cancelButtonClicked()},confirm(){this.$emit("confirm"),this.closeOnButtonClick&&this.closeModal()},openModal(){window.addEventListener("keydown",this.handleEsc),this.initiated=!0,this.show=!0},handleEsc(t){(t.key==="Escape"||t.key==="Esc"||t.key===27)&&this.escClosesModal&&this.handleOutsideClick()}}},m={class:"model-content"},h={class:"d-block"},u={class:"buttons-footer"};function f(t,n,o,d,l,i){return e.openBlock(),e.createElementBlock("div",null,[e.createVNode(e.Transition,{name:i.backdropTransition},{default:e.withCtx(()=>[l.show?(e.openBlock(),e.createElementBlock("div",{key:0,class:"modal-backdrop",onClick:n[0]||(n[0]=(...a)=>i.handleOutsideClick&&i.handleOutsideClick(...a))})):e.createCommentVNode("",!0)]),_:1},8,["name"]),e.createVNode(e.Transition,{name:i.modalTransition},{default:e.withCtx(()=>[l.initiated?e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:0,class:"modal",style:e.normalizeStyle({width:i.computedWidth,"max-height":i.computedMaxHeight})},[e.createElementVNode("header",{class:e.normalizeClass(i.headerClass)},[e.renderSlot(t.$slots,"header",{},void 0,!0)],2),e.createElementVNode("div",m,[e.createElementVNode("section",null,[e.renderSlot(t.$slots,"body",{},void 0,!0)])]),e.createElementVNode("footer",{class:e.normalizeClass(i.footerClass)},[e.createElementVNode("div",h,[e.renderSlot(t.$slots,"footer",{},void 0,!0)]),e.createElementVNode("div",u,[e.renderSlot(t.$slots,"buttons",{},()=>[e.createElementVNode("button",{type:"button",class:e.normalizeClass(o.cancelButtonClass),onClick:n[1]||(n[1]=(...a)=>i.cancelButtonClicked&&i.cancelButtonClicked(...a))},e.toDisplayString(o.cancelButtonText),3),o.showConfirmButton?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:e.normalizeClass(o.confirmButtonClass),onClick:n[2]||(n[2]=(...a)=>i.confirm&&i.confirm(...a))},e.toDisplayString(o.confirmButtonText),3)):e.createCommentVNode("",!0)],!0)])],2)],4)),[[e.vShow,l.show]]):e.createCommentVNode("",!0)]),_:3},8,["name"])])}const k=r(c,[["render",f],["__scopeId","data-v-8c6374f0"]]);s.VueModal=k,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@appoly/vue-modal",
"version": "3.0.0",
"version": "3.0.1",
"description": "A simple modal component built with Vue.js",
"type": "module",
"files": [
Expand Down

0 comments on commit 5841dad

Please sign in to comment.