UNPKG

@zeit-ui/vue

Version:

A popular UI framework for Vue

2 lines 7.11 kB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["checkbox"]=t():e["checkbox"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({"05cc":function(e,t,n){"use strict";var r=n("ad11"),o=n.n(r);o.a},ad11:function(e,t,n){},f6fd:function(e,t){(function(e){var t="currentScript",n=e.getElementsByTagName("script");t in e||Object.defineProperty(e,t,{get:function(){try{throw new Error}catch(r){var e,t=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(r.stack)||[!1])[1];for(e in n)if(n[e].src==t||"interactive"==n[e].readyState)return n[e];return null}}})})(document)},fb15:function(e,t,n){"use strict";var r;(n.r(t),"undefined"!==typeof window)&&(n("f6fd"),(r=window.document.currentScript)&&(r=r.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=r[1]));var o=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("label",{staticClass:"zi-checkbox-container",class:{disabled:e.isDisabled}},[e.model?n("checked",{staticClass:"zi-checkbox",class:{disabled:e.isDisabled},attrs:{size:"15"}}):e._e(),e.model?e._e():n("unchecked",{staticClass:"zi-checkbox",class:{disabled:e.isDisabled},attrs:{size:"15"}}),n("input",{directives:[{name:"model",rawName:"v-model",value:e.model,expression:"model"}],staticClass:"zi-checkbox-original",attrs:{type:"checkbox",disabled:e.isDisabled},domProps:{checked:Array.isArray(e.model)?e._i(e.model,null)>-1:e.model},on:{change:function(t){var n=e.model,r=t.target,o=!!r.checked;if(Array.isArray(n)){var i=null,s=e._i(n,i);r.checked?s<0&&(e.model=n.concat([i])):s>-1&&(e.model=n.slice(0,s).concat(n.slice(s+1)))}else e.model=o}}}),n("span",{staticClass:"zi-checkbox-label"},[e.$slots.default?e._e():[e._v(e._s(e.label))],e._t("default")],2)],1)},i=[],s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("svg",e._g(e._b({style:e.styles,attrs:{fill:"none",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"}},"svg",e.attrs,!1),e.listeners),[n("path",{attrs:{d:"M16.09 3H7.91A4.91 4.91 0 003 7.91v8.18A4.909 4.909 0 007.91 21h8.18A4.909 4.909 0 0021 16.09V7.91A4.909 4.909 0 0016.09 3z"}})])},l=[];const a={size:[String,Number],color:String},c={listeners(){return{...this.$listeners}},styles(){const e=this.size?{height:this.size,width:this.size}:{};return{...e,color:this.color||"currentColor"}},attrs(){return{viewBox:"0 0 24 24","shape-rendering":"geometricPrecision",width:24,height:24,...this.$attrs}}};var u={name:"checkbox-icon",props:a,computed:c},d=u;function f(e,t,n,r,o,i,s,l){var a,c="function"===typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),s?(a=function(e){e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,e||"undefined"===typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},c._ssrRegister=a):o&&(a=l?function(){o.call(this,this.$root.$options.shadowRoot)}:o),a)if(c.functional){c._injectStyles=a;var u=c.render;c.render=function(e,t){return a.call(t),u(e,t)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,a):[a]}return{exports:e,options:c}}var p=f(d,s,l,!1,null,null,null),h=p.exports,m=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("svg",e._g(e._b({style:e.styles,attrs:{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5"}},"svg",e.attrs,!1),e.listeners),[n("path",{attrs:{fill:"currentColor",stroke:"none",d:"M7.91 3h8.18a4.908 4.908 0 014.31 2.554l-8.273 8.377-2.592-2.638a.75.75 0 10-1.07 1.05l3.125 3.182a.75.75 0 001.069.002l8.281-8.386c.04.25.06.507.06.768v8.182A4.909 4.909 0 0116.09 21H7.91A4.909 4.909 0 013 16.09V7.91A4.91 4.91 0 017.91 3z"}})])},b=[],v={name:"checkbox-fill-icon",props:a,computed:c},_=v,y=f(_,m,b,!1,null,null,null),g=y.exports,x={name:"zi-checkbox",components:{unchecked:h,checked:g},data:function(){return{_model:!1}},props:{label:{type:[String,Boolean,Number]},value:Boolean,disabled:Boolean},computed:{model:{get:function(){var e=this;return this.inGroup?!!this._group.model.find((function(t){return t===e.label})):void 0!==this.value?this.value:this._model},set:function(e){if(this.inGroup)return this._group.setLabelStatus(this.label,e);this._model=e,this.$emit("input",e)}},isDisabled:function(){return this.inGroup&&this._group.disabled||this.disabled},inGroup:function(){var e=this.$parent;while(e){if("zi-checkbox-group"===e.$options.name)return this._group=e,!0;e=e.$parent}return!1}}},k=x,S=(n("05cc"),f(k,o,i,!1,null,null,null)),$=S.exports,j=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"zi-checkbox-group"},[e._t("default")],2)},w=[];function A(e){return E(e)||O(e)||z(e)||C()}function C(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function z(e,t){if(e){if("string"===typeof e)return P(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(n):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(e,t):void 0}}function O(e){if("undefined"!==typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}function E(e){if(Array.isArray(e))return P(e)}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var T={name:"zi-checkbox-group",data:function(){return{_model:[]}},props:{value:{type:Array,default:function(){return[]}},disabled:Boolean},computed:{model:{get:function(){return void 0!==this.value?this.value:this._model},set:function(e){this._model=e,this.$emit("input",e)}}},methods:{setLabelStatus:function(e,t){this.model=t?A(new Set(this.model.concat([e]))):this.model.filter((function(t){return t!==e}))}}},M=T,B=f(M,j,w,!1,null,null,null),N=B.exports;$.install=function(e){e.component($.name,$),e.component(N.name,N)};var D=$;t["default"]=D}})["default"]})); //# sourceMappingURL=checkbox.umd.min.js.map