vuiii 0.1.0-alpha

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +16 -0
  2. package/dist/components/Breadcrumbs.vue.d.ts +17 -0
  3. package/dist/components/Button.vue.d.ts +76 -0
  4. package/dist/components/Checkbox.vue.d.ts +28 -0
  5. package/dist/components/CheckboxGroup.vue.d.ts +59 -0
  6. package/dist/components/Form.vue.d.ts +84 -0
  7. package/dist/components/FormFields.vue.d.ts +49 -0
  8. package/dist/components/FormGroup.vue.d.ts +47 -0
  9. package/dist/components/Icon.vue.d.ts +16 -0
  10. package/dist/components/Input.vue.d.ts +57 -0
  11. package/dist/components/Select.vue.d.ts +83 -0
  12. package/dist/components/Table.vue.d.ts +51 -0
  13. package/dist/components/Textarea.vue.d.ts +19 -0
  14. package/dist/components/modal/ModalLayout.vue.d.ts +32 -0
  15. package/dist/components/modal/ModalLayoutDialog.vue.d.ts +36 -0
  16. package/dist/components/modal/ModalStack.vue.d.ts +18 -0
  17. package/dist/components/snackbar/SnackbarStack.vue.d.ts +18 -0
  18. package/dist/favicon.ico +0 -0
  19. package/dist/hooks/useAction.d.ts +35 -0
  20. package/dist/icons/arrow-narrow-down.vue.d.ts +2 -0
  21. package/dist/icons/arrow-narrow-left.vue.d.ts +2 -0
  22. package/dist/icons/arrow-narrow-right.vue.d.ts +2 -0
  23. package/dist/icons/arrow-narrow-up.vue.d.ts +2 -0
  24. package/dist/icons/check-circle.vue.d.ts +2 -0
  25. package/dist/icons/check.vue.d.ts +2 -0
  26. package/dist/icons/chevron-left.vue.d.ts +2 -0
  27. package/dist/icons/chevron-right.vue.d.ts +2 -0
  28. package/dist/icons/exclamation-circle.vue.d.ts +2 -0
  29. package/dist/icons/exclamation.vue.d.ts +2 -0
  30. package/dist/icons/plus.vue.d.ts +2 -0
  31. package/dist/icons/search.vue.d.ts +2 -0
  32. package/dist/icons/spinner.vue.d.ts +2 -0
  33. package/dist/icons/trash.vue.d.ts +2 -0
  34. package/dist/icons/x.vue.d.ts +2 -0
  35. package/dist/index.d.ts +21 -0
  36. package/dist/modal.d.ts +69 -0
  37. package/dist/snackbar.d.ts +21 -0
  38. package/dist/style.css +1 -0
  39. package/dist/utils/normalizeOptions.d.ts +13 -0
  40. package/dist/utils/resolveGlobImport.d.ts +3 -0
  41. package/dist/utils/transformInputAttrs.d.ts +5 -0
  42. package/dist/vui.es.js +1751 -0
  43. package/dist/vui.umd.js +1 -0
  44. package/package.json +45 -0
@@ -0,0 +1 @@
1
+ (function(c,e){typeof exports=="object"&&typeof module!="undefined"?e(exports,require("vue"),require("vue-router")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router"],e):(c=typeof globalThis!="undefined"?globalThis:c||self,e(c.vui={},c.Vue,c.VueRouter))})(this,function(c,e,h){"use strict";var rn=Object.defineProperty,ln=Object.defineProperties;var sn=Object.getOwnPropertyDescriptors;var E=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;var x=(c,e,h)=>e in c?rn(c,e,{enumerable:!0,configurable:!0,writable:!0,value:h}):c[e]=h,y=(c,e)=>{for(var h in e||(e={}))A.call(e,h)&&x(c,h,e[h]);if(E)for(var h of E(e))T.call(e,h)&&x(c,h,e[h]);return c},B=(c,e)=>ln(c,sn(e));var D=(c,e)=>{var h={};for(var b in c)A.call(c,b)&&e.indexOf(b)<0&&(h[b]=c[b]);if(c!=null&&E)for(var b of E(c))e.indexOf(b)<0&&T.call(c,b)&&(h[b]=c[b]);return h};var b="",u=(t,o)=>{const n=t.__vccOpts||t;for(const[a,l]of o)n[a]=l;return n};const P={},G={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},q=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M16 17l-4 4m0 0l-4-4m4 4V3"},null,-1)];function R(t,o){return e.openBlock(),e.createElementBlock("svg",G,q)}var K=u(P,[["render",R]]),U=Object.freeze(Object.defineProperty({__proto__:null,default:K},Symbol.toStringTag,{value:"Module"}));const H={},W={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},X=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M7 16l-4-4m0 0l4-4m-4 4h18"},null,-1)];function Y(t,o){return e.openBlock(),e.createElementBlock("svg",W,X)}var J=u(H,[["render",Y]]),Q=Object.freeze(Object.defineProperty({__proto__:null,default:J},Symbol.toStringTag,{value:"Module"}));const Z={},v={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},ee=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17 8l4 4m0 0l-4 4m4-4H3"},null,-1)];function te(t,o){return e.openBlock(),e.createElementBlock("svg",v,ee)}var oe=u(Z,[["render",te]]),ne=Object.freeze(Object.defineProperty({__proto__:null,default:oe},Symbol.toStringTag,{value:"Module"}));const re={},le={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},se=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M8 7l4-4m0 0l4 4m-4-4v18"},null,-1)];function ae(t,o){return e.openBlock(),e.createElementBlock("svg",le,se)}var ce=u(re,[["render",ae]]),ie=Object.freeze(Object.defineProperty({__proto__:null,default:ce},Symbol.toStringTag,{value:"Module"}));const de={},_e={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},pe=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)];function me(t,o){return e.openBlock(),e.createElementBlock("svg",_e,pe)}var ue=u(de,[["render",me]]),fe=Object.freeze(Object.defineProperty({__proto__:null,default:ue},Symbol.toStringTag,{value:"Module"}));const he={},ke={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},ge=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 13l4 4L19 7"},null,-1)];function be(t,o){return e.openBlock(),e.createElementBlock("svg",ke,ge)}var ye=u(he,[["render",be]]),$e=Object.freeze(Object.defineProperty({__proto__:null,default:ye},Symbol.toStringTag,{value:"Module"}));const Be={},we={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},Se=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M15 19l-7-7 7-7"},null,-1)];function Ce(t,o){return e.openBlock(),e.createElementBlock("svg",we,Se)}var Ve=u(Be,[["render",Ce]]),Ee=Object.freeze(Object.defineProperty({__proto__:null,default:Ve},Symbol.toStringTag,{value:"Module"}));const Ne={},Me={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},je=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 5l7 7-7 7"},null,-1)];function Ie(t,o){return e.openBlock(),e.createElementBlock("svg",Me,je)}var ze=u(Ne,[["render",Ie]]),Oe=Object.freeze(Object.defineProperty({__proto__:null,default:ze},Symbol.toStringTag,{value:"Module"}));const Fe={},Le={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},xe=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)];function Ae(t,o){return e.openBlock(),e.createElementBlock("svg",Le,xe)}var Te=u(Fe,[["render",Ae]]),De=Object.freeze(Object.defineProperty({__proto__:null,default:Te},Symbol.toStringTag,{value:"Module"}));const Pe={},Ge={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},qe=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},null,-1)];function Re(t,o){return e.openBlock(),e.createElementBlock("svg",Ge,qe)}var Ke=u(Pe,[["render",Re]]),Ue=Object.freeze(Object.defineProperty({__proto__:null,default:Ke},Symbol.toStringTag,{value:"Module"}));const He={},We={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},Xe=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 4v16m8-8H4"},null,-1)];function Ye(t,o){return e.openBlock(),e.createElementBlock("svg",We,Xe)}var Je=u(He,[["render",Ye]]),Qe=Object.freeze(Object.defineProperty({__proto__:null,default:Je},Symbol.toStringTag,{value:"Module"}));const Ze={},ve={fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},et=[e.createElementVNode("path",{d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},null,-1)];function tt(t,o){return e.openBlock(),e.createElementBlock("svg",ve,et)}var ot=u(Ze,[["render",tt]]),nt=Object.freeze(Object.defineProperty({__proto__:null,default:ot},Symbol.toStringTag,{value:"Module"})),yn="";const rt={},lt=t=>(e.pushScopeId("data-v-683816b2"),t=t(),e.popScopeId(),t),st={class:"IconSpinner",fill:"none",stroke:"currentColor",viewBox:"0 0 25 25",xmlns:"http://www.w3.org/2000/svg"},at=[lt(()=>e.createElementVNode("path",{d:"M23.5 12.5c0 6.1-4.9 11-11 11s-11-4.9-11-11 4.9-11 11-11","shape-rendering":"geometricPrecision",style:{"stroke-width":"2","stroke-miterlimit":"10",stroke:"currentColor",fill:"none"},"vector-effect":"non-scaling-stroke"},null,-1))];function ct(t,o){return e.openBlock(),e.createElementBlock("svg",st,at)}var it=u(rt,[["render",ct],["__scopeId","data-v-683816b2"]]),dt=Object.freeze(Object.defineProperty({__proto__:null,default:it},Symbol.toStringTag,{value:"Module"}));const _t={},pt={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},mt=[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"},null,-1)];function ut(t,o){return e.openBlock(),e.createElementBlock("svg",pt,mt)}var ft=u(_t,[["render",ut]]),ht=Object.freeze(Object.defineProperty({__proto__:null,default:ft},Symbol.toStringTag,{value:"Module"}));const kt={},gt={"aria-hidden":"true",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},bt=[e.createElementVNode("path",{d:"M6 18L18 6M6 6l12 12","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2"},null,-1)];function yt(t,o){return e.openBlock(),e.createElementBlock("svg",gt,bt)}var $t=u(kt,[["render",yt]]),Bt=Object.freeze(Object.defineProperty({__proto__:null,default:$t},Symbol.toStringTag,{value:"Module"}));function wt(t,o){var n;return(n=Object.entries(t).map(([a,l])=>({path:a,source:l})).find(a=>a.path.endsWith(`/${o}`)))==null?void 0:n.source.default}var Sn="";let N;function St(t){N=t}function Ct(t){let o;return N&&(o=N(t)),o||(o=wt(Vt,`${t}.vue`)),o}const Vt={"../icons/arrow-narrow-down.vue":U,"../icons/arrow-narrow-left.vue":Q,"../icons/arrow-narrow-right.vue":ne,"../icons/arrow-narrow-up.vue":ie,"../icons/check-circle.vue":fe,"../icons/check.vue":$e,"../icons/chevron-left.vue":Ee,"../icons/chevron-right.vue":Oe,"../icons/exclamation-circle.vue":De,"../icons/exclamation.vue":Ue,"../icons/plus.vue":Qe,"../icons/search.vue":nt,"../icons/spinner.vue":dt,"../icons/trash.vue":ht,"../icons/x.vue":Bt},Et=e.defineComponent({props:{name:{type:String,required:!0}},data(){return{component:void 0}},watch:{name:{immediate:!0,handler(){this.component=Ct(this.name)}}}});function Nt(t,o,n,a,l,d){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(y({},t.component)),{class:"Icon"})}var $=u(Et,[["render",Nt],["__scopeId","data-v-3f9f02d0"]]),Cn="";const Mt=e.defineComponent({components:{Icon:$},props:{breadcrumbs:{type:Object,default:()=>({})}}}),jt={class:"Breadcrumbs"};function It(t,o,n,a,l,d){const s=e.resolveComponent("router-link"),r=e.resolveComponent("Icon");return e.openBlock(),e.createElementBlock("div",jt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.breadcrumbs,(i,m,p)=>(e.openBlock(),e.createElementBlock("div",{key:p,class:"Breadcrumbs__breadcrumb"},[e.createVNode(s,{to:i,class:"Breadcrumbs__link"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m),1)]),_:2},1032,["to"]),e.createVNode(r,{name:"chevron-right",class:"Breadcrumbs__arrow"})]))),128))])}var zt=u(Mt,[["render",It],["__scopeId","data-v-357000f6"]]),Vn="",En="";const Ot=["normal","small"],Ft=["default","primary","secondary","danger"],Lt=e.defineComponent({components:{Icon:$},inheritAttrs:!1,props:{size:{type:String,default:"normal",validator:t=>Ot.includes(t)},variant:{type:String,default:"default",validator:t=>Ft.includes(t)},prefixIcon:{type:String,default:""},suffixIcon:{type:String,default:""},label:{type:String,default:""},active:Boolean,loading:Boolean,block:Boolean,disabled:Boolean},computed:{component(){return this.$attrs.to?"router-link":this.$attrs.href?"a":"button"},classModifiers(){const t=[this.size,this.variant];return this.active&&t.push("active"),this.loading&&t.push("loading"),this.disabled&&t.push("disabled"),t.map(o=>`button--${o}`)},normalizedAttrs(){return y({type:this.component==="button"?"button":void 0},this.$attrs)}}}),xt={key:1};function At(t,o,n,a,l,d){const s=e.resolveComponent("Icon");return e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.component),e.mergeProps({class:["Button button",[t.classModifiers,{"Button--block":t.block},{"button--disabled":t.$attrs.disabled}]]},t.normalizedAttrs),{default:e.withCtx(()=>[e.renderSlot(t.$slots,"prefix",{},()=>[t.prefixIcon&&!t.loading?(e.openBlock(),e.createBlock(s,{key:0,class:e.normalizeClass(["Button__icon Button__icon--prefix",[`Button__icon--${t.size}`]]),name:t.prefixIcon},null,8,["class","name"])):e.createCommentVNode("",!0)],!0),t.loading?(e.openBlock(),e.createBlock(s,{key:0,class:e.normalizeClass(["Button__icon Button__icon--prefix",[`Button__icon--${t.size}`]]),name:"spinner"},null,8,["class"])):e.createCommentVNode("",!0),t.$slots.default||t.label?(e.openBlock(),e.createElementBlock("span",xt,[e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.label),1)],!0)])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"suffix",{},()=>[t.suffixIcon?(e.openBlock(),e.createBlock(s,{key:0,class:e.normalizeClass(["Button__icon Button__icon--suffix",[`Button__icon--${t.size}`]]),name:t.suffixIcon},null,8,["class","name"])):e.createCommentVNode("",!0)],!0)]),_:3},16,["class"])}var S=u(Lt,[["render",At],["__scopeId","data-v-4c3e5fdd"]]),Nn="";const C=e.defineComponent({emits:["update:modelValue"],computed:{normalizedAttrs(){const t=l=>l.getAttribute("type")==="number"?l.valueAsNumber:l.getAttribute("type")==="checkbox"?l.checked:l.value,a=this.$attrs,{class:o}=a,n=D(a,["class"]);return B(y({},n),{onInput:l=>this.$emit("update:modelValue",t(l.target))})}}});var Mn="";const Tt=e.defineComponent({mixins:[C],inheritAttrs:!1,props:{modelValue:Boolean,required:Boolean,switch:Boolean,caption:{type:String,default:""}}}),Dt=t=>(e.pushScopeId("data-v-6d3aac34"),t=t(),e.popScopeId(),t),Pt=["checked","required"],Gt=[Dt(()=>e.createElementVNode("div",{class:"Checkbox__switchDot"},null,-1))],qt={key:1,class:"Checkbox__label"},Rt={key:0,class:"Checkbox__required"};function Kt(t,o,n,a,l,d){return e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["Checkbox",[t.$attrs.class,{"Checkbox--disabled":t.$attrs.disabled}]])},[e.withDirectives(e.createElementVNode("input",e.mergeProps(t.normalizedAttrs,{checked:t.modelValue,class:"Checkbox__input input",required:t.required,type:"checkbox"}),null,16,Pt),[[e.vShow,!t.$props.switch]]),t.$props.switch?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["Checkbox__switch",{"Checkbox__switch--active":t.modelValue}])},Gt,2)):e.createCommentVNode("",!0),t.$slots.default||t.caption?(e.openBlock(),e.createElementBlock("div",qt,[t.required?(e.openBlock(),e.createElementBlock("span",Rt,"*")):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(t.caption),1)],!0)])):e.createCommentVNode("",!0)],2)}var j=u(Tt,[["render",Kt],["__scopeId","data-v-6d3aac34"]]);function V(t,o){return typeof o=="function"?o(t):o||o===0?t[o]:t}function I(t,o={}){return Array.isArray(t)?t.map(n=>({value:V(n,o.value),label:V(n,o.label),description:o.description&&V(n,o.description),disabled:o.disabled&&V(n,o.disabled)})):Object.entries(t||{}).reduce((n,[a,l])=>n.concat({value:a,label:l}),[])}var In="";const Ut=e.defineComponent({components:{Checkbox:j},props:{modelValue:{type:Array,default:()=>[]},options:{type:[Array,Object],required:!0},optionLabelKey:{type:[Function,String,Number],default:void 0},optionValueKey:{type:[Function,String,Number],default:void 0},optionDisabledKey:{type:[Function,String,Number],default:void 0}},emits:["update:modelValue"],computed:{normalizedOptions(){return I(this.options,{value:this.optionValueKey,label:this.optionLabelKey,disabled:this.optionDisabledKey})},checkedValues(){return this.modelValue.reduce((t,o)=>B(y({},t),{[o]:!0}),{})}},methods:{toggleCheckedValue(t){const o=B(y({},this.checkedValues),{[t]:!this.checkedValues[t]}),n=Object.entries(o).filter(([a,l])=>l).map(([a])=>a);this.$emit("update:modelValue",n)}}}),Ht={class:"CheckboxGroup"};function Wt(t,o,n,a,l,d){const s=e.resolveComponent("Checkbox");return e.openBlock(),e.createElementBlock("div",Ht,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.normalizedOptions,r=>(e.openBlock(),e.createElementBlock("div",{key:r.value},[e.createVNode(s,{disabled:r.disabled,"model-value":t.checkedValues[r.value],"onUpdate:modelValue":i=>t.toggleCheckedValue(r.value)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.label),1)]),_:2},1032,["disabled","model-value","onUpdate:modelValue"])]))),128))])}var Xt=u(Ut,[["render",Wt]]),zn="";const Yt=e.defineComponent({props:{label:{type:String,default:""},error:{type:[String,Array,Boolean],default:""},description:{type:String,default:""},hint:{type:String,default:""},required:Boolean},computed:{errorMessage(){return Array.isArray(this.error)?this.error.filter(Boolean).join(" "):typeof this.error=="string"?this.error:""}}}),Jt={key:0,class:"FormGroup__header"},Qt={class:"FormGroup__label"},Zt={key:0,class:"FormGroup__required"},vt={key:1,class:"FormGroup__description"},eo={key:2,class:"FormGroup__hint"},to={key:3,class:"FormGroup__error"};function oo(t,o,n,a,l,d){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["FormGroup",{"FormGroup--invalid":t.error}])},[t.label?(e.openBlock(),e.createElementBlock("div",Jt,[e.createElementVNode("label",Qt,e.toDisplayString(t.label),1),t.required?(e.openBlock(),e.createElementBlock("div",Zt,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),t.$slots.description||t.description?(e.openBlock(),e.createElementBlock("div",vt,[e.renderSlot(t.$slots,"description",{},()=>[e.createTextVNode(e.toDisplayString(t.description),1)],!0)])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",{},void 0,!0),t.$slots.hint||t.hint?(e.openBlock(),e.createElementBlock("div",eo,[e.renderSlot(t.$slots,"hint",{},()=>[e.createTextVNode(e.toDisplayString(t.hint),1)],!0)])):e.createCommentVNode("",!0),t.errorMessage?(e.openBlock(),e.createElementBlock("div",to,e.toDisplayString(t.errorMessage),1)):e.createCommentVNode("",!0)],2)}var z=u(Yt,[["render",oo],["__scopeId","data-v-4214535a"]]),On="";const no={class:"FormFields"},ro=e.defineComponent({name:"FormFields",props:{fields:{type:Object,default:()=>({})},modelValue:{type:Object,default:()=>({})},errors:{type:Object,default:()=>({})}},emits:["update:modelValue"],setup(t,{emit:o}){const n=t;function a(d){var r;return(((r=n.fields[d].value)==null?void 0:r.getter)||(i=>i[d]))(n.modelValue)}function l(d,s){var m;const i=(((m=n.fields[d].value)==null?void 0:m.setter)||((p,_)=>B(y({},_),{[d]:p})))(s,n.modelValue);o("update:modelValue",i)}return(d,s)=>(e.openBlock(),e.createElementBlock("div",no,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.fields,(r,i)=>{var m;return e.openBlock(),e.createBlock(z,{key:i,label:r.label,description:r.description,hint:r.hint,required:r.required,error:(m=t.errors)==null?void 0:m[i]},{default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.component),e.mergeProps({"model-value":a(String(i))},r.props,{"onUpdate:modelValue":p=>l(String(i),p)}),null,16,["model-value","onUpdate:modelValue"]))]),_:2},1032,["label","description","hint","required","error"])}),128))]))}});var O=u(ro,[["__scopeId","data-v-319aedc6"]]),Fn="";const lo={class:"Form"},so=["disabled"],ao={key:0,class:"Form__title"},co={key:0,class:"Form__buttons"},io=e.defineComponent({name:"Form",props:{structure:{type:Object,default:()=>({})},modelValue:{type:Object,default:()=>{}},errors:{type:Object,default:()=>({})},submit:{type:Function,default:void 0},submitLabel:{type:String,default:"Submit"},cancel:{type:[Function,Object],default:void 0},cancelLabel:{type:String,default:"Cancel"},submitting:Boolean},emits:["update:modelValue","change","submit","cancel"],setup(t,{emit:o}){const n=t,a=h.useRouter();function l(){var s;(s=n.submit)==null||s.call(n,n.modelValue)}function d(){var s;typeof n.cancel=="function"?(s=n.cancel)==null||s.call(n):n.cancel&&a.push(n.cancel)}return(s,r)=>(e.openBlock(),e.createElementBlock("div",lo,[t.modelValue?(e.openBlock(),e.createElementBlock("form",{key:0,disabled:t.submitting,onSubmit:r[3]||(r[3]=e.withModifiers(i=>l==null?void 0:l(),["prevent"]))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.structure,(i,m)=>(e.openBlock(),e.createElementBlock("div",{key:m},[i.title?(e.openBlock(),e.createElementBlock("div",ao,e.toDisplayString(i.title),1)):e.createCommentVNode("",!0),e.createVNode(O,{fields:i.fields,"model-value":t.modelValue,errors:t.errors,"onUpdate:modelValue":r[0]||(r[0]=p=>o("update:modelValue",p)),onChange:r[1]||(r[1]=p=>o("change",p))},null,8,["fields","model-value","errors"])]))),128)),e.renderSlot(s.$slots,"buttons",e.normalizeProps(e.guardReactiveProps({cancel:d,submit:l})),()=>[l||d?(e.openBlock(),e.createElementBlock("div",co,[l?(e.openBlock(),e.createBlock(S,{key:0,variant:"primary",type:"submit",label:t.submitLabel,disabled:t.submitting,"prefix-icon":t.submitting?"spinner":void 0},null,8,["label","disabled","prefix-icon"])):e.createCommentVNode("",!0),d?(e.openBlock(),e.createBlock(S,{key:1,label:t.cancelLabel,disabled:t.submitting,onClick:r[2]||(r[2]=i=>d())},null,8,["label","disabled"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],!0)],40,so)):(e.openBlock(),e.createBlock($,{key:1,name:"spinner"}))]))}});var _o=u(io,[["__scopeId","data-v-5366fc3a"]]),Ln="";const po=["normal","small"],mo=e.defineComponent({components:{Icon:$},mixins:[C],inheritAttrs:!1,props:{modelValue:{type:[Number,String],default:""},prefixIcon:{type:String,default:""},suffixIcon:{type:String,default:""},size:{type:String,default:"normal",validator:t=>po.includes(t)},invalid:Boolean},computed:{hasPrefix(){return Boolean(this.$slots.prefix||this.prefixIcon)},hasSuffix(){return Boolean(this.$slots.suffix||this.suffixIcon)}}}),uo={class:"Input__icon Input__icon--left"},fo=["aria-label","value"],ho={class:"Input__icon Input__icon--right"};function ko(t,o,n,a,l,d){const s=e.resolveComponent("Icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["Input input",[t.$attrs.class,{"input--invalid":t.invalid,"input--disabled":t.$attrs.disabled,"input--small":t.size==="small"}]]),onClick:o[0]||(o[0]=r=>t.$refs.input.focus())},[t.hasPrefix?e.renderSlot(t.$slots,"prefix",{key:0},()=>[e.createElementVNode("div",uo,[e.createVNode(s,{name:t.prefixIcon},null,8,["name"])])]):e.createCommentVNode("",!0),e.createElementVNode("input",e.mergeProps({ref:"input","aria-label":t.$attrs.placeholder||"input"},t.normalizedAttrs,{class:"Input__nestedInput input__nested",value:t.modelValue}),null,16,fo),t.hasSuffix?e.renderSlot(t.$slots,"suffix",{key:1},()=>[e.createElementVNode("div",ho,[e.createVNode(s,{name:t.suffixIcon},null,8,["name"])])]):e.createCommentVNode("",!0)],2)}var go=u(mo,[["render",ko]]);const bo=["normal","small"],yo=e.defineComponent({mixins:[C],props:{value:{type:[String,Number,Object],default:""},options:{type:[Array,Object],required:!0},optionLabelKey:{type:[Function,String,Number],default:void 0},optionValueKey:{type:[Function,String,Number],default:void 0},optionDisabledKey:{type:[Function,String,Number],default:void 0},placeholder:{type:String,default:""},size:{type:String,default:"normal",validator:t=>bo.includes(t)},allowEmpty:Boolean},computed:{normalizedOptions(){return I(this.options,{value:this.optionValueKey,label:this.optionLabelKey,disabled:this.optionDisabledKey})}}}),$o=["value"],Bo=["disabled"],wo=["disabled","value"];function So(t,o,n,a,l,d){return e.openBlock(),e.createElementBlock("select",e.mergeProps({class:"Select input"},t.normalizedAttrs,{class:[t.$attrs.class,{"input--small":t.size==="small"}],value:t.value}),[t.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,disabled:!t.allowEmpty,selected:"",value:void 0},e.toDisplayString(t.placeholder),9,Bo)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.normalizedOptions,s=>(e.openBlock(),e.createElementBlock("option",{key:s.value,disabled:s.disabled,value:s.value},e.toDisplayString(s.label),9,wo))),128))],16,$o)}var Co=u(yo,[["render",So]]),xn="",An="";const Vo=e.defineComponent({props:{items:{type:Array,default:()=>[]},columns:{type:Object,default:null},rowClass:{type:[String,Function],default:null}},computed:{normalizedColumns(){return Object.entries(this.columns).reduce((t,[o,n])=>B(y({},t),{[o]:typeof n=="string"?{label:n}:n}),{})}},methods:{formatValue(t,o){const n=this.normalizedColumns[o],a=typeof n.value=="function"?n.value(t):t[o];return n.format?n.format(a):a},resolveRowClass(t){return typeof this.rowClass=="function"?this.rowClass(t):this.rowClass}}}),Eo={class:"table table--hover"},No=["width"];function Mo(t,o,n,a,l,d){const s=e.resolveComponent("router-link");return e.openBlock(),e.createElementBlock("table",Eo,[e.createElementVNode("thead",null,[e.createElementVNode("tr",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.normalizedColumns,(r,i)=>(e.openBlock(),e.createElementBlock("th",{key:i,style:e.normalizeStyle({textAlign:r.align||"left"}),width:r.width},e.toDisplayString(r.label),13,No))),128))])]),e.createElementVNode("tbody",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(r,i)=>(e.openBlock(),e.createElementBlock("tr",{key:i,class:e.normalizeClass(t.resolveRowClass(r))},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.normalizedColumns,(m,p)=>(e.openBlock(),e.createElementBlock("td",{key:p,style:e.normalizeStyle({textAlign:m.align||"left"})},[e.renderSlot(t.$slots,p,e.normalizeProps(e.guardReactiveProps({item:r})),()=>[m.href?(e.openBlock(),e.createBlock(s,{key:0,class:"link",to:m.href(r)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.formatValue(r,p)),1)]),_:2},1032,["to"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(t.formatValue(r,p)),1)],64))])],4))),128))],2))),128))])])}var jo=u(Vo,[["render",Mo]]);const Io=e.defineComponent({mixins:[C],props:{value:{type:String,default:""}}}),zo=["value"];function Oo(t,o,n,a,l,d){return e.openBlock(),e.createElementBlock("textarea",e.mergeProps(t.normalizedAttrs,{class:["Textarea input",t.$attrs.class],value:t.value}),null,16,zo)}var Fo=u(Io,[["render",Oo]]),Tn="";const Lo={key:1,class:"ModalLayout__header"},xo={class:"ModalLayout__title"},Ao={class:"ModalLayout__body"},To={key:2,class:"ModalLayout__footer"},Do=e.defineComponent({name:"ModalLayout",props:{title:{type:String,default:""},width:{type:[Number,String],default:600},hideCloser:Boolean,scroll:Boolean,plain:Boolean},setup(t){const o=t,n=e.useSlots();e.useAttrs(),e.getCurrentInstance(),e.getCurrentScope();const a=e.computed(()=>Boolean(n.header||o.title)),l=e.computed(()=>Boolean(n.footer)),d=e.computed(()=>{const r=o.width+(Number(o.width)?"px":"");return r&&r!=="auto"?{width:"100%",maxWidth:r}:{}});function s(){window.dispatchEvent(new KeyboardEvent("keydown",{key:"Escape"}))}return(r,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["ModalLayout",{hasHeader:e.unref(a),hasFooter:e.unref(l),isScrollable:r.$props.scroll,isPlain:r.$props.plain}]),style:e.normalizeStyle(e.unref(d))},[t.hideCloser?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"ModalLayout__close",onClick:i[0]||(i[0]=m=>s())},[e.createVNode($,{name:"x",class:"ModalLayout__closeIcon"})])),e.unref(a)?(e.openBlock(),e.createElementBlock("div",Lo,[e.renderSlot(r.$slots,"header",{},()=>[e.createElementVNode("div",xo,e.toDisplayString(t.title),1)])])):e.createCommentVNode("",!0),e.createElementVNode("div",Ao,[e.renderSlot(r.$slots,"default")]),e.unref(l)?(e.openBlock(),e.createElementBlock("div",To,[e.renderSlot(r.$slots,"footer")])):e.createCommentVNode("",!0)],6))}});var Dn="";const Po={class:"ModalLayoutDialog__buttons"},Go=e.defineComponent({name:"ModalLayoutDialog",props:{title:{type:String,default:""},message:{type:String,default:""},buttons:{type:Array,default:()=>[]}},emits:["close"],setup(t){return(o,n)=>{var a;return e.openBlock(),e.createBlock(Do,{ref:"root",class:"ModalLayoutDialog",width:"480",title:o.$props.title},e.createSlots({default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(o.$props.message)+" ",1)]),_:2},[(a=o.$props.buttons)!=null&&a.length?{name:"footer",fn:e.withCtx(()=>[e.createElementVNode("div",Po,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.$props.buttons,(l,d)=>(e.openBlock(),e.createElementBlock("span",{key:d,class:"ModalLayoutDialog__buttonWrapper"},[e.createVNode(S,{type:"button",variant:l.variant,"prefix-icon":l.icon,autofocus:"",onClick:s=>o.$emit("close",l.value)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:2},1032,["variant","prefix-icon","onClick"])]))),128))])])}:void 0]),1032,["title"])}}});var Pn="";const qo={class:"ModalStack"},Ro={key:0,class:"ModalStack__backdrop"},Ko=["onClick"],Uo=e.defineComponent({name:"ModalStack",props:{modals:{type:Array,default:()=>[]}},emits:["closeModal"],setup(t,{emit:o}){const n=t,a=e.ref({}),l=e.computed(()=>n.modals.length?n.modals[n.modals.length-1]:null);function d(p){return _=>a.value[p]=_}function s(p,_){var g;const f=()=>{o("closeModal",{modal:p,result:_})},k=a.value[p.id].$refs.root;(g=k.$attrs)!=null&&g.onBeforeClose?k.$attrs.onBeforeClose(f):f()}function r(){l.value&&s(l.value)}function i(p){l.value&&p.key==="Escape"&&!p.defaultPrevented&&(p.preventDefault(),r())}function m(p,_){p.target===p.currentTarget&&s(_)}return e.onMounted(()=>{window.addEventListener("keydown",i)}),e.onBeforeUnmount(()=>{window.removeEventListener("keydown",i)}),(p,_)=>(e.openBlock(),e.createElementBlock("div",qo,[e.createVNode(e.Transition,{name:"ModalStack__backdrop"},{default:e.withCtx(()=>[n.modals.length?(e.openBlock(),e.createElementBlock("div",Ro)):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.TransitionGroup,{name:"ModalStack__modal"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.modals,f=>{var k;return e.openBlock(),e.createElementBlock("div",{key:f.id,class:"ModalStack__modalWrapper",onClick:g=>m(g,f)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(f.component),e.mergeProps(f.props,{ref_for:!0,ref:d(f.id),class:["ModalStack__modal",{isActive:((k=e.unref(l))==null?void 0:k.id)===f.id}],onClose:g=>s(f,g)}),null,16,["class","onClose"]))],8,Ko)}),128))]),_:1})]))}}),Ho={cancelLabel:"Cancel",confirmLabel:"OK"},Wo=(t,o={})=>{let n=1;o=y(y({},Ho),o);const a=e.reactive({modals:[]}),l=(_,f)=>{var k;a.modals=a.modals.filter(({id:g})=>g!==_.id),_.resolve(f),(k=_.focusElement)==null||k.focus()},d=e.createApp({parent:t,data(){return a},render(){return e.h(Uo,{modals:a.modals,onCloseModal:({modal:_,result:f})=>l(_,f)})}}),s=document.createElement("div");document.body.appendChild(s),d.mount(s);const r=(_,f)=>{var g;const k=document.activeElement;return(g=k.blur)==null||g.call(k),new Promise(w=>{a.modals.push({id:n++,component:_,props:f,resolve:w,focusElement:k})})},i=_=>r(Go,_),m=_=>{typeof _=="string"&&(_={message:_});const{title:f,message:k,confirmVariant:g,confirmLabel:w=o.confirmLabel,confirmIcon:M}=_;return i({title:f,message:k,buttons:[{variant:g||"primary",label:w||"",icon:M}]})},p=_=>{typeof _=="string"&&(_={message:_});const{title:f,message:k,cancelLabel:g=o.cancelLabel,cancelVariant:w,cancelIcon:M,confirmLabel:tn=o.confirmLabel,confirmVariant:on,confirmIcon:nn}=_;return i({title:f,message:k,buttons:[{variant:w||"secondary",label:g||"",icon:M,value:!1},{variant:on||"primary",label:tn||"",icon:nn,value:!0}]})};t.config.globalProperties.$modal={open:r,dialog:i,alert:m,confirm:p}};function F(){var t;return(t=e.getCurrentInstance())==null?void 0:t.appContext.config.globalProperties.$modal}var Gn="";const Xo={class:"Snackbar"},Yo=["onClick"],Jo=e.defineComponent({name:"SnackbarStack",props:{messages:{type:Array,default:()=>[]}},emits:["remove-message"],setup(t,{emit:o}){const n=t,a=e.computed(()=>[...n.messages].reverse());return(l,d)=>(e.openBlock(),e.createElementBlock("div",Xo,[e.createVNode(e.TransitionGroup,{name:"Snackbar__transition"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(a),(s,r)=>(e.openBlock(),e.createElementBlock("div",{key:s.id,class:"Snackbar__message"},[e.createElementVNode("div",{class:"Snackbar__messageWrapper",style:e.normalizeStyle({transform:`translateY(-${100*r}%)`})},[e.createElementVNode("div",{class:e.normalizeClass(["Snackbar__messageBlock",`Snackbar__messageBlock--${s.type}`])},[e.createElementVNode("div",null,e.toDisplayString(s.text),1),e.createElementVNode("div",{class:"Snackbar__messageClose",onClick:i=>l.$emit("remove-message",s.id)},[e.createVNode($,{class:"Snackbar__messageCloseIcon",name:"x"})],8,Yo)],2)],4)]))),128))]),_:1})]))}}),Qo=1e4,Zo=5,vo=t=>{let o=1;const n=e.reactive({messages:[]}),a=r=>{n.messages=n.messages.filter(({id:i})=>i!==r)},l=e.createApp({parent:t,data(){return n},render(){return e.h(Jo,{messages:this.messages,onRemoveMessage:a})}}),d=document.createElement("div");document.body.appendChild(d),l.mount(d);const s=(r,i="success",m=Qo)=>{const p=o++;n.messages.push({text:r,type:i,id:p}),n.messages.length>Zo&&n.messages.shift(),m>0&&setTimeout(()=>a(p),m)};t.config.globalProperties.$snackbar={success:r=>s(r,"success"),error:r=>s(r,"error",0)}};function L(){var t;return(t=e.getCurrentInstance())==null?void 0:t.appContext.config.globalProperties.$snackbar}function en(t,o={}){const n=L(),a=F(),l=h.useRouter(),d=e.ref(!1),s=e.ref(),r=e.ref(Object.freeze({})),i=async m=>{var p;if(!(o.confirm&&!await a.confirm(typeof o.confirm=="function"?o.confirm(m):o.confirm))){if(o.validator){const _=await o.validator(m);if(r.value=_.errors,!_.isValid)return}d.value=!0;try{s.value=await t(m)}catch(_){if(n.error(typeof o.errorMessage=="function"?o.errorMessage(_,m):o.errorMessage||_.message),d.value=!1,o.onError&&o.onError({error:_,data:m,router:l}))return;throw _}return d.value=!1,o.successMessage&&n.success(typeof o.successMessage=="function"?o.successMessage(s.value,m):o.successMessage),(p=o.onSuccess)==null||p.call(o,{result:s.value,data:m,router:l}),o.redirectOnSuccess&&l.push(typeof o.redirectOnSuccess=="function"?o.redirectOnSuccess(s.value,m):o.redirectOnSuccess),s.value}};return o.immediate&&e.onMounted(i),{submit:i,errors:r,result:s,isSubmitting:d}}c.Breadcrumbs=zt,c.Button=S,c.Checkbox=j,c.CheckboxGroup=Xt,c.Form=_o,c.FormFields=O,c.FormGroup=z,c.Icon=$,c.Input=go,c.Select=Co,c.Table=jo,c.Textarea=Fo,c.modal=Wo,c.registerCustomIconResolver=St,c.snackbar=vo,c.useAction=en,c.useModal=F,c.useSnackbar=L,Object.defineProperties(c,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "vuiii",
3
+ "version": "0.1.0-alpha",
4
+ "scripts": {
5
+ "dev": "vite",
6
+ "build": "vite build && vue-tsc --emitDeclarationOnly --declaration",
7
+ "preview": "vite preview"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "main": "./dist/vui.umd.js",
13
+ "module": "./dist/vui.es.js",
14
+ "exports": {
15
+ ".": {
16
+ "import": "./dist/vui.es.js",
17
+ "require": "./dist/vui.umd.js"
18
+ },
19
+ "./style.css": "./dist/style.css"
20
+ },
21
+ "unpkg": "./dist/vui.umd.js",
22
+ "jsdelivr": "./dist/vui.umd.js",
23
+ "types": "./dist/index.d.ts",
24
+ "dependencies": {},
25
+ "devDependencies": {
26
+ "@types/node": "^17.0.35",
27
+ "@typescript-eslint/parser": "^5.25.0",
28
+ "@vitejs/plugin-vue": "^2.3.3",
29
+ "autoprefixer": "^10.4.7",
30
+ "eslint": "^8.16.0",
31
+ "eslint-config-prettier": "^8.5.0",
32
+ "eslint-plugin-prettier": "^4.0.0",
33
+ "eslint-plugin-simple-import-sort": "^7.0.0",
34
+ "eslint-plugin-vue": "^9.0.1",
35
+ "postcss": "^8.4.14",
36
+ "postcss-import": "^14.1.0",
37
+ "postcss-nesting": "^10.1.7",
38
+ "prettier": "^2.6.2",
39
+ "typescript": "^4.5.4",
40
+ "vite": "^2.9.9",
41
+ "vue-tsc": "^0.34.16",
42
+ "vue": "^3.2.36",
43
+ "vue-router": "^4.0.15"
44
+ }
45
+ }