ketekny-ui-kit 1.0.3
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/README.md +22 -0
- package/dist/ketekny-ui-kit.css +1 -0
- package/dist/ketekny-ui-kit.js +2607 -0
- package/dist/ketekny-ui-kit.umd.cjs +9 -0
- package/index.js +61 -0
- package/package.json +45 -0
- package/src/directives/v-tooltip.js +286 -0
- package/src/layout/kAppFooter.vue +20 -0
- package/src/layout/kAppHeader.vue +69 -0
- package/src/layout/kAppMain.vue +18 -0
- package/src/layout/kHero.vue +11 -0
- package/src/plugins/alertPlugin.js +23 -0
- package/src/plugins/confirmPlugin.js +16 -0
- package/src/plugins/inputDialogPlugin.js +27 -0
- package/src/plugins/toastPlugin.js +18 -0
- package/src/plugins/tooltipPlugin.js +10 -0
- package/src/style/style.css +39 -0
- package/src/ui/kAlert.vue +124 -0
- package/src/ui/kArrayList.vue +149 -0
- package/src/ui/kButton.vue +92 -0
- package/src/ui/kChip.vue +48 -0
- package/src/ui/kCode.vue +54 -0
- package/src/ui/kConfirmDialog.vue +70 -0
- package/src/ui/kDatatable.vue +156 -0
- package/src/ui/kDateSelector.vue +326 -0
- package/src/ui/kDialog.vue +100 -0
- package/src/ui/kDrawer.vue +71 -0
- package/src/ui/kEditor.vue +128 -0
- package/src/ui/kIcon.vue +50 -0
- package/src/ui/kInput.vue +200 -0
- package/src/ui/kInputDialog.vue +129 -0
- package/src/ui/kMenu.vue +51 -0
- package/src/ui/kMessage.vue +63 -0
- package/src/ui/kSearch.vue +45 -0
- package/src/ui/kSelect.vue +188 -0
- package/src/ui/kSelectButton.vue +70 -0
- package/src/ui/kSpinner.vue +38 -0
- package/src/ui/kTable.vue +90 -0
- package/src/ui/kTabs.vue +36 -0
- package/src/ui/kTags.vue +88 -0
- package/src/ui/kToast.vue +90 -0
- package/src/ui/kToggle.vue +46 -0
- package/src/ui/kToolbar.vue +84 -0
- package/src/ui/kUploader.vue +193 -0
- package/tailwind-preset.js +53 -0
- package/tailwind.config.js +66 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(function(c,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("lucide-vue-next"),require("@vuepic/vue-datepicker"),require("moment"),require("vue3-easy-data-table")):typeof define=="function"&&define.amd?define(["exports","vue","lucide-vue-next","@vuepic/vue-datepicker","moment","vue3-easy-data-table"],e):(c=typeof globalThis<"u"?globalThis:c||self,e(c.KeteknyUIKit={},c.Vue,c.LucideVueNext,c.VueDatePicker,c.moment,c.Vue3EasyDataTable))})(this,function(c,e,d,D,y,M){"use strict";function T(l){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(l){for(const o in l)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(l,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>l[o]})}}return t.default=l,Object.freeze(t)}const V=T(d),L={class:"flex flex-col justify-center flex-1 py-2 pr-4"},I=Object.assign({props:{type:{type:String,default:"warning",validator:l=>["info","success","warning","error"].includes(l)},title:{type:String,default:""}},computed:{bgClass(){return`bg-semantic-${this.type}-bg`},borderClass(){return`border-semantic-${this.type}-border`},textClass(){return`text-semantic-${this.type}-text`},iconColor(){return`text-semantic-${this.type}-text`},icon(){return{info:d.Info,warning:d.TriangleAlert,error:d.OctagonX,success:d.CircleCheckBig}[this.type]}}},{__name:"kMessage",setup(l){return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex rounded-lg overflow-hidden min-h-[50px] border-l-8",["border-semantic-"+l.type+"-border","bg-semantic-"+l.type+"-bg"]])},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-start justify-center h-full px-4",t.iconColor])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.icon),{class:"mt-3"}))],2),e.createElementVNode("div",L,[l.title?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["mb-2 text-xl font-medium",t.textClass])},e.toDisplayString(l.title),3)):e.createCommentVNode("",!0),e.createElementVNode("p",{class:e.normalizeClass(["p-0 m-0 leading-normal",t.textClass])},[e.renderSlot(t.$slots,"default")],2)])],2))}}),z=["disabled","aria-label","title"],A={key:3},w=Object.assign({name:"kButton",props:{primary:{type:Boolean,default:null},secondary:{type:Boolean,default:null},outlined:{type:Boolean,default:null},danger:{type:Boolean,default:null},warning:{type:Boolean,default:null},success:{type:Boolean,default:null},disabled:{type:Boolean,default:null},loading:{type:Boolean,default:null},label:{type:String,default:null},icon:{type:String,default:null},ariaLabel:{type:String,default:null},tooltip:{type:String,default:null},small:{type:Boolean,default:!1},fullWidth:{type:Boolean,default:!1},iconOnly:{type:Boolean,default:!1}},computed:{IconComponent(){return this.icon&&V[this.icon]||null},showLabel(){return!this.iconOnly},btnClass(){const l=this.small?"px-3 py-[5px] text-sm h-auto max-h-14":"px-4 py-2 text-base h-auto",t=this.fullWidth?"w-full justify-center":"w-auto";if(this.disabled||this.loading)return this.danger?`cursor-not-allowed bg-red-300 text-gray-600 ${l} ${t}`:this.success?`cursor-not-allowed bg-green-300 text-gray-500 ${l} ${t}`:this.warning?`cursor-not-allowed bg-orange-300 text-gray-500 ${l} ${t}`:this.secondary?`cursor-not-allowed text-gray-500 ${l} ${t}`:`bg-gray-300 text-gray-500 cursor-not-allowed ${l} ${t}`;let o=`cursor-pointer ${l} ${t} `;return this.danger?o+="bg-red-800 hover:bg-red-700 text-white":this.success?o+="bg-green-700 hover:bg-green-600 text-white":this.warning?o+="bg-orange-700 hover:bg-orange-600 text-white":this.secondary?o+="text-black hover:bg-neutral-200":this.outlined?o+="bg-neutral-100 text-black hover:bg-gray-300":o+="bg-cyan-800 hover:bg-cyan-700 text-white",o},computedAriaLabel(){return this.ariaLabel?this.ariaLabel:this.label?this.label:this.icon?this.icon.replace(/([a-z])([A-Z])/g,"$1 $2"):"Button"}},mounted(){const l=!this.label&&!this.$slots.default;(this.iconOnly||this.icon&&l)&&!this.computedAriaLabel&&console.warn("kButton: Icon-only buttons must include an `ariaLabel`, `label`, or slot content for accessibility.")}},{setup(l){return(t,o)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["inline-flex flex-row items-center justify-center transition-all border-none rounded-lg",t.btnClass]),disabled:l.disabled||l.loading,"aria-label":t.computedAriaLabel,title:l.tooltip},[l.loading?(e.openBlock(),e.createBlock(e.unref(d.Loader),{key:0,class:"w-6 h-6 mr-2 animate-spin",style:{"animation-duration":"1.5s"}})):e.createCommentVNode("",!0),!l.loading&&t.IconComponent?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.IconComponent),{key:1,class:e.normalizeClass("w-5 h-5 "+(t.showLabel?"mr-2":""))},null,8,["class"])):e.createCommentVNode("",!0),t.showLabel&&t.$slots.default?e.renderSlot(t.$slots,"default",{key:2}):t.showLabel&&l.label!=null?(e.openBlock(),e.createElementBlock("div",A,e.toDisplayString(l.label),1)):e.createCommentVNode("",!0)],10,z))}}),O={key:0},F={key:2,class:"flex items-center justify-center px-1 ml-2 text-gray-800 bg-white"},P={__name:"kChip",props:{label:{type:String,default:null},value:{type:[String,Number],default:null},type:{type:String,default:"info",validator:l=>["info","success","warning","error"].includes(l)},color:{type:String,default:"blue",validator:l=>["blue","green","red","yellow","purple","orange"].includes(l)}},setup(l){return e.computed(()=>({blue:"border-blue-300 bg-blue-100 text-blue-800",green:"border-green-300 bg-green-100 text-green-800",red:"border-red-300 bg-red-100 text-red-800",yellow:"border-yellow-300 bg-yellow-100 text-yellow-800",purple:"border-purple-300 bg-purple-100 text-purple-800",orange:"border-orange-300 bg-orange-100 text-orange-800"})),(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["inline-flex items-center border border-black px-3 rounded-2xl text-sm font-medium transition-colors duration-200 ease-in-out","border-semantic-"+l.type+"-border","text-semantic-"+l.type+"-text","bg-semantic-"+l.type+"-bg"])},[l.label?(e.openBlock(),e.createElementBlock("div",O,e.toDisplayString(l.label),1)):e.createCommentVNode("",!0),t.$slots.default?e.renderSlot(t.$slots,"default",{key:1}):e.createCommentVNode("",!0),l.value!==null?(e.openBlock(),e.createElementBlock("div",F,e.toDisplayString(l.value),1)):e.createCommentVNode("",!0)],2))}},u=(l,t)=>{const o=l.__vccOpts||l;for(const[n,a]of t)o[n]=a;return o},Y={props:{htmlContent:{type:String,required:!0}},computed:{normalizedContent(){return this.dedent(this.htmlContent).trim()}},methods:{dedent(l){const t=l.replace(/^\n/,"").replace(/\n\s*$/,"").split(`
|
|
2
|
+
`);let o=1/0;return t.forEach(a=>{if(a.trim()==="")return;const r=a.match(/^(\s*)/),s=r?r[1].length:0;s<o&&(o=s)}),o===1/0&&(o=0),t.map(a=>a.length>=o?a.slice(o):a).join(`
|
|
3
|
+
`)}}},j={class:"p-4 mt-3 overflow-hidden text-white whitespace-pre bg-gray-900 border rounded-lg"},X={class:"overflow-auto"};function K(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("div",X,[e.createElementVNode("code",null,e.toDisplayString(r.normalizedContent),1)])])}const H=u(Y,[["render",K]]);let C=1e3;const U={name:"kDialog",components:{X:d.X},props:{visible:Boolean,title:String,maximized:Boolean,width:{type:String,default:""}},data(){return{zIndex:1e3}},watch:{visible(l){l&&(C+=1,this.zIndex=C)}},computed:{computedWidth(){return this.width?this.width:"sm:w-[600px]"},dialogClasses(){return this.width?this.computedWidth:this.maximized?"max-w-none h-[90vh]":this.computedWidth+" max-h-[90vh]"}},methods:{close(){this.$emit("update:visible",!1)}}},W={class:"flex flex-row items-center p-4 text-white bg-primary shrink-0"},q={class:"text-xl font-semibold !text-white"},R={key:0},Q={class:"flex-1 p-4 overflow-auto bg-secondary"},G={key:1,class:"flex flex-row justify-end gap-2 p-4 shrink-0"};function J(l,t,o,n,a,r){const s=e.resolveComponent("x");return o.visible?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle({zIndex:a.zIndex}),class:"fixed inset-0 flex items-center justify-center overflow-hidden bg-black bg-opacity-50 backdrop-blur-sm"},[e.createVNode(e.Transition,{name:"dialog"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["relative bg-white shadow-lg overflow-hidden rounded-2xl flex flex-col max-h-[90vh] w-full m-4 sm:min-w-[600px] sm:w-auto",r.dialogClasses])},[e.createElementVNode("div",W,[e.createElementVNode("div",q,e.toDisplayString(o.title),1),t[1]||(t[1]=e.createElementVNode("div",{class:"flex-1"},null,-1)),e.createElementVNode("div",{class:"p-1 text-black transition duration-100 ease-in-out rounded-full cursor-pointer text-secondary hover:bg-white hover:text-primary",onClick:t[0]||(t[0]=(...i)=>r.close&&r.close(...i))},[e.createVNode(s)])]),l.$slots.fixed?(e.openBlock(),e.createElementBlock("div",R,[e.renderSlot(l.$slots,"fixed")])):e.createCommentVNode("",!0),e.createElementVNode("div",Q,[e.renderSlot(l.$slots,"default")]),l.$slots.footer?(e.openBlock(),e.createElementBlock("div",G,[e.renderSlot(l.$slots,"footer")])):e.createCommentVNode("",!0)],2),[[e.vShow,o.visible]])]),_:3})],4)):e.createCommentVNode("",!0)}const Z=u(U,[["render",J]]),v={name:"KDrawer",components:{X:d.X},props:{visible:{type:Boolean,required:!0},title:{type:String,default:""},side:{type:String,default:"right",validator:l=>["left","right"].includes(l)}},watch:{visible(l){document.body.style.overflow=l?"hidden":""}},beforeUnmount(){document.body.style.overflow=""},methods:{close(){this.$emit("update:visible",!1)}}},ee={key:0,class:"fixed inset-0 z-50 flex"},te={class:"flex items-center justify-between p-4 text-white bg-primary"},le={class:"text-lg font-semibold"},oe={class:"flex-1 p-4 overflow-auto bg-secondary"},ne={class:"p-4 bg-gray-100"};function re(l,t,o,n,a,r){const s=e.resolveComponent("X");return o.visible?(e.openBlock(),e.createElementBlock("div",ee,[e.createVNode(e.Transition,{name:"fade "},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"fixed inset-0 bg-black bg-opacity-50 backdrop-blur-sm",onClick:t[0]||(t[0]=(...i)=>r.close&&r.close(...i))})]),_:1}),e.createElementVNode("div",{class:e.normalizeClass(["fixed top-0 bottom-0 z-50 flex flex-col bg-white shadow-xl w-[400px] transition-all duration-500",o.side==="right"?"right-0":"left-0"])},[e.createElementVNode("div",te,[e.createElementVNode("div",le,e.toDisplayString(o.title),1),e.createElementVNode("button",{onClick:t[1]||(t[1]=(...i)=>r.close&&r.close(...i)),class:"text-white hover:text-gray-200"},[e.createVNode(s,{class:"w-5 h-5"})])]),e.createElementVNode("div",oe,[e.renderSlot(l.$slots,"default")]),e.createElementVNode("div",ne,[e.renderSlot(l.$slots,"footer")])],2)])):e.createCommentVNode("",!0)}const ae=u(v,[["render",re]]),se={class:"w-full"},ie={key:0},de=["for"],ce={class:"relative"},me=["id","value","disabled","placeholder","autofocus"],pe={key:1},he=["for"],ue={class:"relative"},fe=["id","type","value","disabled","placeholder","autofocus"],ge={class:"text-xs select-none"},ye={key:2},be=["for"],ke={class:"relative"},we=["id","value","disabled","placeholder","autofocus"],xe={key:3,class:"text-sm text-red-500"},Ve={key:4,class:"text-sm text-gray-500"},Ee=Object.assign({name:"kInput",props:{modelValue:[String,Number,Date,Object,Array],label:{type:String,default:null},info:{type:String,default:null},error:{type:[String,Boolean],default:null},placeholder:{type:String,default:null},type:{type:String,default:"text"},disabled:{type:Boolean,default:!1},icon:{type:String,default:null},id:String,autofocus:{type:Boolean,default:!1},capsOnly:{type:Boolean,default:!1}},mounted(){this.autofocus&&this.$nextTick(()=>{const l=this.$el.querySelector("input");l&&l.focus()})},data(){return{defaultStyle:"w-full px-3 py-2 border rounded-lg transition shadow-sm focus:outline-none text-gray-700 focus:ring-0 focus:border-green-500 bg-white placeholder-gray-400",errorStyle:"border-red-500 focus:ring focus:ring-red-300",disabledStyle:"!bg-gray-100 !text-gray-400 !cursor-not-allowed",computedModelValue:null,showPassword:!1,computedId:`input-${Math.random().toString(36).substr(2,9)}`}},computed:{iconComponent(){return this.icon&&V[this.icon]||null},hasError(){return this.error!=null&&this.error!==!1}},created(){this.init(this.modelValue)},watch:{modelValue(l){this.init(l)},computedModelValue(l){const t=this.type==="integer"?parseInt(l||0,10):l;this.$emit("update:modelValue",t)}},methods:{init(l){this.computedModelValue=l??""},blockInvalidKeys(l){["e","E","+","-","."].includes(l.key)&&l.preventDefault()},handleInput(l){let t=l.target.value;this.type==="integer"&&(t=t.replace(/\D+/g,"")),typeof t=="string"&&this.capsOnly&&(t=t.normalize("NFD").replace(new RegExp("\\p{Diacritic}","gu"),""),t=t.replace(/[άαΆΑ]/g,"Α").replace(/[έεΈΕ]/g,"Ε").replace(/[ήηΉΗ]/g,"Η").replace(/[ίιΊΙϊΐ]/g,"Ι").replace(/[όοΌΟ]/g,"Ο").replace(/[ύυΎΫΰϋ]/g,"Υ").replace(/[ώωΏΩ]/g,"Ω"),t=t.toUpperCase()),this.computedModelValue=t}}},{setup(l){return(t,o)=>(e.openBlock(),e.createElementBlock("div",se,[l.type==="text"?(e.openBlock(),e.createElementBlock("div",ie,[l.label!=null?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.computedId,class:e.normalizeClass(["inputLabel",t.hasError?"text-red-500":"text-gray-700"])},e.toDisplayString(l.label),11,de)):e.createCommentVNode("",!0),e.createElementVNode("div",ce,[e.createElementVNode("input",{id:t.computedId,type:"text",value:t.computedModelValue,onInput:o[0]||(o[0]=(...n)=>t.handleInput&&t.handleInput(...n)),disabled:l.disabled,placeholder:l.placeholder,class:e.normalizeClass([t.defaultStyle,t.hasError?t.errorStyle:"",l.disabled?t.disabledStyle:""]),autofocus:l.autofocus},null,42,me),t.iconComponent?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.iconComponent),{key:0,class:"absolute w-4 h-4 text-gray-400 -translate-y-1/2 pointer-events-none right-3 top-1/2"})):e.createCommentVNode("",!0)])])):l.type==="password"?(e.openBlock(),e.createElementBlock("div",pe,[l.label!=null?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.computedId,class:e.normalizeClass(["inputLabel",t.hasError?"text-red-500":""])},e.toDisplayString(l.label),11,he)):e.createCommentVNode("",!0),e.createElementVNode("div",ue,[e.createElementVNode("input",{id:t.computedId,type:t.showPassword?"text":"password",value:t.computedModelValue,onInput:o[1]||(o[1]=(...n)=>t.handleInput&&t.handleInput(...n)),disabled:l.disabled,placeholder:l.placeholder,class:e.normalizeClass([t.defaultStyle,t.hasError?t.errorStyle:"",l.disabled?t.disabledStyle:""]),autofocus:l.autofocus},null,42,fe),e.createElementVNode("div",{class:"absolute inset-y-0 right-0 flex items-center pr-3 text-gray-500 cursor-pointer",onClick:o[2]||(o[2]=n=>t.showPassword=!t.showPassword)},[e.createElementVNode("span",ge,e.toDisplayString(t.showPassword?"Hide":"Show"),1)])])])):l.type==="integer"?(e.openBlock(),e.createElementBlock("div",ye,[l.label!=null?(e.openBlock(),e.createElementBlock("label",{key:0,for:t.computedId,class:e.normalizeClass(["inputLabel",t.hasError?"text-red-500":"text-gray-700"])},e.toDisplayString(l.label),11,be)):e.createCommentVNode("",!0),e.createElementVNode("div",ke,[e.createElementVNode("input",{id:t.computedId,type:"text",inputmode:"numeric",pattern:"[0-9]*",value:t.computedModelValue,onInput:o[3]||(o[3]=(...n)=>t.handleInput&&t.handleInput(...n)),onKeydown:o[4]||(o[4]=(...n)=>t.blockInvalidKeys&&t.blockInvalidKeys(...n)),disabled:l.disabled,placeholder:l.placeholder,autofocus:l.autofocus,class:e.normalizeClass([t.defaultStyle,t.hasError?t.errorStyle:"",l.disabled?t.disabledStyle:""])},null,42,we),t.iconComponent?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.iconComponent),{key:0,class:"absolute w-4 h-4 text-gray-400 -translate-y-1/2 pointer-events-none right-3 top-1/2"})):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),t.hasError&&l.error!==!0&&l.error!==""?(e.openBlock(),e.createElementBlock("div",xe,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0),l.info!=null?(e.openBlock(),e.createElementBlock("div",Ve,e.toDisplayString(l.info),1)):e.createCommentVNode("",!0)]))}}),Ce={name:"kDatePicker",components:{Datepicker:D,ChevronLeft:d.ChevronLeft,ChevronRight:d.ChevronRight,X:d.X,Calendar:d.Calendar},props:{modelValue:[String,Date],type:{type:String,default:"date",validator:l=>["date","yearMonth"].includes(l)},info:{type:String,default:null},error:{type:[String,Boolean],default:null},label:{type:String,default:"Ημερομηνία"},placeholder:{type:String,default:"Επιλέξτε ημερομηνία"},disabled:{type:Boolean,default:!1},valueFormat:{type:String,default:null},id:{type:String,default:()=>`datepicker-${Math.random().toString(36).substr(2,9)}`}},data(){const l=y(this.modelValue,"YYYY-MM",!0),t=y(),o=(()=>{if(!this.modelValue)return"";const n=y(this.modelValue);return n.isValid()?n.format("DD/MM/YYYY"):""})();return{defaultStyle:"w-full px-3 py-2 border rounded-lg transition shadow-sm focus:outline-none text-gray-700 focus:ring-0 focus:border-green-500 bg-white placeholder-gray-400",errorStyle:"border-red-500 focus:ring focus:ring-red-300",disabledStyle:"!bg-gray-100 !text-gray-400 !cursor-not-allowed",showPopup:!1,currentYear:l.isValid()?l.year():t.year(),selectedMonth:l.isValid()?l.month()+1:null,months:["Ιαν","Φεβ","Μάρ","Απρ","Μάι","Ιούν","Ιούλ","Αυγ","Σεπ","Οκτ","Νοέ","Δεκ"],popupStyles:{position:"absolute",top:"0px",left:"0px",width:"100%"},textDate:o,inputInvalid:!1}},computed:{hasError(){return this.error!=null&&this.error!==!1},displayValue(){return!this.selectedMonth||!this.currentYear?"":y(`${this.currentYear}-${String(this.selectedMonth).padStart(2,"0")}`).format("MM/YYYY")},calendarDate:{get(){if(!this.modelValue)return null;const l=y(this.modelValue);return l.isValid()?l.toDate():null},set(l){const t=y(l);if(!t.isValid()){this.$emit("update:modelValue",null);return}const o=this.valueFormat?t.format(this.valueFormat):t.toDate();this.$emit("update:modelValue",o)}},dateFormat(){return"dd/MM/yyyy"}},watch:{modelValue(l){if(!l){this.textDate="";return}const t=y(l);this.textDate=t.isValid()?t.format("DD/MM/YYYY"):""}},mounted(){this.clickOutsideHandler=l=>{this.showPopup&&!this.$el.contains(l.target)&&(this.showPopup=!1)},document.addEventListener("click",this.clickOutsideHandler)},beforeUnmount(){document.removeEventListener("click",this.clickOutsideHandler)},methods:{onTextInput(l){if(this.disabled)return;let t=l.target.value||"";t=t.replace(/[^0-9/]/g,"");const o=t.replace(/\D/g,"");if(o.length>2&&!t.includes("/")&&(t=`${o.slice(0,2)}/${o.slice(2)}`),o.length>4&&(t.match(/\//g)||[]).length<2&&(t=`${o.slice(0,2)}/${o.slice(2,4)}/${o.slice(4)}`),t=t.replace(/\/{2,}/g,"/"),this.textDate=t,o.length===8){const n=y(t,"DD/MM/YYYY",!0);if(n.isValid()){this.inputInvalid=!1;const a=this.valueFormat?n.format(this.valueFormat):n.toDate();this.$emit("update:modelValue",a)}else this.inputInvalid=!0}else this.inputInvalid=!1},commitTextDate(){const l=(this.textDate||"").trim();if(!l){this.inputInvalid=!1,this.$emit("update:modelValue",null);return}const t=["DD/MM/YYYY","D/M/YYYY","YYYY-MM-DD",y.ISO_8601],o=y(l,t,!0);if(!o.isValid()){this.inputInvalid=!0;return}this.inputInvalid=!1;const n=this.valueFormat?o.format(this.valueFormat):o.toDate();this.$emit("update:modelValue",n)},openCalendar(){this.disabled||this.$refs.dp&&this.$refs.dp.openMenu&&this.$refs.dp.openMenu()},togglePopup(){this.disabled||(this.showPopup=!this.showPopup,this.showPopup&&this.$nextTick(()=>{const l=this.$refs.trigger;if(l){const t=l.getBoundingClientRect();this.popupStyles={position:"absolute",top:`${t.bottom+window.scrollY}px`,left:`${t.left+window.scrollX}px`,width:`${t.width}px`,zIndex:9999}}}))},clearSelection(){this.selectedMonth=null,this.$emit("update:modelValue",null),this.showPopup=!1},selectMonth(l){this.selectedMonth=l;const t=y(`${this.currentYear}-${String(l).padStart(2,"0")}`,"YYYY-MM"),o=this.valueFormat?t.format(this.valueFormat):t.toDate();this.$emit("update:modelValue",o),this.showPopup=!1},isSelected(l){const t=y(this.modelValue,"YYYY-MM",!0);return this.selectedMonth===l&&t.isValid()&&t.year()===this.currentYear}}},Be={class:"relative w-full"},Se=["for"],$e={key:0},Ne={class:"relative"},_e=["id","placeholder","disabled"],De=["disabled"],Me={key:1,class:"relative"},Te={class:"relative"},Le=["disabled"],Ie={class:"flex items-center justify-between pb-3 mb-4 border-b"},ze={class:"font-medium text-gray-700"},Ae={class:"grid grid-cols-3 gap-2"},Oe=["onClick"],Fe={key:2,class:"text-sm text-red-500"},Pe={key:3,class:"text-sm text-red-500"},Ye={key:4,class:"text-sm text-gray-500"};function je(l,t,o,n,a,r){const s=e.resolveComponent("Calendar"),i=e.resolveComponent("Datepicker"),p=e.resolveComponent("X"),f=e.resolveComponent("ChevronLeft"),g=e.resolveComponent("ChevronRight");return e.openBlock(),e.createElementBlock("div",Be,[e.createElementVNode("label",{for:o.id,class:e.normalizeClass(["inputLabel",r.hasError||a.inputInvalid?"text-red-500":"text-gray-700"])},e.toDisplayString(o.label),11,Se),o.type==="date"?(e.openBlock(),e.createElementBlock("div",$e,[e.createElementVNode("div",Ne,[e.withDirectives(e.createElementVNode("input",{id:o.id,type:"text","onUpdate:modelValue":t[0]||(t[0]=m=>a.textDate=m),placeholder:o.placeholder||"dd/mm/yyyy",disabled:o.disabled,class:e.normalizeClass([a.defaultStyle,r.hasError||a.inputInvalid?a.errorStyle:"",o.disabled?a.disabledStyle:""]),onInput:t[1]||(t[1]=(...m)=>r.onTextInput&&r.onTextInput(...m)),onBlur:t[2]||(t[2]=(...m)=>r.commitTextDate&&r.commitTextDate(...m)),onKeydown:t[3]||(t[3]=e.withKeys(e.withModifiers((...m)=>r.commitTextDate&&r.commitTextDate(...m),["prevent"]),["enter"]))},null,42,_e),[[e.vModelText,a.textDate]]),e.createElementVNode("button",{type:"button",class:"absolute p-1 text-gray-500 -translate-y-1/2 right-2 top-1/2 hover:text-black disabled:opacity-50",disabled:o.disabled,onClick:t[4]||(t[4]=(...m)=>r.openCalendar&&r.openCalendar(...m)),"aria-label":"Open calendar"},[e.createVNode(s,{class:"w-5 h-5"})],8,De)]),e.createVNode(i,{ref:"dp",modelValue:r.calendarDate,"onUpdate:modelValue":t[5]||(t[5]=m=>r.calendarDate=m),format:r.dateFormat,"enable-time-picker":!1,"auto-apply":"",disabled:o.disabled,"hide-input-icon":!0,teleport:"body",class:"sr-only"},null,8,["modelValue","format","disabled"])])):(e.openBlock(),e.createElementBlock("div",Me,[e.createElementVNode("div",Te,[e.createElementVNode("div",{ref:"trigger",class:e.normalizeClass([a.defaultStyle,r.hasError?a.errorStyle:"",o.disabled?a.disabledStyle:""]),onClick:t[6]||(t[6]=(...m)=>r.togglePopup&&r.togglePopup(...m))},e.toDisplayString(r.displayValue||o.placeholder),3),e.createElementVNode("button",{type:"button",class:"absolute p-1 text-gray-500 -translate-y-1/2 right-2 top-1/2 hover:text-black disabled:opacity-50",disabled:o.disabled,onClick:t[7]||(t[7]=e.withModifiers((...m)=>r.togglePopup&&r.togglePopup(...m),["stop"])),"aria-label":"Open month selector"},[e.createVNode(s,{class:"w-5 h-5"})],8,Le),r.displayValue&&!o.disabled?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:t[8]||(t[8]=e.withModifiers((...m)=>r.clearSelection&&r.clearSelection(...m),["stop"])),type:"button",class:"absolute text-sm font-bold text-gray-400 -translate-y-1/2 right-9 top-1/2 hover:text-red-500","aria-label":"Clear"},[e.createVNode(p,{class:"w-5 h-5"})])):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[a.showPopup?(e.openBlock(),e.createElementBlock("div",{key:0,class:"p-4 bg-white border border-gray-200 rounded-lg shadow-lg",style:e.normalizeStyle(a.popupStyles)},[e.createElementVNode("div",Ie,[e.createElementVNode("button",{onClick:t[9]||(t[9]=e.withModifiers(m=>a.currentYear--,["stop"])),class:"text-gray-600 hover:text-black","aria-label":"Previous year"},[e.createVNode(f)]),e.createElementVNode("span",ze,e.toDisplayString(a.currentYear),1),e.createElementVNode("button",{onClick:t[10]||(t[10]=e.withModifiers(m=>a.currentYear++,["stop"])),class:"text-gray-600 hover:text-black","aria-label":"Next year"},[e.createVNode(g)])]),e.createElementVNode("div",Ae,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.months,(m,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,onClick:b=>r.selectMonth(h+1),class:e.normalizeClass(["px-3 py-2 text-center transition rounded-lg cursor-pointer",[r.isSelected(h+1)?"bg-blue-600 text-white":"hover:bg-gray-100 text-gray-700"]])},e.toDisplayString(m),11,Oe))),128))])],4)):e.createCommentVNode("",!0)]))])),r.hasError&&o.error!==!0&&o.error!==""?(e.openBlock(),e.createElementBlock("div",Fe,e.toDisplayString(o.error),1)):e.createCommentVNode("",!0),a.inputInvalid&&!r.hasError?(e.openBlock(),e.createElementBlock("div",Pe,"Μη έγκυρη ημερομηνία. Χρησιμοποιήστε μορφή dd/mm/yyyy.")):e.createCommentVNode("",!0),o.info!=null?(e.openBlock(),e.createElementBlock("div",Ye,e.toDisplayString(o.info),1)):e.createCommentVNode("",!0)])}const Xe=u(Ce,[["render",je]]),Ke={class:"relative flex items-center justify-between px-4 py-2 bg-white border border-b rounded-md min-h-[46px] kToolbar"},He={key:0,class:"text-xl font-semibold"},Ue={class:"flex"},We={class:"content-center mr-2"},qe={class:"hidden space-x-1 md:flex"},Re={key:0,class:"absolute z-50 w-48 bg-white border rounded shadow-lg top-16 right-4"},Qe=["onClick","disabled"],Ge={key:0,class:"inline-block w-4 h-4 mr-2 border-2 border-gray-300 rounded-full border-t-transparent animate-spin"},Je={__name:"kToolbar",props:{title:{type:String,default:null},actions:{type:Array,default:()=>[]}},setup(l){const t=e.ref(!1),o=()=>{t.value=!t.value},n=()=>{t.value=!1};return(a,r)=>(e.openBlock(),e.createElementBlock("div",Ke,[l.title!=null?(e.openBlock(),e.createElementBlock("h1",He,e.toDisplayString(l.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Ue,[e.createElementVNode("div",We,[e.renderSlot(a.$slots,"default")]),e.createElementVNode("div",qe,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.actions,(s,i)=>(e.openBlock(),e.createBlock(w,{outlined:"",key:i,icon:s.icon,label:s.label,loading:s.loading,disabled:s.disabled,onClick:s.onClick},null,8,["icon","label","loading","disabled","onClick"]))),128))]),e.createElementVNode("div",{class:"md:hidden"},[e.createElementVNode("button",{onClick:o,class:"p-2 rounded hover:bg-gray-100 focus:outline-none","aria-label":"openMenu"},r[0]||(r[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"w-6 h-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 6h16M4 12h16M4 18h16"})],-1)]))]),t.value?(e.openBlock(),e.createElementBlock("div",Re,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.actions,(s,i)=>(e.openBlock(),e.createElementBlock("button",{key:i,onClick:()=>{s.onClick(),n()},class:"w-full px-4 py-2 text-left hover:bg-gray-100 disabled:opacity-50",disabled:s.disabled||s.loading},[s.loading?(e.openBlock(),e.createElementBlock("span",Ge)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(s.label),1)],8,Qe))),128))])):e.createCommentVNode("",!0),t.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"fixed inset-0 z-40 bg-black bg-opacity-30",onClick:n})):e.createCommentVNode("",!0)])]))}},Ze={class:"relative w-full"},ve=["for"],et=["aria-expanded","aria-disabled"],tt={class:"block pr-10 truncate"},lt={class:"absolute text-gray-400 -translate-y-1/2 pointer-events-none right-3 top-1/2"},ot={class:"sticky top-0 z-10 pt-2 pb-2 mx-2 bg-white"},nt={class:"flex flex-col gap-[2px] p-2"},rt=["onClick","aria-selected"],at={key:0,class:"px-3 py-2 text-gray-400"},st={key:0,class:"mt-1 text-red-500"},it={key:1,class:"mt-1 text-gray-500"},dt=Object.assign({name:"kSelect",props:{options:{type:Array,required:!0},modelValue:[String,Number],optionValue:{type:String,default:"value"},optionLabel:{type:String,default:"label"},label:String,info:String,error:[String,Boolean],disabled:Boolean,placeholder:{type:String,default:"Επιλέξτε μία τιμή"},id:{type:String,default:""},dropdownHeight:{type:String,default:"max-h-60"}},data(){return{isOpen:!1,searchQuery:"",dropdownPositionStyle:{},defaultStyle:"w-full px-3 py-2 border rounded-lg transition shadow-sm focus:outline-none text-gray-700 focus:ring-0 focus:border-green-500 bg-white placeholder-gray-400",errorStyle:"border-red-500 focus:ring focus:ring-red-300",disabledStyle:"!bg-gray-100 !text-gray-400 !cursor-not-allowed"}},computed:{computedId(){return this.id||`select-${Math.random().toString(36).substr(2,9)}`},selectedValue(){return this.modelValue},selectedLabel(){const l=this.options.find(t=>t[this.optionValue]===this.modelValue);return l?l[this.optionLabel]:""},filteredOptions(){const l=this.searchQuery.trim().toLowerCase();return this.options.filter(t=>t[this.optionLabel].toLowerCase().includes(l))},hasError(){return this.error!=null&&this.error!==!1},baseInputClasses(){return"transition shadow-sm focus:ring focus:ring-blue-300"}},methods:{toggleDropdown(){this.disabled||(this.isOpen=!this.isOpen,this.isOpen&&this.$nextTick(()=>this.getDropdownPosition()))},selectOption(l){this.$emit("update:modelValue",l[this.optionValue]),this.searchQuery="",this.isOpen=!1},clearSelection(){this.$emit("update:modelValue",null),this.searchQuery="",this.isOpen=!1},closeOnClickOutside(l){!this.$el.contains(l.target)&&!(this.$refs.dropdown&&this.$refs.dropdown.contains(l.target))&&(this.isOpen=!1)},getDropdownPosition(){const l=this.$refs.trigger;if(!l)return;const t=l.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,n=window.pageXOffset||document.documentElement.scrollLeft;this.dropdownPositionStyle={position:"absolute",top:`${t.bottom+o}px`,left:`${t.left+n}px`,minWidth:`${t.width}px`,maxWidth:"500px"}}},mounted(){document.addEventListener("click",this.closeOnClickOutside)},beforeUnmount(){document.removeEventListener("click",this.closeOnClickOutside)}},{setup(l){return(t,o)=>(e.openBlock(),e.createElementBlock("div",Ze,[e.createElementVNode("label",{for:t.computedId,class:e.normalizeClass(["inputLabel",t.hasError?"text-red-500":"text-gray-700"])},e.toDisplayString(l.label),11,ve),e.createElementVNode("div",{ref:"trigger",onClick:o[1]||(o[1]=(...n)=>t.toggleDropdown&&t.toggleDropdown(...n)),class:e.normalizeClass(["relative w-full px-3 py-2 text-gray-700 bg-white border rounded-lg cursor-pointer trigger-box",[t.defaultStyle,t.hasError?t.errorStyle:"",l.disabled?t.disabledStyle:""]]),"aria-haspopup":"listbox","aria-expanded":t.isOpen.toString(),"aria-disabled":l.disabled.toString(),role:"combobox"},[e.createElementVNode("span",tt,e.toDisplayString(t.selectedLabel||l.placeholder),1),t.selectedValue&&!l.disabled?(e.openBlock(),e.createElementBlock("button",{key:0,class:"absolute text-gray-400 -translate-y-1/2 right-8 top-1/2 hover:text-red-500",onClick:o[0]||(o[0]=e.withModifiers((...n)=>t.clearSelection&&t.clearSelection(...n),["stop"])),"aria-label":"Clear selection"},[e.createVNode(e.unref(d.X),{class:"w-5 h-5 mr-2"})])):e.createCommentVNode("",!0),e.createElementVNode("span",lt,[t.isOpen?(e.openBlock(),e.createBlock(e.unref(d.ChevronUp),{key:1,class:"w-5 h-5"})):(e.openBlock(),e.createBlock(e.unref(d.ChevronDown),{key:0,class:"w-5 h-5"}))])],10,et),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.isOpen?(e.openBlock(),e.createElementBlock("div",{key:0,ref:"dropdown",class:e.normalizeClass(["absolute z-[9999] mt-1 overflow-auto bg-white border border-gray-200 rounded-lg shadow-lg",l.dropdownHeight]),style:e.normalizeStyle(t.dropdownPositionStyle),role:"listbox"},[e.createElementVNode("div",ot,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":o[2]||(o[2]=n=>t.searchQuery=n),placeholder:"Αναζήτηση...",class:"w-full px-3 py-2 border border-gray-200 rounded-md focus:outline-none",role:"searchbox","aria-label":"Search options"},null,512),[[e.vModelText,t.searchQuery]])]),e.createElementVNode("div",nt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.filteredOptions,n=>(e.openBlock(),e.createElementBlock("div",{key:n[l.optionValue],onClick:a=>t.selectOption(n),class:e.normalizeClass(["px-3 py-2 rounded cursor-pointer",n[l.optionValue]===t.selectedValue?"bg-primary text-white":"hover:bg-blue-100"]),role:"option","aria-selected":(n[l.optionValue]===t.selectedValue).toString()},e.toDisplayString(n[l.optionLabel]),11,rt))),128))]),t.filteredOptions.length===0?(e.openBlock(),e.createElementBlock("div",at,"Δεν βρέθηκαν αποτελέσματα")):e.createCommentVNode("",!0)],6)):e.createCommentVNode("",!0)])),t.hasError&&l.error!==!0&&l.error!==""?(e.openBlock(),e.createElementBlock("div",st,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0),l.info?(e.openBlock(),e.createElementBlock("div",it,e.toDisplayString(l.info),1)):e.createCommentVNode("",!0)]))}}),ct={name:"kTable",mounted(){this.$nextTick(()=>{this.applyMobileLayout(),this._observer=new MutationObserver(()=>{this.$nextTick(()=>this.applyMobileLayout())}),this._observer.observe(this.$refs.tbodyRef,{childList:!0,subtree:!0})})},beforeUnmount(){this._observer&&this._observer.disconnect()},methods:{applyMobileLayout(){const l=this.$refs.theadRef;if(!l)return;const t=Array.from(l.querySelectorAll("th")).map(a=>a.textContent.trim());this.$refs.tbodyRef.querySelectorAll("tr").forEach(a=>{const r=a.querySelectorAll("td");a.classList.add("block","sm:table-row","mb-4","sm:mb-0","transition","duration-300","ease-in-out","hover:bg-gray-50"),r.forEach((s,i)=>{s.setAttribute("data-label",t[i]||""),s.classList.add("block","sm:table-cell","text-left","h-[3.2rem]","px-2","py-2")})})}}},mt={ref:"tableWrapper",class:"w-full"},pt={class:"table-custom"},ht={ref:"theadRef",class:"hidden sm:table-header-group"},ut={ref:"tbodyRef"};function ft(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("div",mt,[e.createElementVNode("table",pt,[e.createElementVNode("thead",ht,[e.renderSlot(l.$slots,"head")],512),e.createElementVNode("tbody",ut,[e.renderSlot(l.$slots,"body")],512)])],512)}const gt=u(ct,[["render",ft]]),yt={name:"TabList",props:{modelValue:{type:[String,Number],required:!0},tabs:{type:Array,required:!0,validator:l=>l.every(t=>"id"in t&&"title"in t)}},emits:["update:modelValue"],methods:{selectTab(l){this.$emit("update:modelValue",l)}}},bt={class:"w-full overflow-hidden bg-white border rounded-md"},kt={class:"flex"},wt=["onClick"];function xt(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("div",bt,[e.createElementVNode("div",kt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.tabs,s=>(e.openBlock(),e.createElementBlock("button",{key:s.id,onClick:i=>r.selectTab(s.id),class:e.normalizeClass(["px-8 py-4 text-lg font-medium",o.modelValue===s.id?"bg-primary text-secondary ":"text-gray-500 hover:text-gray-700"])},e.toDisplayString(s.title),11,wt))),128))])])}const Vt=u(yt,[["render",xt]]),Et={computed:{computedId(){return this.id||`input-${Math.random().toString(36).substr(2,9)}`},showLabel(){return!!this.label&&this.label.trim()!==""}},props:{label:String,modelValue:Boolean,id:String,labelStyle:{type:String,default:null}},methods:{toggle(){this.$emit("update:modelValue",!this.modelValue)}}},Ct={key:0,class:"block mb-1 text-sm font-bold text-gray-700",for:"toggle"},Bt=["aria-label"],St=["for"];function $t(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(o.labelStyle==="inline"?"flex items-center":"")},[r.showLabel&&o.labelStyle!=="inline"?(e.openBlock(),e.createElementBlock("div",Ct,e.toDisplayString(o.label),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{onClick:t[0]||(t[0]=(...s)=>r.toggle&&r.toggle(...s)),id:"toggle","aria-label":o.label||"Toggle",class:e.normalizeClass(["w-16 h-8 flex items-center rounded-full p-1 transition duration-300",o.modelValue?"bg-green-500":"bg-gray-400"])},[e.createElementVNode("div",{class:e.normalizeClass(["w-6 h-6 bg-white rounded-full shadow-md transform transition duration-300",o.modelValue?"translate-x-8":"translate-x-0"])},null,2)],10,Bt),r.showLabel&&o.labelStyle==="inline"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"ml-2 text-sm font-bold text-gray-700 cursor-pointer",for:r.computedId,onClick:t[1]||(t[1]=(...s)=>r.toggle&&r.toggle(...s))},e.toDisplayString(o.label),9,St)):e.createCommentVNode("",!0)],2)}const Nt=u(Et,[["render",$t],["__scopeId","data-v-66e2b3cf"]]),_t={class:"flex flex-col items-center justify-center space-y-4"},Dt={class:"text-sm text-gray-500"},Mt=["multiple","accept"],Tt={key:1},Lt={class:"space-y-4"},It={class:"flex items-center space-x-4"},zt={class:"text-sm font-medium text-gray-700"},At={class:"text-xs text-gray-500"},Ot={class:"flex items-center space-x-4"},Ft=["onClick"],Pt={name:"FileUpload",emits:["update"],props:{multiple:{type:Boolean,default:!1},fileTypes:{type:Array,default:["PDF","DOCX","JPG","PNG","XLS","XLSX"]},maxSize:{type:String,default:"10MB"},disabled:{type:Boolean,default:!1}},components:{UploadCloudIcon:d.UploadCloudIcon,FileIcon:d.FileIcon,CheckCircleIcon:d.CheckCircleIcon,XIcon:d.XIcon},data(){return{dragover:!1,files:[]}},methods:{onDragover(){this.dragover=!0},onDragleave(){this.dragover=!1},onDrop(l){this.dragover=!1;const t=[...l.dataTransfer.files];this.handleFiles(t)},onFileSelected(l){const t=[...l.target.files];this.handleFiles(t)},handleFiles(l){l.forEach(async t=>{this.isValidFile(t)?(this.files.push({fileName:t.name,fileSize:t.size,data:await this.fileToBase64(t)}),this.$emit("update",this.files)):alert(`Invalid file: ${t.name}. Please check file type and size.`)})},isValidFile(l){const t=["application/pdf","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-excel","application/vnd.oasis.opendocument.spreadsheet","image/jpeg","image/png"];return console.log(l.type,l.size),t.includes(l.type)&&l.size<=20971520},removeFile(l){const t=this.files.findIndex(o=>o.name===l.name);this.files.splice(t,1)},formatFileSize(l){if(l===0)return"0 Bytes";const t=1024,o=["Bytes","KB","MB","GB","TB"],n=Math.floor(Math.log(l)/Math.log(t));return parseFloat((l/Math.pow(t,n)).toFixed(2))+" "+o[n]},fileToBase64(l){return new Promise((t,o)=>{const n=new FileReader;n.onload=()=>{try{const r=n.result.split("base64,")[1];t(r)}catch{o(new Error("Failed to process the file"))}},n.onerror=a=>{o(new Error("Failed to read the file"))},n.readAsDataURL(l)})}}},Yt=Object.assign(Pt,{setup(l){return(t,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["mx-auto bg-white",l.disabled?"pointer-events-none opacity-50":""])},[l.multiple||!l.multiple&&t.files.length==0?(e.openBlock(),e.createElementBlock("div",{key:0,onDragover:o[1]||(o[1]=e.withModifiers((...n)=>t.onDragover&&t.onDragover(...n),["prevent"])),onDragleave:o[2]||(o[2]=e.withModifiers((...n)=>t.onDragleave&&t.onDragleave(...n),["prevent"])),onDrop:o[3]||(o[3]=e.withModifiers((...n)=>t.onDrop&&t.onDrop(...n),["prevent"])),class:e.normalizeClass(["border-2 border-dashed rounded-lg p-8 text-center transition-colors mb-8",t.dragover?"border-blue-500 bg-blue-50":"border-gray-300 hover:border-gray-400"])},[e.createElementVNode("div",_t,[e.createVNode(e.unref(d.UploadCloudIcon),{class:"w-12 h-12 text-gray-400"}),o[4]||(o[4]=e.createElementVNode("p",{class:"text-lg font-medium text-gray-700"},[e.createTextVNode(" Σύρετε το αρχείο εδώ, ή "),e.createElementVNode("label",{for:"file-input",class:"underline cursor-pointer text-dark hover:text-blue-600 focus:outline-none"}," αναζητήστε ")],-1)),e.createElementVNode("p",Dt," Supported file types: "+e.toDisplayString(l.fileTypes.join(", "))+" (max "+e.toDisplayString(l.maxSize)+") ",1)]),e.createElementVNode("input",{id:"file-input",type:"file",multiple:l.multiple,class:"hidden",onChange:o[0]||(o[0]=(...n)=>t.onFileSelected&&t.onFileSelected(...n)),accept:l.fileTypes.map(n=>`.${n}`).join(", ")},null,40,Mt)],34)):e.createCommentVNode("",!0),t.files.length>0?(e.openBlock(),e.createElementBlock("div",Tt,[e.createElementVNode("ul",Lt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.files,n=>(e.openBlock(),e.createElementBlock("li",{key:n.name,class:"flex items-center justify-between p-4 bg-white rounded-lg shadow"},[e.createElementVNode("div",It,[e.createVNode(e.unref(d.FileIcon),{class:"w-8 h-8 text-gray-400"}),e.createElementVNode("div",null,[e.createElementVNode("p",zt,e.toDisplayString(n.fileName),1),e.createElementVNode("p",At,e.toDisplayString(t.formatFileSize(n.fileSize)),1)])]),e.createElementVNode("div",Ot,[e.createVNode(e.unref(d.CheckCircleIcon),{class:"w-5 h-5 text-green-500"}),e.createElementVNode("button",{onClick:a=>t.removeFile(n),class:"text-gray-400 hover:text-red-500 focus:outline-none","aria-label":"Remove file"},[e.createVNode(e.unref(d.XIcon),{class:"w-5 h-5"})],8,Ft)])]))),128))])])):e.createCommentVNode("",!0)],2))}}),jt={class:"w-full"},Xt={class:"flex items-center gap-2 px-2 py-1 border rounded-t-md bg-gray-50"},Kt=["disabled","onClick","title"],Ht=["placeholder"],Ut={key:0,class:"text-sm text-red-500"},Wt={key:1,class:"text-sm text-gray-500"},qt=Object.assign({name:"kEditor",computed:{hasError(){return this.error!=null&&this.error!==!1}},props:{modelValue:String,disabled:{type:Boolean,default:!1},label:{type:String,default:null},error:{type:[String,Boolean],default:null},info:{type:String,default:null},placeholder:{type:String,default:"Πληκτρολογήστε κείμενο..."}},emits:["update:modelValue"],data(){return{defaultStyle:"w-full px-3 py-2 border rounded-b-lg transition shadow-sm focus:outline-none focus:ring-0 min-h-[150px] focus:border-green-500 bg-white placeholder-gray-400 !list-disc !list-inside prose",errorStyle:"border-red-500 focus:ring focus:ring-red-300' : 'border-gray-300 focus:ring focus:ring-blue-300",disabledStyle:"!bg-gray-100 !text-gray-400 !cursor-not-allowed editor pointer-events-none select-none",toolbar:[{command:"bold",icon:d.Bold,title:"Bold"},{command:"italic",icon:d.Italic,title:"Italic"},{command:"underline",icon:d.Underline,title:"Underline"},{command:"insertUnorderedList",icon:d.List,title:"Bullet list"}]}},mounted(){this.$refs.editor.innerHTML=this.modelValue||""},methods:{exec(l,t=null){document.execCommand(l,!1,t),this.updateValue()},updateValue(){const l=this.$refs.editor;l.querySelectorAll("div").forEach(o=>{if(!o.closest("ul")&&o.innerText.trim().length&&o.tagName.toLowerCase()!=="li"){const n=document.createElement("p");n.innerHTML=o.innerHTML,o.replaceWith(n)}});const t=l.innerHTML;this.$emit("update:modelValue",t)}},watch:{modelValue(l){this.$refs.editor&&this.$refs.editor.innerHTML!==l&&(this.$refs.editor.innerHTML=l||"")}}},{setup(l){return(t,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",{class:e.normalizeClass(["inputLabel",t.hasError?"text-red-500":"text-gray-700"])},e.toDisplayString(l.label),3),e.createElementVNode("div",jt,[e.createElementVNode("div",Xt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.toolbar,(n,a)=>(e.openBlock(),e.createElementBlock("button",{disabled:l.disabled,key:a,onClick:e.withModifiers(r=>t.exec(n.command,n.value),["prevent"]),title:n.title,class:e.normalizeClass(["text-gray-600 p-1.5 rounded",l.disabled==!1?"hover:text-black hover:bg-gray-200":""])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.icon),{class:"w-5 h-5"}))],10,Kt))),128))]),e.createElementVNode("div",{class:e.normalizeClass(["editor-content",[t.defaultStyle,t.hasError?t.errorStyle:"",l.disabled?t.disabledStyle:""]]),contenteditable:"",ref:"editor",onInput:o[0]||(o[0]=(...n)=>t.updateValue&&t.updateValue(...n)),onBlur:o[1]||(o[1]=(...n)=>t.updateValue&&t.updateValue(...n)),placeholder:l.placeholder},null,42,Ht),t.hasError&&l.error!==!0&&l.error!==""?(e.openBlock(),e.createElementBlock("div",Ut,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0),l.info!=null?(e.openBlock(),e.createElementBlock("div",Wt,e.toDisplayString(l.info),1)):e.createCommentVNode("",!0)])],64))}}),Rt={key:0,class:"flex items-center justify-center w-16 space-x-1"},Qt=u(Object.assign({name:"FourDotSpinner",props:{type:{type:String,default:"line"}}},{setup(l){return(t,o)=>l.type=="line"?(e.openBlock(),e.createElementBlock("div",Rt,o[0]||(o[0]=[e.createStaticVNode('<i class="ml-1 text-blue-500 pi pi-wave-pulse" data-v-f21017cb></i><div class="w-2 h-2 bg-blue-500 rounded-full animate-fade" style="animation-delay:0s;" data-v-f21017cb></div><div class="w-2 h-2 bg-blue-500 rounded-full animate-fade" style="animation-delay:0.15s;" data-v-f21017cb></div><div class="w-2 h-2 bg-blue-500 rounded-full animate-fade" style="animation-delay:0.3s;" data-v-f21017cb></div><div class="w-2 h-2 bg-blue-500 rounded-full animate-fade" style="animation-delay:0.45s;" data-v-f21017cb></div>',5)]))):l.type=="circle"?(e.openBlock(),e.createBlock(e.unref(d.Loader),{key:1,class:"w-6 h-6 mr-2 animate-spin",style:{"animation-duration":"1.5s"}})):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-f21017cb"]]),Gt={name:"kSelectButton",props:{modelValue:[String,Number,Array],options:{type:Array,required:!0},multiple:{type:Boolean,default:!1},valueKey:{type:String,default:"value"},labelKey:{type:String,default:"label"},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],computed:{baseClasses(){return"px-4 py-2 text-sm font-medium border-none focus:outline-none"},activeClasses(){return"bg-primary text-white"},inactiveClasses(){return"bg-white text-gray-700 hover:bg-gray-100"}},methods:{isSelected(l){const t=l[this.valueKey];return this.multiple&&Array.isArray(this.modelValue)?this.modelValue.includes(t):this.modelValue===t},toggle(l){if(this.disabled)return;const t=l[this.valueKey];if(this.multiple){const o=[...this.modelValue||[]],n=o.indexOf(t);n===-1?o.push(t):o.splice(n,1),this.$emit("update:modelValue",o)}else this.$emit("update:modelValue",this.modelValue===t?null:t)}}},Jt={class:"inline-flex overflow-hidden border border-gray-300 rounded-md",style:{width:"fit-content"}},Zt=["onClick","disabled"];function vt(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("div",Jt,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,(s,i)=>(e.openBlock(),e.createElementBlock("button",{key:s[o.valueKey],class:e.normalizeClass([r.baseClasses,r.isSelected(s)?r.activeClasses:r.inactiveClasses,i===0?"border-r":"",i===o.options.length-1?"border-l":"border-l border-r",o.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer"]),onClick:p=>r.toggle(s),disabled:o.disabled,type:"button"},e.toDisplayString(s[o.labelKey]),11,Zt))),128))])}const el=u(Gt,[["render",vt]]),tl={name:"kDatatable",components:{EasyDataTable:M},inheritAttrs:!1,props:{headers:{type:Array,required:!0},items:{type:Array,required:!0},search:{type:String,default:""},selectionMode:{type:String,default:"none",validator:l=>["none","single","multiple"].includes(l)},itemSelectable:{type:Function,default:()=>()=>!1},modelValue:{type:[Array,Object,String,Number,null],default:null}},emits:["update:modelValue"],data(){return{internalSelection:this.normalizeModelValue(this.modelValue)}},watch:{modelValue(l){this.internalSelection=this.normalizeModelValue(l)},internalSelection(l){this.selectionMode==="single"?this.$emit("update:modelValue",l[0]||null):this.selectionMode==="multiple"&&this.$emit("update:modelValue",l)}},methods:{normalizeModelValue(l){return this.selectionMode==="none"?[]:this.selectionMode==="single"?l?[l]:[]:this.selectionMode==="multiple"?Array.isArray(l)?l:[]:[]}}};function ll(l,t,o,n,a,r){const s=e.resolveComponent("EasyDataTable");return o.selectionMode!=="none"?(e.openBlock(),e.createBlock(s,e.mergeProps({key:0},l.$attrs,{headers:o.headers,items:o.items,search:o.search,"show-select":o.selectionMode!=="none","single-select":o.selectionMode==="single","items-selected":a.internalSelection,"onUpdate:itemsSelected":t[0]||(t[0]=i=>a.internalSelection=i),itemSelectable:o.itemSelectable,alternating:"","buttons-pagination":"","table-class-name":"customize-table"}),e.createSlots({_:2},[e.renderList(l.$slots,(i,p)=>({name:p,fn:e.withCtx(f=>[e.renderSlot(l.$slots,p,e.normalizeProps(e.guardReactiveProps(f)))])}))]),1040,["headers","items","search","show-select","single-select","items-selected","itemSelectable"])):(e.openBlock(),e.createBlock(s,e.mergeProps({key:1},l.$attrs,{headers:o.headers,items:o.items,search:o.search,"show-select":!1,alternating:"","buttons-pagination":"","table-class-name":"customize-table"}),e.createSlots({_:2},[e.renderList(l.$slots,(i,p)=>({name:p,fn:e.withCtx(f=>[e.renderSlot(l.$slots,p,e.normalizeProps(e.guardReactiveProps(f)))])}))]),1040,["headers","items","search"]))}const ol=u(tl,[["render",ll]]),nl={props:{name:{type:String,required:!0},size:{type:[String,Number],default:24},strokeWidth:{type:[String,Number],default:2},color:{type:String,default:"currentColor"}},computed:{iconComponent(){const l=this.name.split("-").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join("");return V[l]||null},iconProps(){return{size:this.size,strokeWidth:this.strokeWidth,color:this.color}}}};function rl(l,t,o,n,a,r){return e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.iconComponent),e.mergeProps(r.iconProps,{class:"inline-block"}),null,16)}const al=u(nl,[["render",rl]]),sl={name:"kMenu",data(){return{isOpen:!1}},methods:{toggleMenu(){this.isOpen=!this.isOpen},closeMenu(){this.isOpen=!1}},mounted(){document.addEventListener("click",this.handleClickOutside)},beforeUnmount(){document.removeEventListener("click",this.handleClickOutside)},methods:{toggleMenu(){this.isOpen=!this.isOpen},handleClickOutside(l){this.$el.contains(l.target)||this.closeMenu()},closeMenu(){this.isOpen=!1}}},il={class:"relative inline-block text-left"},dl={key:0,class:"absolute right-0 z-10 w-56 mt-2 bg-white rounded-md shadow-lg ring-1 ring-black ring-opacity-5"};function cl(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("div",il,[e.createElementVNode("div",{onClick:t[0]||(t[0]=(...s)=>r.toggleMenu&&r.toggleMenu(...s))},[e.renderSlot(l.$slots,"trigger")]),a.isOpen?(e.openBlock(),e.createElementBlock("div",dl,[e.renderSlot(l.$slots,"items")])):e.createCommentVNode("",!0)])}const ml=u(sl,[["render",cl]]),pl={name:"TagsInput",props:{modelValue:{type:Array,default:()=>[]},label:{type:String,default:null},info:{type:String,default:null},error:{type:[String,Boolean],default:null},disabled:{type:Boolean,default:!1},icon:{type:String,default:null},placeholder:{type:String,default:null},id:String},data(){return{newTag:""}},computed:{hasError(){return this.error!=null&&this.error!==!1},internalTags:{get(){return this.modelValue},set(l){this.$emit("update:modelValue",l)}}},methods:{addTag(){const l=this.newTag.trim();l&&!this.internalTags.includes(l)&&(this.internalTags=[...this.internalTags,l]),this.newTag=""},handleBackspace(l){this.newTag===""&&this.internalTags.length&&this.removeTag(this.internalTags.length-1)},removeTag(l){const t=[...this.internalTags];t.splice(l,1),this.internalTags=t}}},hl={class:"w-full"},ul={class:"flex flex-wrap items-center gap-2 p-2 border border-gray-300 rounded-xl shadow-sm min-h-[3rem]"},fl=["onClick"],gl=["placeholder"],yl={key:1,class:"text-sm text-red-500"},bl={key:2,class:"text-sm text-gray-500"};function kl(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("div",hl,[o.label!=null?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["inputLabel",r.hasError?"text-red-500":"text-gray-700"])},e.toDisplayString(o.label),3)):e.createCommentVNode("",!0),e.createElementVNode("div",ul,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.internalTags,(s,i)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:"flex items-center px-2 py-1 text-blue-700 bg-blue-100 rounded-full"},[e.createTextVNode(e.toDisplayString(s)+" ",1),e.createElementVNode("button",{onClick:p=>r.removeTag(i),class:"ml-1 text-blue-500 hover:text-blue-700"},"×",8,fl)]))),128)),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=s=>a.newTag=s),onKeydown:[t[1]||(t[1]=e.withKeys(e.withModifiers((...s)=>r.addTag&&r.addTag(...s),["prevent"]),["enter"])),t[2]||(t[2]=e.withKeys((...s)=>r.handleBackspace&&r.handleBackspace(...s),["backspace"]))],placeholder:o.placeholder,class:"flex-1 p-1 bg-transparent border-none focus:outline-none"},null,40,gl),[[e.vModelText,a.newTag]])]),r.hasError&&o.error!==!0&&o.error!==""?(e.openBlock(),e.createElementBlock("div",yl,e.toDisplayString(o.error),1)):e.createCommentVNode("",!0),o.info!=null?(e.openBlock(),e.createElementBlock("div",bl,e.toDisplayString(o.info),1)):e.createCommentVNode("",!0)])}const wl=u(pl,[["render",kl],["__scopeId","data-v-0dafb1cb"]]),xl={class:"relative w-full"},Vl=["placeholder"],El=Object.assign({name:"kSearch",props:{modelValue:{type:String,default:""},debounce:{type:[String,Number],default:300},placeholder:{type:String,default:"Αναζήτηση..."}},data(){return{defaultStyle:"w-full px-3 py-2 border rounded-lg transition shadow-sm focus:outline-none text-gray-700 focus:ring-0 focus:border-green-500 bg-white placeholder-gray-400",localValue:this.modelValue,debounceTimeout:null}},watch:{modelValue(l){this.localValue=l}},methods:{onInput(){clearTimeout(this.debounceTimeout),this.debounceTimeout=setTimeout(()=>{this.$emit("update:modelValue",this.localValue)},this.debounce)}},beforeUnmount(){clearTimeout(this.debounceTimeout)}},{setup(l){return(t,o)=>(e.openBlock(),e.createElementBlock("div",xl,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":o[0]||(o[0]=n=>t.localValue=n),onInput:o[1]||(o[1]=(...n)=>t.onInput&&t.onInput(...n)),class:e.normalizeClass(t.defaultStyle),placeholder:l.placeholder},null,42,Vl),[[e.vModelText,t.localValue]]),e.createVNode(e.unref(d.Search),{class:"absolute w-4 h-4 text-gray-400 -translate-y-1/2 pointer-events-none right-3 top-1/2"})]))}}),Cl={name:"KInputList",props:{modelValue:{type:Array,default:()=>[]},label:{type:String,default:""},hint:{type:String,default:"Paste items separated by comma, space, or new line."},placeholder:{type:String,default:`apple, banana orange
|
|
4
|
+
pear`},rows:{type:Number,default:6},trimItems:{type:Boolean,default:!0},filterEmpty:{type:Boolean,default:!0},id:{type:String,default:()=>`kinputlist-${Math.random().toString(36).slice(2,9)}`},displayJoiner:{type:String,default:`
|
|
5
|
+
`}},data(){return{textValue:this.joinArray(this.modelValue),isFocused:!1,isComposing:!1}},computed:{parsedArray(){return this.parseToArray(this.textValue)},count(){return this.parsedArray.length}},watch:{textValue(){this.isComposing||this.$emit("update:modelValue",this.parsedArray)},modelValue:{deep:!0,handler(l){if(this.isFocused||this.isComposing)return;const t=this.joinArray(l);t!==this.textValue&&(this.textValue=t)}}},methods:{onCompositionEnd(){this.isComposing=!1,this.$emit("update:modelValue",this.parsedArray)},parseToArray(l){if(!l)return[];let t=String(l).split(/[\s,]+/g);return this.trimItems&&(t=t.map(o=>String(o).trim())),this.filterEmpty&&(t=t.filter(o=>o.length>0)),t},joinArray(l){if(!Array.isArray(l))return"";const t=l.map(n=>{const a=String(n??"");return this.trimItems?a.trim():a});return(this.filterEmpty?t.filter(n=>n.length>0):t).join(this.displayJoiner)}}},Bl={class:"w-full"},Sl=["for"],$l=["id","placeholder","rows"],Nl={class:"flex items-center justify-between mt-2 text-xs text-gray-500"},_l={class:"font-semibold text-gray-700"},Dl={key:0};function Ml(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("div",Bl,[o.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:o.id,class:"block mb-1 text-sm font-medium text-gray-700"},e.toDisplayString(o.label),9,Sl)):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("textarea",{id:o.id,"onUpdate:modelValue":t[0]||(t[0]=s=>a.textValue=s),placeholder:o.placeholder,rows:o.rows,class:"block w-full p-3 transition bg-white border border-gray-300 shadow-sm outline-none rounded-xl focus:border-gray-400 focus:ring-2 focus:ring-gray-200",onFocus:t[1]||(t[1]=s=>a.isFocused=!0),onBlur:t[2]||(t[2]=s=>a.isFocused=!1),onCompositionstart:t[3]||(t[3]=s=>a.isComposing=!0),onCompositionend:t[4]||(t[4]=(...s)=>r.onCompositionEnd&&r.onCompositionEnd(...s))},null,40,$l),[[e.vModelText,a.textValue]]),e.createElementVNode("div",Nl,[e.createElementVNode("span",null,[t[5]||(t[5]=e.createTextVNode("Items: ")),e.createElementVNode("span",_l,e.toDisplayString(r.count),1)]),o.hint?(e.openBlock(),e.createElementBlock("span",Dl,e.toDisplayString(o.hint),1)):e.createCommentVNode("",!0)])])}const Tl=u(Cl,[["render",Ml]]),Ll={class:"relative flex items-center justify-between px-2 py-3"},Il={class:"flex-1 hidden w-full xl:flex"},zl=u(Object.assign({props:{fullWidth:{type:Boolean,default:null},class:{type:String,default:""}},data(){return{isMenuOpen:!1}},methods:{closeMenu(){this.isMenuOpen=!1},onMobileClick(l){l.target.closest("a, button, li")&&this.closeMenu()}},watch:{$route(){this.closeMenu()},isMenuOpen(l){document.body.style.overflow=l?"hidden":""}}},{__name:"kAppHeader",setup(l){return(t,o)=>(e.openBlock(),e.createElementBlock("header",null,[e.createElementVNode("div",{class:e.normalizeClass(["!border-gray-300 min-h-10 !border-b bg-white no-print",l.class])},[e.createElementVNode("div",{class:e.normalizeClass(l.fullWidth==null?"md:container md:mx-auto rounded-xl":"")},[e.createElementVNode("div",Ll,[e.createElementVNode("img",{alt:"dropdown icon",src:"https://support.instdrg.gr/logo_blank_bg.png",class:"mr-4 cursor-pointer max-h-[40px]",onClick:o[0]||(o[0]=n=>t.$router.push("/"))}),e.createElementVNode("div",{onClick:o[1]||(o[1]=n=>t.isMenuOpen=!t.isMenuOpen),class:"p-2 mr-4 rounded-md cursor-pointer xl:hidden"},[t.isMenuOpen?(e.openBlock(),e.createBlock(e.unref(d.X),{key:1})):(e.openBlock(),e.createBlock(e.unref(d.Menu),{key:0}))]),e.createElementVNode("div",Il,[e.renderSlot(t.$slots,"desktop",{},void 0,!0)])]),t.isMenuOpen?(e.openBlock(),e.createElementBlock("div",{key:0,class:"absolute z-50 w-full h-screen bg-white border-t border-gray-300 xl:hidden",onClick:o[2]||(o[2]=(...n)=>t.onMobileClick&&t.onMobileClick(...n))},[e.renderSlot(t.$slots,"mobile",{},void 0,!0)])):e.createCommentVNode("",!0)],2)],2)]))}}),[["__scopeId","data-v-f2d0fd55"]]),Al={props:{fullWidth:{type:Boolean,default:null},class:{type:String,default:""}},methods:{}},Ol={key:0,class:"container mx-auto"},Fl={key:1};function Pl(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("footer",{class:e.normalizeClass(["py-4 mt-auto text-gray-500 border-t no-print",o.class])},[o.fullWidth==null?(e.openBlock(),e.createElementBlock("div",Ol,[e.renderSlot(l.$slots,"default")])):(e.openBlock(),e.createElementBlock("div",Fl,[e.renderSlot(l.$slots,"default")]))],2)}const Yl=u(Al,[["render",Pl]]),jl={props:{fullWidth:{type:Boolean,default:null},class:{type:String,default:""}}};function Xl(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("main",null,[e.createElementVNode("div",{class:e.normalizeClass(o.class)},[e.createElementVNode("div",{class:e.normalizeClass(o.fullWidth==null?"md:container md:mx-auto rounded-xl":"")},[e.renderSlot(l.$slots,"default")],2)],2)])}const Kl=u(jl,[["render",Xl]]),Hl={},Ul={class:"py-16 text-white border bg-dark rounded-xl"},Wl={class:"container px-4 mx-auto text-center"};function ql(l,t,o,n,a,r){return e.openBlock(),e.createElementBlock("section",Ul,[e.createElementVNode("div",Wl,[e.renderSlot(l.$slots,"default")])])}const Rl=u(Hl,[["render",ql]]),Ql={name:"kToast",components:{CheckCircleIcon:d.CheckCircleIcon,XCircleIcon:d.XCircleIcon,AlertCircleIcon:d.AlertCircleIcon,InfoIcon:d.InfoIcon,X:d.X},data(){return{toasts:[],icons:{success:d.CheckCircleIcon,error:d.XCircleIcon,warning:d.AlertCircleIcon,info:d.InfoIcon},toastTitles:{success:"Success!",error:"Error!",warning:"Warning!",info:"Info!"}}},methods:{addToast(l,t,o=4e3){const n=Date.now()+Math.random();this.toasts.push({id:n,type:l,message:t}),setTimeout(()=>this.remove(n),o)},remove(l){const t=this.toasts.findIndex(o=>o.id===l);t!==-1&&this.toasts.splice(t,1)}}},Gl={class:"fixed flex flex-col items-end gap-3 z-6000 bottom-6 right-6",style:{"z-index":"5020"}},Jl={class:"flex items-start gap-2"},Zl={class:"flex-1"},vl={class:"text-sm leading-snug text-gray-700"},eo=["onClick"];function to(l,t,o,n,a,r){const s=e.resolveComponent("X");return e.openBlock(),e.createElementBlock("div",Gl,[e.createVNode(e.TransitionGroup,{name:"toast",tag:"div",class:"flex flex-col gap-3"},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.toasts,i=>(e.openBlock(),e.createElementBlock("div",{key:i.id,class:e.normalizeClass(["relative flex items-start gap-3 px-4 py-3 rounded-lg shadow-xl w-[90vw] max-w-sm border-l-8",["border-semantic-"+i.type+"-border","bg-semantic-"+i.type+"-bg"]])},[e.createElementVNode("div",Jl,[e.createElementVNode("span",{class:e.normalizeClass(["text-xl mt-0.5","text-semantic-"+i.type+"-text"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.icons[i.type])))],2),e.createElementVNode("div",Zl,[e.createElementVNode("p",{class:e.normalizeClass("font-bold mb-1 text-semantic-"+i.type+"-text")},e.toDisplayString(a.toastTitles[i.type]),3),e.createElementVNode("p",vl,e.toDisplayString(i.message),1)])]),e.createElementVNode("button",{onClick:p=>r.remove(i.id),class:"absolute text-xl leading-none text-gray-500 top-2 right-2 hover:text-black"},[e.createVNode(s,{class:"w-5 h-5"})],8,eo)],2))),128))]),_:1})])}const lo=u(Ql,[["render",to],["__scopeId","data-v-76f82ebf"]]),oo={install(l){const t=e.createApp(lo),o=document.createElement("div");document.body.appendChild(o);const n=t.mount(o);l.config.globalProperties.$toast={success:(a,r)=>n.addToast("success",a,r),error:(a,r)=>n.addToast("error",a,r),info:(a,r)=>n.addToast("info",a,r),warning:(a,r)=>n.addToast("warning",a,r)}}},no={key:0,class:"fixed inset-0 flex items-center justify-center bg-black bg-opacity-40",style:{"z-index":"1500"}},ro={class:"w-full max-w-md p-6 bg-white rounded-lg shadow-xl"},ao={class:"mb-2 text-lg font-semibold"},so={class:"mb-6 text-gray-700"},io=["innerHTML"],co={class:"flex justify-end gap-3"},mo={__name:"kConfirmDialog",setup(l,{expose:t}){const o=e.ref(!1),n=e.ref(""),a=e.ref(""),r=e.ref(!1);let s=null,i=null;function p(h){return n.value=h.title||"Confirm",a.value=h.message||"",i=h.onConfirm||null,o.value=!0,document.body.classList.add("overflow-hidden"),new Promise(b=>{s=b})}async function f(){if(i){r.value=!0;try{await i()}catch(h){console.error("Confirm action failed:",h)}finally{r.value=!1,m(!0)}}else m(!0)}function g(){m(!1)}function m(h){o.value=!1,document.body.classList.remove("overflow-hidden"),s(h)}return t({open:p}),(h,b)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[o.value?(e.openBlock(),e.createElementBlock("div",no,[e.createElementVNode("div",ro,[e.createElementVNode("h2",ao,e.toDisplayString(n.value),1),e.createElementVNode("div",so,[e.createElementVNode("span",{innerHTML:a.value},null,8,io)]),e.createElementVNode("div",co,[e.createVNode(w,{disabled:r.value,secondary:"",label:"Άκυρο",onClick:g},null,8,["disabled"]),e.createVNode(w,{loading:r.value,danger:"",label:"Συνέχεια",onClick:f},null,8,["loading"])])])])):e.createCommentVNode("",!0)]),_:1})]))}},po={install(l){const t=document.createElement("div");document.body.appendChild(t);const n=e.createApp(mo).mount(t);l.config.globalProperties.$confirm=a=>n.open(a)}},ho={name:"kInputDialog",components:{kButton:w},data(){return{visible:!1,title:"",message:"",placeholder:"",inputType:"text",confirmLabel:"OK",cancelLabel:"Cancel",value:"",loading:!1,error:"",onConfirmFn:null,validate:null,resolver:null}},methods:{open(l={}){return Object.assign(this,{title:l.title??"Input",message:l.message??"",placeholder:l.placeholder??"",inputType:l.inputType??"text",confirmLabel:l.confirmLabel??"OK",cancelLabel:l.cancelLabel??"Cancel",onConfirmFn:l.onConfirm??null,validate:l.validate??null,value:l.initialValue??"",error:""}),this.visible=!0,document.body.classList.add("overflow-hidden"),e.nextTick(()=>{var t;(t=this.$refs.inputEl)==null||t.focus()}),new Promise(t=>this.resolver=t)},async confirm(){if(this.validate){const l=this.validate(this.value);if(l!==!0){this.error=typeof l=="string"?l:"Invalid input.";return}}this.loading=!0;try{this.onConfirmFn&&await this.onConfirmFn(this.value),this.close({confirmed:!0,value:this.value})}catch(l){this.error=(l==null?void 0:l.message)||"Error"}finally{this.loading=!1}},cancel(){this.close({confirmed:!1,value:null})},close(l){var t;this.visible=!1,document.body.classList.remove("overflow-hidden"),(t=this.resolver)==null||t.call(this,l)}}},uo={class:"w-full max-w-md p-6 bg-white rounded-lg shadow-xl"},fo={class:"mb-2 text-lg font-semibold"},go={class:"mb-4 text-gray-700"},yo=["innerHTML"],bo={class:"mb-2"},ko=["type","placeholder","disabled"],wo={key:0,class:"mb-2 text-sm text-red-600"},xo={class:"flex justify-end gap-3 pt-2"};function Vo(l,t,o,n,a,r){const s=e.resolveComponent("kButton");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[a.visible?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed inset-0 flex items-center justify-center bg-black bg-opacity-40",style:{"z-index":"1500"},onKeydown:t[2]||(t[2]=e.withKeys(e.withModifiers((...i)=>r.cancel&&r.cancel(...i),["prevent"]),["esc"]))},[e.createElementVNode("div",uo,[e.createElementVNode("h2",fo,e.toDisplayString(a.title),1),e.createElementVNode("div",go,[e.createElementVNode("span",{innerHTML:a.message},null,8,yo)]),e.createElementVNode("div",bo,[e.withDirectives(e.createElementVNode("input",{type:a.inputType,"onUpdate:modelValue":t[0]||(t[0]=i=>a.value=i),placeholder:a.placeholder,class:"w-full px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-indigo-500",disabled:a.loading,ref:"inputEl",onKeyup:t[1]||(t[1]=e.withKeys((...i)=>r.confirm&&r.confirm(...i),["enter"]))},null,40,ko),[[e.vModelDynamic,a.value]])]),a.error?(e.openBlock(),e.createElementBlock("p",wo,e.toDisplayString(a.error),1)):e.createCommentVNode("",!0),e.createElementVNode("div",xo,[e.createVNode(s,{disabled:a.loading,secondary:"",label:a.cancelLabel,onClick:r.cancel},null,8,["disabled","label","onClick"]),e.createVNode(s,{loading:a.loading,primary:"",label:a.confirmLabel,onClick:r.confirm},null,8,["loading","label","onClick"])])])],32)):e.createCommentVNode("",!0)]),_:1})])}const Eo=u(ho,[["render",Vo]]);function Co(l){const t=document.createElement("div");document.body.appendChild(t);const o=e.createApp(l),n=o.mount(t);return{open:r=>n.open(r).finally(()=>{o.unmount(),t.remove()})}}const Bo={install(l){l.config.globalProperties.$prompt=(t={})=>Co(Eo).open(t)}},So={key:0,class:"fixed inset-0 flex items-center justify-center",style:{"z-index":"5000"}},$o={class:"flex-1 text-center"},No={key:0,class:"leading-relaxed text-gray-600 text"},_o=["innerHTML"],Do=u({__name:"kAlert",setup(l,{expose:t}){const o=e.ref(!1),n=e.ref(""),a=e.ref(""),r=e.ref("info");let s=null;const i={success:d.Check,error:d.XCircleIcon,warning:d.AlertTriangleIcon,info:d.Info},p={success:"Συνέχεια",error:"Προσπάθεια ξανά",warning:"Συνέχεια",info:"Συνέχεια"};function f(h){return n.value=h.title||"Alert",a.value=h.message||"",r.value=h.type||"info",o.value=!0,document.body.classList.add("overflow-hidden"),window.addEventListener("keydown",m),new Promise(b=>{s=b})}function g(){o.value=!1,document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",m),s(!0)}function m(h){h.key==="Enter"&&g()}return t({open:f}),(h,b)=>o.value?(e.openBlock(),e.createElementBlock("div",So,[b[0]||(b[0]=e.createElementVNode("div",{class:"absolute inset-0 bg-black/40 backdrop-blur-sm"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["relative w-full max-w-sm p-6 space-y-4 text-center bg-white shadow-2xl z-5010 rounded-2xl",["border-semantic-"+r.value+"-border"]]),style:{"z-index":"5010"}},[e.createElementVNode("div",{class:e.normalizeClass(["flex flex-row items-center pb-3 text-2xl font-bold",["text-semantic-"+r.value+"-text","border-semantic-"+r.value+"-border"]])},[e.createElementVNode("div",null,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(i[r.value]),{class:"w-10 h-10 mr-4"}))]),e.createElementVNode("div",$o,e.toDisplayString(n.value),1)],2),a.value?(e.openBlock(),e.createElementBlock("p",No,[e.createElementVNode("span",{innerHTML:a.value},null,8,_o)])):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["w-full px-6 py-3 font-semibold !text-white transition rounded-lg cursor-pointer text hover:opacity-90",["bg-semantic-"+r.value+"-button","border-semantic-"+r.value+"-border"]]),onClick:g},e.toDisplayString(p[r.value]),3)],2)])):e.createCommentVNode("",!0)}},[["__scopeId","data-v-0a10bc45"]]),Mo={install(l){const t=document.createElement("div");document.body.appendChild(t);const n=e.createApp(Do).mount(t);l.config.globalProperties.$alert={success:(a,r="Επιτυχία")=>n.open({title:r,message:a,type:"success"}),warning:(a,r="Προειδοποίηση")=>n.open({title:r,message:a,type:"warning"}),error:(a,r="Σφάλμα")=>n.open({title:r,message:a,type:"error"}),info:(a,r="Πληροφορία")=>n.open({title:r,message:a,type:"info"})}}},B=["top","bottom","left","right"],To={top:"bottom",bottom:"top",left:"right",right:"left"};function S(l){return B.includes(l.arg)?l.arg:Object.keys(l.modifiers||{}).find(o=>B.includes(o))||"top"}function $(l){const t=l.value;if(typeof t=="string")return l.modifiers.html?{mode:"html",html:t}:{mode:"text",text:t};if(t&&typeof t=="object"){if(t.component)return{mode:"component",component:t.component,props:t.props||{}};if(typeof t.html=="string")return{mode:"html",html:t.html};if(typeof t.text=="string")return{mode:"text",text:t.text}}return{mode:"text",text:""}}function Lo(){const l=document.createElement("div");l.style.position="fixed",l.style.zIndex="9999",l.style.pointerEvents="none";const t=document.createElement("div");t.className=`
|
|
6
|
+
px-2.5 py-1 rounded-md text-xs font-medium
|
|
7
|
+
text-white bg-gray-900 shadow-lg ring-1 ring-black/10
|
|
8
|
+
opacity-0 scale-95 transition duration-150 ease-out
|
|
9
|
+
`.replace(/\s+/g," ").trim(),t.style.whiteSpace="normal",t.style.maxWidth="min(32rem, calc(100vw - 2rem))",t.style.wordBreak="break-word",t.style.position="relative";const o=document.createElement("div");return o.className="absolute w-2 h-2 rotate-45 bg-gray-900",o.setAttribute("aria-hidden","true"),l.appendChild(t),l.appendChild(o),{wrapper:l,bubble:t,arrow:o}}function N(l,t,o,n,a){const r=window.innerWidth,s=window.innerHeight;return l>=a&&t>=a&&l+o<=r-a&&t+n<=s-a}function k(l,t,o){return Math.max(t,Math.min(o,l))}function Io({elRect:l,bSize:t,placement:o,gap:n,pad:a}){const r=window.innerWidth,s=window.innerHeight;function i(g){let m,h;switch(g){case"bottom":m=Math.round(l.left+l.width/2-t.width/2),h=Math.round(l.bottom+n);break;case"left":m=Math.round(l.left-t.width-n),h=Math.round(l.top+l.height/2-t.height/2);break;case"right":m=Math.round(l.right+n),h=Math.round(l.top+l.height/2-t.height/2);break;case"top":default:m=Math.round(l.left+l.width/2-t.width/2),h=Math.round(l.top-t.height-n);break}return{x:m,y:h,placement:g}}let p=i(o);if(N(p.x,p.y,t.width,t.height,a))return p;const f=i(To[o]);return N(f.x,f.y,t.width,t.height,a)?f:(p.x=k(p.x,a,Math.max(a,r-t.width-a)),p.y=k(p.y,a,Math.max(a,s-t.height-a)),p)}function zo({arrow:l,bubbleRect:t,elRect:o,pos:n}){const s=t.width-6,i=t.height-6,p=o.left+o.width/2,f=o.top+o.height/2,g=p-n.x,m=f-n.y;switch(n.placement){case"bottom":l.style.top="-4px",l.style.bottom="",l.style.left=`${k(g-4,6,s)}px`,l.style.right="";break;case"top":l.style.bottom="-4px",l.style.top="",l.style.left=`${k(g-4,6,s)}px`,l.style.right="";break;case"left":l.style.right="-4px",l.style.left="",l.style.top=`${k(m-4,6,i)}px`,l.style.bottom="";break;case"right":l.style.left="-4px",l.style.right="",l.style.top=`${k(m-4,6,i)}px`,l.style.bottom="";break}}function Ao(l){const t={opacity:l.style.opacity,transform:l.style.transform,visibility:l.style.visibility};l.style.visibility="hidden",l.style.opacity="1",l.style.transform="none";const o=l.getBoundingClientRect();return l.style.visibility=t.visibility,l.style.opacity=t.opacity,l.style.transform=t.transform,{width:o.width,height:o.height}}const Oo={mounted(l,t){const o=S(t),n=$(t);if(n.mode==="text"&&!n.text&&n.mode==="html"&&!n.html&&n.mode==="component"&&!n.component)return;const{wrapper:a,bubble:r,arrow:s}=Lo();document.body.appendChild(a);let i;n.mode==="text"&&(r.textContent=n.text),n.mode==="html"&&(r.innerHTML=n.html),n.mode==="component"&&(i=e.createApp({render:()=>e.h(n.component,n.props||{})}),i.mount(r));const p={placement:o,pad:8,gap:8};function f(){const _=l.getBoundingClientRect(),E=Ao(r),x=Io({elRect:_,bSize:E,placement:p.placement,gap:p.gap,pad:p.pad});a.style.left=`${x.x}px`,a.style.top=`${x.y}px`,zo({arrow:s,bubbleRect:{width:E.width,height:E.height},elRect:_,pos:x}),r.classList.remove("opacity-0","scale-95"),r.classList.add("opacity-100","scale-100"),s.style.display="block",p.placement=x.placement}function g(){r.classList.remove("opacity-100","scale-100"),r.classList.add("opacity-0","scale-95"),s.style.display="none"}const m=()=>f(),h=()=>g(),b=()=>{r.classList.contains("opacity-100")&&f()};l.addEventListener("mouseenter",m),l.addEventListener("mouseleave",h),l.addEventListener("focus",m),l.addEventListener("blur",h),window.addEventListener("scroll",b,!0),window.addEventListener("resize",b),l._tooltip={wrapper:a,bubble:r,arrow:s,onEnter:m,onLeave:h,onScrollOrResize:b,app:i}},updated(l,t){const o=l._tooltip;if(!o)return;const n=S(t);n!==void 0&&(o.prefPlacement=n);const a=$(t);if(a.mode==="text")o.bubble.textContent=a.text||"";else if(a.mode==="html")o.bubble.innerHTML=a.html||"";else if(a.mode==="component"){o.app&&o.app.unmount();const r=e.createApp({render:()=>e.h(a.component,a.props||{})});r.mount(o.bubble),o.app=r}},unmounted(l){const t=l._tooltip;t&&(t.app&&t.app.unmount(),t.bubble.remove(),t.arrow.remove(),t.wrapper.remove(),l.removeEventListener("mouseenter",t.onEnter),l.removeEventListener("mouseleave",t.onLeave),l.removeEventListener("focus",t.onEnter),l.removeEventListener("blur",t.onLeave),window.removeEventListener("scroll",t.onScrollOrResize,!0),window.removeEventListener("resize",t.onScrollOrResize),delete l._tooltip)}},Fo={install(l){l.directive("tooltip",Oo)}},Po={theme:{extend:{colors:{default:"#1B2A33",header:"#256D96",background:"#FEFCF6",accent:"#8C1F1F",primary:"#1E5F7C",secondary:"#f5f7fa",success:"#228B22",danger:"#A32626",dark:"#12303F",semantic:{success:{bg:"#D1FAE5",border:"#86efac",text:"#065F46",disabled:"#A7F3D0",button:"#228B22"},warning:{bg:"#FEF3C7",border:"#fde047",text:"#92400E",disabled:"#FDE68A",button:"#92400E"},error:{bg:"#FEE2E2",border:"#fca5a5",text:"#991B1B",disabled:"#FCA5A5",button:"#A32626"},info:{bg:"#DBEAFE",border:"#93c5fd",text:"#1E3A8A",disabled:"#BFDBFE",button:"#1E3A8A"}}}}},plugins:[]};c.alertPlugin=Mo,c.confirmPlugin=po,c.inputDialogPlugin=Bo,c.kAppFooter=Yl,c.kAppHeader=zl,c.kAppMain=Kl,c.kArrayList=Tl,c.kButton=w,c.kChip=P,c.kCode=H,c.kDatatable=ol,c.kDateSelector=Xe,c.kDialog=Z,c.kDrawer=ae,c.kEditor=qt,c.kHero=Rl,c.kIcon=al,c.kInput=Ee,c.kMenu=ml,c.kMessage=I,c.kSearch=El,c.kSelect=dt,c.kSelectButton=el,c.kSpinner=Qt,c.kTable=gt,c.kTabs=Vt,c.kTags=wl,c.kToggle=Nt,c.kToolbar=Je,c.kUploader=Yt,c.tailwindPreset=Po,c.toastPlugin=oo,c.tooltipPlugin=Fo,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
package/index.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// UI Components
|
|
2
|
+
import kMessage from './src/ui/kMessage.vue'
|
|
3
|
+
import kButton from './src/ui/kButton.vue'
|
|
4
|
+
import kChip from './src/ui/kChip.vue'
|
|
5
|
+
import kCode from './src/ui/kCode.vue'
|
|
6
|
+
import kDialog from './src/ui/kDialog.vue'
|
|
7
|
+
import kDrawer from './src/ui/kDrawer.vue'
|
|
8
|
+
import kInput from './src/ui/kInput.vue'
|
|
9
|
+
import kDateSelector from './src/ui/kDateSelector.vue'
|
|
10
|
+
import kToolbar from './src/ui/kToolbar.vue'
|
|
11
|
+
import kSelect from './src/ui/kSelect.vue'
|
|
12
|
+
import kTable from './src/ui/kTable.vue'
|
|
13
|
+
import kTabs from './src/ui/kTabs.vue'
|
|
14
|
+
import kToggle from './src/ui/kToggle.vue'
|
|
15
|
+
import kUploader from './src/ui/kUploader.vue'
|
|
16
|
+
import kEditor from './src/ui/kEditor.vue'
|
|
17
|
+
import kSpinner from './src/ui/kSpinner.vue'
|
|
18
|
+
import kSelectButton from './src/ui/kSelectButton.vue'
|
|
19
|
+
import kDatatable from './src/ui/kDatatable.vue'
|
|
20
|
+
import kIcon from './src/ui/kIcon.vue'
|
|
21
|
+
import kMenu from './src/ui/kMenu.vue'
|
|
22
|
+
import kTags from './src/ui/kTags.vue'
|
|
23
|
+
import kSearch from './src/ui/kSearch.vue'
|
|
24
|
+
import kArrayList from './src/ui/kArrayList.vue'
|
|
25
|
+
|
|
26
|
+
// Layout Components
|
|
27
|
+
import kAppHeader from './src/layout/kAppHeader.vue'
|
|
28
|
+
import kAppFooter from './src/layout/kAppFooter.vue'
|
|
29
|
+
import kAppMain from './src/layout/kAppMain.vue'
|
|
30
|
+
import kHero from './src/layout/kHero.vue'
|
|
31
|
+
|
|
32
|
+
// Toast/Confirm/Alert Plugins
|
|
33
|
+
import toastPlugin from './src/plugins/toastPlugin.js'
|
|
34
|
+
import confirmPlugin from './src/plugins/confirmPlugin.js'
|
|
35
|
+
import inputDialogPlugin from './src/plugins/inputDialogPlugin.js'
|
|
36
|
+
import alertPlugin from './src/plugins/alertPlugin.js'
|
|
37
|
+
import tooltipPlugin from './src/plugins/tooltipPlugin.js'
|
|
38
|
+
|
|
39
|
+
// Tailwind preset
|
|
40
|
+
import tailwindPreset from './tailwind-preset.js'
|
|
41
|
+
|
|
42
|
+
// Named exports (tree-shaking friendly)
|
|
43
|
+
export {
|
|
44
|
+
// UI Components
|
|
45
|
+
kMessage, kCode, kToolbar, kTable, kTabs, kChip, kSpinner, kDatatable, kIcon, kMenu,
|
|
46
|
+
|
|
47
|
+
// Form Components
|
|
48
|
+
kButton, kSelect, kUploader, kToggle, kInput, kDateSelector, kEditor, kSelectButton, kTags, kSearch, kArrayList,
|
|
49
|
+
|
|
50
|
+
// Dialogs
|
|
51
|
+
kDialog, kDrawer,
|
|
52
|
+
|
|
53
|
+
// Layout Components
|
|
54
|
+
kAppHeader, kAppFooter, kAppMain, kHero,
|
|
55
|
+
|
|
56
|
+
// Plugins
|
|
57
|
+
toastPlugin, confirmPlugin, alertPlugin, tooltipPlugin, inputDialogPlugin,
|
|
58
|
+
|
|
59
|
+
// Tailwind Config
|
|
60
|
+
tailwindPreset
|
|
61
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ketekny-ui-kit",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.3",
|
|
5
|
+
"description": "A Vue 3 UI component library with Tailwind CSS styling",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"index.js",
|
|
9
|
+
"src/",
|
|
10
|
+
"dist/",
|
|
11
|
+
"tailwind-preset.js",
|
|
12
|
+
"tailwind.config.js"
|
|
13
|
+
],
|
|
14
|
+
"keywords": ["vue", "ui", "components", "tailwind", "library"],
|
|
15
|
+
"peerDependencies": {
|
|
16
|
+
"vue": "^3.0.0"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "vite",
|
|
20
|
+
"build": "vite build",
|
|
21
|
+
"preview": "vite preview"
|
|
22
|
+
},
|
|
23
|
+
"author": "",
|
|
24
|
+
"license": "ISC",
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@vitejs/plugin-vue": "^5.2.4",
|
|
27
|
+
"autoprefixer": "^10.4.21",
|
|
28
|
+
"postcss": "^8.5.3",
|
|
29
|
+
"sass-embedded": "^1.89.0",
|
|
30
|
+
"tailwindcss": "^3.4.17",
|
|
31
|
+
"vite": "^6.3.5"
|
|
32
|
+
},
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@primeuix/themes": "^1.1.1",
|
|
35
|
+
"@vuepic/vue-datepicker": "^11.0.2",
|
|
36
|
+
"json-editor-vue": "^0.18.1",
|
|
37
|
+
"lucide-vue-next": "^0.511.0",
|
|
38
|
+
"moment": "^2.30.1",
|
|
39
|
+
"primeicons": "^7.0.0",
|
|
40
|
+
"primevue": "^4.3.4",
|
|
41
|
+
"quill": "^2.0.3",
|
|
42
|
+
"simple-code-editor": "^2.0.9",
|
|
43
|
+
"vue3-easy-data-table": "^1.5.47"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
// directives/v-tooltip.js
|
|
2
|
+
import { createApp, h } from 'vue'
|
|
3
|
+
|
|
4
|
+
const PLACEMENTS = ['top', 'bottom', 'left', 'right']
|
|
5
|
+
const OPPOSITE = { top: 'bottom', bottom: 'top', left: 'right', right: 'left' }
|
|
6
|
+
|
|
7
|
+
function resolvePlacement(binding) {
|
|
8
|
+
if (PLACEMENTS.includes(binding.arg)) return binding.arg // v-tooltip:bottom
|
|
9
|
+
const mod = Object.keys(binding.modifiers || {}).find(m => PLACEMENTS.includes(m)) // v-tooltip.bottom
|
|
10
|
+
return mod || 'top'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function normalizeValue(binding) {
|
|
14
|
+
const v = binding.value
|
|
15
|
+
if (typeof v === 'string') {
|
|
16
|
+
if (binding.modifiers.html) return { mode: 'html', html: v }
|
|
17
|
+
return { mode: 'text', text: v }
|
|
18
|
+
}
|
|
19
|
+
if (v && typeof v === 'object') {
|
|
20
|
+
if (v.component) return { mode: 'component', component: v.component, props: v.props || {} }
|
|
21
|
+
if (typeof v.html === 'string') return { mode: 'html', html: v.html }
|
|
22
|
+
if (typeof v.text === 'string') return { mode: 'text', text: v.text }
|
|
23
|
+
}
|
|
24
|
+
return { mode: 'text', text: '' }
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function createNodes() {
|
|
28
|
+
const wrapper = document.createElement('div')
|
|
29
|
+
wrapper.style.position = 'fixed' // viewport positioning
|
|
30
|
+
wrapper.style.zIndex = '9999'
|
|
31
|
+
wrapper.style.pointerEvents = 'none'
|
|
32
|
+
|
|
33
|
+
const bubble = document.createElement('div')
|
|
34
|
+
bubble.className = `
|
|
35
|
+
px-2.5 py-1 rounded-md text-xs font-medium
|
|
36
|
+
text-white bg-gray-900 shadow-lg ring-1 ring-black/10
|
|
37
|
+
opacity-0 scale-95 transition duration-150 ease-out
|
|
38
|
+
`.replace(/\s+/g, ' ').trim()
|
|
39
|
+
bubble.style.whiteSpace = 'normal' // allow wrap when needed
|
|
40
|
+
bubble.style.maxWidth = 'min(32rem, calc(100vw - 2rem))' // clamp width
|
|
41
|
+
bubble.style.wordBreak = 'break-word'
|
|
42
|
+
bubble.style.position = 'relative'
|
|
43
|
+
|
|
44
|
+
const arrow = document.createElement('div')
|
|
45
|
+
arrow.className = 'absolute w-2 h-2 rotate-45 bg-gray-900'
|
|
46
|
+
arrow.setAttribute('aria-hidden', 'true')
|
|
47
|
+
|
|
48
|
+
wrapper.appendChild(bubble)
|
|
49
|
+
wrapper.appendChild(arrow)
|
|
50
|
+
return { wrapper, bubble, arrow }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function fitsWithinViewport(x, y, w, h, pad) {
|
|
54
|
+
const vw = window.innerWidth
|
|
55
|
+
const vh = window.innerHeight
|
|
56
|
+
return (
|
|
57
|
+
x >= pad &&
|
|
58
|
+
y >= pad &&
|
|
59
|
+
x + w <= vw - pad &&
|
|
60
|
+
y + h <= vh - pad
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function clamp(n, min, max) {
|
|
65
|
+
return Math.max(min, Math.min(max, n))
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function computePosition({ elRect, bSize, placement, gap, pad }) {
|
|
69
|
+
// Try preferred, then opposite, then keep preferred but clamp
|
|
70
|
+
const vw = window.innerWidth
|
|
71
|
+
const vh = window.innerHeight
|
|
72
|
+
|
|
73
|
+
function coords(pl) {
|
|
74
|
+
let x, y
|
|
75
|
+
switch (pl) {
|
|
76
|
+
case 'bottom':
|
|
77
|
+
x = Math.round(elRect.left + elRect.width / 2 - bSize.width / 2)
|
|
78
|
+
y = Math.round(elRect.bottom + gap)
|
|
79
|
+
break
|
|
80
|
+
case 'left':
|
|
81
|
+
x = Math.round(elRect.left - bSize.width - gap)
|
|
82
|
+
y = Math.round(elRect.top + elRect.height / 2 - bSize.height / 2)
|
|
83
|
+
break
|
|
84
|
+
case 'right':
|
|
85
|
+
x = Math.round(elRect.right + gap)
|
|
86
|
+
y = Math.round(elRect.top + elRect.height / 2 - bSize.height / 2)
|
|
87
|
+
break
|
|
88
|
+
case 'top':
|
|
89
|
+
default:
|
|
90
|
+
x = Math.round(elRect.left + elRect.width / 2 - bSize.width / 2)
|
|
91
|
+
y = Math.round(elRect.top - bSize.height - gap)
|
|
92
|
+
break
|
|
93
|
+
}
|
|
94
|
+
return { x, y, placement: pl }
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 1) preferred
|
|
98
|
+
let pos = coords(placement)
|
|
99
|
+
if (fitsWithinViewport(pos.x, pos.y, bSize.width, bSize.height, pad)) {
|
|
100
|
+
return pos
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// 2) flip
|
|
104
|
+
const flipped = coords(OPPOSITE[placement])
|
|
105
|
+
if (fitsWithinViewport(flipped.x, flipped.y, bSize.width, bSize.height, pad)) {
|
|
106
|
+
return flipped
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 3) clamp (shift) while keeping preferred
|
|
110
|
+
pos.x = clamp(pos.x, pad, Math.max(pad, vw - bSize.width - pad))
|
|
111
|
+
pos.y = clamp(pos.y, pad, Math.max(pad, vh - bSize.height - pad))
|
|
112
|
+
return pos
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function placeArrow({ arrow, bubbleRect, elRect, pos }) {
|
|
116
|
+
// Position arrow along the edge closest to the trigger
|
|
117
|
+
// Keep it within bubble bounds
|
|
118
|
+
const AR = 4 // half arrow size (w=8 => 4px offset)
|
|
119
|
+
const minEdge = 6
|
|
120
|
+
const maxX = bubbleRect.width - minEdge
|
|
121
|
+
const maxY = bubbleRect.height - minEdge
|
|
122
|
+
|
|
123
|
+
// center (in viewport) of trigger
|
|
124
|
+
const anchorX = elRect.left + elRect.width / 2
|
|
125
|
+
const anchorY = elRect.top + elRect.height / 2
|
|
126
|
+
|
|
127
|
+
// arrow position relative to bubble (bubble top-left is pos.x,pos.y)
|
|
128
|
+
const relX = anchorX - pos.x
|
|
129
|
+
const relY = anchorY - pos.y
|
|
130
|
+
|
|
131
|
+
switch (pos.placement) {
|
|
132
|
+
case 'bottom':
|
|
133
|
+
arrow.style.top = `-${AR}px`
|
|
134
|
+
arrow.style.bottom = ''
|
|
135
|
+
arrow.style.left = `${clamp(relX - AR, minEdge, maxX)}px`
|
|
136
|
+
arrow.style.right = ''
|
|
137
|
+
break
|
|
138
|
+
case 'top':
|
|
139
|
+
arrow.style.bottom = `-${AR}px`
|
|
140
|
+
arrow.style.top = ''
|
|
141
|
+
arrow.style.left = `${clamp(relX - AR, minEdge, maxX)}px`
|
|
142
|
+
arrow.style.right = ''
|
|
143
|
+
break
|
|
144
|
+
case 'left':
|
|
145
|
+
arrow.style.right = `-${AR}px`
|
|
146
|
+
arrow.style.left = ''
|
|
147
|
+
arrow.style.top = `${clamp(relY - AR, minEdge, maxY)}px`
|
|
148
|
+
arrow.style.bottom = ''
|
|
149
|
+
break
|
|
150
|
+
case 'right':
|
|
151
|
+
arrow.style.left = `-${AR}px`
|
|
152
|
+
arrow.style.right = ''
|
|
153
|
+
arrow.style.top = `${clamp(relY - AR, minEdge, maxY)}px`
|
|
154
|
+
arrow.style.bottom = ''
|
|
155
|
+
break
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function measureBubble(bubble) {
|
|
160
|
+
// Temporarily show to measure without transition flicker
|
|
161
|
+
const prev = {
|
|
162
|
+
opacity: bubble.style.opacity,
|
|
163
|
+
transform: bubble.style.transform,
|
|
164
|
+
visibility: bubble.style.visibility,
|
|
165
|
+
}
|
|
166
|
+
bubble.style.visibility = 'hidden'
|
|
167
|
+
bubble.style.opacity = '1'
|
|
168
|
+
bubble.style.transform = 'none'
|
|
169
|
+
const rect = bubble.getBoundingClientRect()
|
|
170
|
+
bubble.style.visibility = prev.visibility
|
|
171
|
+
bubble.style.opacity = prev.opacity
|
|
172
|
+
bubble.style.transform = prev.transform
|
|
173
|
+
return { width: rect.width, height: rect.height }
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export default {
|
|
177
|
+
mounted(el, binding) {
|
|
178
|
+
const placementPref = resolvePlacement(binding)
|
|
179
|
+
const content = normalizeValue(binding)
|
|
180
|
+
if (
|
|
181
|
+
(content.mode === 'text' && !content.text) &&
|
|
182
|
+
(content.mode === 'html' && !content.html) &&
|
|
183
|
+
(content.mode === 'component' && !content.component)
|
|
184
|
+
) return
|
|
185
|
+
|
|
186
|
+
const { wrapper, bubble, arrow } = createNodes()
|
|
187
|
+
document.body.appendChild(wrapper)
|
|
188
|
+
|
|
189
|
+
// Render content
|
|
190
|
+
let app
|
|
191
|
+
if (content.mode === 'text') bubble.textContent = content.text
|
|
192
|
+
if (content.mode === 'html') bubble.innerHTML = content.html
|
|
193
|
+
if (content.mode === 'component') {
|
|
194
|
+
app = createApp({ render: () => h(content.component, content.props || {}) })
|
|
195
|
+
app.mount(bubble)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const state = {
|
|
199
|
+
placement: placementPref,
|
|
200
|
+
pad: 8, // viewport padding
|
|
201
|
+
gap: 8 // distance from trigger
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function positionAndShow() {
|
|
205
|
+
const elRect = el.getBoundingClientRect()
|
|
206
|
+
const bSize = measureBubble(bubble)
|
|
207
|
+
const pos = computePosition({ elRect, bSize, placement: state.placement, gap: state.gap, pad: state.pad })
|
|
208
|
+
|
|
209
|
+
// Apply position
|
|
210
|
+
wrapper.style.left = `${pos.x}px`
|
|
211
|
+
wrapper.style.top = `${pos.y}px`
|
|
212
|
+
|
|
213
|
+
// Arrow
|
|
214
|
+
placeArrow({ arrow, bubbleRect: { width: bSize.width, height: bSize.height }, elRect, pos })
|
|
215
|
+
|
|
216
|
+
// Show
|
|
217
|
+
bubble.classList.remove('opacity-0', 'scale-95')
|
|
218
|
+
bubble.classList.add('opacity-100', 'scale-100')
|
|
219
|
+
arrow.style.display = 'block'
|
|
220
|
+
|
|
221
|
+
// Save current placement (may be flipped)
|
|
222
|
+
state.placement = pos.placement
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function hide() {
|
|
226
|
+
bubble.classList.remove('opacity-100', 'scale-100')
|
|
227
|
+
bubble.classList.add('opacity-0', 'scale-95')
|
|
228
|
+
arrow.style.display = 'none'
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// Events
|
|
232
|
+
const onEnter = () => positionAndShow()
|
|
233
|
+
const onLeave = () => hide()
|
|
234
|
+
const onScrollOrResize = () => {
|
|
235
|
+
// If visible, keep it clamped while scrolling/resizing
|
|
236
|
+
if (bubble.classList.contains('opacity-100')) positionAndShow()
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
el.addEventListener('mouseenter', onEnter)
|
|
240
|
+
el.addEventListener('mouseleave', onLeave)
|
|
241
|
+
el.addEventListener('focus', onEnter)
|
|
242
|
+
el.addEventListener('blur', onLeave)
|
|
243
|
+
window.addEventListener('scroll', onScrollOrResize, true)
|
|
244
|
+
window.addEventListener('resize', onScrollOrResize)
|
|
245
|
+
|
|
246
|
+
el._tooltip = { wrapper, bubble, arrow, onEnter, onLeave, onScrollOrResize, app }
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
updated(el, binding) {
|
|
250
|
+
const t = el._tooltip
|
|
251
|
+
if (!t) return
|
|
252
|
+
|
|
253
|
+
const nextPlacement = resolvePlacement(binding)
|
|
254
|
+
if (nextPlacement !== undefined) {
|
|
255
|
+
// Update preferred placement; flip may still occur on show
|
|
256
|
+
// We store it on a small state on the element:
|
|
257
|
+
t.prefPlacement = nextPlacement
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
const content = normalizeValue(binding)
|
|
261
|
+
if (content.mode === 'text') t.bubble.textContent = content.text || ''
|
|
262
|
+
else if (content.mode === 'html') t.bubble.innerHTML = content.html || ''
|
|
263
|
+
else if (content.mode === 'component') {
|
|
264
|
+
if (t.app) t.app.unmount()
|
|
265
|
+
const app = createApp({ render: () => h(content.component, content.props || {}) })
|
|
266
|
+
app.mount(t.bubble)
|
|
267
|
+
t.app = app
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
|
|
271
|
+
unmounted(el) {
|
|
272
|
+
const t = el._tooltip
|
|
273
|
+
if (!t) return
|
|
274
|
+
if (t.app) t.app.unmount()
|
|
275
|
+
t.bubble.remove()
|
|
276
|
+
t.arrow.remove()
|
|
277
|
+
t.wrapper.remove()
|
|
278
|
+
el.removeEventListener('mouseenter', t.onEnter)
|
|
279
|
+
el.removeEventListener('mouseleave', t.onLeave)
|
|
280
|
+
el.removeEventListener('focus', t.onEnter)
|
|
281
|
+
el.removeEventListener('blur', t.onLeave)
|
|
282
|
+
window.removeEventListener('scroll', t.onScrollOrResize, true)
|
|
283
|
+
window.removeEventListener('resize', t.onScrollOrResize)
|
|
284
|
+
delete el._tooltip
|
|
285
|
+
}
|
|
286
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<template lang="">
|
|
2
|
+
<footer class="py-4 mt-auto text-gray-500 border-t no-print" :class="class">
|
|
3
|
+
<div class="container mx-auto" v-if="fullWidth == null">
|
|
4
|
+
<slot></slot>
|
|
5
|
+
</div>
|
|
6
|
+
<div v-else><slot></slot></div>
|
|
7
|
+
</footer>
|
|
8
|
+
</template>
|
|
9
|
+
<script setup></script>
|
|
10
|
+
|
|
11
|
+
<script>
|
|
12
|
+
export default {
|
|
13
|
+
props: {
|
|
14
|
+
fullWidth: { type: Boolean, default: null },
|
|
15
|
+
class: { type: String, default: "" },
|
|
16
|
+
},
|
|
17
|
+
methods: {},
|
|
18
|
+
};
|
|
19
|
+
</script>
|
|
20
|
+
<style lang="css" scoped></style>
|