vue-lib-components
Version:
Contains Vue 3 components that are used quite often. At the moment it is a test version (however, the current components can be used), but in the near future new features will be improved and new components will be added.
2 lines (1 loc) • 9.02 kB
JavaScript
(function(a,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(a=typeof globalThis<"u"?globalThis:a||self,e(a["vue-lib-components"]={},a.Vue))})(this,function(a,e){"use strict";const b={class:"ui-accordion"},u={class:"ui-accordion__box-icon"},f={class:"ui-accordion__body"},B={key:0},y={key:1},$=e.defineComponent({__name:"Accordion",props:{title:{},content:{},disabled:{type:Boolean},open:{type:Boolean}},setup(c){const i=c,n=e.ref(!1),l=()=>{i.disabled||(n.value=!n.value)};return(t,s)=>(e.openBlock(),e.createElementBlock("div",b,[e.createElementVNode("div",{class:e.normalizeClass(["ui-accordion__title",{"ui-accordion__disabled":t.disabled}]),onClick:l},[e.createElementVNode("span",null,e.toDisplayString(t.title),1),e.createElementVNode("div",u,[t.$slots.icon?e.renderSlot(t.$slots,"icon",{key:0},void 0,!0):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["ui-accordion__chevron",{"ui-accordion__chevron--open":n.value||t.open}])},null,2)])],2),e.withDirectives(e.createElementVNode("div",f,[t.content?(e.openBlock(),e.createElementBlock("span",B,e.toDisplayString(t.content),1)):(e.openBlock(),e.createElementBlock("span",y,[e.renderSlot(t.$slots,"default",{},void 0,!0)]))],512),[[e.vShow,n.value||t.open]])]))}}),_=(c,i)=>{const n=c.__vccOpts||c;for(const[l,t]of i)n[l]=t;return n},E=_($,[["__scopeId","data-v-8bc91b40"]]),S=["disabled","id"],g={key:0},V={key:1,class:"ui-button__content"},N={key:0,class:"ui-button__content-slot"},C={class:"ui-button__text"},D={key:1,class:"ui-button__content-slot ui-button__content-slot--right"},w=_(e.defineComponent({__name:"Button",props:{text:{},id:{},disabled:{type:Boolean},fullWidth:{type:Boolean},loading:{type:Boolean}},emits:["click"],setup(c,{emit:i}){const n=i,l=()=>{n("click")};return(t,s)=>(e.openBlock(),e.createElementBlock("button",{disabled:t.disabled,id:t.id,class:e.normalizeClass(["ui-button",{"ui-button__disabled":t.disabled,"ui-button__full-width":t.fullWidth}]),onClick:l},[t.loading?(e.openBlock(),e.createElementBlock("div",g,s[0]||(s[0]=[e.createElementVNode("span",null,"Loading ...",-1)]))):(e.openBlock(),e.createElementBlock("div",V,[t.$slots.leftSlot?(e.openBlock(),e.createElementBlock("span",N,[e.renderSlot(t.$slots,"leftSlot",{},void 0,!0)])):e.createCommentVNode("",!0),e.createElementVNode("span",C,[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.text),1)],!0)]),t.$slots.rightSlot?(e.openBlock(),e.createElementBlock("span",D,[e.renderSlot(t.$slots,"rightSlot",{},void 0,!0)])):e.createCommentVNode("",!0)]))],10,S))}}),[["__scopeId","data-v-dfd16da5"]]),z={class:"ui-input"},I={class:"ui-input__container"},T={key:0,class:"ui-button__content-slot ui-button__content-slot--left"},O=["disabled","placeholder","maxlength"],A={key:1,class:"ui-button__content-slot ui-button__content-slot--right"},M={key:0,class:"ui-input__bottom"},U={class:"ui-input__hint"},j={key:0,class:"ui-input__maxlength"},F={key:1,class:"ui-input__error"},L=_(e.defineComponent({__name:"Input",props:{model:{},text:{},placeholder:{},id:{},disabled:{type:Boolean},error:{},hint:{},maxlength:{}},emits:["update:model","click"],setup(c,{emit:i}){const n=c;let l=e.ref(!1);const t=e.computed(()=>n.model?n.model.length:0),s=i,r=e.computed({get(){return n.model},set(o){s("update:model",o)}});return(o,p)=>(e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("div",{class:e.normalizeClass(["ui-input__text",{"input__text--focus":e.unref(l)}])},e.toDisplayString(o.text),3),e.createElementVNode("div",I,[o.$slots.leftSlot?(e.openBlock(),e.createElementBlock("div",T,[e.renderSlot(o.$slots,"leftSlot",{},void 0,!0)])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h),class:e.normalizeClass(["ui-input__field",{"ui-input__field--error":o.error}]),disabled:o.disabled,placeholder:o.placeholder,type:"text",maxlength:o.maxlength},null,10,O),[[e.vModelText,r.value]]),o.$slots.rightSlot?(e.openBlock(),e.createElementBlock("div",A,[e.renderSlot(o.$slots,"rightSlot",{},void 0,!0)])):e.createCommentVNode("",!0)]),o.maxlength||o.hint?(e.openBlock(),e.createElementBlock("div",M,[e.createElementVNode("span",U,e.toDisplayString(o.hint),1),o.maxlength?(e.openBlock(),e.createElementBlock("span",j,e.toDisplayString(t.value)+"/"+e.toDisplayString(o.maxlength),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),o.error?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(o.error),1)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-9d5c8e66"]]),W={class:"ui-select"},q={class:"ui-select__label"},P={class:"ui-select__container"},R=["disabled"],G={key:0,disabled:"",selected:"",value:""},H=["value","disabled"],J={key:0,class:"ui-select__error"},K={key:1,class:"ui-select__hint"},Q=_(e.defineComponent({__name:"Select",props:{model:{},width:{},label:{},notSelected:{},hideNotSelect:{type:Boolean},options:{},disabled:{type:Boolean},error:{},hint:{}},emits:["update:model","click"],setup(c,{emit:i}){let n=e.ref(!1);const l=c,t=e.computed(()=>l.notSelected?l.notSelected:"не указан"),s=e.computed(()=>Array.isArray(l.options)?!!l.options.length:!1),r=i,o=e.computed({get(){return l.model},set(d){r("update:model",d)}}),p=()=>n.value=!0,h=()=>n.value=!1;return(d,k)=>(e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",q,e.toDisplayString(d.label),1),e.createElementVNode("div",P,[e.withDirectives(e.createElementVNode("select",{"onUpdate:modelValue":k[0]||(k[0]=m=>o.value=m),onFocus:p,onBlur:h,disabled:d.disabled,class:e.normalizeClass(["ui-select__field",{"ui-select__field--not-selected":!o.value,"ui-select__field--error":d.error}])},[!o.value&&!d.hideNotSelect?(e.openBlock(),e.createElementBlock("option",G,e.toDisplayString(t.value),1)):e.createCommentVNode("",!0),s.value?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(d.options,(m,ce)=>(e.openBlock(),e.createElementBlock("option",{key:ce,value:m.value,disabled:m.disabled},e.toDisplayString(m.label),9,H))),128)):e.createCommentVNode("",!0)],42,R),[[e.vModelSelect,o.value]]),e.createElementVNode("div",{class:e.normalizeClass(["ui-select__icon",e.unref(n)?"select__icon--arrow-up":"select__icon--arrow-down"])},null,2)]),d.error?(e.openBlock(),e.createElementBlock("div",J,e.toDisplayString(d.error),1)):e.createCommentVNode("",!0),d.hint?(e.openBlock(),e.createElementBlock("div",K,e.toDisplayString(d.hint),1)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-fe3a36a2"]]),X={class:"ui-checkbox"},Y={class:"ui-checkbox__label"},Z={class:"ui-checkbox__slot"},x=["disabled"],v=_(e.defineComponent({__name:"Checkbox",props:{check:{},disabled:{},label:{}},emits:["update:check"],setup(c,{emit:i}){const n=c,l=i,t=e.computed({get(){return n.check},set(s){l("update:check",s)}});return(s,r)=>(e.openBlock(),e.createElementBlock("div",X,[e.createElementVNode("label",Y,[e.createElementVNode("span",Z,[e.createTextVNode(e.toDisplayString(s.label)+" ",1),e.renderSlot(s.$slots,"default",{},void 0,!0)]),e.withDirectives(e.createElementVNode("input",{type:"checkbox",disabled:!!s.disabled,"onUpdate:modelValue":r[0]||(r[0]=o=>t.value=o),class:"ui-checkbox__input"},null,8,x),[[e.vModelCheckbox,t.value]]),e.createElementVNode("span",{class:e.normalizeClass(["ui-checkbox__checkmark ",{"ui-checkbox__checkmark_disabled":s.disabled}])},null,2)])]))}}),[["__scopeId","data-v-d307a83d"]]),ee={class:"ui-tabs"},te={class:"ui-tabs__header"},oe=["value","disabled"],ne={class:"ui-tabs__label"},le={class:"ui-tabs__content"},se=_(e.defineComponent({__name:"Tabs",props:{picked:{},items:{}},emits:["update:picked"],setup(c,{emit:i}){const n=c,l=i,t=e.computed({get(){return n.picked},set(s){l("update:picked",s)}});return(s,r)=>(e.openBlock(),e.createElementBlock("div",ee,[e.createElementVNode("div",te,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.items,o=>(e.openBlock(),e.createElementBlock("label",{key:o.id,class:e.normalizeClass(["ui-tabs__tab",{"ui-tabs__tab--active":o.id===t.value}])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=p=>t.value=p),type:"radio",value:o.id,disabled:o.disabled,class:"ui-tabs__input"},null,8,oe),[[e.vModelRadio,t.value]]),e.createElementVNode("span",ne,e.toDisplayString(o.label),1)],2))),128))]),e.createElementVNode("div",le,[e.renderSlot(s.$slots,"default",{},void 0,!0)])]))}}),[["__scopeId","data-v-35a8f9cd"]]),ie=_(e.defineComponent({__name:"Skeleton",props:{backgroundColor:{},width:{},height:{}},setup(c){const i=c,n=e.computed(()=>{let l={};return Object.keys(i).forEach(t=>{t&&(l[t]=i[t])}),l});return(l,t)=>(e.openBlock(),e.createElementBlock("div",{class:"ui-skeleton",style:e.normalizeStyle(n.value)},null,4))}}),[["__scopeId","data-v-02f01480"]]);a.Accordion=E,a.Button=w,a.Checkbox=v,a.Input=L,a.Select=Q,a.Skeleton=ie,a.Tabs=se,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})});