@a-vision-software/vue-input-components 1.1.50 → 1.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/favicon.ico +0 -0
- package/dist/src/components/FileUpload.vue.d.ts +27 -0
- package/dist/src/components/TextInput.vue.d.ts +57 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/main.d.ts +1 -0
- package/dist/src/router/index.d.ts +2 -0
- package/dist/src/types.d.ts +33 -0
- package/dist/vue-input-components.cjs.js +1 -0
- package/dist/vue-input-components.css +1 -0
- package/dist/vue-input-components.es.js +295 -0
- package/dist/vue-input-components.umd.js +1 -0
- package/package.json +6 -3
- package/src/App.vue +0 -48
- package/src/assets/colors.css +0 -67
- package/src/assets/logo.svg +0 -1
- package/src/assets/main.css +0 -160
- package/src/components/FileUpload.vue +0 -310
- package/src/components/TextInput.vue +0 -368
- package/src/index.ts +0 -6
- package/src/main.ts +0 -21
- package/src/router/index.ts +0 -27
- package/src/types.d.ts +0 -23
- package/src/types.ts +0 -36
- package/src/views/DashboardView.vue +0 -57
- package/src/views/FileUploadTestView.vue +0 -177
- package/src/views/TextInputTestView.vue +0 -348
package/dist/favicon.ico
ADDED
|
Binary file
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
icon?: string | undefined;
|
|
3
|
+
uploadUrl?: string | undefined;
|
|
4
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
5
|
+
"upload-complete": (files: File[]) => void;
|
|
6
|
+
"upload-error": (error: string) => void;
|
|
7
|
+
"files-selected": (files: File[]) => void;
|
|
8
|
+
"start-upload": (files: File[]) => void;
|
|
9
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
10
|
+
icon?: string | undefined;
|
|
11
|
+
uploadUrl?: string | undefined;
|
|
12
|
+
}>>> & Readonly<{
|
|
13
|
+
"onUpload-complete"?: ((files: File[]) => any) | undefined;
|
|
14
|
+
"onUpload-error"?: ((error: string) => any) | undefined;
|
|
15
|
+
"onFiles-selected"?: ((files: File[]) => any) | undefined;
|
|
16
|
+
"onStart-upload"?: ((files: File[]) => any) | undefined;
|
|
17
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
18
|
+
export default _default;
|
|
19
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
20
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
21
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
22
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
23
|
+
} : {
|
|
24
|
+
type: import('vue').PropType<T[K]>;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
2
|
+
modelValue: string;
|
|
3
|
+
label?: string | undefined;
|
|
4
|
+
type?: string | undefined;
|
|
5
|
+
icon?: string | undefined;
|
|
6
|
+
placeholder?: string | undefined;
|
|
7
|
+
required?: boolean | undefined;
|
|
8
|
+
disabled?: boolean | undefined;
|
|
9
|
+
error?: string | undefined;
|
|
10
|
+
success?: string | undefined;
|
|
11
|
+
labelPosition?: "top" | "left" | undefined;
|
|
12
|
+
labelAlign?: "left" | "right" | "center" | undefined;
|
|
13
|
+
totalWidth?: string | undefined;
|
|
14
|
+
inputWidth?: string | undefined;
|
|
15
|
+
labelWidth?: string | undefined;
|
|
16
|
+
autosave?: ((value: string) => Promise<void>) | undefined;
|
|
17
|
+
isTextarea?: boolean | undefined;
|
|
18
|
+
maxHeight?: string | undefined;
|
|
19
|
+
height?: string | undefined;
|
|
20
|
+
}>>, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
21
|
+
"update:modelValue": (value: string) => void;
|
|
22
|
+
changed: () => void;
|
|
23
|
+
saved: () => void;
|
|
24
|
+
}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
|
|
25
|
+
modelValue: string;
|
|
26
|
+
label?: string | undefined;
|
|
27
|
+
type?: string | undefined;
|
|
28
|
+
icon?: string | undefined;
|
|
29
|
+
placeholder?: string | undefined;
|
|
30
|
+
required?: boolean | undefined;
|
|
31
|
+
disabled?: boolean | undefined;
|
|
32
|
+
error?: string | undefined;
|
|
33
|
+
success?: string | undefined;
|
|
34
|
+
labelPosition?: "top" | "left" | undefined;
|
|
35
|
+
labelAlign?: "left" | "right" | "center" | undefined;
|
|
36
|
+
totalWidth?: string | undefined;
|
|
37
|
+
inputWidth?: string | undefined;
|
|
38
|
+
labelWidth?: string | undefined;
|
|
39
|
+
autosave?: ((value: string) => Promise<void>) | undefined;
|
|
40
|
+
isTextarea?: boolean | undefined;
|
|
41
|
+
maxHeight?: string | undefined;
|
|
42
|
+
height?: string | undefined;
|
|
43
|
+
}>>> & Readonly<{
|
|
44
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
45
|
+
onChanged?: (() => any) | undefined;
|
|
46
|
+
onSaved?: (() => any) | undefined;
|
|
47
|
+
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
48
|
+
export default _default;
|
|
49
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
50
|
+
type __VLS_TypePropsToRuntimeProps<T> = {
|
|
51
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
52
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
53
|
+
} : {
|
|
54
|
+
type: import('vue').PropType<T[K]>;
|
|
55
|
+
required: true;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
|
|
3
|
+
export interface TextInputProps {
|
|
4
|
+
modelValue: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
maxlength?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface FileUploadProps {
|
|
13
|
+
modelValue: File[];
|
|
14
|
+
label?: string;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
required?: boolean;
|
|
19
|
+
multiple?: boolean;
|
|
20
|
+
accept?: string;
|
|
21
|
+
maxSize?: number;
|
|
22
|
+
uploadUrl?: string;
|
|
23
|
+
}
|
|
24
|
+
export interface FileUploadEmits {
|
|
25
|
+
(e: 'update:modelValue', files: File[]): void;
|
|
26
|
+
(e: 'files-selected', files: File[]): void;
|
|
27
|
+
(e: 'start-upload', files: File[]): void;
|
|
28
|
+
(e: 'upload-progress', progress: number): void;
|
|
29
|
+
(e: 'upload-success', response: any): void;
|
|
30
|
+
(e: 'upload-error', error: Error): void;
|
|
31
|
+
}
|
|
32
|
+
export type TextInputComponent = Component<TextInputProps>;
|
|
33
|
+
export type FileUploadComponent = Component<FileUploadProps>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),V=["for"],N=["id","type","value","placeholder","required","disabled"],S=["id","value","placeholder","required","disabled"],T={key:3,class:"status-indicator required-indicator"},D={key:0,class:"status-indicator saved-indicator"},F={key:0,class:"status-indicator changed-indicator"},$={key:4,class:"error-message"},U={key:5,class:"message success-message"},M=e.defineComponent({__name:"TextInput",props:{modelValue:{},label:{},type:{},icon:{},placeholder:{},required:{type:Boolean},disabled:{type:Boolean},error:{},success:{},labelPosition:{},labelAlign:{},totalWidth:{},inputWidth:{},labelWidth:{},autosave:{type:Function},isTextarea:{type:Boolean},maxHeight:{},height:{}},emits:["update:modelValue","changed","saved"],setup(v,{emit:f}){const s=v,c=f,d=e.computed(()=>`input-${Math.random().toString(36).substr(2,9)}`),a=e.ref(!1),u=e.ref(!1),p=e.ref(!1),n=e.ref(null),i=e.ref(null),h=e.ref(null),k=e.computed(()=>s.label?s.labelPosition==="left"&&s.labelWidth?{"grid-template-columns":`${s.labelWidth} 1fr`}:{}:{}),B=async t=>{if(s.autosave)try{await s.autosave(t),s.error||(c("saved"),a.value=!0,u.value=!1,setTimeout(()=>{a.value=!1},3e3))}catch(m){console.error("Autosave failed:",m)}},E=t=>{n.value&&clearTimeout(n.value),i.value&&clearTimeout(i.value),s.error||(u.value=!0),i.value=window.setTimeout(()=>{c("changed"),p.value=!0},500),n.value=window.setTimeout(()=>{B(t)},1500)},_=()=>{var t;(t=h.value)==null||t.focus()},b=t=>{t.style.height="auto",t.style.height=`${t.scrollHeight}px`},y=t=>{const m=t.target.value;c("update:modelValue",m),E(m),b(t.target)};return e.onUnmounted(()=>{n.value&&clearTimeout(n.value),i.value&&clearTimeout(i.value)}),(t,m)=>{const o=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-input",{[`label-${t.labelPosition}`]:t.label,[`label-align-${t.labelAlign}`]:t.label}]),style:e.normalizeStyle([{width:t.totalWidth||"100%"},k.value,{"--max-textarea-height":s.maxHeight||s.height||"14rem","--textarea-height":s.height||"5.5rem"}])},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:d.value,class:"label"},e.toDisplayString(t.label),9,V)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["input-wrapper",{"has-error":t.error,"has-icon":t.icon}])},[t.icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:"icon-wrapper",onClick:_},[e.createVNode(o,{icon:t.icon,class:"icon"},null,8,["icon"])])):e.createCommentVNode("",!0),t.isTextarea?(e.openBlock(),e.createElementBlock("textarea",{key:2,id:d.value,value:t.modelValue,placeholder:t.placeholder,required:t.required,disabled:t.disabled,class:"input",onInput:y,ref_key:"inputRef",ref:h},null,40,S)):(e.openBlock(),e.createElementBlock("input",{key:1,id:d.value,type:t.type,value:t.modelValue,placeholder:t.placeholder,required:t.required,disabled:t.disabled,class:"input",onInput:y,ref_key:"inputRef",ref:h},null,40,N)),t.required&&!a.value&&!u.value?(e.openBlock(),e.createElementBlock("span",T,"required")):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[a.value&&!t.error?(e.openBlock(),e.createElementBlock("span",D,"saved")):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[u.value&&!t.error?(e.openBlock(),e.createElementBlock("span",F,"changed")):e.createCommentVNode("",!0)]),_:1}),t.error?(e.openBlock(),e.createElementBlock("div",$,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0),t.success?(e.openBlock(),e.createElementBlock("span",U,e.toDisplayString(t.success),1)):e.createCommentVNode("",!0)],2)],6)}}}),w=(v,f)=>{const s=v.__vccOpts||v;for(const[c,d]of f)s[c]=d;return s},I=w(M,[["__scopeId","data-v-cc2497d0"]]),z={class:"file-upload"},q={class:"upload-content"},A={key:0},L={key:1,class:"selected-files"},P={class:"file-name"},W={class:"file-size"},H={key:0,class:"error-message"},R={key:1,class:"progress-bar"},O=20*1024*1024,j=e.defineComponent({__name:"FileUpload",props:{icon:{},uploadUrl:{}},emits:["upload-complete","upload-error","files-selected","start-upload"],setup(v,{emit:f}){const s=v,c=f,d=e.ref(null),a=e.ref([]),u=e.ref(!1),p=e.ref(0),n=e.ref(""),i=e.ref(null),h=o=>{if(o===0)return"0 Bytes";const l=1024,r=["Bytes","KB","MB","GB"],g=Math.floor(Math.log(o)/Math.log(l));return parseFloat((o/Math.pow(l,g)).toFixed(2))+" "+r[g]},k=o=>o.size>O?(n.value=`File "${o.name}" exceeds the maximum size of 20MB`,!1):!0,B=()=>{u.value=!0},E=()=>{u.value=!1},_=o=>{var l;if(u.value=!1,n.value="",(l=o.dataTransfer)!=null&&l.files){const r=Array.from(o.dataTransfer.files);r.every(k)&&(a.value=[...a.value,...r])}},b=()=>{var o;(o=d.value)==null||o.click()},y=o=>{n.value="";const l=o.target;if(l.files){const r=Array.from(l.files);r.every(k)&&(a.value=[...a.value,...r])}l.value=""},t=async()=>{if(!s.uploadUrl){n.value="No upload URL provided";return}if(a.value.length===0){n.value="No files selected";return}const o=new FormData;a.value.forEach(l=>{o.append("files",l)});try{const l=new XMLHttpRequest;l.upload.addEventListener("progress",r=>{r.lengthComputable&&(p.value=r.loaded/r.total*100)}),l.addEventListener("load",()=>{if(l.status>=200&&l.status<300)i.value={type:"success",message:"Upload completed successfully"},c("upload-complete",a.value),a.value=[],p.value=0;else throw new Error(`Upload failed with status ${l.status}`)}),l.addEventListener("error",()=>{throw new Error("Upload failed")}),l.open("POST",s.uploadUrl),l.send(o)}catch(l){const r=l instanceof Error?l.message:"Upload failed";n.value=r,i.value={type:"error",message:r},c("upload-error",r)}},m=()=>{c("start-upload",a.value)};return e.watch(a,o=>{o.length>0&&(s.uploadUrl?t():c("files-selected",o))}),(o,l)=>{const r=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",z,[e.createElementVNode("div",{class:e.normalizeClass(["upload-area",{"is-dragging":u.value,"has-files":a.value.length>0}]),onDragenter:e.withModifiers(B,["prevent"]),onDragleave:e.withModifiers(E,["prevent"]),onDragover:l[0]||(l[0]=e.withModifiers(()=>{},["prevent"])),onDrop:e.withModifiers(_,["prevent"]),onClick:b},[e.createElementVNode("input",{ref_key:"fileInput",ref:d,type:"file",multiple:"",class:"file-input",onChange:y},null,544),e.createElementVNode("div",q,[e.createVNode(r,{icon:["fas",o.icon||"upload"]},null,8,["icon"]),a.value.length===0?(e.openBlock(),e.createElementBlock("p",A,"Drag & drop files here or click to select")):(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("p",null,e.toDisplayString(a.value.length)+" file(s) selected",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(g,C)=>(e.openBlock(),e.createElementBlock("div",{key:C,class:"file-info"},[e.createElementVNode("span",P,e.toDisplayString(g.name),1),e.createElementVNode("span",W,e.toDisplayString(h(g.size)),1)]))),128))]))])],34),n.value?(e.openBlock(),e.createElementBlock("div",H,e.toDisplayString(n.value),1)):e.createCommentVNode("",!0),p.value>0&&p.value<100?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("div",{class:"progress",style:e.normalizeStyle({width:`${p.value}%`})},null,4)])):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["status-message",i.value.type])},e.toDisplayString(i.value.message),3)):e.createCommentVNode("",!0),a.value.length>0&&!o.uploadUrl?(e.openBlock(),e.createElementBlock("button",{key:3,class:"upload-button",onClick:m}," Upload Files ")):e.createCommentVNode("",!0)])}}}),X=w(j,[["__scopeId","data-v-75b2aeea"]]);exports.FileUpload=X;exports.TextInput=I;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.text-input[data-v-cc2497d0]{display:grid;gap:.5rem;width:100%;margin-top:.7rem}.text-input.label-top[data-v-cc2497d0]{grid-template-rows:auto 1fr}.text-input.label-left[data-v-cc2497d0]{grid-template-columns:30% 1fr;align-items:start;gap:1rem}.text-input.label-left .label[data-v-cc2497d0]{padding-top:.75rem;width:100%}.label[data-v-cc2497d0]{font-weight:500;color:var(--text-color);text-align:left}.label-align-left .label[data-v-cc2497d0]{text-align:left}.label-align-right .label[data-v-cc2497d0]{text-align:right}.label-align-center .label[data-v-cc2497d0]{text-align:center}.required[data-v-cc2497d0]{color:var(--danger-color);margin-left:.25rem}.input-wrapper[data-v-cc2497d0]{position:relative;display:grid;grid-template-columns:1fr;border:1px solid var(--border-color);border-radius:.5rem;transition:all .2s ease;width:100%;min-height:2rem;background:var(--input-bg-color)}.input-wrapper.has-icon[data-v-cc2497d0]{grid-template-columns:auto 1fr}.input-wrapper[data-v-cc2497d0]:focus-within{border-color:var(--primary-color);box-shadow:0 0 0 3px var(--shadow-color)}.input-wrapper.has-error[data-v-cc2497d0]{border-color:var(--danger-color);border-bottom-left-radius:0;border-bottom-right-radius:0}.icon-wrapper[data-v-cc2497d0]{display:grid;place-items:start;padding:1rem;border-right:1px solid var(--border-color);cursor:pointer;overflow:hidden}.icon-wrapper[data-v-cc2497d0]:hover{background-color:var(--input-bg-hover)}.icon[data-v-cc2497d0]{color:var(--text-muted);font-size:1rem}.input[data-v-cc2497d0]{padding:.75rem 1rem;border:none;outline:none;font-size:1rem;color:var(--text-color);background:transparent;width:100%;line-height:var(--line-height)}.input[data-v-cc2497d0]::placeholder{color:var(--text-muted)}.input[data-v-cc2497d0]:disabled{background-color:var(--input-bg-disabled);cursor:not-allowed}.message[data-v-cc2497d0]{position:absolute;bottom:-1.5rem;left:0;font-size:.75rem;white-space:nowrap}.error-message[data-v-cc2497d0]{position:absolute;bottom:0;left:0;right:0;padding:.25rem .75rem;background-color:var(--danger-color);color:#fff;font-size:.75rem;border-radius:0 0 .5rem .5rem;transform:translateY(100%);transition:transform .2s ease;line-height:var(--line-height);z-index:1}.success-message[data-v-cc2497d0]{position:absolute;bottom:-1.5rem;left:0;color:var(--success-color);font-size:.75rem;line-height:var(--line-height)}.status-indicator[data-v-cc2497d0]{position:absolute;top:-.1rem;right:.5rem;font-size:.75rem;color:var(--text-muted);line-height:0px;background-color:var(--input-bg-color);padding:0 .25rem}.saved-indicator[data-v-cc2497d0]{color:var(--success-color)}.changed-indicator[data-v-cc2497d0]{color:var(--warning-color)}.fade-enter-active[data-v-cc2497d0],.fade-leave-active[data-v-cc2497d0]{transition:opacity .2s ease}.fade-enter-from[data-v-cc2497d0],.fade-leave-to[data-v-cc2497d0]{opacity:0}textarea[data-v-cc2497d0]{min-height:var(--textarea-height, 5.5rem);max-height:var(--max-textarea-height, 14rem);overflow-y:auto;resize:none}.file-upload[data-v-75b2aeea]{width:100%;max-width:600px;margin:0 auto}.upload-area[data-v-75b2aeea]{border:2px dashed var(--upload-border-color);border-radius:.75rem;padding:2rem;text-align:center;cursor:pointer;transition:all .3s ease;background-color:var(--upload-bg-color)}.upload-area.is-dragging[data-v-75b2aeea]{border-color:var(--upload-dragging-border-color);background-color:var(--upload-dragging-bg-color)}.upload-area.has-files[data-v-75b2aeea]{border-color:var(--upload-has-files-border-color);background-color:var(--upload-has-files-bg-color)}.file-input[data-v-75b2aeea]{display:none}.upload-content[data-v-75b2aeea]{display:flex;flex-direction:column;align-items:center;gap:1rem}.upload-content[data-v-75b2aeea] svg{font-size:2rem;color:var(--upload-icon-color)}.selected-files[data-v-75b2aeea]{width:100%;text-align:left;max-height:200px;overflow-y:auto;font-size:.75rem;color:var(--upload-text-color)}.file-info[data-v-75b2aeea]{display:flex;justify-content:space-between;align-items:center;padding:.125rem 0;border-radius:.25rem;gap:.5rem;font-size:.75rem}.file-name[data-v-75b2aeea]{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin-right:.5rem}.file-size[data-v-75b2aeea]{font-size:.7rem;flex-shrink:0}.error-message[data-v-75b2aeea]{color:var(--error-text-color);margin-top:1rem;font-size:.875rem}.progress-bar[data-v-75b2aeea]{height:.5rem;background-color:var(--progress-bg-color);border-radius:.25rem;margin-top:1rem;overflow:hidden}.progress[data-v-75b2aeea]{height:100%;background-color:var(--progress-color);transition:width .3s ease}.status-message[data-v-75b2aeea]{margin-top:1rem;padding:.5rem;border-radius:.25rem;font-size:.875rem}.status-message.success[data-v-75b2aeea]{background-color:var(--success-bg-color);color:var(--success-text-color)}.status-message.error[data-v-75b2aeea]{background-color:var(--error-bg-color);color:var(--error-text-color)}.upload-button[data-v-75b2aeea]{margin-top:1rem;padding:.5rem 1rem;background-color:var(--primary-color);color:#fff;border:none;border-radius:.25rem;cursor:pointer;font-size:.875rem;transition:background-color .3s ease}.upload-button[data-v-75b2aeea]:hover{background-color:var(--primary-color-light)}
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
import { defineComponent as z, computed as q, ref as u, onUnmounted as H, resolveComponent as A, createElementBlock as s, openBlock as o, normalizeStyle as L, normalizeClass as I, createCommentVNode as c, createElementVNode as h, toDisplayString as m, createVNode as U, Transition as B, withCtx as M, watch as N, withModifiers as F, Fragment as P, renderList as R } from "vue";
|
|
2
|
+
const O = ["for"], X = ["id", "type", "value", "placeholder", "required", "disabled"], j = ["id", "value", "placeholder", "required", "disabled"], G = {
|
|
3
|
+
key: 3,
|
|
4
|
+
class: "status-indicator required-indicator"
|
|
5
|
+
}, K = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "status-indicator saved-indicator"
|
|
8
|
+
}, Z = {
|
|
9
|
+
key: 0,
|
|
10
|
+
class: "status-indicator changed-indicator"
|
|
11
|
+
}, J = {
|
|
12
|
+
key: 4,
|
|
13
|
+
class: "error-message"
|
|
14
|
+
}, Q = {
|
|
15
|
+
key: 5,
|
|
16
|
+
class: "message success-message"
|
|
17
|
+
}, Y = /* @__PURE__ */ z({
|
|
18
|
+
__name: "TextInput",
|
|
19
|
+
props: {
|
|
20
|
+
modelValue: {},
|
|
21
|
+
label: {},
|
|
22
|
+
type: {},
|
|
23
|
+
icon: {},
|
|
24
|
+
placeholder: {},
|
|
25
|
+
required: { type: Boolean },
|
|
26
|
+
disabled: { type: Boolean },
|
|
27
|
+
error: {},
|
|
28
|
+
success: {},
|
|
29
|
+
labelPosition: {},
|
|
30
|
+
labelAlign: {},
|
|
31
|
+
totalWidth: {},
|
|
32
|
+
inputWidth: {},
|
|
33
|
+
labelWidth: {},
|
|
34
|
+
autosave: { type: Function },
|
|
35
|
+
isTextarea: { type: Boolean },
|
|
36
|
+
maxHeight: {},
|
|
37
|
+
height: {}
|
|
38
|
+
},
|
|
39
|
+
emits: ["update:modelValue", "changed", "saved"],
|
|
40
|
+
setup(_, { emit: b }) {
|
|
41
|
+
const r = _, p = b, f = q(() => `input-${Math.random().toString(36).substr(2, 9)}`), t = u(!1), v = u(!1), g = u(!1), i = u(null), d = u(null), k = u(null), T = q(() => r.label ? r.labelPosition === "left" && r.labelWidth ? {
|
|
42
|
+
"grid-template-columns": `${r.labelWidth} 1fr`
|
|
43
|
+
} : {} : {}), C = async (e) => {
|
|
44
|
+
if (r.autosave)
|
|
45
|
+
try {
|
|
46
|
+
await r.autosave(e), r.error || (p("saved"), t.value = !0, v.value = !1, setTimeout(() => {
|
|
47
|
+
t.value = !1;
|
|
48
|
+
}, 3e3));
|
|
49
|
+
} catch (y) {
|
|
50
|
+
console.error("Autosave failed:", y);
|
|
51
|
+
}
|
|
52
|
+
}, D = (e) => {
|
|
53
|
+
i.value && clearTimeout(i.value), d.value && clearTimeout(d.value), r.error || (v.value = !0), d.value = window.setTimeout(() => {
|
|
54
|
+
p("changed"), g.value = !0;
|
|
55
|
+
}, 500), i.value = window.setTimeout(() => {
|
|
56
|
+
C(e);
|
|
57
|
+
}, 1500);
|
|
58
|
+
}, E = () => {
|
|
59
|
+
var e;
|
|
60
|
+
(e = k.value) == null || e.focus();
|
|
61
|
+
}, S = (e) => {
|
|
62
|
+
e.style.height = "auto", e.style.height = `${e.scrollHeight}px`;
|
|
63
|
+
}, $ = (e) => {
|
|
64
|
+
const y = e.target.value;
|
|
65
|
+
p("update:modelValue", y), D(y), S(e.target);
|
|
66
|
+
};
|
|
67
|
+
return H(() => {
|
|
68
|
+
i.value && clearTimeout(i.value), d.value && clearTimeout(d.value);
|
|
69
|
+
}), (e, y) => {
|
|
70
|
+
const l = A("font-awesome-icon");
|
|
71
|
+
return o(), s("div", {
|
|
72
|
+
class: I(["text-input", {
|
|
73
|
+
[`label-${e.labelPosition}`]: e.label,
|
|
74
|
+
[`label-align-${e.labelAlign}`]: e.label
|
|
75
|
+
}]),
|
|
76
|
+
style: L([
|
|
77
|
+
{ width: e.totalWidth || "100%" },
|
|
78
|
+
T.value,
|
|
79
|
+
{
|
|
80
|
+
"--max-textarea-height": r.maxHeight || r.height || "14rem",
|
|
81
|
+
"--textarea-height": r.height || "5.5rem"
|
|
82
|
+
}
|
|
83
|
+
])
|
|
84
|
+
}, [
|
|
85
|
+
e.label ? (o(), s("label", {
|
|
86
|
+
key: 0,
|
|
87
|
+
for: f.value,
|
|
88
|
+
class: "label"
|
|
89
|
+
}, m(e.label), 9, O)) : c("", !0),
|
|
90
|
+
h("div", {
|
|
91
|
+
class: I(["input-wrapper", {
|
|
92
|
+
"has-error": e.error,
|
|
93
|
+
"has-icon": e.icon
|
|
94
|
+
}])
|
|
95
|
+
}, [
|
|
96
|
+
e.icon ? (o(), s("div", {
|
|
97
|
+
key: 0,
|
|
98
|
+
class: "icon-wrapper",
|
|
99
|
+
onClick: E
|
|
100
|
+
}, [
|
|
101
|
+
U(l, {
|
|
102
|
+
icon: e.icon,
|
|
103
|
+
class: "icon"
|
|
104
|
+
}, null, 8, ["icon"])
|
|
105
|
+
])) : c("", !0),
|
|
106
|
+
e.isTextarea ? (o(), s("textarea", {
|
|
107
|
+
key: 2,
|
|
108
|
+
id: f.value,
|
|
109
|
+
value: e.modelValue,
|
|
110
|
+
placeholder: e.placeholder,
|
|
111
|
+
required: e.required,
|
|
112
|
+
disabled: e.disabled,
|
|
113
|
+
class: "input",
|
|
114
|
+
onInput: $,
|
|
115
|
+
ref_key: "inputRef",
|
|
116
|
+
ref: k
|
|
117
|
+
}, null, 40, j)) : (o(), s("input", {
|
|
118
|
+
key: 1,
|
|
119
|
+
id: f.value,
|
|
120
|
+
type: e.type,
|
|
121
|
+
value: e.modelValue,
|
|
122
|
+
placeholder: e.placeholder,
|
|
123
|
+
required: e.required,
|
|
124
|
+
disabled: e.disabled,
|
|
125
|
+
class: "input",
|
|
126
|
+
onInput: $,
|
|
127
|
+
ref_key: "inputRef",
|
|
128
|
+
ref: k
|
|
129
|
+
}, null, 40, X)),
|
|
130
|
+
e.required && !t.value && !v.value ? (o(), s("span", G, "required")) : c("", !0),
|
|
131
|
+
U(B, { name: "fade" }, {
|
|
132
|
+
default: M(() => [
|
|
133
|
+
t.value && !e.error ? (o(), s("span", K, "saved")) : c("", !0)
|
|
134
|
+
]),
|
|
135
|
+
_: 1
|
|
136
|
+
}),
|
|
137
|
+
U(B, { name: "fade" }, {
|
|
138
|
+
default: M(() => [
|
|
139
|
+
v.value && !e.error ? (o(), s("span", Z, "changed")) : c("", !0)
|
|
140
|
+
]),
|
|
141
|
+
_: 1
|
|
142
|
+
}),
|
|
143
|
+
e.error ? (o(), s("div", J, m(e.error), 1)) : c("", !0),
|
|
144
|
+
e.success ? (o(), s("span", Q, m(e.success), 1)) : c("", !0)
|
|
145
|
+
], 2)
|
|
146
|
+
], 6);
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
}), V = (_, b) => {
|
|
150
|
+
const r = _.__vccOpts || _;
|
|
151
|
+
for (const [p, f] of b)
|
|
152
|
+
r[p] = f;
|
|
153
|
+
return r;
|
|
154
|
+
}, de = /* @__PURE__ */ V(Y, [["__scopeId", "data-v-cc2497d0"]]), x = { class: "file-upload" }, ee = { class: "upload-content" }, ae = { key: 0 }, le = {
|
|
155
|
+
key: 1,
|
|
156
|
+
class: "selected-files"
|
|
157
|
+
}, te = { class: "file-name" }, se = { class: "file-size" }, oe = {
|
|
158
|
+
key: 0,
|
|
159
|
+
class: "error-message"
|
|
160
|
+
}, re = {
|
|
161
|
+
key: 1,
|
|
162
|
+
class: "progress-bar"
|
|
163
|
+
}, ne = 20 * 1024 * 1024, ie = /* @__PURE__ */ z({
|
|
164
|
+
__name: "FileUpload",
|
|
165
|
+
props: {
|
|
166
|
+
icon: {},
|
|
167
|
+
uploadUrl: {}
|
|
168
|
+
},
|
|
169
|
+
emits: ["upload-complete", "upload-error", "files-selected", "start-upload"],
|
|
170
|
+
setup(_, { emit: b }) {
|
|
171
|
+
const r = _, p = b, f = u(null), t = u([]), v = u(!1), g = u(0), i = u(""), d = u(null), k = (l) => {
|
|
172
|
+
if (l === 0) return "0 Bytes";
|
|
173
|
+
const a = 1024, n = ["Bytes", "KB", "MB", "GB"], w = Math.floor(Math.log(l) / Math.log(a));
|
|
174
|
+
return parseFloat((l / Math.pow(a, w)).toFixed(2)) + " " + n[w];
|
|
175
|
+
}, T = (l) => l.size > ne ? (i.value = `File "${l.name}" exceeds the maximum size of 20MB`, !1) : !0, C = () => {
|
|
176
|
+
v.value = !0;
|
|
177
|
+
}, D = () => {
|
|
178
|
+
v.value = !1;
|
|
179
|
+
}, E = (l) => {
|
|
180
|
+
var a;
|
|
181
|
+
if (v.value = !1, i.value = "", (a = l.dataTransfer) != null && a.files) {
|
|
182
|
+
const n = Array.from(l.dataTransfer.files);
|
|
183
|
+
n.every(T) && (t.value = [...t.value, ...n]);
|
|
184
|
+
}
|
|
185
|
+
}, S = () => {
|
|
186
|
+
var l;
|
|
187
|
+
(l = f.value) == null || l.click();
|
|
188
|
+
}, $ = (l) => {
|
|
189
|
+
i.value = "";
|
|
190
|
+
const a = l.target;
|
|
191
|
+
if (a.files) {
|
|
192
|
+
const n = Array.from(a.files);
|
|
193
|
+
n.every(T) && (t.value = [...t.value, ...n]);
|
|
194
|
+
}
|
|
195
|
+
a.value = "";
|
|
196
|
+
}, e = async () => {
|
|
197
|
+
if (!r.uploadUrl) {
|
|
198
|
+
i.value = "No upload URL provided";
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (t.value.length === 0) {
|
|
202
|
+
i.value = "No files selected";
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
const l = new FormData();
|
|
206
|
+
t.value.forEach((a) => {
|
|
207
|
+
l.append("files", a);
|
|
208
|
+
});
|
|
209
|
+
try {
|
|
210
|
+
const a = new XMLHttpRequest();
|
|
211
|
+
a.upload.addEventListener("progress", (n) => {
|
|
212
|
+
n.lengthComputable && (g.value = n.loaded / n.total * 100);
|
|
213
|
+
}), a.addEventListener("load", () => {
|
|
214
|
+
if (a.status >= 200 && a.status < 300)
|
|
215
|
+
d.value = {
|
|
216
|
+
type: "success",
|
|
217
|
+
message: "Upload completed successfully"
|
|
218
|
+
}, p("upload-complete", t.value), t.value = [], g.value = 0;
|
|
219
|
+
else
|
|
220
|
+
throw new Error(`Upload failed with status ${a.status}`);
|
|
221
|
+
}), a.addEventListener("error", () => {
|
|
222
|
+
throw new Error("Upload failed");
|
|
223
|
+
}), a.open("POST", r.uploadUrl), a.send(l);
|
|
224
|
+
} catch (a) {
|
|
225
|
+
const n = a instanceof Error ? a.message : "Upload failed";
|
|
226
|
+
i.value = n, d.value = {
|
|
227
|
+
type: "error",
|
|
228
|
+
message: n
|
|
229
|
+
}, p("upload-error", n);
|
|
230
|
+
}
|
|
231
|
+
}, y = () => {
|
|
232
|
+
p("start-upload", t.value);
|
|
233
|
+
};
|
|
234
|
+
return N(t, (l) => {
|
|
235
|
+
l.length > 0 && (r.uploadUrl ? e() : p("files-selected", l));
|
|
236
|
+
}), (l, a) => {
|
|
237
|
+
const n = A("font-awesome-icon");
|
|
238
|
+
return o(), s("div", x, [
|
|
239
|
+
h("div", {
|
|
240
|
+
class: I(["upload-area", { "is-dragging": v.value, "has-files": t.value.length > 0 }]),
|
|
241
|
+
onDragenter: F(C, ["prevent"]),
|
|
242
|
+
onDragleave: F(D, ["prevent"]),
|
|
243
|
+
onDragover: a[0] || (a[0] = F(() => {
|
|
244
|
+
}, ["prevent"])),
|
|
245
|
+
onDrop: F(E, ["prevent"]),
|
|
246
|
+
onClick: S
|
|
247
|
+
}, [
|
|
248
|
+
h("input", {
|
|
249
|
+
ref_key: "fileInput",
|
|
250
|
+
ref: f,
|
|
251
|
+
type: "file",
|
|
252
|
+
multiple: "",
|
|
253
|
+
class: "file-input",
|
|
254
|
+
onChange: $
|
|
255
|
+
}, null, 544),
|
|
256
|
+
h("div", ee, [
|
|
257
|
+
U(n, {
|
|
258
|
+
icon: ["fas", l.icon || "upload"]
|
|
259
|
+
}, null, 8, ["icon"]),
|
|
260
|
+
t.value.length === 0 ? (o(), s("p", ae, "Drag & drop files here or click to select")) : (o(), s("div", le, [
|
|
261
|
+
h("p", null, m(t.value.length) + " file(s) selected", 1),
|
|
262
|
+
(o(!0), s(P, null, R(t.value, (w, W) => (o(), s("div", {
|
|
263
|
+
key: W,
|
|
264
|
+
class: "file-info"
|
|
265
|
+
}, [
|
|
266
|
+
h("span", te, m(w.name), 1),
|
|
267
|
+
h("span", se, m(k(w.size)), 1)
|
|
268
|
+
]))), 128))
|
|
269
|
+
]))
|
|
270
|
+
])
|
|
271
|
+
], 34),
|
|
272
|
+
i.value ? (o(), s("div", oe, m(i.value), 1)) : c("", !0),
|
|
273
|
+
g.value > 0 && g.value < 100 ? (o(), s("div", re, [
|
|
274
|
+
h("div", {
|
|
275
|
+
class: "progress",
|
|
276
|
+
style: L({ width: `${g.value}%` })
|
|
277
|
+
}, null, 4)
|
|
278
|
+
])) : c("", !0),
|
|
279
|
+
d.value ? (o(), s("div", {
|
|
280
|
+
key: 2,
|
|
281
|
+
class: I(["status-message", d.value.type])
|
|
282
|
+
}, m(d.value.message), 3)) : c("", !0),
|
|
283
|
+
t.value.length > 0 && !l.uploadUrl ? (o(), s("button", {
|
|
284
|
+
key: 3,
|
|
285
|
+
class: "upload-button",
|
|
286
|
+
onClick: y
|
|
287
|
+
}, " Upload Files ")) : c("", !0)
|
|
288
|
+
]);
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
}), ce = /* @__PURE__ */ V(ie, [["__scopeId", "data-v-75b2aeea"]]);
|
|
292
|
+
export {
|
|
293
|
+
ce as FileUpload,
|
|
294
|
+
de as TextInput
|
|
295
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(p,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(p=typeof globalThis<"u"?globalThis:p||self,e(p.VueInputComponents={},p.Vue))})(this,function(p,e){"use strict";const N=["for"],S=["id","type","value","placeholder","required","disabled"],T=["id","value","placeholder","required","disabled"],D={key:3,class:"status-indicator required-indicator"},F={key:0,class:"status-indicator saved-indicator"},$={key:0,class:"status-indicator changed-indicator"},U={key:4,class:"error-message"},I={key:5,class:"message success-message"},M=e.defineComponent({__name:"TextInput",props:{modelValue:{},label:{},type:{},icon:{},placeholder:{},required:{type:Boolean},disabled:{type:Boolean},error:{},success:{},labelPosition:{},labelAlign:{},totalWidth:{},inputWidth:{},labelWidth:{},autosave:{type:Function},isTextarea:{type:Boolean},maxHeight:{},height:{}},emits:["update:modelValue","changed","saved"],setup(h,{emit:g}){const n=h,c=g,u=e.computed(()=>`input-${Math.random().toString(36).substr(2,9)}`),a=e.ref(!1),d=e.ref(!1),m=e.ref(!1),r=e.ref(null),i=e.ref(null),k=e.ref(null),B=e.computed(()=>n.label?n.labelPosition==="left"&&n.labelWidth?{"grid-template-columns":`${n.labelWidth} 1fr`}:{}:{}),_=async t=>{if(n.autosave)try{await n.autosave(t),n.error||(c("saved"),a.value=!0,d.value=!1,setTimeout(()=>{a.value=!1},3e3))}catch(f){console.error("Autosave failed:",f)}},b=t=>{r.value&&clearTimeout(r.value),i.value&&clearTimeout(i.value),n.error||(d.value=!0),i.value=window.setTimeout(()=>{c("changed"),m.value=!0},500),r.value=window.setTimeout(()=>{_(t)},1500)},w=()=>{var t;(t=k.value)==null||t.focus()},V=t=>{t.style.height="auto",t.style.height=`${t.scrollHeight}px`},E=t=>{const f=t.target.value;c("update:modelValue",f),b(f),V(t.target)};return e.onUnmounted(()=>{r.value&&clearTimeout(r.value),i.value&&clearTimeout(i.value)}),(t,f)=>{const l=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["text-input",{[`label-${t.labelPosition}`]:t.label,[`label-align-${t.labelAlign}`]:t.label}]),style:e.normalizeStyle([{width:t.totalWidth||"100%"},B.value,{"--max-textarea-height":n.maxHeight||n.height||"14rem","--textarea-height":n.height||"5.5rem"}])},[t.label?(e.openBlock(),e.createElementBlock("label",{key:0,for:u.value,class:"label"},e.toDisplayString(t.label),9,N)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["input-wrapper",{"has-error":t.error,"has-icon":t.icon}])},[t.icon?(e.openBlock(),e.createElementBlock("div",{key:0,class:"icon-wrapper",onClick:w},[e.createVNode(l,{icon:t.icon,class:"icon"},null,8,["icon"])])):e.createCommentVNode("",!0),t.isTextarea?(e.openBlock(),e.createElementBlock("textarea",{key:2,id:u.value,value:t.modelValue,placeholder:t.placeholder,required:t.required,disabled:t.disabled,class:"input",onInput:E,ref_key:"inputRef",ref:k},null,40,T)):(e.openBlock(),e.createElementBlock("input",{key:1,id:u.value,type:t.type,value:t.modelValue,placeholder:t.placeholder,required:t.required,disabled:t.disabled,class:"input",onInput:E,ref_key:"inputRef",ref:k},null,40,S)),t.required&&!a.value&&!d.value?(e.openBlock(),e.createElementBlock("span",D,"required")):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[a.value&&!t.error?(e.openBlock(),e.createElementBlock("span",F,"saved")):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[d.value&&!t.error?(e.openBlock(),e.createElementBlock("span",$,"changed")):e.createCommentVNode("",!0)]),_:1}),t.error?(e.openBlock(),e.createElementBlock("div",U,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0),t.success?(e.openBlock(),e.createElementBlock("span",I,e.toDisplayString(t.success),1)):e.createCommentVNode("",!0)],2)],6)}}}),C=(h,g)=>{const n=h.__vccOpts||h;for(const[c,u]of g)n[c]=u;return n},z=C(M,[["__scopeId","data-v-cc2497d0"]]),q={class:"file-upload"},v={class:"upload-content"},A={key:0},L={key:1,class:"selected-files"},P={class:"file-name"},W={class:"file-size"},H={key:0,class:"error-message"},R={key:1,class:"progress-bar"},j=20*1024*1024,O=C(e.defineComponent({__name:"FileUpload",props:{icon:{},uploadUrl:{}},emits:["upload-complete","upload-error","files-selected","start-upload"],setup(h,{emit:g}){const n=h,c=g,u=e.ref(null),a=e.ref([]),d=e.ref(!1),m=e.ref(0),r=e.ref(""),i=e.ref(null),k=l=>{if(l===0)return"0 Bytes";const o=1024,s=["Bytes","KB","MB","GB"],y=Math.floor(Math.log(l)/Math.log(o));return parseFloat((l/Math.pow(o,y)).toFixed(2))+" "+s[y]},B=l=>l.size>j?(r.value=`File "${l.name}" exceeds the maximum size of 20MB`,!1):!0,_=()=>{d.value=!0},b=()=>{d.value=!1},w=l=>{var o;if(d.value=!1,r.value="",(o=l.dataTransfer)!=null&&o.files){const s=Array.from(l.dataTransfer.files);s.every(B)&&(a.value=[...a.value,...s])}},V=()=>{var l;(l=u.value)==null||l.click()},E=l=>{r.value="";const o=l.target;if(o.files){const s=Array.from(o.files);s.every(B)&&(a.value=[...a.value,...s])}o.value=""},t=async()=>{if(!n.uploadUrl){r.value="No upload URL provided";return}if(a.value.length===0){r.value="No files selected";return}const l=new FormData;a.value.forEach(o=>{l.append("files",o)});try{const o=new XMLHttpRequest;o.upload.addEventListener("progress",s=>{s.lengthComputable&&(m.value=s.loaded/s.total*100)}),o.addEventListener("load",()=>{if(o.status>=200&&o.status<300)i.value={type:"success",message:"Upload completed successfully"},c("upload-complete",a.value),a.value=[],m.value=0;else throw new Error(`Upload failed with status ${o.status}`)}),o.addEventListener("error",()=>{throw new Error("Upload failed")}),o.open("POST",n.uploadUrl),o.send(l)}catch(o){const s=o instanceof Error?o.message:"Upload failed";r.value=s,i.value={type:"error",message:s},c("upload-error",s)}},f=()=>{c("start-upload",a.value)};return e.watch(a,l=>{l.length>0&&(n.uploadUrl?t():c("files-selected",l))}),(l,o)=>{const s=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",q,[e.createElementVNode("div",{class:e.normalizeClass(["upload-area",{"is-dragging":d.value,"has-files":a.value.length>0}]),onDragenter:e.withModifiers(_,["prevent"]),onDragleave:e.withModifiers(b,["prevent"]),onDragover:o[0]||(o[0]=e.withModifiers(()=>{},["prevent"])),onDrop:e.withModifiers(w,["prevent"]),onClick:V},[e.createElementVNode("input",{ref_key:"fileInput",ref:u,type:"file",multiple:"",class:"file-input",onChange:E},null,544),e.createElementVNode("div",v,[e.createVNode(s,{icon:["fas",l.icon||"upload"]},null,8,["icon"]),a.value.length===0?(e.openBlock(),e.createElementBlock("p",A,"Drag & drop files here or click to select")):(e.openBlock(),e.createElementBlock("div",L,[e.createElementVNode("p",null,e.toDisplayString(a.value.length)+" file(s) selected",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(y,X)=>(e.openBlock(),e.createElementBlock("div",{key:X,class:"file-info"},[e.createElementVNode("span",P,e.toDisplayString(y.name),1),e.createElementVNode("span",W,e.toDisplayString(k(y.size)),1)]))),128))]))])],34),r.value?(e.openBlock(),e.createElementBlock("div",H,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0),m.value>0&&m.value<100?(e.openBlock(),e.createElementBlock("div",R,[e.createElementVNode("div",{class:"progress",style:e.normalizeStyle({width:`${m.value}%`})},null,4)])):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["status-message",i.value.type])},e.toDisplayString(i.value.message),3)):e.createCommentVNode("",!0),a.value.length>0&&!l.uploadUrl?(e.openBlock(),e.createElementBlock("button",{key:3,class:"upload-button",onClick:f}," Upload Files ")):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-75b2aeea"]]);p.FileUpload=O,p.TextInput=z,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a-vision-software/vue-input-components",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.52",
|
|
4
4
|
"description": "A collection of reusable Vue 3 input components with TypeScript support",
|
|
5
5
|
"author": "A-Vision Software",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,11 +22,14 @@
|
|
|
22
22
|
],
|
|
23
23
|
"type": "module",
|
|
24
24
|
"files": [
|
|
25
|
-
"
|
|
25
|
+
"dist"
|
|
26
26
|
],
|
|
27
27
|
"main": "./dist/vue-input-components.cjs.js",
|
|
28
28
|
"module": "./dist/vue-input-components.cjs.js",
|
|
29
|
-
"exports":
|
|
29
|
+
"exports": {
|
|
30
|
+
"./index.ts": "./dist/vue-input-components.es.js",
|
|
31
|
+
"./styles.css": "./dist/vue-input-components.css"
|
|
32
|
+
},
|
|
30
33
|
"sideEffects": [
|
|
31
34
|
"**/*.css"
|
|
32
35
|
],
|
package/src/App.vue
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { RouterView } from 'vue-router'
|
|
3
|
-
</script>
|
|
4
|
-
|
|
5
|
-
<template>
|
|
6
|
-
<div id="app">
|
|
7
|
-
<router-view />
|
|
8
|
-
</div>
|
|
9
|
-
</template>
|
|
10
|
-
|
|
11
|
-
<style>
|
|
12
|
-
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
|
|
13
|
-
|
|
14
|
-
*,
|
|
15
|
-
*::before,
|
|
16
|
-
*::after {
|
|
17
|
-
box-sizing: border-box;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
html,
|
|
21
|
-
body {
|
|
22
|
-
padding: 0;
|
|
23
|
-
margin: 0;
|
|
24
|
-
font-family:
|
|
25
|
-
'Inter',
|
|
26
|
-
-apple-system,
|
|
27
|
-
BlinkMacSystemFont,
|
|
28
|
-
'Segoe UI',
|
|
29
|
-
Roboto,
|
|
30
|
-
Oxygen,
|
|
31
|
-
Ubuntu,
|
|
32
|
-
Cantarell,
|
|
33
|
-
'Fira Sans',
|
|
34
|
-
'Droid Sans',
|
|
35
|
-
'Helvetica Neue',
|
|
36
|
-
sans-serif;
|
|
37
|
-
-webkit-font-smoothing: antialiased;
|
|
38
|
-
-moz-osx-font-smoothing: grayscale;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
#app {
|
|
42
|
-
min-height: 100vh;
|
|
43
|
-
width: 100vw;
|
|
44
|
-
display: grid;
|
|
45
|
-
grid-template-rows: 1fr;
|
|
46
|
-
grid-template-columns: 1fr;
|
|
47
|
-
}
|
|
48
|
-
</style>
|
package/src/assets/colors.css
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
:root {
|
|
2
|
-
/* Base colors */
|
|
3
|
-
--primary-color: #3498db;
|
|
4
|
-
--primary-color-light: rgba(52, 152, 219, 0.2);
|
|
5
|
-
--secondary-color: #2ecc71;
|
|
6
|
-
|
|
7
|
-
/* Text colors */
|
|
8
|
-
--text-color: #2c3e50;
|
|
9
|
-
--text-color-light: #7f8c8d;
|
|
10
|
-
|
|
11
|
-
/* UI colors */
|
|
12
|
-
--border-color: #dcdfe6;
|
|
13
|
-
--icon-color: #95a5a6;
|
|
14
|
-
|
|
15
|
-
/* State colors */
|
|
16
|
-
--error-color: #e74c3c;
|
|
17
|
-
--error-color-light: rgba(231, 76, 60, 0.2);
|
|
18
|
-
--success-color: #2ecc71;
|
|
19
|
-
--success-color-light: rgba(46, 204, 113, 0.2);
|
|
20
|
-
--warning-color: #f1c40f;
|
|
21
|
-
--warning-color-light: rgba(241, 196, 15, 0.2);
|
|
22
|
-
|
|
23
|
-
/* Background colors */
|
|
24
|
-
--disabled-color: #bdc3c7;
|
|
25
|
-
--disabled-background: #f5f7fa;
|
|
26
|
-
--card-bg: #ffffff;
|
|
27
|
-
--background-color: #f8f9fa;
|
|
28
|
-
|
|
29
|
-
/* Input colors */
|
|
30
|
-
--input-bg-color: rgba(255, 255, 255, 0.8);
|
|
31
|
-
--input-bg-hover: rgba(0, 0, 0, 0.05);
|
|
32
|
-
--input-bg-disabled: rgba(0, 0, 0, 0.05);
|
|
33
|
-
|
|
34
|
-
/* Text Colors */
|
|
35
|
-
--text-muted: #6c757d;
|
|
36
|
-
|
|
37
|
-
/* Border Colors */
|
|
38
|
-
--input-bg: #ffffff;
|
|
39
|
-
--input-bg-disabled: #e9ecef;
|
|
40
|
-
|
|
41
|
-
/* Status Colors */
|
|
42
|
-
--danger-color: #dc3545;
|
|
43
|
-
--success-color: #28a745;
|
|
44
|
-
--warning-color: #ffc107;
|
|
45
|
-
|
|
46
|
-
/* Shadow Colors */
|
|
47
|
-
--shadow-color: rgba(74, 108, 247, 0.25);
|
|
48
|
-
|
|
49
|
-
/* Typography */
|
|
50
|
-
--line-height: 20px;
|
|
51
|
-
|
|
52
|
-
/* File Upload Colors */
|
|
53
|
-
--upload-border-color: var(--border-color);
|
|
54
|
-
--upload-bg-color: var(--background-color);
|
|
55
|
-
--upload-dragging-border-color: var(--primary-color);
|
|
56
|
-
--upload-dragging-bg-color: var(--primary-color-light);
|
|
57
|
-
--upload-has-files-border-color: var(--success-color);
|
|
58
|
-
--upload-has-files-bg-color: var(--success-color-light);
|
|
59
|
-
--upload-icon-color: var(--icon-color);
|
|
60
|
-
--upload-text-color: var(--text-color-light);
|
|
61
|
-
--progress-bg-color: var(--disabled-background);
|
|
62
|
-
--progress-color: var(--primary-color);
|
|
63
|
-
--success-bg-color: var(--success-color-light);
|
|
64
|
-
--success-text-color: var(--success-color);
|
|
65
|
-
--error-bg-color: var(--error-color-light);
|
|
66
|
-
--error-text-color: var(--error-color);
|
|
67
|
-
}
|
package/src/assets/logo.svg
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 261.76 226.69"><path d="M161.096.001l-30.225 52.351L100.647.001H-.005l130.877 226.688L261.749.001z" fill="#41b883"/><path d="M161.096.001l-30.225 52.351L100.647.001H52.346l78.526 136.01L209.398.001z" fill="#34495e"/></svg>
|