treqit-ui-library 1.4.14 → 1.4.16
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(s,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(s=typeof globalThis<"u"?globalThis:s||self,e(s.TreqitUiLibrary={},s.Vue))})(this,(function(s,e){"use strict";const m=(t,l)=>{const o=t.__vccOpts||t;for(const[a,n]of l)o[a]=n;return o},G={key:0,class:"avatar-initials"},V=m({__name:"Avatar",props:{size:{type:[String,Number],default:48},rounded:{type:[String,Number,Boolean],default:!0},color:{type:String,default:"var(--treqit-gray-300)"},initials:{type:String,default:null}},setup(t){const l=t,o=e.computed(()=>["avatar",{"avatar--rounded-sm":l.rounded==="sm","avatar--rounded-lg":l.rounded==="lg"}]),a=e.computed(()=>{const n={width:`${l.size}px`,height:`${l.size}px`,backgroundColor:l.color};return l.rounded===!0||l.rounded===""?n.borderRadius="50%":l.rounded===!1||l.rounded===0||l.rounded==="0"?n.borderRadius="0px":typeof l.rounded=="number"&&(n.borderRadius=`${l.rounded}px`),n});return(n,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(o.value),style:e.normalizeStyle(a.value)},[e.renderSlot(n.$slots,"default",{},()=>[t.initials?(e.openBlock(),e.createElementBlock("span",G,e.toDisplayString(t.initials),1)):e.createCommentVNode("",!0)],!0)],6))}},[["__scopeId","data-v-2e02a766"]]),X=["type","disabled"],W={key:0,class:"btn-loader"},$=m({__name:"Button",props:{variant:{type:String,default:"primary",validator:t=>["primary","secondary","destructive","flat","elevated","text","outlined","outlined-primary","outlined-secondary","rounded"].includes(t)},size:{type:String,default:"medium",validator:t=>["sm","small","medium","large","x-large"].includes(t)},type:{type:String,default:"button"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},full:{type:Boolean,default:!1}},emits:["click"],setup(t){const l=t,o=e.computed(()=>["btn",`btn--${l.variant}`,`btn--${l.size==="sm"?"small":l.size}`,{"btn--loading":l.loading,"btn--full":l.full}]);return(a,n)=>(e.openBlock(),e.createElementBlock("button",{type:t.type,class:e.normalizeClass(o.value),disabled:t.disabled||t.loading,onClick:n[0]||(n[0]=r=>a.$emit("click"))},[t.loading?(e.openBlock(),e.createElementBlock("div",W,[...n[1]||(n[1]=[e.createElementVNode("div",{class:"simple-spinner"},null,-1)])])):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(["btn-content",{"content-hidden":t.loading}])},[e.renderSlot(a.$slots,"default",{},void 0,!0)],2)],10,X))}},[["__scopeId","data-v-8db92d47"]]),Y={class:"card"},x=m({__name:"Card",setup(t){return(l,o)=>(e.openBlock(),e.createElementBlock("div",Y,[e.renderSlot(l.$slots,"default",{},void 0,!0)]))}},[["__scopeId","data-v-09430cb2"]]),C=m({__name:"Chip",props:{variant:{type:String,default:"secondary",validator:t=>["primary","secondary","success","warning","danger"].includes(t)},removable:{type:Boolean,default:!1}},emits:["remove"],setup(t){const l=t,o=e.computed(()=>["chip",`chip--${l.variant}`]);return(a,n)=>{const r=e.resolveComponent("Icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(o.value)},[e.renderSlot(a.$slots,"default",{},void 0,!0),t.removable?(e.openBlock(),e.createElementBlock("button",{key:0,class:"remove-btn",onClick:n[0]||(n[0]=e.withModifiers(i=>a.$emit("remove"),["stop"])),"aria-label":"Remove"},[e.createVNode(r,{name:"close",size:"14","stroke-width":"2.5"})])):e.createCommentVNode("",!0)],2)}}},[["__scopeId","data-v-6b6b7ae9"]]),N=m(e.defineComponent({__name:"Column",props:{cols:{type:[String,Number],default:null},xs:{type:[String,Number],default:null},sm:{type:[String,Number],default:null},md:{type:[String,Number],default:null},lg:{type:[String,Number],default:null},xl:{type:[String,Number],default:null}},setup(t){const l=t,o=e.computed(()=>{const a=["col"],n={cols:"col-",xs:"col-xs-",sm:"col-sm-",md:"col-md-",lg:"col-lg-",xl:"col-xl-"};for(const r in n)l[r]&&a.push(`${n[r]}${l[r]}`);return a});return(a,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(o.value)},[e.renderSlot(a.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-a5db8165"]]),b=m({__name:"Icon",props:{icon:{type:String,required:!1},size:{type:[String,Number],default:24},color:{type:String,default:null}},setup(t){const l=t,o={"x-small":12,small:16,medium:24,large:32,"x-large":40},a=e.computed(()=>l.icon?["icon","mdi",l.icon]:["icon"]),n=e.computed(()=>{let r=l.size;typeof l.size=="string"&&o[l.size]&&(r=o[l.size]);const i={fontSize:`${r}px`};return l.color&&(i.color=l.color),i});return(r,i)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass(a.value),style:e.normalizeStyle(n.value),"aria-hidden":"true"},null,6))}},[["__scopeId","data-v-4a07735a"]]),K=["for"],J={key:0,class:"date-picker__required"},Q={class:"date-picker__input-wrapper"},Z=["id","value","disabled","readonly","min","max","required"],v={key:1,class:"date-picker__error"},ee={key:2,class:"date-picker__help"},E=m(e.defineComponent({__name:"DatePicker",props:{modelValue:{default:""},label:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},min:{},max:{},errorMessage:{},helpText:{},size:{default:"medium"},variant:{default:"default"},showIcon:{type:Boolean,default:!0}},emits:["update:modelValue","change","blur","focus"],setup(t,{emit:l}){const o=t,a=l,n=e.computed(()=>`date-picker-${Math.random().toString(36).substr(2,9)}`),r=e.computed(()=>["date-picker",`date-picker--${o.size}`,`date-picker--${o.variant}`,{"date-picker--disabled":o.disabled,"date-picker--readonly":o.readonly,"date-picker--error":o.errorMessage,"date-picker--required":o.required}]),i=e.computed(()=>["date-picker__input",{"date-picker__input--with-icon":o.showIcon}]),d=p=>{const k=p.target;a("update:modelValue",k.value)},c=p=>{const k=p.target;a("change",k.value)},f=p=>{a("blur",p)},y=p=>{a("focus",p)};return(p,k)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["date-picker",r.value])},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:n.value,class:"date-picker__label"},[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",J,"*")):e.createCommentVNode("",!0)],8,K)):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[e.createElementVNode("input",{id:n.value,type:"date",value:t.modelValue,disabled:t.disabled,readonly:t.readonly,min:t.min,max:t.max,required:t.required,class:e.normalizeClass(i.value),onInput:d,onChange:c,onBlur:f,onFocus:y},null,42,Z),t.showIcon?(e.openBlock(),e.createBlock(b,{key:0,icon:"mdi-calendar",class:"date-picker__icon"})):e.createCommentVNode("",!0)]),t.errorMessage?(e.openBlock(),e.createElementBlock("div",v,e.toDisplayString(t.errorMessage),1)):e.createCommentVNode("",!0),t.helpText&&!t.errorMessage?(e.openBlock(),e.createElementBlock("div",ee,e.toDisplayString(t.helpText),1)):e.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-f09e8bb1"]]),te=["aria-labelledby"],oe={key:0,class:"dialog-header"},le={id:"dialog-title",class:"dialog-title"},I=m({__name:"Dialog",props:{modelValue:{type:Boolean,required:!0},title:{type:String,default:""},persistent:{type:Boolean,default:!1},scrollable:{type:Boolean,default:!1},size:{type:String,default:"md"},width:{type:[String,Number],default:null},okOnly:{type:Boolean,default:!1}},emits:["update:modelValue","ok"],setup(t,{emit:l}){const o=t,a=l,n=()=>{a("update:modelValue",!1)},r=()=>{o.persistent||n()},i=e.computed(()=>o.width?"":`dialog-content--${o.size}`),d=e.computed(()=>{const c={};return o.width&&(c.maxWidth=typeof o.width=="number"||!isNaN(Number(o.width))?`${o.width}px`:o.width,c.width=c.maxWidth),c});return e.watch(()=>o.modelValue,c=>{typeof document<"u"&&(document.body.style.overflow=c?"hidden":"")}),e.onUnmounted(()=>{typeof document<"u"&&(document.body.style.overflow="")}),(c,f)=>{const y=e.resolveComponent("Icon");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"dialog-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dialog-overlay",onClick:r},[e.createElementVNode("div",{class:e.normalizeClass(["dialog-content",i.value]),style:e.normalizeStyle(d.value),role:"dialog","aria-modal":"true","aria-labelledby":t.title?"dialog-title":void 0,onClick:f[0]||(f[0]=e.withModifiers(()=>{},["stop"]))},[t.title?(e.openBlock(),e.createElementBlock("header",oe,[e.createElementVNode("h2",le,e.toDisplayString(t.title),1),e.createElementVNode("button",{onClick:n,class:"dialog-close-btn","aria-label":"Close dialog"},[e.createVNode(y,{icon:"mdi-close",size:"24"})])])):e.createCommentVNode("",!0),e.createElementVNode("main",{class:e.normalizeClass(["dialog-body",{scrollable:t.scrollable}])},[e.renderSlot(c.$slots,"default",{},void 0,!0)],2)],14,te)])):e.createCommentVNode("",!0)]),_:3})])}}},[["__scopeId","data-v-b9e605dc"]]),z=m({__name:"Divider",props:{vertical:{type:Boolean,default:!1},height:{type:[String,Number],default:1}},setup(t){const l=t,o=e.computed(()=>["divider",l.vertical?"divider--vertical":"divider--horizontal"]),a=e.computed(()=>l.vertical?{}:{height:`${l.height}px`});return(n,r)=>(e.openBlock(),e.createElementBlock("hr",{class:e.normalizeClass(o.value),style:e.normalizeStyle(a.value)},null,6))}},[["__scopeId","data-v-cbf66f89"]]),ae={class:"spinner-container"},S=m({__name:"ProgressSpinner",setup(t){return(l,o)=>(e.openBlock(),e.createElementBlock("div",ae,[...o[0]||(o[0]=[e.createElementVNode("div",{class:"spinner"},null,-1)])]))}},[["__scopeId","data-v-69bc6c98"]]),ne={key:0,class:"placeholder"},re=["src","alt"],T=m({__name:"Image",props:{src:{type:String,required:!0},alt:{type:String,required:!1},width:{type:String,default:"100%"},height:{type:String,default:"auto"},maxHeight:{type:String,default:void 0},fit:{type:String,default:"cover"}},setup(t){const l=t,o=e.ref(!0),a=e.ref(!1),n=()=>{o.value=!1,a.value=!1},r=()=>{o.value=!1,a.value=!0};e.watch(()=>l.src,()=>{o.value=!0,a.value=!1},{immediate:!0});const i=e.computed(()=>({width:l.width,height:l.height,minWidth:l.width,minHeight:l.height,maxHeight:l.maxHeight}));return(d,c)=>{const f=e.resolveComponent("Icon");return e.openBlock(),e.createElementBlock("div",{class:"image-container",style:e.normalizeStyle(i.value)},[o.value||a.value?(e.openBlock(),e.createElementBlock("div",ne,[o.value?(e.openBlock(),e.createBlock(S,{key:0})):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(f,{key:1,name:"image-off",size:48})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("img",{src:t.src,alt:t.alt,class:"image",style:e.normalizeStyle({objectFit:t.fit,maxHeight:t.maxHeight}),onLoad:n,onError:r},null,44,re),[[e.vShow,!o.value&&!a.value]])],4)}}},[["__scopeId","data-v-a3997b8b"]]),ie=["src"],se={key:0,class:"slideshow-text-content"},ce={key:0,class:"slideshow-title"},de=["innerHTML"],D=m({__name:"ImageSlideShow",props:{modelValue:{type:Boolean,required:!0},images:{type:Array,required:!0},startIndex:{type:Number,default:0},name:{type:String,default:""},description:{type:String,default:""},baseUrl:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,a=l,n=e.ref(0),r=e.ref(0),i=e.ref(o.startIndex);e.watch(()=>o.modelValue,u=>{u?(i.value=o.startIndex,window.addEventListener("keydown",p),document.body.style.overflow="hidden"):(window.removeEventListener("keydown",p),document.body.style.overflow="")});const d=e.computed(()=>{if(!o.images||o.images.length===0)return"";const u=o.images[i.value];return`${o.baseUrl}${u}.jpg`}),c=()=>{a("update:modelValue",!1)},f=()=>{i.value=(i.value+1)%o.images.length},y=()=>{i.value=(i.value-1+o.images.length)%o.images.length},p=u=>{u.key==="Escape"&&c(),u.key==="ArrowRight"&&f(),u.key==="ArrowLeft"&&y()},k=u=>{n.value=u.touches[0].clientX,r.value=u.touches[0].clientY},w=u=>{const h=u.changedTouches[0].clientX,B=u.changedTouches[0].clientY,_=h-n.value,Le=B-r.value;Math.abs(_)>Math.abs(Le)&&(_>50?y():_<-50&&f())};return e.onUnmounted(()=>{window.removeEventListener("keydown",p),document.body.style.overflow=""}),(u,h)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"slideshow-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:"slideshow-overlay",onClick:e.withModifiers(c,["self"])},[e.createElementVNode("button",{class:"slideshow-close-btn",onClick:e.withModifiers(c,["stop"]),"aria-label":"Close slideshow"},[e.createVNode(b,{icon:"mdi-close",size:"48"})]),e.createElementVNode("div",{class:"slideshow-content",onTouchstartPassive:k,onTouchendPassive:w},[e.createElementVNode("button",{class:"slideshow-nav-btn prev",onClick:e.withModifiers(y,["stop"]),"aria-label":"Previous image",style:{fontSize:"48px"}},[e.createVNode(b,{icon:"mdi-chevron-left",size:"80"})]),e.createElementVNode("img",{src:d.value,class:"slideshow-image",alt:"Slideshow image"},null,8,ie),e.createElementVNode("button",{class:"slideshow-nav-btn next",onClick:e.withModifiers(f,["stop"]),"aria-label":"Next image",style:{fontSize:"48px"}},[e.createVNode(b,{icon:"mdi-chevron-right",size:"80"})]),t.name||t.description?(e.openBlock(),e.createElementBlock("div",se,[t.name?(e.openBlock(),e.createElementBlock("h3",ce,e.toDisplayString(t.name),1)):e.createCommentVNode("",!0),t.description?(e.openBlock(),e.createElementBlock("div",{key:1,class:"slideshow-description",innerHTML:t.description},null,8,de)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],32)])):e.createCommentVNode("",!0)]),_:1})]))}},[["__scopeId","data-v-ff74117f"]]),me=["for"],ue={class:"input-container"},fe=["id","type","value","placeholder","disabled"],M=m({__name:"Input",props:{modelValue:{type:[String,Number],default:""},label:{type:String,default:""},placeholder:{type:String,default:""},type:{type:String,default:"text"},disabled:{type:Boolean,default:!1},id:{type:String,default:()=>`input-${Math.random().toString(36).substring(2,9)}`},class:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,a=l,n=r=>{a("update:modelValue",r.target.value)};return(r,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["input-wrapper",o.class])},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.id,class:"input-label"},e.toDisplayString(t.label),9,me)):e.createCommentVNode("",!0),e.createElementVNode("div",ue,[e.createElementVNode("input",{id:t.id,type:t.type,value:t.modelValue,onInput:n,placeholder:t.placeholder,disabled:t.disabled,class:"input-field"},null,40,fe)])],2))}},[["__scopeId","data-v-9c7a100f"]]),q=m({__name:"NavigationDrawer",props:{modelValue:{type:Boolean,required:!0},location:{type:String,default:"left",validator:t=>["left","right"].includes(t)},width:{type:[String,Number],default:300}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,a=l,n=()=>{a("update:modelValue",!1)},r=e.computed(()=>["navigation-drawer",`navigation-drawer--${o.location}`]),i=e.computed(()=>({width:`${o.width}px`})),d=e.computed(()=>`slide-from-${o.location}`);return e.watch(()=>o.modelValue,c=>{typeof document<"u"&&(c?document.body.style.overflow="hidden":document.body.style.overflow="")}),e.onUnmounted(()=>{typeof document<"u"&&(document.body.style.overflow="")}),(c,f)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:"overlay",onClick:n,"aria-hidden":"true"})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:d.value},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("aside",{key:0,class:e.normalizeClass(r.value),style:e.normalizeStyle(i.value),role:"dialog","aria-modal":"true"},[e.renderSlot(c.$slots,"default",{},void 0,!0)],6)):e.createCommentVNode("",!0)]),_:3},8,["name"])]))}},[["__scopeId","data-v-a13e59a5"]]),pe=["aria-valuenow"],ye=["width","height","viewBox"],he=["cx","cy","r","stroke-width"],ge=["cx","cy","r","stroke-width","stroke-dasharray","stroke-dashoffset"],ke={key:0,class:"progress-circular__content"},g=44,P=m({__name:"Progress",props:{modelValue:{type:[Number,String],default:0},size:{type:[Number,String],default:60},width:{type:[Number,String],default:10},color:{type:String,default:"primary"},indeterminate:{type:Boolean,default:!1}},setup(t){const l=t,o=e.computed(()=>(g-l.width)/2),a=e.computed(()=>2*Math.PI*o.value),n=e.computed(()=>({width:`${l.size}px`,height:`${l.size}px`,color:l.color==="primary"?"#3C9273":l.color})),r=e.computed(()=>l.width/l.size*g),i=e.computed(()=>l.indeterminate?null:a.value*(1-l.modelValue/100));return(d,c)=>(e.openBlock(),e.createElementBlock("div",{class:"progress-circular",style:e.normalizeStyle(n.value),role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":t.indeterminate?void 0:t.modelValue},[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:t.size,height:t.size,viewBox:`0 0 ${g} ${g}`},[e.createElementVNode("circle",{class:"progress-circular__underlay",fill:"transparent",cx:g/2,cy:g/2,r:o.value,"stroke-width":r.value},null,8,he),e.createElementVNode("circle",{class:"progress-circular__overlay",fill:"transparent",cx:g/2,cy:g/2,r:o.value,"stroke-width":r.value,"stroke-dasharray":a.value,"stroke-dashoffset":i.value},null,8,ge)],8,ye)),d.$slots.default?(e.openBlock(),e.createElementBlock("div",ke,[e.renderSlot(d.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0)],12,pe))}},[["__scopeId","data-v-bdb14b7f"]]),A=m({__name:"Row",props:{justify:{type:String,default:"flex-start"},align:{type:String,default:"stretch"},gap:{type:String,default:"0"},wrap:{type:Boolean,default:!0}},setup(t){const l=t,o=e.computed(()=>({justifyContent:l.justify,alignItems:l.align,gap:l.gap,flexWrap:l.wrap?"wrap":"nowrap"}));return(a,n)=>(e.openBlock(),e.createElementBlock("div",{class:"flex-row",style:e.normalizeStyle(o.value)},[e.renderSlot(a.$slots,"default",{},void 0,!0)],4))}},[["__scopeId","data-v-fc69ad3e"]]),be=["for"],Be={class:"select-container"},_e=["id","value","disabled","multiple"],Se=["selected"],we=["value"],Ve={key:0,class:"select-icon","aria-hidden":"true"},L=m({__name:"Select",props:{modelValue:{type:[String,Number,Array],default:""},options:{type:Array,required:!0},label:{type:String,default:""},placeholder:{type:String,default:"Select an option"},disabled:{type:Boolean,default:!1},id:{type:String,default:()=>`select-${Math.random().toString(36).substring(2,9)}`},multiple:{type:Boolean,default:!1},hideArrow:{type:Boolean,default:!1},class:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,a=l;e.computed(()=>!o.options||o.options.length===0?[]:typeof o.options[0]=="string"?o.options.map(r=>({text:r,value:r})):o.options);const n=r=>{if(o.multiple){const i=Array.from(r.target.selectedOptions).map(d=>d.value);a("update:modelValue",i)}else a("update:modelValue",r.target.value)};return(r,i)=>{const d=e.resolveComponent("Icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["select-wrapper",o.class])},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.id,class:"select-label"},e.toDisplayString(t.label),9,be)):e.createCommentVNode("",!0),e.createElementVNode("div",Be,[e.createElementVNode("select",{id:t.id,value:t.modelValue,onChange:n,disabled:t.disabled,multiple:t.multiple,class:e.normalizeClass([{"no-arrow":t.hideArrow},"select-input"])},[t.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:"",disabled:"",selected:!t.modelValue},e.toDisplayString(t.placeholder),9,Se)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,c=>(e.openBlock(),e.createElementBlock("option",{key:c.value,value:c.value},e.toDisplayString(c.text),9,we))),128))],42,_e),t.hideArrow?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ve,[e.createVNode(d,{icon:"mdi-chevron-down",size:"20"})]))])],2)}}},[["__scopeId","data-v-d4f9136e"]]),$e={class:"spacer"},F=m({__name:"Spacer",setup(t){return(l,o)=>(e.openBlock(),e.createElementBlock("div",$e))}},[["__scopeId","data-v-370a82d1"]]),xe={class:"textarea-wrapper"},Ce=["for"],Ne=["id","value","placeholder","rows","maxlength"],Ee={key:1,class:"error-message"},O=m({__name:"TextArea",props:{id:{type:String,required:!1},label:{type:String,default:""},modelValue:{type:String,default:""},placeholder:{type:String,default:""},rows:{type:[String,Number],default:3},maxlength:{type:[String,Number],default:null},error:{type:String,default:""}},emits:["update:modelValue"],setup(t){return(l,o)=>(e.openBlock(),e.createElementBlock("div",xe,[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.id,class:"textarea-label"},e.toDisplayString(t.label),9,Ce)):e.createCommentVNode("",!0),e.createElementVNode("textarea",{id:t.id,value:t.modelValue,placeholder:t.placeholder,rows:t.rows,maxlength:t.maxlength,onInput:o[0]||(o[0]=a=>l.$emit("update:modelValue",a.target.value)),class:e.normalizeClass(["textarea-input",{"has-error":t.error}])},null,42,Ne),t.error?(e.openBlock(),e.createElementBlock("p",Ee,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-a2a785c2"]]);class Ie{static newGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(l){const o=Math.random()*16|0;return(l=="x"?o:o&3|8).toString(16)})}static isValidGuid(){const l=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;return function(o){return o&&l.test(o)}}static isEmptyGuid(l){return l==="00000000-0000-0000-0000-000000000000"}static emptyGuid(){return"00000000-0000-0000-0000-000000000000"}}const ze={class:"input-container"},Te=["id","type","value","autocomplete","maxlength"],De=["for"],Me={class:"error-container"},j=m(e.defineComponent({__name:"TextField",props:{id:{type:String,default:()=>`textfield-${Ie.newGuid()}`},label:{type:String,default:""},modelValue:{type:[String,Number],default:""},rules:{type:Array,default:()=>[]},type:{type:String,default:"text"},trim:{type:Boolean,default:!1},placeholder:{type:String,default:""},autocomplete:{type:String,default:"off"},maxlength:{type:[String,Number],default:void 0}},emits:["update:modelValue"],setup(t,{expose:l,emit:o}){const a=t,n=o,r=e.ref([]),i=e.ref(!0),d=e.inject("form",null),c=e.getCurrentInstance(),f=async()=>{r.value=[];let u=!0;for(const h of a.rules){const B=h(a.modelValue);B!==!0&&(u=!1,r.value.push(B))}return{valid:u,errors:r.value}},y=()=>{n("update:modelValue",""),p()},p=()=>{r.value=[],i.value=!0},k=u=>{const h=u.target;n("update:modelValue",h.value),i.value||f()},w=()=>{i.value=!1,a.trim&&typeof a.modelValue=="string"&&n("update:modelValue",a.modelValue.trim()),f()};return e.onMounted(()=>{d&&c&&d.register({id:a.id,validate:f,reset:y,resetValidation:p})}),e.onUnmounted(()=>{d&&c&&d.unregister({id:a.id})}),l({validate:f,reset:y,resetValidation:p,id:a.id,errors:r}),(u,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-field-wrapper",{"has-value":t.modelValue}])},[e.createElementVNode("div",ze,[e.createElementVNode("input",{id:t.id,type:t.type,value:t.modelValue,placeholder:" ",onInput:k,onBlur:w,class:"text-field-input",autocomplete:t.autocomplete,maxlength:t.maxlength},null,40,Te),t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.id,class:"text-field-label"},e.toDisplayString(t.placeholder?t.placeholder:t.label),9,De)):e.createCommentVNode("",!0),e.createElementVNode("fieldset",{"aria-hidden":"true",class:e.normalizeClass(["text-field-fieldset",{"has-error":r.value.length>0}])},[...h[0]||(h[0]=[e.createElementVNode("legend",{class:"text-field-legend"},null,-1)])],2)]),e.createElementVNode("div",Me,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(B,_)=>(e.openBlock(),e.createElementBlock("p",{key:_,class:"error-message"},e.toDisplayString(B),1))),128))])],2))}}),[["__scopeId","data-v-02dabc6c"]]),qe=["aria-label"],Pe={class:"tooltip-content"},R=m({__name:"Tooltip",props:{text:{type:String,required:!0},location:{type:String,default:"top",validator:t=>["top","bottom","left","right"].includes(t)},disabled:{type:Boolean,default:!1}},setup(t){const l=t,o=e.ref(!1),a=()=>{l.disabled||(o.value=!0)},n=()=>{o.value=!1},r=e.computed(()=>["tooltip",`tooltip--${l.location}`]);return(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:"tooltip-container",onMouseenter:a,onMouseleave:n,onFocusin:a,onFocusout:n,role:"tooltip","aria-label":t.text},[e.renderSlot(i.$slots,"default",{},void 0,!0),e.createVNode(e.Transition,{name:"tooltip-fade"},{default:e.withCtx(()=>[o.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(r.value)},[e.createElementVNode("div",Pe,e.toDisplayString(t.text),1),d[0]||(d[0]=e.createElementVNode("div",{class:"tooltip-arrow"},null,-1))],2)):e.createCommentVNode("",!0)]),_:1})],40,qe))}},[["__scopeId","data-v-a7533144"]]),U=m({__name:"Overlay",props:{modelValue:{type:Boolean,default:!1},contained:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:l}){const o=t,a=l;function n(){a("update:modelValue",!1)}return e.watch(()=>o.modelValue,r=>{!o.contained&&typeof document<"u"&&(document.body.style.overflow=r?"hidden":"")}),(r,i)=>(e.openBlock(),e.createBlock(e.Transition,{name:"overlay-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["overlay",{"overlay--contained":t.contained}]),onClick:e.withModifiers(n,["self"])},[e.renderSlot(r.$slots,"default",{},void 0,!0)],2)):e.createCommentVNode("",!0)]),_:3}))}},[["__scopeId","data-v-11b69f56"]]),H=t=>{t.component("Avatar",V),t.component("Button",$),t.component("Card",x),t.component("Chip",C),t.component("Column",N),t.component("DatePicker",E),t.component("Dialog",I),t.component("Divider",z),t.component("Icon",b),t.component("Overlay",U),t.component("Image",T),t.component("ImageSlideShow",D),t.component("Input",M),t.component("NavigationDrawer",q),t.component("Progress",P),t.component("ProgressSpinner",S),t.component("Row",A),t.component("Select",L),t.component("Spacer",F),t.component("TextArea",O),t.component("TextField",j),t.component("Tooltip",R)},Ae={install:H};s.Avatar=V,s.Button=$,s.Card=x,s.Chip=C,s.Column=N,s.DatePicker=E,s.Dialog=I,s.Divider=z,s.Icon=b,s.Image=T,s.ImageSlideShow=D,s.Input=M,s.NavigationDrawer=q,s.Overlay=U,s.Progress=P,s.ProgressSpinner=S,s.Row=A,s.Select=L,s.Spacer=F,s.TextArea=O,s.TextField=j,s.Tooltip=R,s.default=Ae,s.install=H,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(i,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(i=typeof globalThis<"u"?globalThis:i||self,e(i.TreqitUiLibrary={},i.Vue))})(this,(function(i,e){"use strict";const d=(t,l)=>{const a=t.__vccOpts||t;for(const[o,n]of l)a[o]=n;return a},G={key:0,class:"avatar-initials"},S=d({__name:"Avatar",props:{size:{type:[String,Number],default:48},rounded:{type:[String,Number,Boolean],default:!0},color:{type:String,default:"var(--treqit-gray-300)"},initials:{type:String,default:null}},setup(t){const l=t,a=e.computed(()=>["avatar",{"avatar--rounded-sm":l.rounded==="sm","avatar--rounded-lg":l.rounded==="lg"}]),o=e.computed(()=>{const n={width:`${l.size}px`,height:`${l.size}px`,backgroundColor:l.color};return l.rounded===!0||l.rounded===""?n.borderRadius="50%":l.rounded===!1||l.rounded===0||l.rounded==="0"?n.borderRadius="0px":typeof l.rounded=="number"&&(n.borderRadius=`${l.rounded}px`),n});return(n,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(a.value),style:e.normalizeStyle(o.value)},[e.renderSlot(n.$slots,"default",{},()=>[t.initials?(e.openBlock(),e.createElementBlock("span",G,e.toDisplayString(t.initials),1)):e.createCommentVNode("",!0)],!0)],6))}},[["__scopeId","data-v-2e02a766"]]),H=["type","disabled"],L={key:0,class:"btn-loader"},$=d({__name:"Button",props:{variant:{type:String,default:"primary",validator:t=>["primary","secondary","destructive","flat","elevated","text","outlined","outlined-primary","outlined-secondary","rounded"].includes(t)},size:{type:String,default:"medium",validator:t=>["sm","small","medium","large","x-large"].includes(t)},type:{type:String,default:"button"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},full:{type:Boolean,default:!1}},emits:["click"],setup(t){const l=t,a=e.computed(()=>["btn",`btn--${l.variant}`,`btn--${l.size==="sm"?"small":l.size}`,{"btn--loading":l.loading,"btn--full":l.full}]);return(o,n)=>(e.openBlock(),e.createElementBlock("button",{type:t.type,class:e.normalizeClass(a.value),disabled:t.disabled||t.loading,onClick:n[0]||(n[0]=r=>o.$emit("click"))},[t.loading?(e.openBlock(),e.createElementBlock("div",L,[...n[1]||(n[1]=[e.createElementVNode("div",{class:"simple-spinner"},null,-1)])])):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass(["btn-content",{"content-hidden":t.loading}])},[e.renderSlot(o.$slots,"default",{},void 0,!0)],2)],10,H))}},[["__scopeId","data-v-8db92d47"]]),U={class:"card"},V=d({__name:"Card",setup(t){return(l,a)=>(e.openBlock(),e.createElementBlock("div",U,[e.renderSlot(l.$slots,"default",{},void 0,!0)]))}},[["__scopeId","data-v-09430cb2"]]),x=d({__name:"Chip",props:{variant:{type:String,default:"secondary",validator:t=>["primary","secondary","success","warning","danger"].includes(t)},removable:{type:Boolean,default:!1}},emits:["remove"],setup(t){const l=t,a=e.computed(()=>["chip",`chip--${l.variant}`]);return(o,n)=>{const r=e.resolveComponent("Icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(a.value)},[e.renderSlot(o.$slots,"default",{},void 0,!0),t.removable?(e.openBlock(),e.createElementBlock("button",{key:0,class:"remove-btn",onClick:n[0]||(n[0]=e.withModifiers(s=>o.$emit("remove"),["stop"])),"aria-label":"Remove"},[e.createVNode(r,{name:"close",size:"14","stroke-width":"2.5"})])):e.createCommentVNode("",!0)],2)}}},[["__scopeId","data-v-6b6b7ae9"]]),w=d(e.defineComponent({__name:"Column",props:{cols:{type:[String,Number],default:null},xs:{type:[String,Number],default:null},sm:{type:[String,Number],default:null},md:{type:[String,Number],default:null},lg:{type:[String,Number],default:null},xl:{type:[String,Number],default:null}},setup(t){const l=t,a=e.computed(()=>{const o=["col"],n={cols:"col-",xs:"col-xs-",sm:"col-sm-",md:"col-md-",lg:"col-lg-",xl:"col-xl-"};for(const r in n)l[r]&&o.push(`${n[r]}${l[r]}`);return o});return(o,n)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(a.value)},[e.renderSlot(o.$slots,"default",{},void 0,!0)],2))}}),[["__scopeId","data-v-a5db8165"]]),_=d({__name:"Icon",props:{icon:{type:String,required:!1},size:{type:[String,Number],default:24},color:{type:String,default:null}},setup(t){const l=t,a={"x-small":12,small:16,medium:24,large:32,"x-large":40},o=e.computed(()=>l.icon?["icon","mdi",l.icon]:["icon"]),n=e.computed(()=>{let r=l.size;typeof l.size=="string"&&a[l.size]&&(r=a[l.size]);const s={fontSize:`${r}px`};return l.color&&(s.color=l.color),s});return(r,s)=>(e.openBlock(),e.createElementBlock("i",{class:e.normalizeClass(o.value),style:e.normalizeStyle(n.value),"aria-hidden":"true"},null,6))}},[["__scopeId","data-v-4a07735a"]]),W=["for"],X={key:0,class:"date-picker__required"},J={class:"date-picker__input-wrapper"},K=["id","value","disabled","readonly","min","max","required"],Q={key:1,class:"date-picker__error"},Y={key:2,class:"date-picker__help"},C=d(e.defineComponent({__name:"DatePicker",props:{modelValue:{default:""},label:{},placeholder:{},disabled:{type:Boolean},readonly:{type:Boolean},required:{type:Boolean},min:{},max:{},errorMessage:{},helpText:{},size:{default:"medium"},variant:{default:"default"},showIcon:{type:Boolean,default:!0}},emits:["update:modelValue","change","blur","focus"],setup(t,{emit:l}){const a=t,o=l,n=e.computed(()=>`date-picker-${Math.random().toString(36).substr(2,9)}`),r=e.computed(()=>["date-picker",`date-picker--${a.size}`,`date-picker--${a.variant}`,{"date-picker--disabled":a.disabled,"date-picker--readonly":a.readonly,"date-picker--error":a.errorMessage,"date-picker--required":a.required}]),s=e.computed(()=>["date-picker__input",{"date-picker__input--with-icon":a.showIcon}]),m=f=>{const g=f.target;o("update:modelValue",g.value)},c=f=>{const g=f.target;o("change",g.value)},u=f=>{o("blur",f)},y=f=>{o("focus",f)};return(f,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["date-picker",r.value])},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:n.value,class:"date-picker__label"},[e.createTextVNode(e.toDisplayString(t.label)+" ",1),t.required?(e.openBlock(),e.createElementBlock("span",X,"*")):e.createCommentVNode("",!0)],8,W)):e.createCommentVNode("",!0),e.createElementVNode("div",J,[e.createElementVNode("input",{id:n.value,type:"date",value:t.modelValue,disabled:t.disabled,readonly:t.readonly,min:t.min,max:t.max,required:t.required,class:e.normalizeClass(s.value),onInput:m,onChange:c,onBlur:u,onFocus:y},null,42,K),t.showIcon?(e.openBlock(),e.createBlock(_,{key:0,icon:"mdi-calendar",class:"date-picker__icon"})):e.createCommentVNode("",!0)]),t.errorMessage?(e.openBlock(),e.createElementBlock("div",Q,e.toDisplayString(t.errorMessage),1)):e.createCommentVNode("",!0),t.helpText&&!t.errorMessage?(e.openBlock(),e.createElementBlock("div",Y,e.toDisplayString(t.helpText),1)):e.createCommentVNode("",!0)],2))}}),[["__scopeId","data-v-f09e8bb1"]]),Z=["aria-labelledby"],v={key:0,class:"dialog-header"},ee={id:"dialog-title",class:"dialog-title"},N=d({__name:"Dialog",props:{modelValue:{type:Boolean,required:!0},title:{type:String,default:""},persistent:{type:Boolean,default:!1},scrollable:{type:Boolean,default:!1},size:{type:String,default:"md"},width:{type:[String,Number],default:null},okOnly:{type:Boolean,default:!1}},emits:["update:modelValue","ok"],setup(t,{emit:l}){const a=t,o=l,n=()=>{o("update:modelValue",!1)},r=()=>{a.persistent||n()},s=e.computed(()=>a.width?"":`dialog-content--${a.size}`),m=e.computed(()=>{const c={};return a.width&&(c.maxWidth=typeof a.width=="number"||!isNaN(Number(a.width))?`${a.width}px`:a.width,c.width=c.maxWidth),c});return e.watch(()=>a.modelValue,c=>{typeof document<"u"&&(document.body.style.overflow=c?"hidden":"")}),e.onUnmounted(()=>{typeof document<"u"&&(document.body.style.overflow="")}),(c,u)=>{const y=e.resolveComponent("Icon");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"dialog-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dialog-overlay",onClick:r},[e.createElementVNode("div",{class:e.normalizeClass(["dialog-content",s.value]),style:e.normalizeStyle(m.value),role:"dialog","aria-modal":"true","aria-labelledby":t.title?"dialog-title":void 0,onClick:u[0]||(u[0]=e.withModifiers(()=>{},["stop"]))},[t.title?(e.openBlock(),e.createElementBlock("header",v,[e.createElementVNode("h2",ee,e.toDisplayString(t.title),1),e.createElementVNode("button",{onClick:n,class:"dialog-close-btn","aria-label":"Close dialog"},[e.createVNode(y,{icon:"mdi-close",size:"24"})])])):e.createCommentVNode("",!0),e.createElementVNode("main",{class:e.normalizeClass(["dialog-body",{scrollable:t.scrollable}])},[e.renderSlot(c.$slots,"default",{},void 0,!0)],2)],14,Z)])):e.createCommentVNode("",!0)]),_:3})])}}},[["__scopeId","data-v-b9e605dc"]]),E=d({__name:"Divider",props:{vertical:{type:Boolean,default:!1},height:{type:[String,Number],default:1}},setup(t){const l=t,a=e.computed(()=>["divider",l.vertical?"divider--vertical":"divider--horizontal"]),o=e.computed(()=>l.vertical?{}:{height:`${l.height}px`});return(n,r)=>(e.openBlock(),e.createElementBlock("hr",{class:e.normalizeClass(a.value),style:e.normalizeStyle(o.value)},null,6))}},[["__scopeId","data-v-cbf66f89"]]),te={class:"spinner-container"},B=d({__name:"ProgressSpinner",setup(t){return(l,a)=>(e.openBlock(),e.createElementBlock("div",te,[...a[0]||(a[0]=[e.createElementVNode("div",{class:"spinner"},null,-1)])]))}},[["__scopeId","data-v-69bc6c98"]]),le={key:0,class:"placeholder"},ae=["src","alt"],z=d({__name:"Image",props:{src:{type:String,required:!0},alt:{type:String,required:!1},width:{type:String,default:"100%"},height:{type:String,default:"auto"},maxHeight:{type:String,default:void 0},fit:{type:String,default:"cover"}},setup(t){const l=t,a=e.ref(!0),o=e.ref(!1),n=()=>{a.value=!1,o.value=!1},r=()=>{a.value=!1,o.value=!0};e.watch(()=>l.src,()=>{a.value=!0,o.value=!1},{immediate:!0});const s=e.computed(()=>({width:l.width,height:l.height,minWidth:l.width,minHeight:l.height,maxHeight:l.maxHeight}));return(m,c)=>{const u=e.resolveComponent("Icon");return e.openBlock(),e.createElementBlock("div",{class:"image-container",style:e.normalizeStyle(s.value)},[a.value||o.value?(e.openBlock(),e.createElementBlock("div",le,[a.value?(e.openBlock(),e.createBlock(B,{key:0})):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createBlock(u,{key:1,name:"image-off",size:48})):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("img",{src:t.src,alt:t.alt,class:"image",style:e.normalizeStyle({objectFit:t.fit,maxHeight:t.maxHeight}),onLoad:n,onError:r},null,44,ae),[[e.vShow,!a.value&&!o.value]])],4)}}},[["__scopeId","data-v-a3997b8b"]]),oe=["for"],ne={class:"input-container"},re=["id","type","value","placeholder","disabled"],I=d({__name:"Input",props:{modelValue:{type:[String,Number],default:""},label:{type:String,default:""},placeholder:{type:String,default:""},type:{type:String,default:"text"},disabled:{type:Boolean,default:!1},id:{type:String,default:()=>`input-${Math.random().toString(36).substring(2,9)}`},class:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:l}){const a=t,o=l,n=r=>{o("update:modelValue",r.target.value)};return(r,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["input-wrapper",a.class])},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.id,class:"input-label"},e.toDisplayString(t.label),9,oe)):e.createCommentVNode("",!0),e.createElementVNode("div",ne,[e.createElementVNode("input",{id:t.id,type:t.type,value:t.modelValue,onInput:n,placeholder:t.placeholder,disabled:t.disabled,class:"input-field"},null,40,re)])],2))}},[["__scopeId","data-v-9c7a100f"]]),D=d({__name:"NavigationDrawer",props:{modelValue:{type:Boolean,required:!0},location:{type:String,default:"left",validator:t=>["left","right"].includes(t)},width:{type:[String,Number],default:300}},emits:["update:modelValue"],setup(t,{emit:l}){const a=t,o=l,n=()=>{o("update:modelValue",!1)},r=e.computed(()=>["navigation-drawer",`navigation-drawer--${a.location}`]),s=e.computed(()=>({width:`${a.width}px`})),m=e.computed(()=>`slide-from-${a.location}`);return e.watch(()=>a.modelValue,c=>{typeof document<"u"&&(c?document.body.style.overflow="hidden":document.body.style.overflow="")}),e.onUnmounted(()=>{typeof document<"u"&&(document.body.style.overflow="")}),(c,u)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:"overlay",onClick:n,"aria-hidden":"true"})):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:m.value},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("aside",{key:0,class:e.normalizeClass(r.value),style:e.normalizeStyle(s.value),role:"dialog","aria-modal":"true"},[e.renderSlot(c.$slots,"default",{},void 0,!0)],6)):e.createCommentVNode("",!0)]),_:3},8,["name"])]))}},[["__scopeId","data-v-a13e59a5"]]),ie=["aria-valuenow"],se=["width","height","viewBox"],ce=["cx","cy","r","stroke-width"],de=["cx","cy","r","stroke-width","stroke-dasharray","stroke-dashoffset"],me={key:0,class:"progress-circular__content"},p=44,T=d({__name:"Progress",props:{modelValue:{type:[Number,String],default:0},size:{type:[Number,String],default:60},width:{type:[Number,String],default:10},color:{type:String,default:"primary"},indeterminate:{type:Boolean,default:!1}},setup(t){const l=t,a=e.computed(()=>(p-l.width)/2),o=e.computed(()=>2*Math.PI*a.value),n=e.computed(()=>({width:`${l.size}px`,height:`${l.size}px`,color:l.color==="primary"?"#3C9273":l.color})),r=e.computed(()=>l.width/l.size*p),s=e.computed(()=>l.indeterminate?null:o.value*(1-l.modelValue/100));return(m,c)=>(e.openBlock(),e.createElementBlock("div",{class:"progress-circular",style:e.normalizeStyle(n.value),role:"progressbar","aria-valuemin":"0","aria-valuemax":"100","aria-valuenow":t.indeterminate?void 0:t.modelValue},[(e.openBlock(),e.createElementBlock("svg",{xmlns:"http://www.w3.org/2000/svg",width:t.size,height:t.size,viewBox:`0 0 ${p} ${p}`},[e.createElementVNode("circle",{class:"progress-circular__underlay",fill:"transparent",cx:p/2,cy:p/2,r:a.value,"stroke-width":r.value},null,8,ce),e.createElementVNode("circle",{class:"progress-circular__overlay",fill:"transparent",cx:p/2,cy:p/2,r:a.value,"stroke-width":r.value,"stroke-dasharray":o.value,"stroke-dashoffset":s.value},null,8,de)],8,se)),m.$slots.default?(e.openBlock(),e.createElementBlock("div",me,[e.renderSlot(m.$slots,"default",{},void 0,!0)])):e.createCommentVNode("",!0)],12,ie))}},[["__scopeId","data-v-bdb14b7f"]]),M=d({__name:"Row",props:{justify:{type:String,default:"flex-start"},align:{type:String,default:"stretch"},gap:{type:String,default:"0"},wrap:{type:Boolean,default:!0}},setup(t){const l=t,a=e.computed(()=>({justifyContent:l.justify,alignItems:l.align,gap:l.gap,flexWrap:l.wrap?"wrap":"nowrap"}));return(o,n)=>(e.openBlock(),e.createElementBlock("div",{class:"flex-row",style:e.normalizeStyle(a.value)},[e.renderSlot(o.$slots,"default",{},void 0,!0)],4))}},[["__scopeId","data-v-fc69ad3e"]]),ue=["for"],fe={class:"select-container"},pe=["id","value","disabled","multiple"],ye=["selected"],ge=["value"],he={key:0,class:"select-icon","aria-hidden":"true"},q=d({__name:"Select",props:{modelValue:{type:[String,Number,Array],default:""},options:{type:Array,required:!0},label:{type:String,default:""},placeholder:{type:String,default:"Select an option"},disabled:{type:Boolean,default:!1},id:{type:String,default:()=>`select-${Math.random().toString(36).substring(2,9)}`},multiple:{type:Boolean,default:!1},hideArrow:{type:Boolean,default:!1},class:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:l}){const a=t,o=l;e.computed(()=>!a.options||a.options.length===0?[]:typeof a.options[0]=="string"?a.options.map(r=>({text:r,value:r})):a.options);const n=r=>{if(a.multiple){const s=Array.from(r.target.selectedOptions).map(m=>m.value);o("update:modelValue",s)}else o("update:modelValue",r.target.value)};return(r,s)=>{const m=e.resolveComponent("Icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["select-wrapper",a.class])},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.id,class:"select-label"},e.toDisplayString(t.label),9,ue)):e.createCommentVNode("",!0),e.createElementVNode("div",fe,[e.createElementVNode("select",{id:t.id,value:t.modelValue,onChange:n,disabled:t.disabled,multiple:t.multiple,class:e.normalizeClass([{"no-arrow":t.hideArrow},"select-input"])},[t.placeholder?(e.openBlock(),e.createElementBlock("option",{key:0,value:"",disabled:"",selected:!t.modelValue},e.toDisplayString(t.placeholder),9,ye)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.options,c=>(e.openBlock(),e.createElementBlock("option",{key:c.value,value:c.value},e.toDisplayString(c.text),9,ge))),128))],42,pe),t.hideArrow?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",he,[e.createVNode(m,{icon:"mdi-chevron-down",size:"20"})]))])],2)}}},[["__scopeId","data-v-d4f9136e"]]),ke={class:"spacer"},P=d({__name:"Spacer",setup(t){return(l,a)=>(e.openBlock(),e.createElementBlock("div",ke))}},[["__scopeId","data-v-370a82d1"]]),be={class:"textarea-wrapper"},_e=["for"],Be=["id","value","placeholder","rows","maxlength"],Se={key:1,class:"error-message"},A=d({__name:"TextArea",props:{id:{type:String,required:!1},label:{type:String,default:""},modelValue:{type:String,default:""},placeholder:{type:String,default:""},rows:{type:[String,Number],default:3},maxlength:{type:[String,Number],default:null},error:{type:String,default:""}},emits:["update:modelValue"],setup(t){return(l,a)=>(e.openBlock(),e.createElementBlock("div",be,[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.id,class:"textarea-label"},e.toDisplayString(t.label),9,_e)):e.createCommentVNode("",!0),e.createElementVNode("textarea",{id:t.id,value:t.modelValue,placeholder:t.placeholder,rows:t.rows,maxlength:t.maxlength,onInput:a[0]||(a[0]=o=>l.$emit("update:modelValue",o.target.value)),class:e.normalizeClass(["textarea-input",{"has-error":t.error}])},null,42,Be),t.error?(e.openBlock(),e.createElementBlock("p",Se,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}},[["__scopeId","data-v-a2a785c2"]]);class $e{static newGuid(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(l){const a=Math.random()*16|0;return(l=="x"?a:a&3|8).toString(16)})}static isValidGuid(){const l=/^[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i;return function(a){return a&&l.test(a)}}static isEmptyGuid(l){return l==="00000000-0000-0000-0000-000000000000"}static emptyGuid(){return"00000000-0000-0000-0000-000000000000"}}const Ve={class:"input-container"},xe=["id","type","value","autocomplete","maxlength"],we=["for"],Ce={class:"error-container"},F=d(e.defineComponent({__name:"TextField",props:{id:{type:String,default:()=>`textfield-${$e.newGuid()}`},label:{type:String,default:""},modelValue:{type:[String,Number],default:""},rules:{type:Array,default:()=>[]},type:{type:String,default:"text"},trim:{type:Boolean,default:!1},placeholder:{type:String,default:""},autocomplete:{type:String,default:"off"},maxlength:{type:[String,Number],default:void 0}},emits:["update:modelValue"],setup(t,{expose:l,emit:a}){const o=t,n=a,r=e.ref([]),s=e.ref(!0),m=e.inject("form",null),c=e.getCurrentInstance(),u=async()=>{r.value=[];let k=!0;for(const h of o.rules){const b=h(o.modelValue);b!==!0&&(k=!1,r.value.push(b))}return{valid:k,errors:r.value}},y=()=>{n("update:modelValue",""),f()},f=()=>{r.value=[],s.value=!0},g=k=>{const h=k.target;n("update:modelValue",h.value),s.value||u()},Ie=()=>{s.value=!1,o.trim&&typeof o.modelValue=="string"&&n("update:modelValue",o.modelValue.trim()),u()};return e.onMounted(()=>{m&&c&&m.register({id:o.id,validate:u,reset:y,resetValidation:f})}),e.onUnmounted(()=>{m&&c&&m.unregister({id:o.id})}),l({validate:u,reset:y,resetValidation:f,id:o.id,errors:r}),(k,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-field-wrapper",{"has-value":t.modelValue}])},[e.createElementVNode("div",Ve,[e.createElementVNode("input",{id:t.id,type:t.type,value:t.modelValue,placeholder:" ",onInput:g,onBlur:Ie,class:"text-field-input",autocomplete:t.autocomplete,maxlength:t.maxlength},null,40,xe),t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.id,class:"text-field-label"},e.toDisplayString(t.placeholder?t.placeholder:t.label),9,we)):e.createCommentVNode("",!0),e.createElementVNode("fieldset",{"aria-hidden":"true",class:e.normalizeClass(["text-field-fieldset",{"has-error":r.value.length>0}])},[...h[0]||(h[0]=[e.createElementVNode("legend",{class:"text-field-legend"},null,-1)])],2)]),e.createElementVNode("div",Ce,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(b,De)=>(e.openBlock(),e.createElementBlock("p",{key:De,class:"error-message"},e.toDisplayString(b),1))),128))])],2))}}),[["__scopeId","data-v-02dabc6c"]]),Ne=["aria-label"],Ee={class:"tooltip-content"},O=d({__name:"Tooltip",props:{text:{type:String,required:!0},location:{type:String,default:"top",validator:t=>["top","bottom","left","right"].includes(t)},disabled:{type:Boolean,default:!1}},setup(t){const l=t,a=e.ref(!1),o=()=>{l.disabled||(a.value=!0)},n=()=>{a.value=!1},r=e.computed(()=>["tooltip",`tooltip--${l.location}`]);return(s,m)=>(e.openBlock(),e.createElementBlock("div",{class:"tooltip-container",onMouseenter:o,onMouseleave:n,onFocusin:o,onFocusout:n,role:"tooltip","aria-label":t.text},[e.renderSlot(s.$slots,"default",{},void 0,!0),e.createVNode(e.Transition,{name:"tooltip-fade"},{default:e.withCtx(()=>[a.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(r.value)},[e.createElementVNode("div",Ee,e.toDisplayString(t.text),1),m[0]||(m[0]=e.createElementVNode("div",{class:"tooltip-arrow"},null,-1))],2)):e.createCommentVNode("",!0)]),_:1})],40,Ne))}},[["__scopeId","data-v-a7533144"]]),j=d({__name:"Overlay",props:{modelValue:{type:Boolean,default:!1},contained:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(t,{emit:l}){const a=t,o=l;function n(){o("update:modelValue",!1)}return e.watch(()=>a.modelValue,r=>{!a.contained&&typeof document<"u"&&(document.body.style.overflow=r?"hidden":"")}),(r,s)=>(e.openBlock(),e.createBlock(e.Transition,{name:"overlay-fade"},{default:e.withCtx(()=>[t.modelValue?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["overlay",{"overlay--contained":t.contained}]),onClick:e.withModifiers(n,["self"])},[e.renderSlot(r.$slots,"default",{},void 0,!0)],2)):e.createCommentVNode("",!0)]),_:3}))}},[["__scopeId","data-v-11b69f56"]]),R=t=>{t.component("Avatar",S),t.component("Button",$),t.component("Card",V),t.component("Chip",x),t.component("Column",w),t.component("DatePicker",C),t.component("Dialog",N),t.component("Divider",E),t.component("Icon",_),t.component("Overlay",j),t.component("Image",z),t.component("Input",I),t.component("NavigationDrawer",D),t.component("Progress",T),t.component("ProgressSpinner",B),t.component("Row",M),t.component("Select",q),t.component("Spacer",P),t.component("TextArea",A),t.component("TextField",F),t.component("Tooltip",O)},ze={install:R};i.Avatar=S,i.Button=$,i.Card=V,i.Chip=x,i.Column=w,i.DatePicker=C,i.Dialog=N,i.Divider=E,i.Icon=_,i.Image=z,i.Input=I,i.NavigationDrawer=D,i.Overlay=j,i.Progress=T,i.ProgressSpinner=B,i.Row=M,i.Select=q,i.Spacer=P,i.TextArea=A,i.TextField=F,i.Tooltip=O,i.default=ze,i.install=R,Object.defineProperties(i,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
CHANGED
|
@@ -3,9 +3,13 @@
|
|
|
3
3
|
".": {
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"import": "./dist/treqit-ui-library.js",
|
|
6
|
-
"require": "./dist/treqit-ui-library.umd.cjs"
|
|
6
|
+
"require": "./dist/treqit-ui-library.umd.cjs",
|
|
7
|
+
"default": "./dist/treqit-ui-library.js"
|
|
7
8
|
},
|
|
8
|
-
"./
|
|
9
|
+
"./style.css": "./dist/treqit-ui-library.css",
|
|
10
|
+
"./dist/style.css": "./dist/treqit-ui-library.css",
|
|
11
|
+
"./css": "./dist/treqit-ui-library.css",
|
|
12
|
+
"./package.json": "./package.json"
|
|
9
13
|
},
|
|
10
14
|
"main": "./dist/treqit-ui-library.umd.cjs",
|
|
11
15
|
"module": "./dist/treqit-ui-library.js",
|
|
@@ -14,7 +18,7 @@
|
|
|
14
18
|
],
|
|
15
19
|
"name": "treqit-ui-library",
|
|
16
20
|
"private": false,
|
|
17
|
-
"version": "1.4.
|
|
21
|
+
"version": "1.4.16",
|
|
18
22
|
"type": "module",
|
|
19
23
|
"types": "./dist/index.d.ts",
|
|
20
24
|
"scripts": {
|