@a-vision-software/vue-input-components 1.1.30 → 1.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
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";
1
+ import { defineComponent as D, computed as V, ref as p, onUnmounted as W, resolveComponent as z, createElementBlock as s, openBlock as o, normalizeStyle as L, normalizeClass as k, createCommentVNode as d, createElementVNode as g, toDisplayString as h, createVNode as F, Transition as M, withCtx as A, watch as H, withModifiers as I, Fragment as P, renderList as R } from "vue";
2
2
  const O = ["for"], X = ["id", "type", "value", "placeholder", "required", "disabled"], j = ["id", "value", "placeholder", "required", "disabled"], G = {
3
3
  key: 3,
4
4
  class: "status-indicator required-indicator"
@@ -8,13 +8,13 @@ const O = ["for"], X = ["id", "type", "value", "placeholder", "required", "disab
8
8
  }, Z = {
9
9
  key: 0,
10
10
  class: "status-indicator changed-indicator"
11
- }, J = {
11
+ }, x = {
12
12
  key: 4,
13
13
  class: "error-message"
14
- }, Q = {
14
+ }, J = {
15
15
  key: 5,
16
16
  class: "message success-message"
17
- }, Y = /* @__PURE__ */ z({
17
+ }, Q = /* @__PURE__ */ D({
18
18
  __name: "TextInput",
19
19
  props: {
20
20
  modelValue: {},
@@ -37,39 +37,39 @@ const O = ["for"], X = ["id", "type", "value", "placeholder", "required", "disab
37
37
  height: {}
38
38
  },
39
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 ? {
40
+ setup(n, { emit: y }) {
41
+ const r = n, c = y, v = V(() => `input-${Math.random().toString(36).substr(2, 9)}`), l = p(!1), m = p(!1), b = p(!1), u = p(null), f = p(null), _ = p(null), T = V(() => r.label ? r.labelPosition === "left" && r.labelWidth ? {
42
42
  "grid-template-columns": `${r.labelWidth} 1fr`
43
- } : {} : {}), C = async (e) => {
43
+ } : {} : {}), S = async (e) => {
44
44
  if (r.autosave)
45
45
  try {
46
- await r.autosave(e), r.error || (p("saved"), t.value = !0, v.value = !1, setTimeout(() => {
47
- t.value = !1;
46
+ await r.autosave(e), r.error || (c("saved"), l.value = !0, m.value = !1, setTimeout(() => {
47
+ l.value = !1;
48
48
  }, 3e3));
49
- } catch (y) {
50
- console.error("Autosave failed:", y);
49
+ } catch (w) {
50
+ console.error("Autosave failed:", w);
51
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);
52
+ }, U = (e) => {
53
+ u.value && clearTimeout(u.value), f.value && clearTimeout(f.value), r.error || (m.value = !0), f.value = window.setTimeout(() => {
54
+ c("changed"), b.value = !0;
55
+ }, 500), u.value = window.setTimeout(() => {
56
+ S(e);
57
57
  }, 1500);
58
- }, E = () => {
58
+ }, B = () => {
59
59
  var e;
60
- (e = k.value) == null || e.focus();
61
- }, S = (e) => {
60
+ (e = _.value) == null || e.focus();
61
+ }, C = (e) => {
62
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);
63
+ }, q = (e) => {
64
+ const w = e.target.value;
65
+ c("update:modelValue", w), U(w), C(e.target);
66
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");
67
+ return W(() => {
68
+ u.value && clearTimeout(u.value), f.value && clearTimeout(f.value);
69
+ }), (e, w) => {
70
+ const t = z("font-awesome-icon");
71
71
  return o(), s("div", {
72
- class: I(["text-input", {
72
+ class: k(["text-input", {
73
73
  [`label-${e.labelPosition}`]: e.label,
74
74
  [`label-align-${e.labelAlign}`]: e.label
75
75
  }]),
@@ -84,11 +84,11 @@ const O = ["for"], X = ["id", "type", "value", "placeholder", "required", "disab
84
84
  }, [
85
85
  e.label ? (o(), s("label", {
86
86
  key: 0,
87
- for: f.value,
87
+ for: v.value,
88
88
  class: "label"
89
- }, m(e.label), 9, O)) : c("", !0),
90
- h("div", {
91
- class: I(["input-wrapper", {
89
+ }, h(e.label), 9, O)) : d("", !0),
90
+ g("div", {
91
+ class: k(["input-wrapper", {
92
92
  "has-error": e.error,
93
93
  "has-icon": e.icon
94
94
  }])
@@ -96,200 +96,264 @@ const O = ["for"], X = ["id", "type", "value", "placeholder", "required", "disab
96
96
  e.icon ? (o(), s("div", {
97
97
  key: 0,
98
98
  class: "icon-wrapper",
99
- onClick: E
99
+ onClick: B
100
100
  }, [
101
- U(l, {
101
+ F(t, {
102
102
  icon: e.icon,
103
103
  class: "icon"
104
104
  }, null, 8, ["icon"])
105
- ])) : c("", !0),
105
+ ])) : d("", !0),
106
106
  e.isTextarea ? (o(), s("textarea", {
107
107
  key: 2,
108
- id: f.value,
108
+ id: v.value,
109
109
  value: e.modelValue,
110
110
  placeholder: e.placeholder,
111
111
  required: e.required,
112
112
  disabled: e.disabled,
113
113
  class: "input",
114
- onInput: $,
114
+ onInput: q,
115
115
  ref_key: "inputRef",
116
- ref: k
116
+ ref: _
117
117
  }, null, 40, j)) : (o(), s("input", {
118
118
  key: 1,
119
- id: f.value,
119
+ id: v.value,
120
120
  type: e.type,
121
121
  value: e.modelValue,
122
122
  placeholder: e.placeholder,
123
123
  required: e.required,
124
124
  disabled: e.disabled,
125
125
  class: "input",
126
- onInput: $,
126
+ onInput: q,
127
127
  ref_key: "inputRef",
128
- ref: k
128
+ ref: _
129
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)
130
+ e.required && !l.value && !m.value ? (o(), s("span", G, "required")) : d("", !0),
131
+ F(M, { name: "fade" }, {
132
+ default: A(() => [
133
+ l.value && !e.error ? (o(), s("span", K, "saved")) : d("", !0)
134
134
  ]),
135
135
  _: 1
136
136
  }),
137
- U(B, { name: "fade" }, {
138
- default: M(() => [
139
- v.value && !e.error ? (o(), s("span", Z, "changed")) : c("", !0)
137
+ F(M, { name: "fade" }, {
138
+ default: A(() => [
139
+ m.value && !e.error ? (o(), s("span", Z, "changed")) : d("", !0)
140
140
  ]),
141
141
  _: 1
142
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)
143
+ e.error ? (o(), s("div", x, h(e.error), 1)) : d("", !0),
144
+ e.success ? (o(), s("span", J, h(e.success), 1)) : d("", !0)
145
145
  ], 2)
146
146
  ], 6);
147
147
  };
148
148
  }
149
- }), V = (_, b) => {
150
- const r = _.__vccOpts || _;
151
- for (const [p, f] of b)
152
- r[p] = f;
149
+ }), E = (n, y) => {
150
+ const r = n.__vccOpts || n;
151
+ for (const [c, v] of y)
152
+ r[c] = v;
153
153
  return r;
154
- }, de = /* @__PURE__ */ V(Y, [["__scopeId", "data-v-cc2497d0"]]), x = { class: "file-upload" }, ee = { class: "upload-content" }, ae = { key: 0 }, le = {
154
+ }, fe = /* @__PURE__ */ E(Q, [["__scopeId", "data-v-cc2497d0"]]), Y = { class: "text-area-input" }, ee = ["value", "placeholder", "disabled", "required", "maxlength", "rows"], ae = {
155
+ key: 1,
156
+ class: "error-message"
157
+ }, te = /* @__PURE__ */ D({
158
+ __name: "TextAreaInput",
159
+ props: {
160
+ modelValue: {
161
+ type: String,
162
+ required: !0
163
+ },
164
+ label: {
165
+ type: String,
166
+ default: ""
167
+ },
168
+ placeholder: {
169
+ type: String,
170
+ default: ""
171
+ },
172
+ error: {
173
+ type: String,
174
+ default: ""
175
+ },
176
+ disabled: {
177
+ type: Boolean,
178
+ default: !1
179
+ },
180
+ required: {
181
+ type: Boolean,
182
+ default: !1
183
+ },
184
+ maxlength: {
185
+ type: Number,
186
+ default: void 0
187
+ },
188
+ rows: {
189
+ type: Number,
190
+ default: 4
191
+ }
192
+ },
193
+ emits: ["update:modelValue"],
194
+ setup(n, { emit: y }) {
195
+ const r = y, c = (v) => {
196
+ const l = v.target;
197
+ r("update:modelValue", l.value);
198
+ };
199
+ return (v, l) => (o(), s("div", Y, [
200
+ n.label ? (o(), s("label", {
201
+ key: 0,
202
+ class: k({ required: n.required })
203
+ }, h(n.label), 3)) : d("", !0),
204
+ g("textarea", {
205
+ value: n.modelValue,
206
+ onInput: c,
207
+ placeholder: n.placeholder,
208
+ disabled: n.disabled,
209
+ required: n.required,
210
+ maxlength: n.maxlength,
211
+ rows: n.rows,
212
+ class: k({ error: !!n.error })
213
+ }, null, 42, ee),
214
+ n.error ? (o(), s("div", ae, h(n.error), 1)) : d("", !0)
215
+ ]));
216
+ }
217
+ }), he = /* @__PURE__ */ E(te, [["__scopeId", "data-v-2e843729"]]), le = { class: "file-upload" }, se = { class: "upload-content" }, oe = { key: 0 }, re = {
155
218
  key: 1,
156
219
  class: "selected-files"
157
- }, te = { class: "file-name" }, se = { class: "file-size" }, oe = {
220
+ }, ne = { class: "file-name" }, ie = { class: "file-size" }, ue = {
158
221
  key: 0,
159
222
  class: "error-message"
160
- }, re = {
223
+ }, de = {
161
224
  key: 1,
162
225
  class: "progress-bar"
163
- }, ne = 20 * 1024 * 1024, ie = /* @__PURE__ */ z({
226
+ }, ce = 20 * 1024 * 1024, pe = /* @__PURE__ */ D({
164
227
  __name: "FileUpload",
165
228
  props: {
166
229
  icon: {},
167
230
  uploadUrl: {}
168
231
  },
169
232
  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) => {
233
+ setup(n, { emit: y }) {
234
+ const r = n, c = y, v = p(null), l = p([]), m = p(!1), b = p(0), u = p(""), f = p(null), _ = (t) => {
235
+ if (t === 0) return "0 Bytes";
236
+ const a = 1024, i = ["Bytes", "KB", "MB", "GB"], $ = Math.floor(Math.log(t) / Math.log(a));
237
+ return parseFloat((t / Math.pow(a, $)).toFixed(2)) + " " + i[$];
238
+ }, T = (t) => t.size > ce ? (u.value = `File "${t.name}" exceeds the maximum size of 20MB`, !1) : !0, S = () => {
239
+ m.value = !0;
240
+ }, U = () => {
241
+ m.value = !1;
242
+ }, B = (t) => {
180
243
  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]);
244
+ if (m.value = !1, u.value = "", (a = t.dataTransfer) != null && a.files) {
245
+ const i = Array.from(t.dataTransfer.files);
246
+ i.every(T) && (l.value = [...l.value, ...i]);
184
247
  }
185
- }, S = () => {
186
- var l;
187
- (l = f.value) == null || l.click();
188
- }, $ = (l) => {
189
- i.value = "";
190
- const a = l.target;
248
+ }, C = () => {
249
+ var t;
250
+ (t = v.value) == null || t.click();
251
+ }, q = (t) => {
252
+ u.value = "";
253
+ const a = t.target;
191
254
  if (a.files) {
192
- const n = Array.from(a.files);
193
- n.every(T) && (t.value = [...t.value, ...n]);
255
+ const i = Array.from(a.files);
256
+ i.every(T) && (l.value = [...l.value, ...i]);
194
257
  }
195
258
  a.value = "";
196
259
  }, e = async () => {
197
260
  if (!r.uploadUrl) {
198
- i.value = "No upload URL provided";
261
+ u.value = "No upload URL provided";
199
262
  return;
200
263
  }
201
- if (t.value.length === 0) {
202
- i.value = "No files selected";
264
+ if (l.value.length === 0) {
265
+ u.value = "No files selected";
203
266
  return;
204
267
  }
205
- const l = new FormData();
206
- t.value.forEach((a) => {
207
- l.append("files", a);
268
+ const t = new FormData();
269
+ l.value.forEach((a) => {
270
+ t.append("files", a);
208
271
  });
209
272
  try {
210
273
  const a = new XMLHttpRequest();
211
- a.upload.addEventListener("progress", (n) => {
212
- n.lengthComputable && (g.value = n.loaded / n.total * 100);
274
+ a.upload.addEventListener("progress", (i) => {
275
+ i.lengthComputable && (b.value = i.loaded / i.total * 100);
213
276
  }), a.addEventListener("load", () => {
214
277
  if (a.status >= 200 && a.status < 300)
215
- d.value = {
278
+ f.value = {
216
279
  type: "success",
217
280
  message: "Upload completed successfully"
218
- }, p("upload-complete", t.value), t.value = [], g.value = 0;
281
+ }, c("upload-complete", l.value), l.value = [], b.value = 0;
219
282
  else
220
283
  throw new Error(`Upload failed with status ${a.status}`);
221
284
  }), a.addEventListener("error", () => {
222
285
  throw new Error("Upload failed");
223
- }), a.open("POST", r.uploadUrl), a.send(l);
286
+ }), a.open("POST", r.uploadUrl), a.send(t);
224
287
  } catch (a) {
225
- const n = a instanceof Error ? a.message : "Upload failed";
226
- i.value = n, d.value = {
288
+ const i = a instanceof Error ? a.message : "Upload failed";
289
+ u.value = i, f.value = {
227
290
  type: "error",
228
- message: n
229
- }, p("upload-error", n);
291
+ message: i
292
+ }, c("upload-error", i);
230
293
  }
231
- }, y = () => {
232
- p("start-upload", t.value);
294
+ }, w = () => {
295
+ c("start-upload", l.value);
233
296
  };
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(() => {
297
+ return H(l, (t) => {
298
+ t.length > 0 && (r.uploadUrl ? e() : c("files-selected", t));
299
+ }), (t, a) => {
300
+ const i = z("font-awesome-icon");
301
+ return o(), s("div", le, [
302
+ g("div", {
303
+ class: k(["upload-area", { "is-dragging": m.value, "has-files": l.value.length > 0 }]),
304
+ onDragenter: I(S, ["prevent"]),
305
+ onDragleave: I(U, ["prevent"]),
306
+ onDragover: a[0] || (a[0] = I(() => {
244
307
  }, ["prevent"])),
245
- onDrop: F(E, ["prevent"]),
246
- onClick: S
308
+ onDrop: I(B, ["prevent"]),
309
+ onClick: C
247
310
  }, [
248
- h("input", {
311
+ g("input", {
249
312
  ref_key: "fileInput",
250
- ref: f,
313
+ ref: v,
251
314
  type: "file",
252
315
  multiple: "",
253
316
  class: "file-input",
254
- onChange: $
317
+ onChange: q
255
318
  }, null, 544),
256
- h("div", ee, [
257
- U(n, {
258
- icon: ["fas", l.icon || "upload"]
319
+ g("div", se, [
320
+ F(i, {
321
+ icon: ["fas", t.icon || "upload"]
259
322
  }, 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,
323
+ l.value.length === 0 ? (o(), s("p", oe, "Drag & drop files here or click to select")) : (o(), s("div", re, [
324
+ g("p", null, h(l.value.length) + " file(s) selected", 1),
325
+ (o(!0), s(P, null, R(l.value, ($, N) => (o(), s("div", {
326
+ key: N,
264
327
  class: "file-info"
265
328
  }, [
266
- h("span", te, m(w.name), 1),
267
- h("span", se, m(k(w.size)), 1)
329
+ g("span", ne, h($.name), 1),
330
+ g("span", ie, h(_($.size)), 1)
268
331
  ]))), 128))
269
332
  ]))
270
333
  ])
271
334
  ], 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", {
335
+ u.value ? (o(), s("div", ue, h(u.value), 1)) : d("", !0),
336
+ b.value > 0 && b.value < 100 ? (o(), s("div", de, [
337
+ g("div", {
275
338
  class: "progress",
276
- style: L({ width: `${g.value}%` })
339
+ style: L({ width: `${b.value}%` })
277
340
  }, null, 4)
278
- ])) : c("", !0),
279
- d.value ? (o(), s("div", {
341
+ ])) : d("", !0),
342
+ f.value ? (o(), s("div", {
280
343
  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", {
344
+ class: k(["status-message", f.value.type])
345
+ }, h(f.value.message), 3)) : d("", !0),
346
+ l.value.length > 0 && !t.uploadUrl ? (o(), s("button", {
284
347
  key: 3,
285
348
  class: "upload-button",
286
- onClick: y
287
- }, " Upload Files ")) : c("", !0)
349
+ onClick: w
350
+ }, " Upload Files ")) : d("", !0)
288
351
  ]);
289
352
  };
290
353
  }
291
- }), ce = /* @__PURE__ */ V(ie, [["__scopeId", "data-v-75b2aeea"]]);
354
+ }), me = /* @__PURE__ */ E(pe, [["__scopeId", "data-v-75b2aeea"]]);
292
355
  export {
293
- ce as FileUpload,
294
- de as TextInput
356
+ me as FileUpload,
357
+ he as TextAreaInput,
358
+ fe as TextInput
295
359
  };
@@ -1 +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"})});
1
+ (function(u,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(u=typeof globalThis<"u"?globalThis:u||self,e(u.VueInputComponents={},u.Vue))})(this,function(u,e){"use strict";const N=["for"],S=["id","type","value","placeholder","required","disabled"],T=["id","value","placeholder","required","disabled"],$={key:3,class:"status-indicator required-indicator"},D={key:0,class:"status-indicator saved-indicator"},I={key:0,class:"status-indicator changed-indicator"},q={key:4,class:"error-message"},F={key:5,class:"message success-message"},U=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(r,{emit:f}){const n=r,c=f,d=e.computed(()=>`input-${Math.random().toString(36).substr(2,9)}`),o=e.ref(!1),m=e.ref(!1),h=e.ref(!1),i=e.ref(null),p=e.ref(null),k=e.ref(null),B=e.computed(()=>n.label?n.labelPosition==="left"&&n.labelWidth?{"grid-template-columns":`${n.labelWidth} 1fr`}:{}:{}),V=async t=>{if(n.autosave)try{await n.autosave(t),n.error||(c("saved"),o.value=!0,m.value=!1,setTimeout(()=>{o.value=!1},3e3))}catch(g){console.error("Autosave failed:",g)}},w=t=>{i.value&&clearTimeout(i.value),p.value&&clearTimeout(p.value),n.error||(m.value=!0),p.value=window.setTimeout(()=>{c("changed"),h.value=!0},500),i.value=window.setTimeout(()=>{V(t)},1500)},C=()=>{var t;(t=k.value)==null||t.focus()},_=t=>{t.style.height="auto",t.style.height=`${t.scrollHeight}px`},b=t=>{const g=t.target.value;c("update:modelValue",g),w(g),_(t.target)};return e.onUnmounted(()=>{i.value&&clearTimeout(i.value),p.value&&clearTimeout(p.value)}),(t,g)=>{const a=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:d.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:C},[e.createVNode(a,{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:b,ref_key:"inputRef",ref:k},null,40,T)):(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:b,ref_key:"inputRef",ref:k},null,40,S)),t.required&&!o.value&&!m.value?(e.openBlock(),e.createElementBlock("span",$,"required")):e.createCommentVNode("",!0),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[o.value&&!t.error?(e.openBlock(),e.createElementBlock("span",D,"saved")):e.createCommentVNode("",!0)]),_:1}),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[m.value&&!t.error?(e.openBlock(),e.createElementBlock("span",I,"changed")):e.createCommentVNode("",!0)]),_:1}),t.error?(e.openBlock(),e.createElementBlock("div",q,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0),t.success?(e.openBlock(),e.createElementBlock("span",F,e.toDisplayString(t.success),1)):e.createCommentVNode("",!0)],2)],6)}}}),E=(r,f)=>{const n=r.__vccOpts||r;for(const[c,d]of f)n[c]=d;return n},z=E(U,[["__scopeId","data-v-cc2497d0"]]),M={class:"text-area-input"},A=["value","placeholder","disabled","required","maxlength","rows"],L={key:1,class:"error-message"},P=E(e.defineComponent({__name:"TextAreaInput",props:{modelValue:{type:String,required:!0},label:{type:String,default:""},placeholder:{type:String,default:""},error:{type:String,default:""},disabled:{type:Boolean,default:!1},required:{type:Boolean,default:!1},maxlength:{type:Number,default:void 0},rows:{type:Number,default:4}},emits:["update:modelValue"],setup(r,{emit:f}){const n=f,c=d=>{const o=d.target;n("update:modelValue",o.value)};return(d,o)=>(e.openBlock(),e.createElementBlock("div",M,[r.label?(e.openBlock(),e.createElementBlock("label",{key:0,class:e.normalizeClass({required:r.required})},e.toDisplayString(r.label),3)):e.createCommentVNode("",!0),e.createElementVNode("textarea",{value:r.modelValue,onInput:c,placeholder:r.placeholder,disabled:r.disabled,required:r.required,maxlength:r.maxlength,rows:r.rows,class:e.normalizeClass({error:!!r.error})},null,42,A),r.error?(e.openBlock(),e.createElementBlock("div",L,e.toDisplayString(r.error),1)):e.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-2e843729"]]),W={class:"file-upload"},H={class:"upload-content"},R={key:0},j={key:1,class:"selected-files"},v={class:"file-name"},O={class:"file-size"},x={key:0,class:"error-message"},X={key:1,class:"progress-bar"},G=20*1024*1024,K=E(e.defineComponent({__name:"FileUpload",props:{icon:{},uploadUrl:{}},emits:["upload-complete","upload-error","files-selected","start-upload"],setup(r,{emit:f}){const n=r,c=f,d=e.ref(null),o=e.ref([]),m=e.ref(!1),h=e.ref(0),i=e.ref(""),p=e.ref(null),k=a=>{if(a===0)return"0 Bytes";const l=1024,s=["Bytes","KB","MB","GB"],y=Math.floor(Math.log(a)/Math.log(l));return parseFloat((a/Math.pow(l,y)).toFixed(2))+" "+s[y]},B=a=>a.size>G?(i.value=`File "${a.name}" exceeds the maximum size of 20MB`,!1):!0,V=()=>{m.value=!0},w=()=>{m.value=!1},C=a=>{var l;if(m.value=!1,i.value="",(l=a.dataTransfer)!=null&&l.files){const s=Array.from(a.dataTransfer.files);s.every(B)&&(o.value=[...o.value,...s])}},_=()=>{var a;(a=d.value)==null||a.click()},b=a=>{i.value="";const l=a.target;if(l.files){const s=Array.from(l.files);s.every(B)&&(o.value=[...o.value,...s])}l.value=""},t=async()=>{if(!n.uploadUrl){i.value="No upload URL provided";return}if(o.value.length===0){i.value="No files selected";return}const a=new FormData;o.value.forEach(l=>{a.append("files",l)});try{const l=new XMLHttpRequest;l.upload.addEventListener("progress",s=>{s.lengthComputable&&(h.value=s.loaded/s.total*100)}),l.addEventListener("load",()=>{if(l.status>=200&&l.status<300)p.value={type:"success",message:"Upload completed successfully"},c("upload-complete",o.value),o.value=[],h.value=0;else throw new Error(`Upload failed with status ${l.status}`)}),l.addEventListener("error",()=>{throw new Error("Upload failed")}),l.open("POST",n.uploadUrl),l.send(a)}catch(l){const s=l instanceof Error?l.message:"Upload failed";i.value=s,p.value={type:"error",message:s},c("upload-error",s)}},g=()=>{c("start-upload",o.value)};return e.watch(o,a=>{a.length>0&&(n.uploadUrl?t():c("files-selected",a))}),(a,l)=>{const s=e.resolveComponent("font-awesome-icon");return e.openBlock(),e.createElementBlock("div",W,[e.createElementVNode("div",{class:e.normalizeClass(["upload-area",{"is-dragging":m.value,"has-files":o.value.length>0}]),onDragenter:e.withModifiers(V,["prevent"]),onDragleave:e.withModifiers(w,["prevent"]),onDragover:l[0]||(l[0]=e.withModifiers(()=>{},["prevent"])),onDrop:e.withModifiers(C,["prevent"]),onClick:_},[e.createElementVNode("input",{ref_key:"fileInput",ref:d,type:"file",multiple:"",class:"file-input",onChange:b},null,544),e.createElementVNode("div",H,[e.createVNode(s,{icon:["fas",a.icon||"upload"]},null,8,["icon"]),o.value.length===0?(e.openBlock(),e.createElementBlock("p",R,"Drag & drop files here or click to select")):(e.openBlock(),e.createElementBlock("div",j,[e.createElementVNode("p",null,e.toDisplayString(o.value.length)+" file(s) selected",1),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(y,Z)=>(e.openBlock(),e.createElementBlock("div",{key:Z,class:"file-info"},[e.createElementVNode("span",v,e.toDisplayString(y.name),1),e.createElementVNode("span",O,e.toDisplayString(k(y.size)),1)]))),128))]))])],34),i.value?(e.openBlock(),e.createElementBlock("div",x,e.toDisplayString(i.value),1)):e.createCommentVNode("",!0),h.value>0&&h.value<100?(e.openBlock(),e.createElementBlock("div",X,[e.createElementVNode("div",{class:"progress",style:e.normalizeStyle({width:`${h.value}%`})},null,4)])):e.createCommentVNode("",!0),p.value?(e.openBlock(),e.createElementBlock("div",{key:2,class:e.normalizeClass(["status-message",p.value.type])},e.toDisplayString(p.value.message),3)):e.createCommentVNode("",!0),o.value.length>0&&!a.uploadUrl?(e.openBlock(),e.createElementBlock("button",{key:3,class:"upload-button",onClick:g}," Upload Files ")):e.createCommentVNode("",!0)])}}}),[["__scopeId","data-v-75b2aeea"]]);u.FileUpload=K,u.TextAreaInput=P,u.TextInput=z,Object.defineProperty(u,Symbol.toStringTag,{value:"Module"})});