vlite3 0.3.8 → 0.4.2

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,5 +1,5 @@
1
- import { defineComponent as B, useSlots as I, computed as r, inject as R, withDirectives as S, openBlock as s, createElementBlock as g, normalizeClass as o, createBlock as u, createCommentVNode as h, renderSlot as f, createTextVNode as m, toDisplayString as b, unref as G } from "vue";
2
- import d from "./Icon.vue.js";
1
+ import { defineComponent as B, useSlots as I, computed as r, inject as R, withDirectives as S, openBlock as s, createElementBlock as g, normalizeClass as i, createBlock as d, createCommentVNode as h, renderSlot as m, createTextVNode as f, toDisplayString as b, unref as G } from "vue";
2
+ import u from "./Icon.vue.js";
3
3
  import { vRipple as j } from "../directives/vRipple.js";
4
4
  const V = ["type", "disabled"], E = /* @__PURE__ */ B({
5
5
  __name: "Button",
@@ -20,8 +20,8 @@ const V = ["type", "disabled"], E = /* @__PURE__ */ B({
20
20
  asIcon: { type: Boolean }
21
21
  },
22
22
  setup(e) {
23
- const t = e, x = I(), l = r(() => t?.asIcon || t.icon && !t.text && !x.default), v = R("buttonGroup", null), w = r(() => !!v?.isInGroup), y = r(() => {
24
- const n = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] cursor-pointer gap-2", i = {
23
+ const n = e, x = I(), l = r(() => n?.asIcon || n.icon && !n.text && !x.default), v = R("buttonGroup", null), w = r(() => !!v?.isInGroup), p = r(() => {
24
+ const t = "inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 active:scale-[0.98] cursor-pointer gap-2", o = {
25
25
  primary: "bg-primary text-primary-foreground hover:bg-primary/90",
26
26
  "primary-light": "bg-primary-light text-primary-fg-light hover:bg-primary/20",
27
27
  secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
@@ -41,27 +41,31 @@ const V = ["type", "disabled"], E = /* @__PURE__ */ B({
41
41
  "outline-success": "border border-success text-success hover:bg-success/10",
42
42
  ghost: "hover:bg-accent hover:text-accent-foreground text-foreground",
43
43
  link: "text-primary underline-offset-4 hover:underline"
44
- }, p = {
44
+ }, y = {
45
45
  xs: "h-6.5 px-2",
46
46
  sm: "h-7.5 px-3",
47
+ sm2: "h-8 px-3",
47
48
  md: "h-9 px-4 py-2",
48
49
  lg: "h-10 px-6",
49
50
  xl: "h-12 px-10"
50
51
  }, z = {
51
52
  xs: "h-6.5 w-6.5 min-h-6.5 min-w-6.5",
52
53
  sm: "h-7 w-7 min-h-7 min-w-7",
54
+ sm2: "h-7 w-7 min-h-7 min-w-7",
53
55
  md: "h-7.5 w-7.5 min-h-7.5 min-w-7.5",
54
56
  lg: "h-8 w-8 min-h-8 min-w-8",
55
57
  xl: "h-8.5 w-8.5 min-h-8.5 min-w-8.5"
56
58
  }, C = {
57
59
  xs: "px-2",
58
60
  sm: "px-3",
61
+ sm2: "px-3",
59
62
  md: "px-4",
60
63
  lg: "px-6",
61
64
  xl: "px-10"
62
65
  }, k = {
63
66
  none: "rounded-none",
64
67
  sm: "rounded-sm",
68
+ sm2: "rounded-sm",
65
69
  md: "rounded",
66
70
  lg: "rounded-lg",
67
71
  xl: "rounded-xl",
@@ -69,57 +73,59 @@ const V = ["type", "disabled"], E = /* @__PURE__ */ B({
69
73
  full: "rounded-full"
70
74
  };
71
75
  let c;
72
- return l.value ? c = w.value ? C[t.size] : z[t.size] : c = p[t.size], [
73
- n,
74
- i[t.variant],
75
- k[t.rounded],
76
+ return l.value ? c = w.value ? C[n.size] : z[n.size] : c = y[n.size], [
77
+ t,
78
+ o[n.variant],
79
+ k[n.rounded],
76
80
  c,
77
- t.class
81
+ n.class
78
82
  ].join(" ");
79
83
  }), a = r(() => {
80
- const n = {
84
+ const t = {
81
85
  xs: "w-3 h-3",
82
86
  sm: "w-4 h-4",
87
+ sm2: "w-4 h-4",
83
88
  md: "w-4 h-4",
84
89
  lg: "w-4 h-4",
85
90
  xl: "w-4 h-4"
86
- }, i = {
91
+ }, o = {
87
92
  xs: "w-3 h-3",
88
93
  sm: "w-3.5 h-3.5",
94
+ sm2: "w-3.5 h-3.5",
89
95
  md: "w-3.5 h-3.5",
90
96
  lg: "w-4 h-4",
91
97
  xl: "w-4 h-4"
92
98
  };
93
- return l.value ? i[t.size] : n[t.size];
99
+ return l.value ? o[n.size] : t[n.size];
94
100
  });
95
- return (n, i) => S((s(), g("button", {
101
+ return (t, o) => S((s(), g("button", {
96
102
  type: e.type,
97
- class: o(y.value),
103
+ class: i(p.value),
98
104
  disabled: e.disabled || e.loading
99
105
  }, [
100
- e.loading ? (s(), u(d, {
106
+ e.loading ? (s(), d(u, {
101
107
  key: 0,
102
108
  icon: "lucide:loader-2",
103
- class: o(["animate-spin pointer-events-none", a.value])
104
- }, null, 8, ["class"])) : e.icon ? (s(), u(d, {
109
+ class: i(["animate-spin pointer-events-none", a.value])
110
+ }, null, 8, ["class"])) : e.icon ? (s(), d(u, {
105
111
  key: 1,
106
112
  icon: e.icon,
107
- class: o(["pointer-events-none", [e.iconClass, a.value, l.value ? "mx-auto" : ""]])
113
+ class: i(["pointer-events-none", [e.iconClass, a.value, l.value ? "mx-auto" : ""]])
108
114
  }, null, 8, ["icon", "class"])) : h("", !0),
109
115
  e.textClass ? (s(), g("span", {
110
116
  key: 2,
111
- class: o(e.textClass)
117
+ class: i(e.textClass)
112
118
  }, [
113
- f(n.$slots, "default", {}, () => [
114
- m(b(e.text), 1)
119
+ m(t.$slots, "default", {}, () => [
120
+ f(b(e.text), 1)
115
121
  ])
116
- ], 2)) : f(n.$slots, "default", { key: 3 }, () => [
117
- m(b(e.text), 1)
122
+ ], 2)) : m(t.$slots, "default", { key: 3 }, () => [
123
+ f(b(e.text), 1)
118
124
  ]),
119
- e.iconRight && !e.loading ? (s(), u(d, {
125
+ e.iconRight && !e.loading ? (s(), d(u, {
120
126
  key: 4,
121
127
  icon: e.iconRight,
122
- class: o([[e.iconRightClass, a.value], "h-4 w-4 pointer-events-none"])
128
+ class: i([[e.iconRightClass, a.value], "h-4 w-4 pointer-events-none"])
123
129
  }, null, 8, ["icon", "class"])) : h("", !0)
124
130
  ], 10, V)), [
125
131
  [G(j)]
@@ -1,7 +1,7 @@
1
- import { defineComponent as f, openBlock as m, createBlock as u, withCtx as a, createElementVNode as x, createVNode as r, renderSlot as d } from "vue";
2
- import g from "./Modal.vue.js";
3
- import c from "./Button.vue.js";
4
- const w = { class: "flex w-full items-center justify-end space-x-2" }, k = /* @__PURE__ */ f({
1
+ import { defineComponent as x, openBlock as u, createBlock as g, withCtx as i, createElementVNode as n, toDisplayString as d, createVNode as c, renderSlot as r } from "vue";
2
+ import p from "./Modal.vue.js";
3
+ import m from "./Button.vue.js";
4
+ const h = { class: "py-2 px-[2px]" }, w = { class: "mb-1.5" }, C = { class: "text-sm text-muted" }, v = { class: "flex w-full items-center justify-end space-x-2 px-[2px]" }, B = /* @__PURE__ */ x({
5
5
  __name: "ConfirmationModal",
6
6
  props: {
7
7
  show: { type: Boolean, default: !1 },
@@ -13,46 +13,52 @@ const w = { class: "flex w-full items-center justify-end space-x-2" }, k = /* @_
13
13
  variant: { default: "danger" }
14
14
  },
15
15
  emits: ["cancel", "confirm"],
16
- setup(e, { emit: s }) {
17
- const i = s, n = () => {
18
- i("cancel");
16
+ setup(e, { emit: f }) {
17
+ const l = f, o = () => {
18
+ l("cancel");
19
19
  };
20
- return (l, t) => (m(), u(g, {
20
+ return (s, t) => (u(), g(p, {
21
21
  show: e.show,
22
- title: e.title,
23
- description: e.description,
24
22
  footerClass: "border-t-0! pt-0! pb-3.5!",
25
23
  "max-width": "max-w-[400px]",
26
- onClose: n,
27
- "onUpdate:show": t[1] || (t[1] = (o) => !o && n())
24
+ onClose: o,
25
+ "onUpdate:show": t[1] || (t[1] = (a) => !a && o())
28
26
  }, {
29
- trigger: a(() => [
30
- d(l.$slots, "trigger", {}, () => [
31
- d(l.$slots, "default")
27
+ trigger: i(() => [
28
+ r(s.$slots, "trigger", {}, () => [
29
+ r(s.$slots, "default")
32
30
  ])
33
31
  ]),
34
- footer: a(({ close: o }) => [
35
- x("div", w, [
36
- r(c, {
37
- variant: "outline",
32
+ footer: i(({ close: a }) => [
33
+ n("div", v, [
34
+ c(m, {
35
+ variant: "secondary",
38
36
  text: e.cancelText,
39
37
  disabled: e.loading,
38
+ size: "sm2",
40
39
  onClick: () => {
41
- o?.(), n?.();
40
+ a?.(), o?.();
42
41
  }
43
42
  }, null, 8, ["text", "disabled", "onClick"]),
44
- r(c, {
43
+ c(m, {
44
+ size: "sm2",
45
45
  variant: e.variant,
46
46
  text: e.confirmText,
47
47
  loading: e.loading,
48
- onClick: t[0] || (t[0] = (C) => i("confirm"))
48
+ onClick: t[0] || (t[0] = (y) => l("confirm"))
49
49
  }, null, 8, ["variant", "text", "loading"])
50
50
  ])
51
51
  ]),
52
+ default: i(() => [
53
+ n("div", h, [
54
+ n("h3", w, d(e.title), 1),
55
+ n("p", C, d(e.description), 1)
56
+ ])
57
+ ]),
52
58
  _: 3
53
- }, 8, ["show", "title", "description"]));
59
+ }, 8, ["show"]));
54
60
  }
55
61
  });
56
62
  export {
57
- k as default
63
+ B as default
58
64
  };
@@ -1,134 +1,148 @@
1
- import { ref as d, computed as G, watch as H } from "vue";
2
- import { initializeFormValues as q, deepClone as v, getNestedValue as B, evaluateConditional as A, setNestedValue as S, collectFileFields as J, filterNullCustomFields as K } from "../utils/form.utils.js";
3
- import { useFileUpload as L } from "./useFileUpload.js";
4
- function ee(D) {
5
- const { schema: u, values: w, isUpdate: m = !1, folderId: x, onSubmit: g } = D, { handleUploadFile: z } = L(), t = d(q(u, w)), n = d({}), y = d(!1), f = d(!1), h = d(v(t.value)), p = G(() => u ? Array.isArray(u[0]) ? u.flat() : u : []);
6
- H(
7
- () => w,
1
+ import { ref as v, computed as K, watch as L } from "vue";
2
+ import { initializeFormValues as q, deepClone as m, getNestedValue as B, evaluateConditional as z, setNestedValue as w, collectFileFields as Q, filterNullCustomFields as W } from "../utils/form.utils.js";
3
+ import { useFileUpload as X } from "./useFileUpload.js";
4
+ function se(M) {
5
+ const { schema: c, values: x, isUpdate: F = !1, folderId: U, onSubmit: g } = M, { handleUploadFile: j } = X(), t = v(q(c, x)), o = v({}), b = v(!1), d = v(!1), h = v(m(t.value)), y = K(() => c ? Array.isArray(c[0]) ? c.flat() : c : []);
6
+ L(
7
+ () => x,
8
8
  (e) => {
9
- e && (t.value = q(u, e), h.value = v(t.value), f.value = !1);
9
+ e && (t.value = q(c, e), h.value = m(t.value), d.value = !1);
10
10
  },
11
11
  { deep: !0 }
12
12
  );
13
- const b = () => ({
13
+ const V = () => ({
14
14
  values: t.value,
15
- isUpdate: m
16
- }), U = (e) => B(t.value, e), M = (e) => n.value[e] || "", E = (e, a) => {
17
- a ? n.value[e] = a : delete n.value[e];
18
- }, V = () => {
19
- n.value = {};
20
- }, C = (e) => e.when ? A(e.when, b()) : !0, j = (e) => A(e.disabled, b()), O = (e) => A(e.readonly, b()), P = (e) => {
21
- const a = U(e.name);
22
- let l = "";
23
- if (e.required && (a == null || a === "" || Array.isArray(a) && a.length === 0) && (l = `${e.label || e.name} is required`), !l && e.maxFileSize) {
24
- const r = e.maxFileSize * 1024 * 1024;
25
- if (a != null && a !== "") {
26
- const s = Array.isArray(a) ? a : [a];
27
- for (const o of s) {
28
- const i = o instanceof File ? o.size : o?.fileSize || o?.file?.size || o?.size;
29
- if (i !== void 0 && i > r) {
30
- l = `${e.label || e.name} size must be less than ${e.maxFileSize}MB`;
15
+ isUpdate: F
16
+ }), E = (e) => B(t.value, e), T = (e) => o.value[e] || "", C = (e, l) => {
17
+ l ? o.value[e] = l : delete o.value[e];
18
+ }, A = () => {
19
+ o.value = {};
20
+ }, N = (e) => e.when ? z(e.when, V()) : !0, O = (e) => z(e.disabled, V()), I = (e) => z(e.readonly, V()), D = (e) => {
21
+ const l = E(e.name);
22
+ let a = "";
23
+ if (e.required && (l == null || l === "" || Array.isArray(l) && l.length === 0) && (a = `${e.label || e.name} is required`), !a && e.maxFileSize) {
24
+ const i = e.maxFileSize * 1024 * 1024;
25
+ if (l != null && l !== "") {
26
+ const n = Array.isArray(l) ? l : [l];
27
+ for (const s of n) {
28
+ const u = s instanceof File ? s.size : s?.fileSize || s?.file?.size || s?.size;
29
+ if (u !== void 0 && u > i) {
30
+ a = `${e.label || e.name} size must be less than ${e.maxFileSize}MB`;
31
31
  break;
32
32
  }
33
33
  }
34
34
  }
35
35
  }
36
- if (!l && (e.type === "file" || e.type === "fileUploader") && (e.props?.multiple || e.maxFiles)) {
37
- const r = e.maxFiles || e.props?.maxFiles;
38
- r && Array.isArray(a) && a.length > r && (l = `Maximum ${r} files allowed`);
36
+ if (!a && (e.type === "file" || e.type === "fileUploader") && (e.props?.multiple || e.maxFiles)) {
37
+ const i = e.maxFiles || e.props?.maxFiles;
38
+ i && Array.isArray(l) && l.length > i && (a = `Maximum ${i} files allowed`);
39
39
  }
40
- return !l && e.validation && (l = e.validation({
41
- value: a,
40
+ return !a && e.validation && (a = e.validation({
41
+ value: l,
42
42
  values: t.value,
43
- isUpdate: m
44
- })), l ? n.value[e.name] = l : delete n.value[e.name], l;
45
- }, $ = () => {
46
- V();
43
+ isUpdate: F
44
+ })), a ? o.value[e.name] = a : delete o.value[e.name], a;
45
+ }, P = () => {
46
+ A();
47
47
  let e = !0;
48
- for (const a of p.value) {
49
- if (!C(a) || j(a)) continue;
50
- P(a) && (e = !1);
48
+ for (const l of y.value) {
49
+ if (!N(l) || O(l)) continue;
50
+ D(l) && (e = !1);
51
51
  }
52
52
  return e;
53
- }, k = (e, a, l) => {
54
- t.value = S(t.value, e, a), f.value = !0, delete n.value[e];
55
- const r = p.value.find((s) => s.name === e);
56
- if (r?.updateValues) {
57
- const s = r.updateValues({
53
+ }, R = (e, l, a) => {
54
+ t.value = w(t.value, e, l), d.value = !0, delete o.value[e];
55
+ const i = y.value.find((n) => n.name === e);
56
+ if (i?.updateValues) {
57
+ const n = i.updateValues({
58
58
  values: t.value,
59
- data: l,
60
- isUpdate: m,
61
- updateError: E
59
+ data: a,
60
+ isUpdate: F,
61
+ updateError: C
62
62
  });
63
- s && typeof s == "object" && (t.value = { ...t.value, ...s });
63
+ n && typeof n == "object" && (t.value = { ...t.value, ...n });
64
64
  }
65
- }, I = async () => {
66
- const e = v(t.value), l = J(u, e).map(async (s) => {
67
- const { name: o, value: i } = s;
68
- if (Array.isArray(i)) {
69
- const N = i.map(async (c) => c instanceof File || c && typeof c == "object" && c.file instanceof File ? await z(c, x) || null : c), F = await Promise.all(N);
70
- return { name: o, value: F };
65
+ }, G = async () => {
66
+ const e = m(t.value), l = Q(c, e), a = (s, u) => {
67
+ let r = null;
68
+ return s instanceof File ? r = s : s && typeof s == "object" && s.file instanceof File && (r = s.file), {
69
+ fileName: s?.fileName || r?.name || u.split("/").pop() || "unknown",
70
+ fileUrl: u,
71
+ fileType: s?.fileType || r?.type || "application/octet-stream",
72
+ fileSize: s?.fileSize || r?.size || 0
73
+ };
74
+ }, i = l.map(async (s) => {
75
+ const { name: u, value: r, field: J } = s, $ = J.returnFileObject === !0;
76
+ if (Array.isArray(r)) {
77
+ const k = r.map(async (f) => {
78
+ if (f instanceof File || f && typeof f == "object" && f.file instanceof File) {
79
+ const S = await j(f, U);
80
+ return S ? $ ? a(f, S) : S : null;
81
+ }
82
+ return f;
83
+ }), p = await Promise.all(k);
84
+ return { name: u, value: p };
71
85
  } else {
72
- if (i instanceof File || i && typeof i == "object" && i.file instanceof File) {
73
- const F = await z(i, x);
74
- if (F)
75
- return { name: o, value: F };
86
+ if (r instanceof File || r && typeof r == "object" && r.file instanceof File) {
87
+ const p = await j(r, U);
88
+ if (p)
89
+ return { name: u, value: $ ? a(r, p) : p };
76
90
  }
77
91
  return null;
78
92
  }
79
93
  });
80
- return (await Promise.all(l)).forEach((s) => {
81
- s && Object.assign(e, S(e, s.name, s.value));
94
+ return (await Promise.all(i)).forEach((s) => {
95
+ s && Object.assign(e, w(e, s.name, s.value));
82
96
  }), e;
83
- }, R = (e) => {
84
- const a = { ...e };
85
- for (const l of p.value)
86
- if (l.type === "customFields" && l.props?.schema) {
87
- const r = B(a, l.name);
88
- if (Array.isArray(r)) {
89
- const s = K(r, l.props.schema);
90
- Object.assign(a, S(a, l.name, s));
97
+ }, H = (e) => {
98
+ const l = { ...e };
99
+ for (const a of y.value)
100
+ if (a.type === "customFields" && a.props?.schema) {
101
+ const i = B(l, a.name);
102
+ if (Array.isArray(i)) {
103
+ const n = W(i, a.props.schema);
104
+ Object.assign(l, w(l, a.name, n));
91
105
  }
92
106
  }
93
- return a;
107
+ return l;
94
108
  };
95
109
  return {
96
110
  formValues: t,
97
- errors: n,
98
- isSubmitting: y,
99
- isDirty: f,
100
- handleFieldChange: k,
101
- validateField: P,
102
- validateAll: $,
103
- isFieldVisible: C,
104
- isFieldDisabled: j,
105
- isFieldReadonly: O,
106
- getFieldValue: U,
107
- getFieldError: M,
108
- setFieldError: E,
109
- clearErrors: V,
111
+ errors: o,
112
+ isSubmitting: b,
113
+ isDirty: d,
114
+ handleFieldChange: R,
115
+ validateField: D,
116
+ validateAll: P,
117
+ isFieldVisible: N,
118
+ isFieldDisabled: O,
119
+ isFieldReadonly: I,
120
+ getFieldValue: E,
121
+ getFieldError: T,
122
+ setFieldError: C,
123
+ clearErrors: A,
110
124
  resetForm: () => {
111
- t.value = v(h.value), V(), f.value = !1;
125
+ t.value = m(h.value), A(), d.value = !1;
112
126
  },
113
127
  handleSubmit: async () => {
114
- if ($()) {
115
- y.value = !0;
128
+ if (P()) {
129
+ b.value = !0;
116
130
  try {
117
- let a = await I();
118
- a = R(a), g && await g({
119
- values: a,
120
- isUpdate: m
121
- }), f.value = !1, h.value = v(a);
122
- } catch (a) {
123
- throw console.error("[useForm] Submit error:", a), a;
131
+ let l = await G();
132
+ l = H(l), g && await g({
133
+ values: l,
134
+ isUpdate: F
135
+ }), d.value = !1, h.value = m(l);
136
+ } catch (l) {
137
+ throw console.error("[useForm] Submit error:", l), l;
124
138
  } finally {
125
- y.value = !1;
139
+ b.value = !1;
126
140
  }
127
141
  }
128
142
  },
129
- flatSchema: p
143
+ flatSchema: y
130
144
  };
131
145
  }
132
146
  export {
133
- ee as useForm
147
+ se as useForm
134
148
  };
@@ -117,6 +117,8 @@ export interface IForm {
117
117
  maxFileSize?: number;
118
118
  /** Maximum number of files allowed when multiple is true */
119
119
  maxFiles?: number;
120
+ /** Return file values as objects { fileName, fileUrl, fileType, fileSize } instead of string URLs */
121
+ returnFileObject?: boolean;
120
122
  }
121
123
  /**
122
124
  * Timeline step for multi-step forms
@@ -33,6 +33,7 @@ export declare function collectFileFields(schema: IForm[] | IForm[][], values: R
33
33
  name: string;
34
34
  value: any;
35
35
  type: string;
36
+ field: IForm;
36
37
  }>;
37
38
  /**
38
39
  * Deep clone an object
@@ -1,7 +1,7 @@
1
1
  function v(e) {
2
2
  return !!e && typeof e == "object";
3
3
  }
4
- function s(e, n) {
4
+ function u(e, n) {
5
5
  if (!n || !e) return;
6
6
  const t = n.split(".");
7
7
  let f = e;
@@ -22,14 +22,14 @@ function d(e, n, t) {
22
22
  return i[f[f.length - 1]] = t, r;
23
23
  }
24
24
  function m(e, n) {
25
- return !v(n) || !n.name ? e : s(e, n.name) === void 0 && n.value !== void 0 ? d(e, n.name, n.value) : e;
25
+ return !v(n) || !n.name ? e : u(e, n.name) === void 0 && n.value !== void 0 ? d(e, n.name, n.value) : e;
26
26
  }
27
27
  function g(e, n) {
28
28
  let t = n ? c(n) : {};
29
29
  const f = Array.isArray(e[0]) ? e.flat() : e;
30
30
  for (const r of f) {
31
31
  if (!r.name) continue;
32
- if (s(t, r.name) === void 0) {
32
+ if (u(t, r.name) === void 0) {
33
33
  const o = typeof r.value == "function" ? r.value() : r.value;
34
34
  o !== void 0 && Object.assign(t, d(t, r.name, o));
35
35
  }
@@ -40,38 +40,40 @@ function g(e, n) {
40
40
  function h(e, n) {
41
41
  return e === void 0 ? !1 : typeof e == "boolean" ? e : typeof e == "function" ? e(n) : !1;
42
42
  }
43
- function F(e, n) {
43
+ function V(e, n) {
44
44
  return Array.isArray(e) ? e.filter((t) => t ? !n.every((r) => {
45
45
  const i = t[r.name];
46
46
  return i == null || i === "";
47
47
  }) : !1) : [];
48
48
  }
49
- function V(e, n) {
49
+ function F(e, n) {
50
50
  const t = [], f = Array.isArray(e[0]) ? e.flat() : e;
51
51
  for (const r of f) {
52
52
  if (!r.name) continue;
53
53
  const i = r.type;
54
54
  if (i === "file" || i === "avatarUpload" || i === "fileUploader") {
55
- const o = s(n, r.name);
55
+ const o = u(n, r.name);
56
56
  o && t.push({
57
57
  name: r.name,
58
58
  value: o,
59
- type: i
59
+ type: i,
60
+ field: r
60
61
  });
61
62
  }
62
63
  if (i === "customFields" && r.props?.schema) {
63
- const o = s(n, r.name);
64
+ const o = u(n, r.name);
64
65
  if (Array.isArray(o)) {
65
66
  const y = r.props.schema.filter(
66
67
  (a) => a.type === "file" || a.type === "avatarUpload" || a.type === "fileUploader"
67
68
  );
68
69
  y.length > 0 && o.forEach((a, A) => {
69
- y.forEach((u) => {
70
- const p = a?.[u.name];
70
+ y.forEach((s) => {
71
+ const p = a?.[s.name];
71
72
  p && t.push({
72
- name: `${r.name}.${A}.${u.name}`,
73
+ name: `${r.name}.${A}.${s.name}`,
73
74
  value: p,
74
- type: u.type
75
+ type: s.type,
76
+ field: s
75
77
  });
76
78
  });
77
79
  });
@@ -94,11 +96,11 @@ function k(e) {
94
96
  return e ? typeof e == "object" && (typeof e.render == "function" || typeof e.setup == "function" || e.__name !== void 0 || e.name !== void 0) : !1;
95
97
  }
96
98
  export {
97
- V as collectFileFields,
99
+ F as collectFileFields,
98
100
  c as deepClone,
99
101
  h as evaluateConditional,
100
- F as filterNullCustomFields,
101
- s as getNestedValue,
102
+ V as filterNullCustomFields,
103
+ u as getNestedValue,
102
104
  g as initializeFormValues,
103
105
  v as isAddonObject,
104
106
  k as isComponent,
@@ -1,4 +1,4 @@
1
- import { defineComponent as W, computed as S, ref as y, provide as E, watch as N, resolveComponent as X, openBlock as a, createElementBlock as i, normalizeClass as D, createElementVNode as h, renderSlot as B, toDisplayString as f, createCommentVNode as m, createBlock as s, unref as I, createVNode as r, resolveDynamicComponent as R, Fragment as P, mergeProps as c, withCtx as o, createTextVNode as v } from "vue";
1
+ import { defineComponent as W, computed as N, ref as y, provide as E, watch as R, resolveComponent as X, openBlock as a, createElementBlock as i, normalizeClass as D, createElementVNode as h, renderSlot as B, toDisplayString as f, createCommentVNode as m, createBlock as s, unref as I, createVNode as r, resolveDynamicComponent as U, Fragment as P, mergeProps as c, withCtx as o, createTextVNode as v } from "vue";
2
2
  import Y from "../Input.vue.js";
3
3
  import u from "../Button.vue.js";
4
4
  import F from "../Icon.vue.js";
@@ -61,32 +61,32 @@ const ae = { class: "flex flex-col w-full space-y-8" }, ne = { class: "flex flex
61
61
  },
62
62
  emits: ["add", "delete"],
63
63
  setup(e, { emit: L }) {
64
- const l = e, U = L, K = S(() => l.name || l.title || "default-screen"), b = te(
64
+ const l = e, j = L, K = N(() => l.name || l.title || "default-screen"), b = te(
65
65
  `view-mode-${K.value}`,
66
66
  l.table ? "table" : "list"
67
- ), x = y(""), A = y({}), w = y(l.pageInfo?.currentPage || 1), $ = y(l.pageInfo?.itemsPerPage || l.paginationProps?.itemsPerPage || 10), g = y([]), j = y([]), k = y(!1);
68
- E("screen-selected-rows", g), E("screen-request-delete", (t) => T(t));
69
- const T = (t) => {
70
- j.value = t, k.value = !0;
67
+ ), x = y(""), A = y({}), w = y(l.pageInfo?.currentPage || 1), $ = y(l.pageInfo?.itemsPerPage || l.paginationProps?.itemsPerPage || 10), g = y([]), V = y([]), k = y(!1);
68
+ E("screen-selected-rows", g), E("screen-request-delete", (t) => S(t));
69
+ const S = (t) => {
70
+ V.value = t, k.value = !0;
71
71
  }, O = () => {
72
- U("delete", j.value), k.value = !1, g.value = [];
72
+ j("delete", V.value), k.value = !1, g.value = [];
73
73
  }, Q = (t) => {
74
- U("delete", t), g.value = [];
74
+ j("delete", t), g.value = [];
75
75
  };
76
- N(
76
+ R(
77
77
  () => l.pageInfo?.currentPage,
78
78
  (t) => {
79
79
  t && (w.value = t);
80
80
  }
81
- ), N(
81
+ ), R(
82
82
  () => l.pageInfo?.itemsPerPage,
83
83
  (t) => {
84
84
  t && ($.value = t);
85
85
  }
86
86
  );
87
- let V = null;
88
- N(x, (t) => {
89
- V && clearTimeout(V), V = setTimeout(() => {
87
+ let T = null;
88
+ R(x, (t) => {
89
+ T && clearTimeout(T), T = setTimeout(() => {
90
90
  w.value = 1, C();
91
91
  }, 300);
92
92
  });
@@ -108,7 +108,7 @@ const ae = { class: "flex flex-col w-full space-y-8" }, ne = { class: "flex flex
108
108
  filter: A.value
109
109
  };
110
110
  l.refetch && l.refetch(t);
111
- }, z = S(() => b.value === "table" && l.table ? l.table : l.list), M = S(() => l.data && l.data.length > 0);
111
+ }, z = N(() => b.value === "table" && l.table ? l.table : l.list), M = N(() => l.data && l.data.length > 0);
112
112
  return (t, n) => {
113
113
  const q = X("router-link");
114
114
  return a(), i("div", ae, [
@@ -132,13 +132,13 @@ const ae = { class: "flex flex-col w-full space-y-8" }, ne = { class: "flex flex
132
132
  class: "hover:bg-destructive/10 shrink-0 h-9! w-9!",
133
133
  icon: "lucide:trash-2",
134
134
  title: "Delete Selected",
135
- onClick: n[0] || (n[0] = (d) => T(g.value))
135
+ onClick: n[0] || (n[0] = (d) => S(g.value))
136
136
  })) : m("", !0),
137
137
  e.table && e.list ? (a(), i("div", se, [
138
138
  h("button", {
139
139
  onClick: n[1] || (n[1] = (d) => b.value = "list"),
140
140
  class: D(["p-1.5 rounded", [
141
- I(b) === "list" ? "bg-secondary/85 dark:bg-gray-250 shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"
141
+ I(b) === "list" ? "bg-secondary/85 dark:bg-secondary shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"
142
142
  ]]),
143
143
  title: "List View"
144
144
  }, [
@@ -150,7 +150,7 @@ const ae = { class: "flex flex-col w-full space-y-8" }, ne = { class: "flex flex
150
150
  h("button", {
151
151
  onClick: n[2] || (n[2] = (d) => b.value = "table"),
152
152
  class: D(["p-1.5 rounded", [
153
- I(b) === "table" ? "bg-secondary/85 dark:bg-gray-250 shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"
153
+ I(b) === "table" ? "bg-secondary/85 dark:bg-secondary shadow-sm text-foreground" : "text-muted-foreground hover:text-foreground"
154
154
  ]]),
155
155
  title: "Table View"
156
156
  }, [
@@ -194,7 +194,7 @@ const ae = { class: "flex flex-col w-full space-y-8" }, ne = { class: "flex flex
194
194
  ]),
195
195
  h("div", ue, [
196
196
  B(t.$slots, "actions", {}, () => [
197
- e.addComponent ? (a(), s(R(e.addComponent), { key: 0 })) : e.canAdd ? (a(), i(P, { key: 1 }, [
197
+ e.addComponent ? (a(), s(U(e.addComponent), { key: 0 })) : e.canAdd ? (a(), i(P, { key: 1 }, [
198
198
  e.addBtn ? (a(), i(P, { key: 0 }, [
199
199
  e.addBtn.modal ? (a(), s(H, c({
200
200
  key: 0,
@@ -293,7 +293,7 @@ const ae = { class: "flex flex-col w-full space-y-8" }, ne = { class: "flex flex
293
293
  icon: e.emptyIcon
294
294
  }, {
295
295
  action: o(() => [
296
- e.addComponent ? (a(), s(R(e.addComponent), { key: 0 })) : e.canAdd ? (a(), i(P, { key: 1 }, [
296
+ e.addComponent ? (a(), s(U(e.addComponent), { key: 0 })) : e.canAdd ? (a(), i(P, { key: 1 }, [
297
297
  e.addBtn ? (a(), i(P, { key: 0 }, [
298
298
  e.addBtn.modal ? (a(), s(H, c({
299
299
  key: 0,
@@ -373,14 +373,14 @@ const ae = { class: "flex flex-col w-full space-y-8" }, ne = { class: "flex flex
373
373
  _: 1
374
374
  }, 8, ["title", "description", "icon"])
375
375
  ]) : (a(), i(P, { key: 1 }, [
376
- z.value ? (a(), s(R(z.value), {
376
+ z.value ? (a(), s(U(z.value), {
377
377
  key: 0,
378
378
  data: e.data,
379
379
  loading: e.loading,
380
380
  refetch: e.refetch,
381
381
  selectedRows: g.value,
382
382
  "onUpdate:selectedRows": n[9] || (n[9] = (d) => g.value = d),
383
- delete: T,
383
+ delete: S,
384
384
  onDelete: Q
385
385
  }, null, 40, ["data", "loading", "refetch", "selectedRows"])) : (a(), i("div", me, " Please provide a `:list` or `:table` component. "))
386
386
  ], 64))
@@ -399,13 +399,13 @@ const ae = { class: "flex flex-col w-full space-y-8" }, ne = { class: "flex flex
399
399
  show: k.value,
400
400
  "onUpdate:show": n[10] || (n[10] = (d) => k.value = d),
401
401
  title: "Confirm Deletion",
402
- description: "Are you sure you want to delete the selected items? This action cannot be undone.",
402
+ description: `Are you sure you want to delete the selected ${V.value.length > 1 ? "items" : "item"}?`,
403
403
  "confirm-text": "Delete",
404
404
  "cancel-text": "Cancel",
405
405
  variant: "danger",
406
406
  onConfirm: O,
407
407
  onCancel: n[11] || (n[11] = (d) => k.value = !1)
408
- }, null, 8, ["show"])
408
+ }, null, 8, ["show", "description"])
409
409
  ]);
410
410
  };
411
411
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "description": "A Vue 3 UI component library built with Tailwind CSS.",
5
5
  "license": "MIT",
6
- "version": "0.3.8",
6
+ "version": "0.4.2",
7
7
  "type": "module",
8
8
  "main": "index.js",
9
9
  "module": "index.js",
package/style.css CHANGED
@@ -259,7 +259,7 @@
259
259
  @custom-variant dark (&:where(.dark, .dark *));
260
260
 
261
261
 
262
- @utility dark {
262
+ .dark {
263
263
  --color-white: #0b0b0b !important;
264
264
  --color-mixture-1: #0c0c0c !important;
265
265
  --color-mixture-2: #ffffff !important;
package/types/button.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export type ButtonVariant = 'primary' | 'primary-light' | 'secondary' | 'danger' | 'danger-light' | 'warning' | 'warning-light' | 'info' | 'info-light' | 'success' | 'success-light' | 'outline' | 'outline-primary' | 'outline-danger' | 'outline-warning' | 'outline-info' | 'outline-success' | 'ghost' | 'link';
2
- export type ButtonSize = 'xs' | 'md' | 'sm' | 'lg' | 'xl';
3
- export type ButtonRounded = 'none' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | 'full';
2
+ export type ButtonSize = 'xs' | 'sm' | 'sm2' | 'md' | 'lg' | 'xl';
3
+ export type ButtonRounded = 'none' | 'sm' | 'sm2' | 'md' | 'lg' | 'xl' | '2xl' | 'full';
4
4
  export interface ButtonProps {
5
5
  variant?: ButtonVariant;
6
6
  size?: ButtonSize;