UNPKG

@jkwamlah/z-button

Version:

A vue based implementation of modern dynamic buttons that bring the best experience and simplicity. It supports enough props to satisfy mind-blowing customizations.

1 lines 4.62 kB
var ZButton=function(){"use strict";function t(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var o,r,a=[],i=!0,l=!1;try{for(n=n.call(t);!(i=(o=n.next()).done)&&(a.push(o.value),!e||a.length!==e);i=!0);}catch(t){l=!0,r=t}finally{try{i||null==n.return||n.return()}finally{if(l)throw r}}return a}(t,n)||function(t,n){if(!t)return;if("string"==typeof t)return e(t,n);var o=Object.prototype.toString.call(t).slice(8,-1);"Object"===o&&t.constructor&&(o=t.constructor.name);if("Map"===o||"Set"===o)return Array.from(t);if("Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return e(t,n)}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}var n={name:"ZButton",props:{buttonStyleObject:{type:Object,default:function(){return{}}},textStyleObject:{type:Object,default:function(){return{}}},buttonType:{type:String,default:""},buttonText:{type:String,default:""},dataToggle:{type:String,default:""},dataTarget:{type:String,default:""},icon:{type:String,default:""},iconStyleObject:{type:Object,default:function(){}},loading:{type:Boolean,default:!1}},methods:{handleButtonClick:function(){this.$emit("button-clicked")}}};function o(t,e,n,o,r,a,i,l,s,c){"boolean"!=typeof i&&(s=l,l=i,i=!1);const u="function"==typeof n?n.options:n;let d;if(t&&t.render&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),o&&(u._scopeId=o),a?(d=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__),e&&e.call(this,s(t)),t&&t._registeredComponents&&t._registeredComponents.add(a)},u._ssrRegister=d):e&&(d=i?function(t){e.call(this,c(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,l(t))}),d)if(u.functional){const t=u.render;u.render=function(e,n){return d.call(n),t(e,n)}}else{const t=u.beforeCreate;u.beforeCreate=t?[].concat(t,d):[d]}return n}const r="undefined"!=typeof navigator&&/msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());function a(t){return(t,e)=>function(t,e){const n=r?e.media||"default":t,o=l[n]||(l[n]={ids:new Set,styles:[]});if(!o.ids.has(t)){o.ids.add(t);let n=e.source;if(e.map&&(n+="\n/*# sourceURL="+e.map.sources[0]+" */",n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(e.map))))+" */"),o.element||(o.element=document.createElement("style"),o.element.type="text/css",e.media&&o.element.setAttribute("media",e.media),void 0===i&&(i=document.head||document.getElementsByTagName("head")[0]),i.appendChild(o.element)),"styleSheet"in o.element)o.styles.push(n),o.element.styleSheet.cssText=o.styles.filter(Boolean).join("\n");else{const t=o.ids.size-1,e=document.createTextNode(n),r=o.element.childNodes;r[t]&&o.element.removeChild(r[t]),r.length?o.element.insertBefore(e,r[t]):o.element.appendChild(e)}}}(t,e)}let i;const l={};var s=o({render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("button",{staticClass:"z-btn",style:t.buttonStyleObject,attrs:{type:t.buttonType,"data-toggle":t.dataToggle,"data-target":t.dataTarget},on:{click:function(e){return e.preventDefault(),t.handleButtonClick.apply(null,arguments)}}},[t.loading?t._e():n("span",{staticClass:"button-text-style",style:t.textStyleObject},[t.buttonText?n("span",{staticClass:"d-flex"},[t._v(t._s(t.buttonText))]):t._e(),t._v(" "),t.icon?n("span",{staticClass:"d-flex",style:t.iconStyleObject},[n("i",{class:t.icon})]):t._e()]),t._v(" "),t.loading?n("span",[t._t("spinner")],2):t._e()])},staticRenderFns:[]},(function(t){t&&t("data-v-010d1594_0",{source:".z-btn[data-v-010d1594]{display:flex;flex-direction:row;justify-content:center;align-items:center;text-decoration:none}.button-text-style[data-v-010d1594]{display:flex;align-items:center;justify-content:center;text-align:center;font-style:normal;font-weight:600;flex:none;order:0;flex-grow:0}button[data-v-010d1594]:focus{box-shadow:none}",map:void 0,media:void 0})}),n,"data-v-010d1594",false,undefined,!1,a,void 0,void 0),c=s,u=function(){var t=c;return t.install=function(e){e.component("ZButton",t)},t}(),d=Object.freeze({__proto__:null,default:u});return Object.entries(d).forEach((function(e){var n=t(e,2),o=n[0],r=n[1];"default"!==o&&(u[o]=r)})),u}();