mgv-backoffice 1.0.0
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.
- package/dist/components/BaseAlert.vue.d.ts +26 -0
- package/dist/components/BaseBadge.vue.d.ts +27 -0
- package/dist/components/BaseButton.vue.d.ts +119 -0
- package/dist/components/BaseLine.vue.d.ts +17 -0
- package/dist/components/BaseLogo.vue.d.ts +17 -0
- package/dist/components/BaseModal.vue.d.ts +49 -0
- package/dist/components/BaseRow.vue.d.ts +31 -0
- package/dist/components/BaseSpinner.vue.d.ts +2 -0
- package/dist/components/BaseToast.vue.d.ts +45 -0
- package/dist/components/ColoredSquares.vue.d.ts +27 -0
- package/dist/components/EuroAmount.vue.d.ts +35 -0
- package/dist/components/Pagination.vue.d.ts +29 -0
- package/dist/components/TrendArrow.vue.d.ts +20 -0
- package/dist/enums/AlertEnum.d.ts +6 -0
- package/dist/enums/BaseBadgeEnum.d.ts +4 -0
- package/dist/enums/BaseButtonEnum.d.ts +9 -0
- package/dist/enums/BaseButtonSizeEnum.d.ts +7 -0
- package/dist/enums/BaseLogoEnum.d.ts +5 -0
- package/dist/enums/BaseModalEnum.d.ts +4 -0
- package/dist/enums/BaseToastEnum.d.ts +5 -0
- package/dist/enums/ColorsEnums.d.ts +9 -0
- package/dist/enums/LineEnum.d.ts +5 -0
- package/dist/enums/PositioningEnum.d.ts +6 -0
- package/dist/index.d.ts +24 -0
- package/dist/style.css +1 -0
- package/dist/ui-lib.js +920 -0
- package/dist/ui-lib.umd.cjs +1 -0
- package/dist/utils/util.d.ts +5 -0
- package/package.json +31 -0
- package/src/components/BaseAlert.vue +32 -0
- package/src/components/BaseBadge.vue +24 -0
- package/src/components/BaseButton.vue +132 -0
- package/src/components/BaseLine.vue +17 -0
- package/src/components/BaseLogo.vue +27 -0
- package/src/components/BaseModal.vue +75 -0
- package/src/components/BaseRow.vue +19 -0
- package/src/components/BaseSpinner.vue +9 -0
- package/src/components/BaseToast.vue +101 -0
- package/src/components/ColoredSquares.vue +51 -0
- package/src/components/EuroAmount.vue +40 -0
- package/src/components/Pagination.vue +136 -0
- package/src/components/TrendArrow.vue +33 -0
- package/src/enums/AlertEnum.ts +6 -0
- package/src/enums/BaseBadgeEnum.ts +4 -0
- package/src/enums/BaseButtonEnum.ts +9 -0
- package/src/enums/BaseButtonSizeEnum.ts +7 -0
- package/src/enums/BaseLogoEnum.ts +5 -0
- package/src/enums/BaseModalEnum.ts +4 -0
- package/src/enums/BaseToastEnum.ts +5 -0
- package/src/enums/ColorsEnums.ts +9 -0
- package/src/enums/LineEnum.ts +3 -0
- package/src/enums/PositioningEnum.ts +3 -0
- package/src/index.ts +29 -0
- package/src/utils/util.ts +53 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@heroicons/vue/24/outline")):typeof define=="function"&&define.amd?define(["exports","vue","@heroicons/vue/24/outline"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.UiLib={},s.Vue,s.HeroiconsOutline))})(this,function(s,e,E){"use strict";var y=(t=>(t.WARNING="WARNING",t.ERROR="ERROR",t.SUCCESS="SUCCESS",t.INFROM="INFROM",t))(y||{}),d=(t=>(t.NONE="NONE",t.RED="RED",t.YELLOW="YELLOW",t.BLACK="BLACK",t.GRAY="GRAY",t.GREEN="GREEN",t.BLUE="BLUE",t))(d||{});function S(t){let r="red";switch(t){case y.ERROR:r="red";break;case y.SUCCESS:r="green";break;case y.INFROM:r="gray";break;case y.WARNING:r="yellow";break}return r}function w(t){let r="red";switch(t){case d.GREEN:{r="green";break}case d.RED:{r="red";break}case d.BLUE:{r="blue";break}case d.YELLOW:{r="yellow";break}case d.NONE:{r="";break}}return r}const L={class:"font-medium pl-1"},A=e.defineComponent({__name:"BaseAlert",props:{title:{type:String,required:!1,default:y.ERROR},color:{type:Object,required:!1}},setup(t){const r=t;function l(){let a=S(r.color);return"flex items-center p-4 mb-4 text-sm text-"+a+"-800 border border-"+a+"-300 rounded-lg bg-"+a+"-50 dark:bg-gray-800 dark:text-"+a+"-400 dark:border-"+a+"-800"}return(a,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l()),role:"alert"},[e.createVNode(e.unref(E.InformationCircleIcon),{class:"w-6 h-6 text-gray-400"}),e.createElementVNode("div",null,[e.createElementVNode("span",L,e.toDisplayString(t.title),1)])],2))}}),x=e.defineComponent({__name:"BaseBadge",props:{color:{type:String,required:!1}},setup(t){const r=e.useSlots(),l=e.computed(()=>!!r.default),a=t;function o(){let n=w(a.color);return"font-bold bg-"+n+"-100 text-"+n+"-800 text-xs mr-2 px-2.5 py-0.5 rounded-full"}return(n,c)=>l.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(o())},[e.renderSlot(n.$slots,"default")],2)):e.createCommentVNode("",!0)}});var f=(t=>(t.RED="RED",t.BLUE="BLUE",t.WHITE="WHITE",t.DARK="DARK",t.GREEN="GREEN",t.YELLOW="YELLOW",t.PURPLE="PURPLE",t))(f||{}),b=(t=>(t.EXTRA_SMALL="EXTRA SMALL",t.SMALL="SMALL",t.BASE="BASE",t.LARGE="LARGE",t.EXTRA_LARGE="EXTRA_LARGE",t))(b||{});const O=["type","disabled"],T={key:0},U={key:1},$=["type","disabled"],M={key:0},D={key:1},G={key:2},I=e.defineComponent({__name:"BaseButton",props:{description:{type:String,required:!0},color:{type:String,required:!1,default:f.BLUE},to:{type:String,required:!1},type:{type:String,required:!1,default:"button"},icon:{type:String,required:!1},iconSize:{type:String,required:!1},iconLeft:{type:String,required:!1},isRounded:{type:Boolean,required:!1},isDisable:{type:Boolean,required:!1},size:{type:String,required:!1},isLoading:{type:Boolean,required:!1}},setup(t){const r=t;function l(){let a="inline-flex items-center",o;switch(r.color){case f.BLUE:{o="focus:outline-none text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300",r.isDisable&&(o+=" bg-blue-400");break}case f.WHITE:{o="focus:outline-none text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-200",r.isDisable&&(o+=" bg-gray-400");break}case f.DARK:{o="focus:outline-none text-white bg-gray-800 hover:bg-gray-900 focus:ring-4 focus:ring-gray-300 ",r.isDisable&&(o+=" bg-gray-400");break}case f.GREEN:{o="focus:outline-none text-white bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300",r.isDisable&&(o+=" bg-green-400");break}case f.RED:{o="focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300",r.isDisable&&(o+=" bg-red-400");break}case f.YELLOW:{o="focus:outline-none text-white bg-yellow-400 hover:bg-yellow-500 focus:ring-4 focus:ring-yellow-300",r.isDisable&&(o+=" bg-yellow-400");break}case f.PURPLE:{o="focus:outline-none text-white bg-purple-700 hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 px-5 py-2.5 mb-2",r.isDisable&&(o+=" bg-purple-400");break}}let n="px-5 py-2.5 mr-2 mb-2 text-sm";switch(r.size){case b.EXTRA_SMALL:{n="px-3 py-2 text-xs";break}case b.SMALL:{n="px-3 py-2 text-sm";break}case b.BASE:{n="px-5 py-2.5 text-sm";break}case b.LARGE:{n="px-5 py-3 text-base";break}case b.EXTRA_LARGE:{n="px-6 py-3.5 text-base";break}}let c="rounded-lg";return r.isRounded&&(c="rounded-full"),r.isDisable&&(o+=" cursor-not-allowed"),a+" "+n+" "+o+" "+"font-medium"+" "+c}return(a,o)=>{const n=e.resolveComponent("router-link");return t.to?(e.openBlock(),e.createBlock(n,{key:0,to:t.to},{default:e.withCtx(()=>[e.createElementVNode("button",{type:r.type,class:e.normalizeClass(l()),disabled:t.isDisable},[t.iconLeft?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",T,e.toDisplayString(t.description),1)),e.renderSlot(a.$slots,"default"),t.iconLeft?(e.openBlock(),e.createElementBlock("span",U,e.toDisplayString(t.description),1)):e.createCommentVNode("",!0)],10,O)]),_:3},8,["to"])):(e.openBlock(),e.createElementBlock("button",{key:1,type:r.type,class:e.normalizeClass(l()),disabled:t.isDisable},[t.isLoading?(e.openBlock(),e.createElementBlock("div",M,[...o[0]||(o[0]=[e.createElementVNode("svg",{"aria-hidden":"true",role:"status",class:"inline w-4 h-4 me-3 text-white animate-spin",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"#E5E7EB"}),e.createElementVNode("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentColor"})],-1)])])):e.createCommentVNode("",!0),t.iconLeft?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",D,e.toDisplayString(t.description),1)),e.renderSlot(a.$slots,"default"),t.iconLeft?(e.openBlock(),e.createElementBlock("span",G,e.toDisplayString(t.description),1)):e.createCommentVNode("",!0)],10,$))}}});var h=(t=>(t.BASE="BASE",t.BASE_SHORTER="BASE_SHORTER",t.SQUARE="SQUARE",t))(h||{});const z={key:0,class:"h-px my-8 bg-gray-200 border-0 dark:bg-gray-700"},q={key:1,class:"w-48 h-1 mx-auto my-4 bg-gray-100 border-0 rounded md:my-10 dark:bg-gray-700"},P={key:2,class:"w-8 h-8 mx-auto my-8 bg-gray-200 border-0 rounded md:my-12 dark:bg-gray-700"},W=e.defineComponent({__name:"BaseLine",props:{mode:{type:String,required:!1,default:h.BASE}},setup(t){return(r,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[t.mode===e.unref(h).BASE?(e.openBlock(),e.createElementBlock("hr",z)):e.createCommentVNode("",!0),t.mode===e.unref(h).BASE_SHORTER?(e.openBlock(),e.createElementBlock("hr",q)):e.createCommentVNode("",!0),t.mode===e.unref(h).SQUARE?(e.openBlock(),e.createElementBlock("hr",P)):e.createCommentVNode("",!0)],64))}});var u=(t=>(t.SMALL="SMALL",t.MEDIUM="MEDIUM",t.LARGE="LARGE",t))(u||{});const F=["height","width"],H=e.defineComponent({__name:"BaseLogo",props:{size:{type:String,required:!1,default:u.MEDIUM}},setup(t){const r=t;function l(){let a="";switch(r.size){case u.SMALL:{a="50px";break}case u.MEDIUM:{a="100px";break}case u.LARGE:{a="150px";break}}return a}return(a,o)=>{const n=e.resolveComponent("router-link");return e.openBlock(),e.createBlock(n,{to:"/",class:"flex items-center mb-6 text-2xl font-semibold text-gray-900 dark:text-white"},{default:e.withCtx(()=>[(e.openBlock(),e.createElementBlock("svg",{height:l(),width:l(),viewBox:"33.6 130.6 499.7 242.9",xmlns:"http://www.w3.org/2000/svg","xmlns:xlink":"http://www.w3.org/1999/xlink"},[...o[0]||(o[0]=[e.createElementVNode("linearGradient",{id:"a"},[e.createElementVNode("stop",{offset:".085","stop-color":"#469e43"}),e.createElementVNode("stop",{offset:"1","stop-color":"#132d13"})],-1),e.createElementVNode("linearGradient",{id:"b",gradientUnits:"userSpaceOnUse",x1:"64.863",x2:"64.863","xlink:href":"#a",y1:"288.291",y2:"369.4"},null,-1),e.createElementVNode("linearGradient",{id:"c",gradientUnits:"userSpaceOnUse",x1:"138.367",x2:"138.367","xlink:href":"#a",y1:"308.454",y2:"370.601"},null,-1),e.createElementVNode("linearGradient",{id:"d",gradientUnits:"userSpaceOnUse",x1:"195.475",x2:"195.475","xlink:href":"#a",y1:"288.291",y2:"369.85"},null,-1),e.createElementVNode("linearGradient",{id:"e",gradientUnits:"userSpaceOnUse",x1:"249.634",x2:"249.634","xlink:href":"#a",y1:"307.312",y2:"369.511"},null,-1),e.createElementVNode("linearGradient",{id:"f",gradientUnits:"userSpaceOnUse",x1:"302.884",x2:"302.884","xlink:href":"#a",y1:"288.291",y2:"367.857"},null,-1),e.createElementVNode("linearGradient",{id:"g",gradientUnits:"userSpaceOnUse",x1:"354.118",x2:"354.118","xlink:href":"#a",y1:"307.312",y2:"369.511"},null,-1),e.createElementVNode("linearGradient",{id:"h",gradientUnits:"userSpaceOnUse",x1:"428.02",x2:"428.02","xlink:href":"#a",y1:"306.156",y2:"367.742"},null,-1),e.createElementVNode("linearGradient",{id:"i",gradientUnits:"userSpaceOnUse",x1:"502.066",x2:"502.066","xlink:href":"#a",y1:"288.291",y2:"369.4"},null,-1),e.createElementVNode("linearGradient",{id:"j",gradientUnits:"userSpaceOnUse",x1:"283.264",x2:"283.264","xlink:href":"#a",y1:"131.629",y2:"232.559"},null,-1),e.createElementVNode("linearGradient",{id:"k",gradientUnits:"userSpaceOnUse",x1:"283.46",x2:"283.46",y1:"202.275",y2:"183.785"},[e.createElementVNode("stop",{offset:"0","stop-color":"#969799","stop-opacity":"0"}),e.createElementVNode("stop",{offset:"1","stop-color":"#808183"})],-1),e.createElementVNode("path",{d:"m65 307.2c-6.8 0-13.1 2.2-18.2 5.9v-24.8h-13.2v81.1h31.4c17.2 0 31.1-13.9 31.1-31.1s-13.9-31.1-31.1-31.1zm0 49.3h-18.2v-18.2c0-10.1 8.2-18.2 18.2-18.2 10.1 0 18.2 8.2 18.2 18.2.1 10.1-8.1 18.2-18.2 18.2z",fill:"url(#b)"},null,-1),e.createElementVNode("path",{d:"m168.8 343.9h-46.7c1.4 7.1 6.6 12 14.1 12.7 6.4.6 12.9.1 19.9.1v11.9c-15.2 4.9-33.3.5-42.1-10.4-3.8-4.7-17.3-34.7 11.5-47.4 39-11.4 45.3 22.4 43.3 33.1zm-14.2-12.7c-1.7-8.1-8.8-12.9-17.9-12.3-7.6.5-14 5.8-14.5 12.3z",fill:"url(#c)"},null,-1),e.createElementVNode("path",{d:"m195.5 320.2c0 10.5-.2 20 .1 29.6.2 5.8 4.4 8.4 13.2 8.6v10.5c-13.8 3.9-26.2-4.5-26.4-18-.2-18.7-.1-43.9-.1-62.6h14.1l-.3 18.5 12.7-.1v13.4h-13.3z",fill:"url(#d)"},null,-1),e.createElementVNode("path",{d:"m249.6 307.3c-17.2 0-31.1 13.9-31.1 31.1s13.9 31.1 31.1 31.1h31.1v-31.1c0-17.2-13.9-31.1-31.1-31.1zm18.6 49.7h-18.5c-10.2 0-18.5-8.3-18.5-18.5s8.3-18.5 18.5-18.5 18.5 8.3 18.5 18.5z",fill:"url(#e)"},null,-1),e.createElementVNode("path",{d:"m296.4 288.3h13v79.6h-13z",fill:"url(#f)"},null,-1),e.createElementVNode("path",{d:"m354.1 307.3c-17.2 0-31.1 13.9-31.1 31.1s13.9 31.1 31.1 31.1h31.1v-31.1c0-17.2-13.9-31.1-31.1-31.1zm18.6 49.7h-18.5c-10.2 0-18.5-8.3-18.5-18.5s8.3-18.5 18.5-18.5 18.5 8.3 18.5 18.5z",fill:"url(#g)"},null,-1),e.createElementVNode("path",{d:"m442.2 367.7c0-12.3.2-23.6 0-34.9-.2-3.4-3.6-13.8-14.1-13.4-10.3-.3-14.4 10-14.3 12.7.1 10.2.5 35.1.5 35.1l-13.6.1s-.3-25.7.2-36.2c.6-14.1 12.7-25 27.5-25 14.7 0 26.2 10.4 26.7 24.9.4 10.4.5 36.3.5 36.3z",fill:"url(#h)"},null,-1),e.createElementVNode("path",{d:"m501.9 307.2c6.8 0 13.1 2.2 18.2 5.9v-24.8h13.2v81.1h-31.4c-17.2 0-31.1-13.9-31.1-31.1s13.9-31.1 31.1-31.1zm0 49.3h18.2v-18.2c0-10.1-8.2-18.2-18.2-18.2-10.1 0-18.2 8.2-18.2 18.2 0 10.1 8.1 18.2 18.2 18.2z",fill:"url(#i)"},null,-1),e.createElementVNode("path",{d:"m309.2 180.6h-24v-24c0-12.6 10.2-24.1 22.8-25 14.8-1 27.1 11.3 26.1 26.1-.8 12.7-12.3 22.9-24.9 22.9zm-50.7-48.9c-14.8-1-27.1 11.3-26.1 26.1.8 12.6 12.4 22.8 25 22.8h23.9v-24c0-12.6-10.3-24.1-22.8-24.9zm50.7 51.9h-24v23.9c0 12.6 10.2 24.1 22.8 25 14.8 1 27.1-11.3 26.1-26.1-.8-12.6-12.3-22.8-24.9-22.8zm-52.4 0c-14 0-25.3 11.8-24.4 26 .8 12.2 10.7 22.1 22.9 22.9 14.2.9 26-10.4 26-24.4v-24.5z",fill:"url(#j)"},null,-1),e.createElementVNode("path",{d:"m281.7 183.8h3.6v18.5h-3.6z",fill:"url(#k)"},null,-1)])],8,F))]),_:1})}}});var B=(t=>(t.DELETE="DELETE",t.SUCCESS="SUCCESS",t))(B||{});const j={class:"dialog relative top-20 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white"},Y={key:0,class:"p-6 text-center"},X={class:"mb-5 text-lg font-normal text-gray-500 dark:text-gray-400"},Z={class:"flex justify-center"},K=e.defineComponent({__name:"BaseModal",props:{title:{type:String,required:!0},description:{type:String,required:!1},to:{type:String,required:!1,default:"/"},mode:{type:String,required:!1,default:"SUCCESS"}},emits:["closeModal","confirmModal"],setup(t){return(r,l)=>{const a=e.resolveComponent("base-button");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:"outside",onClick:l[0]||(l[0]=o=>r.$emit("closeModal"))}),e.createElementVNode("div",j,[t.mode===e.unref(B).DELETE?(e.openBlock(),e.createElementBlock("div",Y,[e.createVNode(e.unref(E.ExclamationCircleIcon),{class:"w-12 h-12 text-gray-400 mx-auto mb-4"}),e.createElementVNode("h3",X," Are you sure you want to delete this "+e.toDisplayString(t.title)+"? ",1),e.createElementVNode("div",Z,[e.createVNode(a,{color:e.unref(f).RED,onClick:l[1]||(l[1]=o=>r.$emit("confirmModal")),description:"Yes, I'm sure"},null,8,["color"]),e.createVNode(a,{color:e.unref(f).WHITE,onClick:l[2]||(l[2]=o=>r.$emit("closeModal")),description:"No, cancel"},null,8,["color"])])])):e.createCommentVNode("",!0)])],64)}}}),N=(t,r)=>{const l=t.__vccOpts||t;for(const[a,o]of r)l[a]=o;return l},Q=N(K,[["__scopeId","data-v-492169b3"]]),J=e.defineComponent({__name:"BaseRow",props:{bgColor:{type:String,required:!1,default:"white"}},setup(t){const r=t;function l(){return"block p-6 border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700 global "+r.bgColor}return(a,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l())},[e.renderSlot(a.$slots,"default")],2))}}),v={},ee={class:"mb-3"};function te(t,r){return e.openBlock(),e.createElementBlock("div",ee,[...r[0]||(r[0]=[e.createElementVNode("svg",{"aria-hidden":"true",class:"inline w-8 h-8 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600",viewBox:"0 0 100 101",xmlns:"http://www.w3.org/2000/svg"},[e.createElementVNode("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),e.createElementVNode("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})],-1),e.createElementVNode("span",{class:"sr-only"},"Loading...",-1)])])}const re=N(v,[["render",te]]);var k=(t=>(t.SUCCESS="SUCCESS",t.WARNING="WARNING",t.ERROR="ERROR",t))(k||{}),C=(t=>(t.TOP_LEFT="TOP_LEFT",t.TOP_RIGHT="TOP_RIGHT",t.BOTTOM_LEFT="BOTTOM_LEFT",t.BOTTOM_RIGHT="BOTTOM_RIGHT",t))(C||{});const oe={class:"flex items-center w-full max-w-md p-4 mb-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800"},ne={class:"ml-3 text-sm font-normal"},le={key:3,type:"button",class:"ml-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex items-center justify-center h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700","data-dismiss-target":"#toast-danger","aria-label":"Close"},ae=e.defineComponent({__name:"BaseToast",props:{mode:{type:Object,required:!0},description:{type:String,required:!0},hasCloseIcon:{type:Boolean,required:!1,default:!0},positioning:{type:String,required:!1,default:"right"}},setup(t){const r=t;function l(){let c="";switch(r.mode){case k.ERROR:c="text-red-500 bg-red-100 dark:bg-red-800 dark:text-red-200";break;case k.SUCCESS:c="text-green-500 bg-green-100 dark:bg-green-800 dark:text-green-200";break;case k.WARNING:c="text-orange-500 bg-orange-100 dark:bg-orange-700 dark:text-orange-200";break}return"inline-flex items-center justify-center flex-shrink-0 w-8 h-8 rounded-lg "+c}function a(){let c="top-5 right-5";switch(r.positioning){case C.BOTTOM_LEFT:c="bottom-5";break;case C.TOP_LEFT:c="top-5";break;case C.TOP_RIGHT:c="top-5 right-5";break;case C.BOTTOM_RIGHT:c="bottom-5 right-5";break}return"fixed flex items-center w-full max-w-md p-4 space-x-4 divide-x rounded-lg "+c+" space-x"}const o=e.ref(!0);function n(){setTimeout(()=>o.value=!1,1e6)}return n(),(c,m)=>o.value?(e.openBlock(),e.createElementBlock("div",{key:0,id:"toast-top-right",class:e.normalizeClass(a()),role:"alert"},[e.createElementVNode("div",oe,[t.mode==e.unref(k).ERROR?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(l())},[e.createVNode(e.unref(E.ExclamationCircleIcon),{class:"h-6 w-6 text-red-500"}),m[1]||(m[1]=e.createElementVNode("span",{class:"sr-only"},"Error icon",-1))],2)):t.mode==e.unref(k).SUCCESS?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(l())},[e.createVNode(e.unref(E.CheckCircleIcon),{class:"h-6 w-6 text-green-500"}),m[2]||(m[2]=e.createElementVNode("span",{class:"sr-only"},"Check icon",-1))],2)):t.mode==e.unref(k).WARNING?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(l())},[e.createVNode(e.unref(E.ExclamationTriangleIcon),{class:"h-6 w-6 text-yellow-500"}),m[3]||(m[3]=e.createElementVNode("span",{class:"sr-only"},"Warning icon",-1))],2)):e.createCommentVNode("",!0),e.createElementVNode("div",ne,e.toDisplayString(t.description),1),t.hasCloseIcon?(e.openBlock(),e.createElementBlock("button",le,[m[4]||(m[4]=e.createElementVNode("span",{class:"sr-only"},"Close",-1)),e.createVNode(e.unref(E.XMarkIcon),{class:"h-6 w-6 text-gray-500 cursor-pointer",onClick:m[0]||(m[0]=i=>o.value=!o.value)})])):e.createCommentVNode("",!0)])],2)):e.createCommentVNode("",!0)}}),se={class:"w-13"},ce=e.defineComponent({__name:"ColoredSquares",props:{color:{type:String,required:!1}},setup(t){const r=t,l=["bg-slate-300","bg-zinc-300","bg-neutral-300","bg-stone-300","bg-blue-300","bg-green-300","bg-yellow-300","bg-purple-300","bg-pink-300"],a=e.computed(()=>l[Math.floor(Math.random()*l.length)]);function o(){let n="gray";switch(r.color){case d.GREEN:{n="green";break}case d.RED:{n="red";break}case d.BLUE:{n="blue";break}case d.YELLOW:{n="yellow";break}case d.NONE:{n="";break}}return"font-bold bg-"+n+"-100 text-"+n+"-800 text-xs mr-2 px-2.5 py-0.5 rounded-full"}return(n,c)=>(e.openBlock(),e.createElementBlock("div",se,[e.createElementVNode("div",{class:e.normalizeClass(["border border-gray-300 relative aspect-square rounded-lg bg-white shadow-sm overflow-hidden flex items-center justify-center text-center",o()])},[e.renderSlot(n.$slots,"default"),e.createElementVNode("div",{class:e.normalizeClass(["absolute bottom-0 left-0 h-1 w-full",a.value])},null,2)],2)]))}}),ie={key:0,class:"font-bold text-green-800"},de={key:0},me={key:0},fe="font-bold",pe=e.defineComponent({__name:"EuroAmount",props:{amount:{type:Number,required:!1},beforeAmount:{type:Number,default:null,required:!1},showCurrency:{type:Boolean,default:!0,required:!1}},setup(t){const r=t,l=e.computed(()=>r.amount!==null&&r.amount!==void 0),a=e.computed(()=>l.value&&r.amount<0),o=e.computed(()=>r.beforeAmount===null||r.beforeAmount===void 0?!1:r.amount<r.beforeAmount),n=e.computed(()=>a.value||o.value),c=e.computed(()=>!a.value&&!o.value&&!(r.beforeAmount===null||r.beforeAmount===void 0));return(m,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[l.value&&c.value?(e.openBlock(),e.createElementBlock("span",ie,[e.createTextVNode(e.toDisplayString(t.amount)+" ",1),t.showCurrency?(e.openBlock(),e.createElementBlock("span",de,"€")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),l.value&&!c.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass([fe,n.value?"text-red-800":"text-gray-800"])},[e.createTextVNode(e.toDisplayString(t.amount)+" ",1),t.showCurrency?(e.openBlock(),e.createElementBlock("span",me,"€")):e.createCommentVNode("",!0)],2)):e.createCommentVNode("",!0)],64))}}),ge=["onClick"],Ee={key:1,style:{cursor:"not-allowed"}},ke=N(e.defineComponent({__name:"Pagination",props:{totalItems:{type:Number,required:!0,default:10},itemsPerPage:{type:Number,default:20}},emits:["page-changed"],setup(t,{emit:r}){const l=t,a=e.ref(1),o=e.ref(0),n=e.ref([]),c=r;function m(i){if(i!==a.value&&i>=1&&i<=o.value&&(a.value=i),o.value>5){n.value=[],i-3>0&&(n.value.push(1),n.value.push(0));for(let p=2;p>=1;p--){let V=i-p;V>0&&n.value.push(V)}n.value.push(a.value);let g=o.value-i,_=g>2,xe=2;if(_){for(let p=1;p<=xe;p++)n.value.push(i+p);n.value.push(0),n.value.push(o.value)}else for(let p=1;p<=g;p++)n.value.push(i+p)}c("page-changed",i)}return e.watch(()=>l.totalItems,()=>{if(o.value=Math.ceil(l.totalItems/l.itemsPerPage),n.value=[],o.value>5){for(let i=1;i<5;i++)n.value.push(i);n.value.push(0),n.value.push(o.value)}else for(let i=1;i<=o.value;i++)n.value.push(i)}),(i,Ce)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,g=>(e.openBlock(),e.createElementBlock("li",{key:g},[g!==0?(e.openBlock(),e.createElementBlock("a",{key:0,onClick:_=>m(g),class:e.normalizeClass({active:g===a.value})},e.toDisplayString(g),11,ge)):e.createCommentVNode("",!0),g===0?(e.openBlock(),e.createElementBlock("span",Ee,"...")):e.createCommentVNode("",!0)]))),128))])]))}}),[["__scopeId","data-v-248e09af"]]),ye={key:0},be={key:0,class:"flex items-center space-x-2"},he={key:1,class:"flex items-center space-x-2"},ue=e.defineComponent({__name:"TrendArrow",props:{number:{type:Number,required:!1},icon:{type:String,required:!1}},setup(t){const r=t,l=e.computed(()=>r.number!==null&&r.number!==void 0&&r.number<0);return(a,o)=>t.number?(e.openBlock(),e.createElementBlock("div",ye,[l.value?(e.openBlock(),e.createElementBlock("span",be,[e.createVNode(x,{color:e.unref(d).RED},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.number)+e.toDisplayString(r.icon),1)]),_:1},8,["color"]),e.createVNode(e.unref(E.ArrowDownIcon),{class:"h-5 w-5 text-red-500"})])):(e.openBlock(),e.createElementBlock("span",he,[e.createVNode(x,{color:e.unref(d).GREEN},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(t.number)+e.toDisplayString(r.icon),1)]),_:1},8,["color"]),e.createVNode(e.unref(E.ArrowUpIcon),{class:"h-5 w-5 text-green-500"})]))])):e.createCommentVNode("",!0)}});var R=(t=>(t.WIN="WIN",t.LOSE="LOSE",t))(R||{});s.AlertEnum=y,s.BaseAlert=A,s.BaseBadge=x,s.BaseBadgeEnum=R,s.BaseButton=I,s.BaseButtonEnum=f,s.BaseButtonSizeEnum=b,s.BaseLine=W,s.BaseLoginEnum=u,s.BaseLogo=H,s.BaseModal=Q,s.BaseModalEnum=B,s.BaseRow=J,s.BaseSpinner=re,s.BaseToast=ae,s.BaseToastEnum=k,s.ColoredSquares=ce,s.ColorsEnums=d,s.EuroAmount=pe,s.LineEnum=h,s.Pagination=ke,s.PositioningEnum=C,s.TrendArrow=ue,s.getBaseColor=S,s.getBaseColorOf=w,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mgv-backoffice",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Shared Vue 3 UI component library",
|
|
5
|
+
"main": "./dist/ui-lib.js",
|
|
6
|
+
"module": "./dist/ui-lib.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "vite build",
|
|
14
|
+
"dev": "vite build --watch"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"vue": "^3.3.0",
|
|
18
|
+
"vue-router": "^4.0.0",
|
|
19
|
+
"@heroicons/vue": "^2.0.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"vue": "^3.5.26",
|
|
23
|
+
"vue-router": "^4.6.4",
|
|
24
|
+
"@heroicons/vue": "^2.2.0",
|
|
25
|
+
"@vitejs/plugin-vue": "^5.2.0",
|
|
26
|
+
"vite": "^5.4.0",
|
|
27
|
+
"vite-plugin-dts": "^4.5.0",
|
|
28
|
+
"typescript": "^5.9.3",
|
|
29
|
+
"sass": "^1.97.1"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="computeCss()" role="alert">
|
|
3
|
+
<InformationCircleIcon class="w-6 h-6 text-gray-400"/>
|
|
4
|
+
<div>
|
|
5
|
+
<span class="font-medium pl-1">{{ title }}</span>
|
|
6
|
+
</div>
|
|
7
|
+
</div>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
import { InformationCircleIcon } from '@heroicons/vue/24/outline'
|
|
12
|
+
import { AlertEnum } from "../enums/AlertEnum";
|
|
13
|
+
import { PropType } from "vue";
|
|
14
|
+
import { getBaseColor } from "../utils/util";
|
|
15
|
+
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
title: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: false,
|
|
20
|
+
default: AlertEnum.ERROR
|
|
21
|
+
},
|
|
22
|
+
color: {
|
|
23
|
+
type: Object as PropType<AlertEnum>,
|
|
24
|
+
required: false
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
function computeCss() {
|
|
29
|
+
let baseColor = getBaseColor(props.color);
|
|
30
|
+
return "flex items-center p-4 mb-4 text-sm text-" + baseColor + "-800 border border-" + baseColor + "-300 rounded-lg bg-" + baseColor + "-50 dark:bg-gray-800 dark:text-" + baseColor + "-400 dark:border-" + baseColor + "-800"
|
|
31
|
+
}
|
|
32
|
+
</script>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span v-if="hasDefaultSlot" :class="computeCss()">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</span>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { computed, useSlots } from 'vue'
|
|
9
|
+
import { getBaseColorOf } from "../utils/util";
|
|
10
|
+
const slots = useSlots()
|
|
11
|
+
|
|
12
|
+
const hasDefaultSlot = computed(() => !!slots.default)
|
|
13
|
+
const props = defineProps({
|
|
14
|
+
color: {
|
|
15
|
+
type: String,
|
|
16
|
+
required: false
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
function computeCss() {
|
|
21
|
+
let color = getBaseColorOf(props.color);
|
|
22
|
+
return "font-bold bg-" + color + "-100 text-" + color + "-800 text-xs mr-2 px-2.5 py-0.5 rounded-full";
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<router-link v-if="to" :to="to">
|
|
3
|
+
<button :type="props.type" :class="computeCss()" :disabled="isDisable">
|
|
4
|
+
<span v-if="!iconLeft">{{ description }}</span>
|
|
5
|
+
<slot></slot>
|
|
6
|
+
<span v-if="iconLeft">{{ description }}</span>
|
|
7
|
+
</button>
|
|
8
|
+
</router-link>
|
|
9
|
+
<button v-else :type="props.type" :class="computeCss()" :disabled="isDisable">
|
|
10
|
+
<div v-if="isLoading">
|
|
11
|
+
<svg aria-hidden="true" role="status" class="inline w-4 h-4 me-3 text-white animate-spin" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
12
|
+
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="#E5E7EB"/>
|
|
13
|
+
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentColor"/>
|
|
14
|
+
</svg>
|
|
15
|
+
</div>
|
|
16
|
+
<span v-if="!iconLeft">{{ description }}</span>
|
|
17
|
+
<slot></slot>
|
|
18
|
+
<span v-if="iconLeft">{{ description }}</span>
|
|
19
|
+
</button>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import { BaseButtonEnum } from "../enums/BaseButtonEnum";
|
|
24
|
+
import { BaseButtonSizeEnum } from "../enums/BaseButtonSizeEnum";
|
|
25
|
+
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
description: {
|
|
28
|
+
type: String,
|
|
29
|
+
required: true
|
|
30
|
+
},
|
|
31
|
+
color: {
|
|
32
|
+
type: String,
|
|
33
|
+
required: false,
|
|
34
|
+
default: BaseButtonEnum.BLUE
|
|
35
|
+
},
|
|
36
|
+
to: {
|
|
37
|
+
type: String,
|
|
38
|
+
required: false
|
|
39
|
+
},
|
|
40
|
+
type: {
|
|
41
|
+
type: String,
|
|
42
|
+
required: false,
|
|
43
|
+
default: 'button'
|
|
44
|
+
},
|
|
45
|
+
icon: {
|
|
46
|
+
type: String,
|
|
47
|
+
required: false
|
|
48
|
+
},
|
|
49
|
+
iconSize: {
|
|
50
|
+
type: String,
|
|
51
|
+
required: false
|
|
52
|
+
},
|
|
53
|
+
iconLeft: {
|
|
54
|
+
type: String,
|
|
55
|
+
required: false
|
|
56
|
+
},
|
|
57
|
+
isRounded: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
required: false
|
|
60
|
+
},
|
|
61
|
+
isDisable: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
required: false
|
|
64
|
+
},
|
|
65
|
+
size: {
|
|
66
|
+
type: String,
|
|
67
|
+
required: false
|
|
68
|
+
},
|
|
69
|
+
isLoading: {
|
|
70
|
+
type: Boolean,
|
|
71
|
+
required: false
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
function computeCss() {
|
|
76
|
+
let commonCss = "inline-flex items-center";
|
|
77
|
+
let css;
|
|
78
|
+
switch (props.color) {
|
|
79
|
+
case BaseButtonEnum.BLUE: {
|
|
80
|
+
css = 'focus:outline-none text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:ring-blue-300';
|
|
81
|
+
if (props.isDisable) { css += " bg-blue-400"; }
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
case BaseButtonEnum.WHITE: {
|
|
85
|
+
css = 'focus:outline-none text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 hover:text-blue-700 focus:z-10 focus:ring-4 focus:ring-gray-200';
|
|
86
|
+
if (props.isDisable) { css += " bg-gray-400"; }
|
|
87
|
+
break;
|
|
88
|
+
}
|
|
89
|
+
case BaseButtonEnum.DARK: {
|
|
90
|
+
css = 'focus:outline-none text-white bg-gray-800 hover:bg-gray-900 focus:ring-4 focus:ring-gray-300 ';
|
|
91
|
+
if (props.isDisable) { css += " bg-gray-400"; }
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
case BaseButtonEnum.GREEN: {
|
|
95
|
+
css = 'focus:outline-none text-white bg-green-700 hover:bg-green-800 focus:ring-4 focus:ring-green-300';
|
|
96
|
+
if (props.isDisable) { css += " bg-green-400"; }
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
case BaseButtonEnum.RED: {
|
|
100
|
+
css = 'focus:outline-none text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300';
|
|
101
|
+
if (props.isDisable) { css += " bg-red-400"; }
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
case BaseButtonEnum.YELLOW: {
|
|
105
|
+
css = 'focus:outline-none text-white bg-yellow-400 hover:bg-yellow-500 focus:ring-4 focus:ring-yellow-300';
|
|
106
|
+
if (props.isDisable) { css += " bg-yellow-400"; }
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
case BaseButtonEnum.PURPLE: {
|
|
110
|
+
css = 'focus:outline-none text-white bg-purple-700 hover:bg-purple-800 focus:ring-4 focus:ring-purple-300 px-5 py-2.5 mb-2';
|
|
111
|
+
if (props.isDisable) { css += " bg-purple-400"; }
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
let size = "px-5 py-2.5 mr-2 mb-2 text-sm";
|
|
117
|
+
switch (props.size) {
|
|
118
|
+
case BaseButtonSizeEnum.EXTRA_SMALL: { size = 'px-3 py-2 text-xs'; break; }
|
|
119
|
+
case BaseButtonSizeEnum.SMALL: { size = 'px-3 py-2 text-sm'; break; }
|
|
120
|
+
case BaseButtonSizeEnum.BASE: { size = 'px-5 py-2.5 text-sm'; break; }
|
|
121
|
+
case BaseButtonSizeEnum.LARGE: { size = 'px-5 py-3 text-base'; break; }
|
|
122
|
+
case BaseButtonSizeEnum.EXTRA_LARGE: { size = 'px-6 py-3.5 text-base'; break; }
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
let rounded = "rounded-lg";
|
|
126
|
+
if (props.isRounded) { rounded = "rounded-full"; }
|
|
127
|
+
if (props.isDisable) { css += " cursor-not-allowed"; }
|
|
128
|
+
|
|
129
|
+
let fontSize = "font-medium";
|
|
130
|
+
return commonCss + " " + size + " " + css + " " + fontSize + " " + rounded;
|
|
131
|
+
}
|
|
132
|
+
</script>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<hr v-if="mode === LineEnum.BASE" class="h-px my-8 bg-gray-200 border-0 dark:bg-gray-700">
|
|
3
|
+
<hr v-if="mode === LineEnum.BASE_SHORTER" class="w-48 h-1 mx-auto my-4 bg-gray-100 border-0 rounded md:my-10 dark:bg-gray-700">
|
|
4
|
+
<hr v-if="mode === LineEnum.SQUARE" class="w-8 h-8 mx-auto my-8 bg-gray-200 border-0 rounded md:my-12 dark:bg-gray-700">
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { LineEnum } from "../enums/LineEnum";
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
mode: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: false,
|
|
14
|
+
default: LineEnum.BASE
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<router-link to="/" class="flex items-center mb-6 text-2xl font-semibold text-gray-900 dark:text-white">
|
|
3
|
+
<svg :height="computePx()" :width="computePx()" viewBox="33.6 130.6 499.7 242.9" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><linearGradient id="a"><stop offset=".085" stop-color="#469e43"/><stop offset="1" stop-color="#132d13"/></linearGradient><linearGradient id="b" gradientUnits="userSpaceOnUse" x1="64.863" x2="64.863" xlink:href="#a" y1="288.291" y2="369.4"/><linearGradient id="c" gradientUnits="userSpaceOnUse" x1="138.367" x2="138.367" xlink:href="#a" y1="308.454" y2="370.601"/><linearGradient id="d" gradientUnits="userSpaceOnUse" x1="195.475" x2="195.475" xlink:href="#a" y1="288.291" y2="369.85"/><linearGradient id="e" gradientUnits="userSpaceOnUse" x1="249.634" x2="249.634" xlink:href="#a" y1="307.312" y2="369.511"/><linearGradient id="f" gradientUnits="userSpaceOnUse" x1="302.884" x2="302.884" xlink:href="#a" y1="288.291" y2="367.857"/><linearGradient id="g" gradientUnits="userSpaceOnUse" x1="354.118" x2="354.118" xlink:href="#a" y1="307.312" y2="369.511"/><linearGradient id="h" gradientUnits="userSpaceOnUse" x1="428.02" x2="428.02" xlink:href="#a" y1="306.156" y2="367.742"/><linearGradient id="i" gradientUnits="userSpaceOnUse" x1="502.066" x2="502.066" xlink:href="#a" y1="288.291" y2="369.4"/><linearGradient id="j" gradientUnits="userSpaceOnUse" x1="283.264" x2="283.264" xlink:href="#a" y1="131.629" y2="232.559"/><linearGradient id="k" gradientUnits="userSpaceOnUse" x1="283.46" x2="283.46" y1="202.275" y2="183.785"><stop offset="0" stop-color="#969799" stop-opacity="0"/><stop offset="1" stop-color="#808183"/></linearGradient><path d="m65 307.2c-6.8 0-13.1 2.2-18.2 5.9v-24.8h-13.2v81.1h31.4c17.2 0 31.1-13.9 31.1-31.1s-13.9-31.1-31.1-31.1zm0 49.3h-18.2v-18.2c0-10.1 8.2-18.2 18.2-18.2 10.1 0 18.2 8.2 18.2 18.2.1 10.1-8.1 18.2-18.2 18.2z" fill="url(#b)"/><path d="m168.8 343.9h-46.7c1.4 7.1 6.6 12 14.1 12.7 6.4.6 12.9.1 19.9.1v11.9c-15.2 4.9-33.3.5-42.1-10.4-3.8-4.7-17.3-34.7 11.5-47.4 39-11.4 45.3 22.4 43.3 33.1zm-14.2-12.7c-1.7-8.1-8.8-12.9-17.9-12.3-7.6.5-14 5.8-14.5 12.3z" fill="url(#c)"/><path d="m195.5 320.2c0 10.5-.2 20 .1 29.6.2 5.8 4.4 8.4 13.2 8.6v10.5c-13.8 3.9-26.2-4.5-26.4-18-.2-18.7-.1-43.9-.1-62.6h14.1l-.3 18.5 12.7-.1v13.4h-13.3z" fill="url(#d)"/><path d="m249.6 307.3c-17.2 0-31.1 13.9-31.1 31.1s13.9 31.1 31.1 31.1h31.1v-31.1c0-17.2-13.9-31.1-31.1-31.1zm18.6 49.7h-18.5c-10.2 0-18.5-8.3-18.5-18.5s8.3-18.5 18.5-18.5 18.5 8.3 18.5 18.5z" fill="url(#e)"/><path d="m296.4 288.3h13v79.6h-13z" fill="url(#f)"/><path d="m354.1 307.3c-17.2 0-31.1 13.9-31.1 31.1s13.9 31.1 31.1 31.1h31.1v-31.1c0-17.2-13.9-31.1-31.1-31.1zm18.6 49.7h-18.5c-10.2 0-18.5-8.3-18.5-18.5s8.3-18.5 18.5-18.5 18.5 8.3 18.5 18.5z" fill="url(#g)"/><path d="m442.2 367.7c0-12.3.2-23.6 0-34.9-.2-3.4-3.6-13.8-14.1-13.4-10.3-.3-14.4 10-14.3 12.7.1 10.2.5 35.1.5 35.1l-13.6.1s-.3-25.7.2-36.2c.6-14.1 12.7-25 27.5-25 14.7 0 26.2 10.4 26.7 24.9.4 10.4.5 36.3.5 36.3z" fill="url(#h)"/><path d="m501.9 307.2c6.8 0 13.1 2.2 18.2 5.9v-24.8h13.2v81.1h-31.4c-17.2 0-31.1-13.9-31.1-31.1s13.9-31.1 31.1-31.1zm0 49.3h18.2v-18.2c0-10.1-8.2-18.2-18.2-18.2-10.1 0-18.2 8.2-18.2 18.2 0 10.1 8.1 18.2 18.2 18.2z" fill="url(#i)"/><path d="m309.2 180.6h-24v-24c0-12.6 10.2-24.1 22.8-25 14.8-1 27.1 11.3 26.1 26.1-.8 12.7-12.3 22.9-24.9 22.9zm-50.7-48.9c-14.8-1-27.1 11.3-26.1 26.1.8 12.6 12.4 22.8 25 22.8h23.9v-24c0-12.6-10.3-24.1-22.8-24.9zm50.7 51.9h-24v23.9c0 12.6 10.2 24.1 22.8 25 14.8 1 27.1-11.3 26.1-26.1-.8-12.6-12.3-22.8-24.9-22.8zm-52.4 0c-14 0-25.3 11.8-24.4 26 .8 12.2 10.7 22.1 22.9 22.9 14.2.9 26-10.4 26-24.4v-24.5z" fill="url(#j)"/><path d="m281.7 183.8h3.6v18.5h-3.6z" fill="url(#k)"/></svg>
|
|
4
|
+
</router-link>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { BaseLoginEnum } from "../enums/BaseLogoEnum";
|
|
9
|
+
|
|
10
|
+
const props = defineProps({
|
|
11
|
+
size: {
|
|
12
|
+
type: String,
|
|
13
|
+
required: false,
|
|
14
|
+
default: BaseLoginEnum.MEDIUM
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
function computePx() {
|
|
19
|
+
let commonCss = ''
|
|
20
|
+
switch (props.size) {
|
|
21
|
+
case BaseLoginEnum.SMALL: { commonCss = '50px'; break; }
|
|
22
|
+
case BaseLoginEnum.MEDIUM: { commonCss = '100px'; break; }
|
|
23
|
+
case BaseLoginEnum.LARGE: { commonCss = '150px'; break; }
|
|
24
|
+
}
|
|
25
|
+
return commonCss;
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="outside" @click="$emit('closeModal')"></div>
|
|
3
|
+
|
|
4
|
+
<div class="dialog relative top-20 mx-auto p-5 border w-96 shadow-lg rounded-md bg-white">
|
|
5
|
+
|
|
6
|
+
<div v-if="mode === BaseModalEnum.DELETE" class="p-6 text-center">
|
|
7
|
+
<ExclamationCircleIcon class="w-12 h-12 text-gray-400 mx-auto mb-4" />
|
|
8
|
+
|
|
9
|
+
<h3 class="mb-5 text-lg font-normal text-gray-500 dark:text-gray-400">
|
|
10
|
+
Are you sure you want to delete this {{ title }}?
|
|
11
|
+
</h3>
|
|
12
|
+
|
|
13
|
+
<div class="flex justify-center">
|
|
14
|
+
<base-button :color="BaseButtonEnum.RED" @click="$emit('confirmModal')" description="Yes, I'm sure"/>
|
|
15
|
+
<base-button :color="BaseButtonEnum.WHITE" @click="$emit('closeModal')" description="No, cancel"/>
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts" setup>
|
|
23
|
+
import { BaseModalEnum } from "../enums/BaseModalEnum";
|
|
24
|
+
import { BaseButtonEnum } from "../enums/BaseButtonEnum";
|
|
25
|
+
import { ExclamationCircleIcon } from '@heroicons/vue/24/outline'
|
|
26
|
+
|
|
27
|
+
defineEmits(['closeModal', 'confirmModal'])
|
|
28
|
+
|
|
29
|
+
const props = defineProps({
|
|
30
|
+
title: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: true
|
|
33
|
+
},
|
|
34
|
+
description: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: false
|
|
37
|
+
},
|
|
38
|
+
to: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: false,
|
|
41
|
+
default: "/"
|
|
42
|
+
},
|
|
43
|
+
mode: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: false,
|
|
46
|
+
default: 'SUCCESS'
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<style lang="scss" scoped>
|
|
52
|
+
.outside {
|
|
53
|
+
position: fixed;
|
|
54
|
+
top: 0;
|
|
55
|
+
left: 0;
|
|
56
|
+
height: 100vh;
|
|
57
|
+
width: 100%;
|
|
58
|
+
background-color: rgba(0, 0, 0, 0.75);
|
|
59
|
+
z-index: 10;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.dialog {
|
|
63
|
+
position: fixed;
|
|
64
|
+
top: 20vh;
|
|
65
|
+
left: 40%;
|
|
66
|
+
width: 20%;
|
|
67
|
+
z-index: 100;
|
|
68
|
+
border-radius: 12px;
|
|
69
|
+
border: none;
|
|
70
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
|
|
71
|
+
padding: 0;
|
|
72
|
+
margin: 0;
|
|
73
|
+
overflow: hidden;
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="computeCss()">
|
|
3
|
+
<slot></slot>
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
const props = defineProps({
|
|
9
|
+
bgColor: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: false,
|
|
12
|
+
default: "white"
|
|
13
|
+
}
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
function computeCss() {
|
|
17
|
+
return 'block p-6 border border-gray-200 rounded-lg shadow dark:bg-gray-800 dark:border-gray-700 global ' + props.bgColor;
|
|
18
|
+
}
|
|
19
|
+
</script>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="mb-3">
|
|
3
|
+
<svg aria-hidden="true" class="inline w-8 h-8 mr-2 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
+
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
|
|
5
|
+
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
|
|
6
|
+
</svg>
|
|
7
|
+
<span class="sr-only">Loading...</span>
|
|
8
|
+
</div>
|
|
9
|
+
</template>
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="isLoading" id="toast-top-right" :class="computeMainComponentCss()" role="alert">
|
|
3
|
+
|
|
4
|
+
<div class="flex items-center w-full max-w-md p-4 mb-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800">
|
|
5
|
+
<div v-if="mode == BaseToastEnum.ERROR" :class="computeModeCss()">
|
|
6
|
+
<ExclamationCircleIcon class="h-6 w-6 text-red-500" />
|
|
7
|
+
<span class="sr-only">Error icon</span>
|
|
8
|
+
</div>
|
|
9
|
+
<div v-else-if="mode == BaseToastEnum.SUCCESS" :class="computeModeCss()">
|
|
10
|
+
<CheckCircleIcon class="h-6 w-6 text-green-500" />
|
|
11
|
+
<span class="sr-only">Check icon</span>
|
|
12
|
+
</div>
|
|
13
|
+
<div v-else-if="mode == BaseToastEnum.WARNING" :class="computeModeCss()">
|
|
14
|
+
<ExclamationTriangleIcon class="h-6 w-6 text-yellow-500" />
|
|
15
|
+
<span class="sr-only">Warning icon</span>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="ml-3 text-sm font-normal">{{ description }}</div>
|
|
19
|
+
|
|
20
|
+
<button v-if="hasCloseIcon" type="button" class="ml-auto -mx-1.5 -my-1.5 bg-white text-gray-400 hover:text-gray-900 rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 inline-flex items-center justify-center h-8 w-8 dark:text-gray-500 dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700" data-dismiss-target="#toast-danger" aria-label="Close">
|
|
21
|
+
<span class="sr-only">Close</span>
|
|
22
|
+
<XMarkIcon
|
|
23
|
+
class="h-6 w-6 text-gray-500 cursor-pointer"
|
|
24
|
+
@click="isLoading = !isLoading"
|
|
25
|
+
/>
|
|
26
|
+
</button>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
|
|
32
|
+
<script lang="ts" setup>
|
|
33
|
+
import { ExclamationCircleIcon, CheckCircleIcon, ExclamationTriangleIcon, XMarkIcon } from '@heroicons/vue/24/outline';
|
|
34
|
+
import { ref, PropType } from "vue";
|
|
35
|
+
import { BaseToastEnum } from "../enums/BaseToastEnum";
|
|
36
|
+
import { PositioningEnum } from "../enums/PositioningEnum";
|
|
37
|
+
|
|
38
|
+
const props = defineProps({
|
|
39
|
+
mode: {
|
|
40
|
+
type: Object as PropType<BaseToastEnum>,
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
description: {
|
|
44
|
+
type: String,
|
|
45
|
+
required: true
|
|
46
|
+
},
|
|
47
|
+
hasCloseIcon: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
required: false,
|
|
50
|
+
default: true
|
|
51
|
+
},
|
|
52
|
+
positioning: {
|
|
53
|
+
type: String,
|
|
54
|
+
required: false,
|
|
55
|
+
default: 'right'
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
function computeModeCss() {
|
|
60
|
+
let basePositioning = "";
|
|
61
|
+
switch (props.mode) {
|
|
62
|
+
case (BaseToastEnum.ERROR):
|
|
63
|
+
basePositioning = "text-red-500 bg-red-100 dark:bg-red-800 dark:text-red-200"
|
|
64
|
+
break;
|
|
65
|
+
case (BaseToastEnum.SUCCESS):
|
|
66
|
+
basePositioning = "text-green-500 bg-green-100 dark:bg-green-800 dark:text-green-200"
|
|
67
|
+
break;
|
|
68
|
+
case (BaseToastEnum.WARNING):
|
|
69
|
+
basePositioning = "text-orange-500 bg-orange-100 dark:bg-orange-700 dark:text-orange-200"
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
return 'inline-flex items-center justify-center flex-shrink-0 w-8 h-8 rounded-lg ' + basePositioning;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function computeMainComponentCss() {
|
|
76
|
+
let basePositioning = "top-5 right-5";
|
|
77
|
+
switch (props.positioning) {
|
|
78
|
+
case (PositioningEnum.BOTTOM_LEFT):
|
|
79
|
+
basePositioning = "bottom-5"
|
|
80
|
+
break;
|
|
81
|
+
case (PositioningEnum.TOP_LEFT):
|
|
82
|
+
basePositioning = "top-5"
|
|
83
|
+
break;
|
|
84
|
+
case (PositioningEnum.TOP_RIGHT):
|
|
85
|
+
basePositioning = "top-5 right-5"
|
|
86
|
+
break;
|
|
87
|
+
case (PositioningEnum.BOTTOM_RIGHT):
|
|
88
|
+
basePositioning = "bottom-5 right-5"
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
return 'fixed flex items-center w-full max-w-md p-4 space-x-4 divide-x rounded-lg ' + basePositioning + ' space-x';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const isLoading = ref(true);
|
|
95
|
+
|
|
96
|
+
function disable() {
|
|
97
|
+
setTimeout(() => isLoading.value = false, 1000000);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
disable()
|
|
101
|
+
</script>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="w-13">
|
|
3
|
+
<div
|
|
4
|
+
class="border border-gray-300 relative aspect-square rounded-lg bg-white shadow-sm overflow-hidden flex items-center justify-center text-center" :class="computeCss()">
|
|
5
|
+
|
|
6
|
+
<slot />
|
|
7
|
+
|
|
8
|
+
<div class="absolute bottom-0 left-0 h-1 w-full" :class="bgColor"/>
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
import { computed } from 'vue'
|
|
15
|
+
import { ColorsEnums } from "../enums/ColorsEnums";
|
|
16
|
+
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
color: {
|
|
19
|
+
type: String,
|
|
20
|
+
required: false
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const pastelColors = [
|
|
25
|
+
'bg-slate-300',
|
|
26
|
+
'bg-zinc-300',
|
|
27
|
+
'bg-neutral-300',
|
|
28
|
+
'bg-stone-300',
|
|
29
|
+
'bg-blue-300',
|
|
30
|
+
'bg-green-300',
|
|
31
|
+
'bg-yellow-300',
|
|
32
|
+
'bg-purple-300',
|
|
33
|
+
'bg-pink-300'
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
const bgColor = computed(() => {
|
|
37
|
+
return pastelColors[Math.floor(Math.random() * pastelColors.length)]
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
function computeCss() {
|
|
41
|
+
let color = 'gray';
|
|
42
|
+
switch (props.color) {
|
|
43
|
+
case ColorsEnums.GREEN: { color = 'green'; break; }
|
|
44
|
+
case ColorsEnums.RED: { color = 'red'; break; }
|
|
45
|
+
case ColorsEnums.BLUE: { color = 'blue'; break; }
|
|
46
|
+
case ColorsEnums.YELLOW: { color = 'yellow'; break; }
|
|
47
|
+
case ColorsEnums.NONE: { color = ''; break; }
|
|
48
|
+
}
|
|
49
|
+
return "font-bold bg-" + color + "-100 text-" + color + "-800 text-xs mr-2 px-2.5 py-0.5 rounded-full";
|
|
50
|
+
}
|
|
51
|
+
</script>
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span v-if="hasAmount && shouldBeGreen" class="font-bold text-green-800">
|
|
3
|
+
{{ amount }} <span v-if="showCurrency">€</span>
|
|
4
|
+
</span>
|
|
5
|
+
|
|
6
|
+
<span v-if="hasAmount && !shouldBeGreen" :class="[baseClasses, shouldBeRed ? 'text-red-800' : 'text-gray-800']">
|
|
7
|
+
{{ amount }} <span v-if="showCurrency">€</span>
|
|
8
|
+
</span>
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script setup lang="ts">
|
|
12
|
+
import { computed } from 'vue'
|
|
13
|
+
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
amount: {
|
|
16
|
+
type: Number,
|
|
17
|
+
required: false
|
|
18
|
+
},
|
|
19
|
+
beforeAmount: {
|
|
20
|
+
type: Number,
|
|
21
|
+
default: null,
|
|
22
|
+
required: false
|
|
23
|
+
},
|
|
24
|
+
showCurrency: {
|
|
25
|
+
type: Boolean,
|
|
26
|
+
default: true,
|
|
27
|
+
required: false
|
|
28
|
+
},
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
const hasAmount = computed(() => props.amount !== null && props.amount !== undefined)
|
|
32
|
+
const isNegative = computed(() => hasAmount.value && props.amount! < 0)
|
|
33
|
+
const isBelowBefore = computed(() => {
|
|
34
|
+
if (props.beforeAmount === null || props.beforeAmount === undefined) return false
|
|
35
|
+
return props.amount! < props.beforeAmount
|
|
36
|
+
})
|
|
37
|
+
const shouldBeRed = computed(() => isNegative.value || isBelowBefore.value)
|
|
38
|
+
const shouldBeGreen = computed(() => !isNegative.value && !isBelowBefore.value && !(props.beforeAmount === null || props.beforeAmount === undefined))
|
|
39
|
+
const baseClasses = 'font-bold'
|
|
40
|
+
</script>
|