@geoblink/design-system
Version:
Geoblink Design System for Vue.js
1 lines • 14.9 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("lodash")):"function"==typeof define&&define.amd?define(["lodash"],e):"object"==typeof exports?exports["components/GeoModal"]=e(require("lodash")):t["components/GeoModal"]=e(t.lodash)}(window,function(t){return o={},e.m=n={"3Fcl":function(t,e,n){"use strict";var o=n("YLtl"),r=n.n(o);e.a=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:10;return r.a.throttle(t,e,{leading:!0,trailing:!0})}},"3iwg":function(t,e,n){"use strict";function o(){var t=0;return function(){return t++}}n.d(e,"a",function(){return o})},79:function(t,e,n){t.exports=n("R9N0")},"DI/g":function(t,e,n){"use strict";e.a=function(t){return t.componentInstance&&t.componentInstance.$isServer}},"H+ED":function(t,e,n){"use strict";var o=n("YLtl"),r=n.n(o),i=n("bdgK"),s=n("3Fcl"),a=n("DI/g"),c=n("3iwg"),u=Object(c.a)(),h={};e.a={bind:function(t,e,n){if(function(t){var e=r.a.get(t.value,"callback",t.value);return"function"==typeof e||(console.error("GeoOnResize [directive] :: provided callback ".concat(e," is not a function")),!1)}(e)&&!Object(a.a)(n)){t.__geoOnResizeCallbackId__=u();var o=r.a.get(e.value,"callback",e.value),c=r.a.get(e.value,"target",t),l=new i.a(Object(s.a)(function(t){o(t)}));l.observe(c),h[t.__geoOnResizeCallbackId__]=l}},unbind:function(t){h[t.__geoOnResizeCallbackId__].disconnect(),h=r.a.omit(h,t.__geoOnResizeCallbackId__)}}},"KHd+":function(t,e,n){"use strict";function o(t,e,n,o,r,i,s,a){var c,u="function"==typeof t?t.options:t;if(e&&(u.render=e,u.staticRenderFns=n,u._compiled=!0),o&&(u.functional=!0),i&&(u._scopeId="data-v-"+i),s?(c=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(s)},u._ssrRegister=c):r&&(c=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),c)if(u.functional){u._injectStyles=c;var h=u.render;u.render=function(t,e){return c.call(e),h(t,e)}}else{var l=u.beforeCreate;u.beforeCreate=l?[].concat(l,c):[c]}return{exports:t,options:u}}n.d(e,"a",function(){return o})},R9N0:function(t,e,n){"use strict";n.r(e);var o=n("H+ED"),r=n("wEB2");function i(){return"undefined"!=typeof document?document:{}}var s={name:"GeoModal",status:"ready",release:"7.3.0",directives:{OnResize:o.a,ScrollAnywhere:r.a},props:{attachTo:{type:null,default:function(){return i().body}},headerIcon:{type:Array,required:!1},headerCloseIcon:{type:Array,default:function(){return[]}}},data:function(){return{containerScrollOffset:{left:0,top:0},containerSize:{height:0,width:0}}},computed:{modalStyle:function(){return this.attachTo===i().body?{position:"fixed"}:{transform:"translate(\n ".concat(this.containerScrollOffset.left,"px,\n ").concat(this.containerScrollOffset.top,"px\n )"),height:"".concat(this.containerSize.height,"px"),width:"".concat(this.containerSize.width,"px")}},hasHeader:function(){return!(!this.$slots.header||!this.$slots.header.length)},hasBody:function(){return!(!this.$slots.body||!this.$slots.body.length)},hasFooter:function(){return!(!this.$slots.footer||!this.$slots.footer.length)}},watch:{attachTo:function(){this.reattachModalToProperParent()}},mounted:function(){this.reattachModalToProperParent()},updated:function(){this.repositionModal()},beforeDestroy:function(){this.removeModalFromDOM()},methods:{removeModalFromDOM:function(){var t=this.$el;t.parentNode&&t.parentNode.removeChild(t)},reattachModalToProperParent:function(){var t=this.$el;this.removeModalFromDOM(),this.attachTo.appendChild(t),this.setAttachToElementPosition(),this.repositionModal()},setAttachToElementPosition:function(){this.attachTo!==i().body&&"static"===getComputedStyle(this.attachTo).getPropertyValue("position")&&(console.warn("GeoModal [component] :: setting position of attach-to element to «relative» since it's required to anchor the modal. Set attach-to element position to «relative» in your CSS styles to avoid this warning."),this.attachTo.style.position="relative")},repositionModal:function(){var t=this.attachTo.getBoundingClientRect();this.containerSize.height=t.height,this.containerSize.width=t.width,this.containerScrollOffset.left=this.attachTo.scrollLeft,this.containerScrollOffset.top=this.attachTo.scrollTop},handleBackdropClick:function(t){this.$emit("click-backdrop",t)},handleCloseClick:function(t){this.$emit("close",t)}}},a=n("KHd+"),c=Object(a.a)(s,function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"on-resize",rawName:"v-on-resize",value:{callback:t.repositionModal,target:t.attachTo},expression:"{\n callback: repositionModal,\n target: attachTo\n }"},{name:"scroll-anywhere",rawName:"v-scroll-anywhere",value:t.repositionModal,expression:"repositionModal"}],staticClass:"geo-modal",style:t.modalStyle},[n("div",{staticClass:"geo-modal__backdrop",on:{click:function(e){return t.handleBackdropClick(e)}}}),t._v(" "),n("div",{staticClass:"geo-modal__content"},[t._t("default",[n("geo-bordered-box",[t.hasHeader?n("geo-bordered-box-header",{attrs:{icon:t.headerIcon,"trailing-icon":t.headerCloseIcon},on:{"click-trailing-icon":function(e){return t.handleCloseClick(e)}}},[t._t("header")],2):t._e(),t._v(" "),t.hasBody?n("div",{staticClass:"geo-modal__content-body"},[t._t("body")],2):t._e(),t._v(" "),t.hasFooter?n("geo-bordered-box-footer",[t._t("footer")],2):t._e()],1)])],2)])},[],!1,null,null,null);e.default=c.exports},YLtl:function(e,n){e.exports=t},bdgK:function(t,e,n){"use strict";(function(t){var n=function(){if("undefined"!=typeof Map)return Map;function t(t,e){var n=-1;return t.some(function(t,o){return t[0]===e&&(n=o,!0)}),n}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(e){var n=t(this.__entries__,e),o=this.__entries__[n];return o&&o[1]},e.prototype.set=function(e,n){var o=t(this.__entries__,e);~o?this.__entries__[o][1]=n:this.__entries__.push([e,n])},e.prototype.delete=function(e){var n=this.__entries__,o=t(n,e);~o&&n.splice(o,1)},e.prototype.has=function(e){return!!~t(this.__entries__,e)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(t,e){void 0===e&&(e=null);for(var n=0,o=this.__entries__;n<o.length;n++){var r=o[n];t.call(e,r[1],r[0])}},e;function e(){this.__entries__=[]}}(),o="undefined"!=typeof window&&"undefined"!=typeof document&&window.document===document,r=void 0!==t&&t.Math===Math?t:"undefined"!=typeof self&&self.Math===Math?self:"undefined"!=typeof window&&window.Math===Math?window:Function("return this")(),i="function"==typeof requestAnimationFrame?requestAnimationFrame.bind(r):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)},s=2,a=["top","right","bottom","left","width","height","size","weight"],c="undefined"!=typeof MutationObserver,u=(h.prototype.addObserver=function(t){~this.observers_.indexOf(t)||this.observers_.push(t),this.connected_||this.connect_()},h.prototype.removeObserver=function(t){var e=this.observers_,n=e.indexOf(t);~n&&e.splice(n,1),!e.length&&this.connected_&&this.disconnect_()},h.prototype.refresh=function(){this.updateObservers_()&&this.refresh()},h.prototype.updateObservers_=function(){var t=this.observers_.filter(function(t){return t.gatherActive(),t.hasActive()});return t.forEach(function(t){return t.broadcastActive()}),0<t.length},h.prototype.connect_=function(){o&&!this.connected_&&(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),c?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},h.prototype.disconnect_=function(){o&&this.connected_&&(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},h.prototype.onTransitionEnd_=function(t){var e=t.propertyName,n=void 0===e?"":e;a.some(function(t){return!!~n.indexOf(t)})&&this.refresh()},h.getInstance=function(){return this.instance_||(this.instance_=new h),this.instance_},h.instance_=null,h);function h(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=function(t,e){var n=!1,o=!1,r=0;function a(){n&&(n=!1,t()),o&&u()}function c(){i(a)}function u(){var t=Date.now();if(n){if(t-r<s)return;o=!0}else o=!(n=!0),setTimeout(c,e);r=t}return u}(this.refresh.bind(this),20)}var l=function(t,e){for(var n=0,o=Object.keys(e);n<o.length;n++){var r=o[n];Object.defineProperty(t,r,{value:e[r],enumerable:!1,writable:!1,configurable:!0})}return t},d=function(t){return t&&t.ownerDocument&&t.ownerDocument.defaultView||r},f=y(0,0,0,0);function p(t){return parseFloat(t)||0}function v(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce(function(e,n){return e+p(t["border-"+n+"-width"])},0)}var _="undefined"!=typeof SVGGraphicsElement?function(t){return t instanceof d(t).SVGGraphicsElement}:function(t){return t instanceof d(t).SVGElement&&"function"==typeof t.getBBox};function b(t){return o?_(t)?function(t){var e=t.getBBox();return y(0,0,e.width,e.height)}(t):function(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return f;var o=d(t).getComputedStyle(t),r=function(t){for(var e={},n=0,o=["top","right","bottom","left"];n<o.length;n++){var r=o[n],i=t["padding-"+r];e[r]=p(i)}return e}(o),i=r.left+r.right,s=r.top+r.bottom,a=p(o.width),c=p(o.height);if("border-box"===o.boxSizing&&(Math.round(a+i)!==e&&(a-=v(o,"left","right")+i),Math.round(c+s)!==n&&(c-=v(o,"top","bottom")+s)),!function(t){return t===d(t).document.documentElement}(t)){var u=Math.round(a+i)-e,h=Math.round(c+s)-n;1!==Math.abs(u)&&(a-=u),1!==Math.abs(h)&&(c-=h)}return y(r.left,r.top,a,c)}(t):f}function y(t,e,n,o){return{x:t,y:e,width:n,height:o}}var m=(g.prototype.isActive=function(){var t=b(this.target);return(this.contentRect_=t).width!==this.broadcastWidth||t.height!==this.broadcastHeight},g.prototype.broadcastRect=function(){var t=this.contentRect_;return this.broadcastWidth=t.width,this.broadcastHeight=t.height,t},g);function g(t){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=y(0,0,0,0),this.target=t}var w=function(t,e){var n=function(t){var e=t.x,n=t.y,o=t.width,r=t.height,i="undefined"!=typeof DOMRectReadOnly?DOMRectReadOnly:Object,s=Object.create(i.prototype);return l(s,{x:e,y:n,width:o,height:r,top:n,right:e+o,bottom:r+n,left:e}),s}(e);l(this,{target:t,contentRect:n})},O=(E.prototype.observe=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof d(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)||(e.set(t,new m(t)),this.controller_.addObserver(this),this.controller_.refresh())}},E.prototype.unobserve=function(t){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if("undefined"!=typeof Element&&Element instanceof Object){if(!(t instanceof d(t).Element))throw new TypeError('parameter 1 is not of type "Element".');var e=this.observations_;e.has(t)&&(e.delete(t),e.size||this.controller_.removeObserver(this))}},E.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},E.prototype.gatherActive=function(){var t=this;this.clearActive(),this.observations_.forEach(function(e){e.isActive()&&t.activeObservations_.push(e)})},E.prototype.broadcastActive=function(){if(this.hasActive()){var t=this.callbackCtx_,e=this.activeObservations_.map(function(t){return new w(t.target,t.broadcastRect())});this.callback_.call(t,e,t),this.clearActive()}},E.prototype.clearActive=function(){this.activeObservations_.splice(0)},E.prototype.hasActive=function(){return 0<this.activeObservations_.length},E);function E(t,e,o){if(this.activeObservations_=[],this.observations_=new n,"function"!=typeof t)throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=t,this.controller_=e,this.callbackCtx_=o}var M="undefined"!=typeof WeakMap?new WeakMap:new n,x=function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=u.getInstance(),o=new O(e,n,this);M.set(this,o)};["observe","unobserve","disconnect"].forEach(function(t){x.prototype[t]=function(){var e;return(e=M.get(this))[t].apply(e,arguments)}});var S=void 0!==r.ResizeObserver?r.ResizeObserver:x;e.a=S}).call(this,n("yLpj"))},wEB2:function(t,e,n){"use strict";var o=n("YLtl"),r=n.n(o),i=n("3Fcl"),s=n("DI/g"),a=n("3iwg"),c=Object(a.a)(),u=Object(i.a)(function(t){for(var e=0,n=Object.values(h);e<n.length;e++)(0,n[e])(t)}),h={};e.a={bind:function(t,e,n){!function(t){return"function"==typeof t.value||(console.error("GeoScrollAnywhere [directive] :: provided expression ".concat(t.expression," is not a function")),!1)}(e)||Object(s.a)(n)||(r.a.isEmpty(h)&&window.addEventListener("scroll",u,!0),t.__geoOnAnyScrollCallbackId__=c(),h[t.__geoOnAnyScrollCallbackId__]=function(t){e.value(t)})},unbind:function(t){h=r.a.omit(h,t.__geoOnAnyScrollCallbackId__),r.a.isEmpty(h)&&window.removeEventListener("scroll",u)}}},yLpj:function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n}},e.c=o,e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var r in t)e.d(o,r,function(e){return t[e]}.bind(null,r));return o},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/",e(e.s=79);function e(t){if(o[t])return o[t].exports;var r=o[t]={i:t,l:!1,exports:{}};return n[t].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n,o});