UNPKG

@zeit-ui/vue

Version:

A popular UI framework for Vue

2 lines 8.57 kB
(function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["input"]=t():e["input"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},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")}({6820:function(e,t,n){},"7ce0":function(e,t,n){},"87b5":function(e,t,n){"use strict";var i=n("6820"),r=n.n(i);r.a},ba8f:function(e,t,n){"use strict";var i=n("7ce0"),r=n.n(i);r.a},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(i){var e,t=(/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(i.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";n.r(t);var i,r={};(n.r(r),n.d(r,"enums",(function(){return b})),n.d(r,"isMac",(function(){return v})),"undefined"!==typeof window)&&(n("f6fd"),(i=window.document.currentScript)&&(i=i.src.match(/(.+\/)[^/]+\.js(\?.*)?$/))&&(n.p=i[1]));var s=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{class:[e.groupClass,{prefix:e.hasPrefix,suffix:e.hasSuffix,clearable:e.clearable}]},[e.prefixLabel?n("span",{staticClass:"zi-label prefix",class:e.size&&e.size},[e._v(e._s(e.prefixLabel))]):e._e(),e.hasPrefixIcon?n("span",{staticClass:"zi-label prefix",class:e.size&&e.size},[e._t("prefixIcon")],2):e._e(),"checkbox"===e._type?n("input",e._g(e._b({directives:[{name:"model",rawName:"v-model",value:e.model,expression:"model"}],staticClass:"zi-input",class:[{disabled:e.disabled},e.size&&e.size,e.type],attrs:{disabled:e.disabled,type:"checkbox"},domProps:{checked:Array.isArray(e.model)?e._i(e.model,null)>-1:e.model},on:{focus:function(t){e.showCloseIcon=!0},blur:function(t){return t.target!==t.currentTarget?null:e.hiddenCloseIcon(t)},change:function(t){var n=e.model,i=t.target,r=!!i.checked;if(Array.isArray(n)){var s=null,o=e._i(n,s);i.checked?o<0&&(e.model=n.concat([s])):o>-1&&(e.model=n.slice(0,o).concat(n.slice(o+1)))}else e.model=r}}},"input",e.$attrs,!1),e.customListeners)):"radio"===e._type?n("input",e._g(e._b({directives:[{name:"model",rawName:"v-model",value:e.model,expression:"model"}],staticClass:"zi-input",class:[{disabled:e.disabled},e.size&&e.size,e.type],attrs:{disabled:e.disabled,type:"radio"},domProps:{checked:e._q(e.model,null)},on:{focus:function(t){e.showCloseIcon=!0},blur:function(t){return t.target!==t.currentTarget?null:e.hiddenCloseIcon(t)},change:function(t){e.model=null}}},"input",e.$attrs,!1),e.customListeners)):n("input",e._g(e._b({directives:[{name:"model",rawName:"v-model",value:e.model,expression:"model"}],staticClass:"zi-input",class:[{disabled:e.disabled},e.size&&e.size,e.type],attrs:{disabled:e.disabled,type:e._type},domProps:{value:e.model},on:{focus:function(t){e.showCloseIcon=!0},blur:function(t){return t.target!==t.currentTarget?null:e.hiddenCloseIcon(t)},input:function(t){t.target.composing||(e.model=t.target.value)}}},"input",e.$attrs,!1),e.customListeners)),e.suffixLabel?n("span",{staticClass:"zi-label suffix",class:e.size&&e.size},[e._v(e._s(e.suffixLabel))]):e._e(),e.hasSuffixIcon?n("span",{staticClass:"zi-label suffix",class:e.size&&e.size},[e._t("suffixIcon")],2):e._e(),e.clearable&&e.showCloseIcon?n("DeleteIcon",{staticClass:"close",on:{mousedown:e.clear}}):e._e()],1)},o=[],a=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:"M21 4H8l-7 8 7 8h13a2 2 0 002-2V6a2 2 0 00-2-2zM18 9l-6 6M12 9l6 6"}})])},l=[];const u={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 f={name:"delete-icon",props:u,computed:c},d=f;function p(e,t,n,i,r,s,o,a){var l,u="function"===typeof e?e.options:e;if(t&&(u.render=t,u.staticRenderFns=n,u._compiled=!0),i&&(u.functional=!0),s&&(u._scopeId="data-v-"+s),o?(l=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__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(o)},u._ssrRegister=l):r&&(l=a?function(){r.call(this,this.$root.$options.shadowRoot)}:r),l)if(u.functional){u._injectStyles=l;var c=u.render;u.render=function(e,t){return l.call(t),c(e,t)}}else{var f=u.beforeCreate;u.beforeCreate=f?[].concat(f,l):[l]}return{exports:e,options:u}}var h=p(d,a,l,!1,null,null,null),m=h.exports,b=function(e){return function(t){return!!Array.isArray(e)&&!!e.find((function(e){return e===t}))}},v=function(){if("undefined"===typeof window||!window.navigator)return!1;var e=navigator.userAgent.toLowerCase();return/macintosh|mac os x/i.test(e)},g=function(e){var t=e.getBoundingClientRect(),n=window.getComputedStyle(e),i=n.width,r=n.height,s=function(e,t){if(!e)return 0;var n=e.includes("px")?+e.split("px")[0]:e.includes("%")?+e.split("%")[0]*t*.01:e;return Number.isNaN(+n)?0:+n};return{width:s("".concat(i),t.width),height:s("".concat(r),t.height)}},y=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("transition",{attrs:{name:"expand"},on:{enter:e.enter,"after-enter":e.afterEnter,leave:e.leave}},[e._t("default")],2)},x=[],_={name:"zi-transition-expand",methods:{enter:function(e){var t=g(e),n=t.width;e.style.width="".concat(n,"px"),e.style.position="absolute",e.style.visibility="hidden",e.style.height="auto";var i=g(e),r=i.height;e.style.width=null,e.style.position=null,e.style.visibility=null,e.style.height=0,g(e);var s=setTimeout((function(){e.style.height="".concat(r,"px"),clearTimeout(s)}),0)},afterEnter:function(e){e.style.height="auto"},leave:function(e){var t=g(e),n=t.height;e.style.height="".concat(n,"px"),g(e);var i=setTimeout((function(){e.style.height=0,clearTimeout(i)}),0)},afterLeave:function(e){e.style.height=null}}},w=_,C=(n("ba8f"),p(w,y,x,!1,null,null,null)),z=(C.exports,new Map,{name:"zi-input",data:function(){return{privateModel:"",showCloseIcon:!1}},components:{DeleteIcon:m},props:{value:[String,Number],clearable:Boolean,prefixIcon:String,suffixIcon:String,prefixLabel:[String,Number],suffixLabel:[String,Number],disabled:Boolean,size:{type:String,validator:r.enums(["mini","small","medium","big"])},type:{type:String,validator:r.enums(["primary","success","warning","danger"]),default:"primary"},_type:String},computed:{model:{get:function(){return void 0===this.value?this.privateModel:this.value},set:function(e){this.privateModel=e,this.$emit("input",e)}},hasPrefix:function(){return this.hasPrefixIcon||this.prefixLabel},hasPrefixIcon:function(){return!!this.$slots.prefixIcon},hasSuffix:function(){return this.hasSuffixIcon||this.suffixLabel},hasSuffixIcon:function(){return!!this.$slots.suffixIcon},groupClass:function(){return this.hasPrefix||this.hasSuffix?"zi-input-group":"zi-input-group-empty"},customListeners:function(){var e=this,t={};return Object.keys(this.$listeners).forEach((function(n){"input"!==n&&(t[n]=e.$listeners[n])})),t}},methods:{clear:function(){this.clearable&&(this.model="")},hiddenCloseIcon:function(){this.showCloseIcon=!1}}}),S=z,I=(n("87b5"),p(S,s,o,!1,null,null,null)),$=I.exports;$.install=function(e){e.component($.name,$)};var P=$;t["default"]=P}})["default"]})); //# sourceMappingURL=input.umd.min.js.map