adverich-kun-ui 0.1.513 → 0.1.514

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,31 +1,32 @@
1
- import { useAttrs as ee, ref as oe, getCurrentInstance as ne, computed as a, createElementBlock as l, openBlock as r, mergeProps as A, renderSlot as d, createElementVNode as i, createCommentVNode as u, normalizeClass as b, toDisplayString as g, normalizeProps as R, guardReactiveProps as z, unref as t, createBlock as y, resolveDynamicComponent as m, Fragment as re, renderList as te, withDirectives as se, vShow as le, createTextVNode as ae } from "vue";
2
- import { kunTextareaProps as de } from "../composables/KunTextareaProps.js";
3
- import ie from "../composables/useKunTextareaComposable.js";
1
+ import { useAttrs as oe, ref as re, getCurrentInstance as te, computed as a, createElementBlock as l, openBlock as r, mergeProps as M, renderSlot as d, createElementVNode as i, createCommentVNode as u, normalizeClass as b, toDisplayString as g, normalizeProps as R, guardReactiveProps as z, unref as t, createBlock as y, resolveDynamicComponent as m, Fragment as ne, renderList as se, withDirectives as le, vShow as ae, createTextVNode as de } from "vue";
2
+ import { kunTextareaProps as ie } from "../composables/KunTextareaProps.js";
3
+ import ue from "../composables/useKunTextareaComposable.js";
4
4
  import { renderIconSlot as h } from "../../../../utils/renderIcon.js";
5
- const ue = { class: "relative" }, pe = {
5
+ import { debounce as pe } from "../../../../utils/utils.js";
6
+ const ce = { class: "relative" }, ve = {
6
7
  key: 0,
7
8
  class: "absolute left-2 top-2 flex items-center"
8
- }, ce = {
9
+ }, fe = {
9
10
  key: 1,
10
11
  class: "absolute left-2 top-2 ml-1"
11
- }, ve = ["value", "rows", "disabled", "readonly", "placeholder"], fe = {
12
+ }, be = ["value", "rows", "disabled", "readonly", "placeholder"], ge = {
12
13
  key: 3,
13
14
  class: "absolute right-2 top-2 mr-1"
14
- }, be = {
15
+ }, ye = {
15
16
  key: 4,
16
17
  class: "absolute right-2 top-2 flex items-center"
17
- }, ge = {
18
+ }, me = {
18
19
  key: 5,
19
20
  class: "mt-1"
20
- }, ye = { class: "h-1 w-full bg-field-background rounded overflow-hidden" }, me = {
21
+ }, he = { class: "h-1 w-full bg-field-background rounded overflow-hidden" }, ke = {
21
22
  key: 7,
22
23
  class: "text-xs text-right mt-1 text-gray-400"
23
- }, he = { key: 0 }, $e = {
24
+ }, Ce = { key: 0 }, Be = {
24
25
  __name: "KunTextarea",
25
- props: { ...de },
26
+ props: { ...ie },
26
27
  emits: ["update:modelValue", "click:clear", "click:control", "update:focused", "mousedown:control"],
27
- setup(D, { expose: M, emit: F }) {
28
- const o = D, k = F, G = ee(), p = oe(null), B = `textarea-${ne().uid}`, {
28
+ setup(A, { expose: D, emit: F }) {
29
+ const o = A, k = F, G = oe(), p = re(null), B = `textarea-${te().uid}`, {
29
30
  isFocused: c,
30
31
  internalValue: v,
31
32
  updateModel: P,
@@ -36,12 +37,13 @@ const ue = { class: "relative" }, pe = {
36
37
  hasError: f,
37
38
  displayedMessages: C,
38
39
  adjustHeight: H
39
- } = ie(o, k, p), L = (e) => {
40
- const n = e.target.value;
41
- v.value = n, P(n), o.autoGrow && H();
42
- }, j = () => {
40
+ } = ue(o, k, p), L = (e) => {
41
+ v.value = e.target.value, j(e.target.value), o.autoGrow && H();
42
+ }, j = pe((e) => {
43
+ P(e);
44
+ }, 100), K = () => {
43
45
  c.value = !0, k("update:focused", !0);
44
- }, K = () => {
46
+ }, U = () => {
45
47
  c.value = !1, k("update:focused", !1);
46
48
  }, V = a(() => c.value || !!v.value || o.dirty), w = a(() => typeof v.value == "string" ? v.value.length : 0), I = a(() => o.counter === !0 ? 25 : o.counter || null), q = a(() => o.persistentCounter || o.counter && c.value), J = a(() => ["relative w-full flex flex-col", o.class, o.wrapperClass]), O = a(
47
49
  () => o.persistentClear ? "opacity-100" : "hover:opacity-100 opacity-0 transition-opacity duration-200"
@@ -59,9 +61,9 @@ const ue = { class: "relative" }, pe = {
59
61
  default:
60
62
  return "";
61
63
  }
62
- }), U = a(
64
+ }), W = a(
63
65
  () => o.density === "compact" ? "p-1" : o.density === "comfortable" ? "p-2" : "p-3"
64
- ), W = a(() => [
66
+ ), X = a(() => [
65
67
  "w-full resize-none p-2 transition-colors duration-150",
66
68
  o.inputClass,
67
69
  {
@@ -80,8 +82,8 @@ const ue = { class: "relative" }, pe = {
80
82
  resize: !o.noResize && !o.autoGrow
81
83
  },
82
84
  Q.value,
83
- U.value
84
- ]), X = {
85
+ W.value
86
+ ]), Y = {
85
87
  label: o.label,
86
88
  isFocused: c,
87
89
  isActive: V,
@@ -108,11 +110,11 @@ const ue = { class: "relative" }, pe = {
108
110
  return (e = p.value) == null ? void 0 : e.blur();
109
111
  },
110
112
  props: o
111
- }, Y = $, Z = $, x = a(() => {
113
+ }, Z = $, x = $, _ = a(() => {
112
114
  const { class: e, ...n } = G;
113
115
  return n;
114
116
  });
115
- return M({
117
+ return D({
116
118
  validate: T,
117
119
  reset: E,
118
120
  resetValidation: N,
@@ -123,20 +125,20 @@ const ue = { class: "relative" }, pe = {
123
125
  return (e = p.value) == null ? void 0 : e.focus();
124
126
  },
125
127
  rootRef: p
126
- }), (e, n) => (r(), l("div", A({
128
+ }), (e, n) => (r(), l("div", M({
127
129
  class: J.value,
128
130
  ref: "rootRef"
129
- }, x.value), [
130
- d(e.$slots, "label", A({ for: B }, X), () => [
131
+ }, _.value), [
132
+ d(e.$slots, "label", M({ for: B }, Y), () => [
131
133
  e.label ? (r(), l("label", {
132
134
  key: 0,
133
135
  for: B,
134
136
  class: b(["absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10", V.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"])
135
137
  }, g(e.label), 3)) : u("", !0)
136
138
  ]),
137
- i("div", ue, [
138
- e.prependIcon || e.$slots.prepend ? (r(), l("div", pe, [
139
- d(e.$slots, "prepend", R(z(t(Y))), () => [
139
+ i("div", ce, [
140
+ e.prependIcon || e.$slots.prepend ? (r(), l("div", ve, [
141
+ d(e.$slots, "prepend", R(z(t(Z))), () => [
140
142
  i("div", {
141
143
  onClick: n[0] || (n[0] = (s) => e.handleIconClick(s, "prepend"))
142
144
  }, [
@@ -144,7 +146,7 @@ const ue = { class: "relative" }, pe = {
144
146
  ])
145
147
  ])
146
148
  ])) : u("", !0),
147
- e.prependInnerIcon || e.$slots["prepend-inner"] ? (r(), l("div", ce, [
149
+ e.prependInnerIcon || e.$slots["prepend-inner"] ? (r(), l("div", fe, [
148
150
  d(e.$slots, "prepend-inner", {}, () => [
149
151
  i("div", {
150
152
  onClick: n[1] || (n[1] = (s) => e.handleIconClick(s, "prependInner"))
@@ -162,13 +164,13 @@ const ue = { class: "relative" }, pe = {
162
164
  readonly: e.readonly,
163
165
  placeholder: e.placeholder,
164
166
  onInput: L,
165
- onFocus: j,
166
- onBlur: K,
167
+ onFocus: K,
168
+ onBlur: U,
167
169
  onClick: n[2] || (n[2] = (s) => e.$emit("click:control", s)),
168
170
  onMousedown: n[3] || (n[3] = (s) => e.$emit("mousedown:control", s)),
169
- class: b(["bg-field-background", [W.value]]),
171
+ class: b(["bg-field-background", [X.value]]),
170
172
  style: { width: "100%", "box-sizing": "border-box", "overflow-y": "hidden" }
171
- }, null, 42, ve),
173
+ }, null, 42, be),
172
174
  e.clearable && t(v) ? (r(), l("div", {
173
175
  key: 2,
174
176
  class: b(["absolute right-2 top-2", O.value])
@@ -183,7 +185,7 @@ const ue = { class: "relative" }, pe = {
183
185
  ])
184
186
  ])
185
187
  ], 2)) : u("", !0),
186
- e.appendInnerIcon || e.$slots["append-inner"] ? (r(), l("div", fe, [
188
+ e.appendInnerIcon || e.$slots["append-inner"] ? (r(), l("div", ge, [
187
189
  d(e.$slots, "append-inner", {}, () => [
188
190
  i("div", {
189
191
  onClick: n[5] || (n[5] = (s) => e.handleIconClick(s, "appendInner"))
@@ -192,8 +194,8 @@ const ue = { class: "relative" }, pe = {
192
194
  ])
193
195
  ])
194
196
  ])) : u("", !0),
195
- e.appendIcon || e.$slots.append ? (r(), l("div", be, [
196
- d(e.$slots, "append", R(z(t(Z))), () => [
197
+ e.appendIcon || e.$slots.append ? (r(), l("div", ye, [
198
+ d(e.$slots, "append", R(z(t(x))), () => [
197
199
  i("div", {
198
200
  onClick: n[6] || (n[6] = (s) => e.handleIconClick(s, "append"))
199
201
  }, [
@@ -201,12 +203,12 @@ const ue = { class: "relative" }, pe = {
201
203
  ])
202
204
  ])
203
205
  ])) : u("", !0),
204
- e.loading ? (r(), l("div", ge, [
206
+ e.loading ? (r(), l("div", me, [
205
207
  d(e.$slots, "loader", {
206
208
  color: e.loadingColor,
207
209
  isActive: !0
208
210
  }, () => [
209
- i("div", ye, [
211
+ i("div", he, [
210
212
  i("div", {
211
213
  class: b(["h-full transition-all duration-300", [e.loadingColor]]),
212
214
  style: { width: "100%" }
@@ -219,8 +221,8 @@ const ue = { class: "relative" }, pe = {
219
221
  class: b(["text-xs mt-1 space-y-1", { "text-red-500": t(f), "text-gray-500": !t(f) }])
220
222
  }, [
221
223
  d(e.$slots, "details", {}, () => [
222
- t(f) ? (r(!0), l(re, { key: 0 }, te(t(C), (s, _) => d(e.$slots, "message", {
223
- key: _,
224
+ t(f) ? (r(!0), l(ne, { key: 0 }, se(t(C), (s, ee) => d(e.$slots, "message", {
225
+ key: ee,
224
226
  message: s
225
227
  }, () => [
226
228
  i("div", null, g(s), 1)
@@ -228,20 +230,20 @@ const ue = { class: "relative" }, pe = {
228
230
  key: 1,
229
231
  hint: e.hint
230
232
  }, () => [
231
- se(i("div", null, g(e.hint), 513), [
232
- [le, e.persistentHint || t(c)]
233
+ le(i("div", null, g(e.hint), 513), [
234
+ [ae, e.persistentHint || t(c)]
233
235
  ])
234
236
  ]) : u("", !0)
235
237
  ])
236
238
  ], 2)) : u("", !0),
237
- q.value ? (r(), l("div", me, [
239
+ q.value ? (r(), l("div", ke, [
238
240
  d(e.$slots, "counter", {
239
241
  counter: w.value,
240
242
  max: I.value,
241
243
  value: w.value
242
244
  }, () => [
243
- ae(g(w.value), 1),
244
- I.value ? (r(), l("span", he, " / " + g(I.value), 1)) : u("", !0)
245
+ de(g(w.value), 1),
246
+ I.value ? (r(), l("span", Ce, " / " + g(I.value), 1)) : u("", !0)
245
247
  ])
246
248
  ])) : u("", !0)
247
249
  ])
@@ -249,5 +251,5 @@ const ue = { class: "relative" }, pe = {
249
251
  }
250
252
  };
251
253
  export {
252
- $e as default
254
+ Be as default
253
255
  };
@@ -1,8 +1,8 @@
1
- import { ref as i, computed as h, watch as E, nextTick as m, onMounted as A, onBeforeUnmount as F } from "vue";
1
+ import { ref as i, computed as h, watch as O, nextTick as v, onMounted as A, onBeforeUnmount as F } from "vue";
2
2
  function $(t, H, l) {
3
- const s = i(""), c = i(t.modelValue), J = i(!1), a = i([]), f = h(() => t.formatModel === "json" || t.formatModel === "auto" && typeof t.modelValue == "object");
4
- function v(e) {
5
- if (f.value && e != null)
3
+ const s = i(""), g = i(t.modelValue), x = i(!1), a = i([]), c = h(() => t.formatModel === "json" || t.formatModel === "auto" && typeof t.modelValue == "object");
4
+ function m(e) {
5
+ if (c.value && e != null)
6
6
  try {
7
7
  return JSON.stringify(e, null, 2);
8
8
  } catch {
@@ -11,7 +11,7 @@ function $(t, H, l) {
11
11
  return e ?? "";
12
12
  }
13
13
  function y(e) {
14
- if (f.value && typeof e == "string")
14
+ if (c.value && typeof e == "string")
15
15
  try {
16
16
  return JSON.parse(e);
17
17
  } catch {
@@ -19,15 +19,14 @@ function $(t, H, l) {
19
19
  }
20
20
  return e;
21
21
  }
22
- function x(e) {
22
+ function I(e) {
23
23
  const u = y(e);
24
- c.value = u, H("update:modelValue", u);
24
+ g.value = u, H("update:modelValue", u);
25
25
  }
26
- E(
26
+ O(
27
27
  () => t.modelValue,
28
28
  (e) => {
29
- const u = JSON.stringify(e), n = JSON.stringify(c.value);
30
- u !== n && (c.value = e, s.value = v(e), t.autoGrow && m(() => d()));
29
+ g.value = e, s.value = m(e), t.autoGrow && v(() => d());
31
30
  },
32
31
  { immediate: !0, deep: !0 }
33
32
  );
@@ -41,21 +40,21 @@ function $(t, H, l) {
41
40
  } else
42
41
  l.value.style.height = e - 16 + "px";
43
42
  };
44
- function N(e) {
45
- var S;
46
- if (!f.value) return;
43
+ function J(e) {
44
+ var V;
45
+ if (!c.value) return;
47
46
  const u = l.value;
48
47
  if (!u) return;
49
- const n = u.selectionStart, o = s.value, r = " ", g = o.slice(0, n), j = o.slice(n), C = g.lastIndexOf(`
48
+ const n = u.selectionStart, o = s.value, r = " ", f = o.slice(0, n), E = o.slice(n), N = f.lastIndexOf(`
50
49
  `) + 1, w = `
51
- ${((S = g.slice(C).match(/^\s*/)) == null ? void 0 : S[0]) ?? ""}${r}`;
52
- s.value = g + w + j, m(() => {
53
- const V = n + w.length;
54
- u.setSelectionRange(V, V);
50
+ ${((V = f.slice(N).match(/^\s*/)) == null ? void 0 : V[0]) ?? ""}${r}`;
51
+ s.value = f + w + E, v(() => {
52
+ const S = n + w.length;
53
+ u.setSelectionRange(S, S);
55
54
  }), e.preventDefault();
56
55
  }
57
56
  A(() => {
58
- s.value = v(t.modelValue), m(() => {
57
+ s.value = m(t.modelValue), v(() => {
59
58
  t.autoGrow && d();
60
59
  });
61
60
  }), F(() => {
@@ -63,8 +62,8 @@ ${((S = g.slice(C).match(/^\s*/)) == null ? void 0 : S[0]) ?? ""}${r}`;
63
62
  const M = h(() => {
64
63
  var e;
65
64
  return !!(a.value.length || (e = t.errorMessages) != null && e.length);
66
- }), O = h(() => M.value ? [...t.errorMessages || [], ...a.value].slice(0, t.maxErrors) : []);
67
- function I() {
65
+ }), b = h(() => M.value ? [...t.errorMessages || [], ...a.value].slice(0, t.maxErrors) : []);
66
+ function j() {
68
67
  const e = t.rules || [], u = t.required && !s.value ? null : y(s.value), n = [];
69
68
  for (const o of e) {
70
69
  const r = typeof o == "function" ? o(u) : o;
@@ -72,19 +71,19 @@ ${((S = g.slice(C).match(/^\s*/)) == null ? void 0 : S[0]) ?? ""}${r}`;
72
71
  }
73
72
  return a.value = n, n.length === 0;
74
73
  }
75
- function b() {
74
+ function C() {
76
75
  a.value = [];
77
76
  }
78
77
  return {
79
78
  internalValue: s,
80
- isFocused: J,
79
+ isFocused: x,
81
80
  hasError: M,
82
- displayedMessages: O,
83
- validate: I,
84
- resetValidation: b,
85
- updateModel: x,
81
+ displayedMessages: b,
82
+ validate: j,
83
+ resetValidation: C,
84
+ updateModel: I,
86
85
  adjustHeight: d,
87
- handleJsonEnter: N
86
+ handleJsonEnter: J
88
87
  };
89
88
  }
90
89
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.513",
3
+ "version": "0.1.514",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",