adverich-kun-ui 0.1.352 → 0.1.354

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,40 +1,43 @@
1
- import { mergeModels as R, useModel as $, onMounted as ae, ref as B, watch as ie, createElementBlock as w, openBlock as i, createVNode as a, unref as t, isRef as F, createSlots as re, withCtx as n, createCommentVNode as k, Fragment as se, renderList as ue, createBlock as d, createElementVNode as de, createTextVNode as v, toDisplayString as V, normalizeClass as ce, withModifiers as me } from "vue";
1
+ import { mergeModels as A, useModel as R, onMounted as ie, ref as $, watch as ae, createElementBlock as v, openBlock as a, createVNode as i, unref as t, isRef as B, createSlots as re, withCtx as n, createCommentVNode as k, Fragment as se, renderList as ue, createBlock as c, createElementVNode as de, createTextVNode as y, toDisplayString as V, normalizeClass as ce, withModifiers as me } from "vue";
2
2
  import { icons as m } from "../../../../icons/index.js";
3
- import { isNotEmpty as fe, isArray as T } from "../../../../utils/utils.js";
3
+ import { isNotEmpty as fe, isArray as F } from "../../../../utils/utils.js";
4
4
  import pe from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
5
  import he from "../../../KunList/src/components/KunList.vue.js";
6
- import I from "../../../KunListItem/src/components/KunListItem.vue.js";
6
+ import T from "../../../KunListItem/src/components/KunListItem.vue.js";
7
7
  import x from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
8
- import ke from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
- import ve from "../../../KunMenu/src/components/KunMenu.vue.js";
8
+ import ve from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
+ import ke from "../../../KunMenu/src/components/KunMenu.vue.js";
10
10
  import { useAutocomplete as ye } from "../composables/useAutocomplete.js";
11
11
  import { KunAutocompleteProps as be } from "../composables/KunAutocompleteProps.js";
12
12
  import ge from "../../../KunTextField/src/components/KunTextField.vue.js";
13
13
  import Ce from "../../../KunBtn/src/components/KunBtn.vue.js";
14
14
  import we from "../../../KunChip/src/components/KunChip.vue.js";
15
- import y from "../../../KunIcon/src/components/KunIcon.vue.js";
15
+ import b from "../../../KunIcon/src/components/KunIcon.vue.js";
16
16
  const Ve = {
17
17
  key: 0,
18
18
  class: "flex justify-center align-center"
19
- }, Ie = { class: "flex justify-center align-center" }, Le = {
19
+ }, Ie = { class: "flex justify-center align-center" }, Se = {
20
+ key: 0,
21
+ class: "p-2"
22
+ }, Ue = {
20
23
  __name: "KunAutocomplete",
21
- props: /* @__PURE__ */ R(be, {
24
+ props: /* @__PURE__ */ A(be, {
22
25
  modelValue: { default: null },
23
26
  modelModifiers: {},
24
27
  items: { default: [], type: Array, required: !0 },
25
28
  itemsModifiers: {}
26
29
  }),
27
- emits: /* @__PURE__ */ R(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
28
- setup(b, { emit: E }) {
29
- const r = $(b, "modelValue"), S = $(b, "items"), u = b, f = E, {
30
- textFieldRef: g,
31
- listRef: D,
30
+ emits: /* @__PURE__ */ A(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
31
+ setup(g, { emit: E }) {
32
+ const r = R(g, "modelValue"), I = R(g, "items"), u = g, f = E, {
33
+ textFieldRef: C,
34
+ listRef: S,
32
35
  menuModel: s,
33
- search: c,
36
+ search: d,
34
37
  removeItem: N,
35
38
  clearSelection: L,
36
39
  lightReset: U,
37
- openMenu: C,
40
+ openMenu: w,
38
41
  closeMenu: H,
39
42
  toggleMenu: O,
40
43
  onMenuKeydown: j,
@@ -44,13 +47,13 @@ const Ve = {
44
47
  isAlphanumeric: G,
45
48
  createItem: J,
46
49
  checkDisabled: Q,
47
- itemToString: K,
50
+ itemToString: D,
48
51
  placeholder: X
49
- } = ye(u, f, r, S);
50
- ae(() => {
51
- u.focusOnRender && g.value.focus();
52
+ } = ye(u, f, r, I);
53
+ ie(() => {
54
+ u.focusOnRender && C.value.focus();
52
55
  });
53
- const M = B(null), p = B(""), _ = (e) => {
56
+ const K = $(null), p = $(""), M = (e) => {
54
57
  for (const o of u.rules) {
55
58
  const l = o(e);
56
59
  if (l !== !0)
@@ -58,12 +61,12 @@ const Ve = {
58
61
  }
59
62
  return p.value = "", f("validation", !0), !0;
60
63
  };
61
- ie(() => r.value, (e, o) => {
62
- fe(u.rules) && _(e);
64
+ ae(() => r.value, (e, o) => {
65
+ fe(u.rules) && M(e);
63
66
  });
64
67
  function Y() {
65
68
  var e;
66
- s.value = !1, (e = g.value.inputField) == null || e.focus();
69
+ s.value = !1, (e = C.value.inputField) == null || e.focus();
67
70
  }
68
71
  function Z(e) {
69
72
  var l, h;
@@ -72,28 +75,28 @@ const Ve = {
72
75
  H();
73
76
  return;
74
77
  }
75
- (G(o) || o === "Backspace") && C(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), s.value || C(), (h = (l = D.value) == null ? void 0 : l.focusWithKey) == null || h.call(l, o));
78
+ (G(o) || o === "Backspace") && w(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), s.value || w(), (h = (l = S.value) == null ? void 0 : l.focusWithKey) == null || h.call(l, o));
76
79
  }
77
80
  function ee(e) {
78
- f("search", c);
81
+ f("search", d);
79
82
  }
80
83
  function le() {
81
- _(r);
84
+ M(r);
82
85
  }
83
86
  function te(e) {
84
87
  j(e);
85
88
  }
86
89
  function oe() {
87
90
  }
88
- return (e, o) => (i(), w("div", {
91
+ return (e, o) => (a(), v("div", {
89
92
  class: "w-full h-fit",
90
93
  ref_key: "parentRef",
91
- ref: M
94
+ ref: K
92
95
  }, [
93
- a(ge, {
94
- modelValue: t(c),
96
+ i(ge, {
97
+ modelValue: t(d),
95
98
  "onUpdate:modelValue": [
96
- o[1] || (o[1] = (l) => F(c) ? c.value = l : null),
99
+ o[1] || (o[1] = (l) => B(d) ? d.value = l : null),
97
100
  ee
98
101
  ],
99
102
  label: e.label,
@@ -101,28 +104,28 @@ const Ve = {
101
104
  "hide-details": e.hideDetails,
102
105
  density: e.density,
103
106
  ref_key: "textFieldRef",
104
- ref: g,
107
+ ref: C,
105
108
  autocomplete: "off",
106
109
  onFocusInput: le,
107
110
  onHandleClick: t(O),
108
111
  rounded: t(s) ? "rounded-t" : "rounded",
109
112
  onBlur: oe,
110
113
  onKeyDown: Z,
111
- placeholder: u.multiple && t(T)(r.value) && r.value.length ? "" : t(X),
114
+ placeholder: u.multiple && t(F)(r.value) && r.value.length ? "" : t(X),
112
115
  error: !!p.value,
113
116
  "error-messages": p.value
114
117
  }, re({
115
118
  default: n(() => [
116
- t(T)(r.value) ? (i(), w("div", Ve, [
117
- (i(!0), w(se, null, ue(r.value, (l) => (i(), d(we, {
119
+ t(F)(r.value) ? (a(), v("div", Ve, [
120
+ (a(!0), v(se, null, ue(r.value, (l) => (a(), c(we, {
118
121
  key: l.id ?? l.name,
119
122
  size: "small",
120
123
  class: "ml-1"
121
124
  }, {
122
125
  default: n(() => [
123
126
  de("div", Ie, [
124
- v(V(t(W)(l, e.itemTitle)) + " ", 1),
125
- a(y, {
127
+ y(V(t(W)(l, e.itemTitle)) + " ", 1),
128
+ i(b, {
126
129
  color: "error",
127
130
  icon: t(m).close,
128
131
  size: "small",
@@ -134,14 +137,14 @@ const Ve = {
134
137
  _: 2
135
138
  }, 1024))), 128))
136
139
  ])) : k("", !0),
137
- a(ve, {
140
+ i(ke, {
138
141
  transition: "fade",
139
142
  "onClick:outside": t(U),
140
143
  modelValue: t(s),
141
- "onUpdate:modelValue": o[0] || (o[0] = (l) => F(s) ? s.value = l : null),
144
+ "onUpdate:modelValue": o[0] || (o[0] = (l) => B(s) ? s.value = l : null),
142
145
  activator: "parent",
143
146
  "z-index": e.zIndex,
144
- "parent-ref": M.value,
147
+ "parent-ref": K.value,
145
148
  location: "bottom",
146
149
  origin: "bottom left",
147
150
  onHandleEscape: Y,
@@ -151,32 +154,29 @@ const Ve = {
151
154
  "hide-details": e.hideDetails
152
155
  }, {
153
156
  default: n(() => [
154
- a(he, {
157
+ i(he, {
155
158
  "onClick:select": t(q),
156
159
  ref_key: "listRef",
157
- ref: D,
160
+ ref: S,
158
161
  onKeyDown: te,
159
162
  selectable: !0
160
163
  }, {
161
164
  default: n(() => [
162
- e.hasCreateItem ? (i(), d(I, { key: 0 }, {
163
- default: n(() => [
164
- a(Ce, {
165
- onClick: t(J),
166
- bgColor: e.btnCreateBg,
167
- class: ce(e.btnCreateClass)
168
- }, {
169
- default: n(() => [
170
- v(V(e.btnCreateText), 1)
171
- ]),
172
- _: 1
173
- }, 8, ["onClick", "bgColor", "class"])
174
- ]),
175
- _: 1
176
- })) : k("", !0),
177
- a(pe, {
178
- items: S.value,
179
- search: t(c),
165
+ e.hasCreateItem ? (a(), v("div", Se, [
166
+ i(Ce, {
167
+ onClick: t(J),
168
+ bgColor: e.btnCreateBg,
169
+ class: ce(e.btnCreateClass)
170
+ }, {
171
+ default: n(() => [
172
+ y(V(e.btnCreateText), 1)
173
+ ]),
174
+ _: 1
175
+ }, 8, ["onClick", "bgColor", "class"])
176
+ ])) : k("", !0),
177
+ i(pe, {
178
+ items: I.value,
179
+ search: t(d),
180
180
  "searchable-keys": u.searchableKeys,
181
181
  virtual: !1,
182
182
  "items-per-intersection": 10,
@@ -184,39 +184,39 @@ const Ve = {
184
184
  "item-height": 48
185
185
  }, {
186
186
  default: n(({ item: l, index: h, empty: ne }) => {
187
- var z, A;
187
+ var _, z;
188
188
  return [
189
- !ne && l ? (i(), d(I, {
189
+ !ne && l ? (a(), c(T, {
190
190
  value: l,
191
- key: ((z = l.id) == null ? void 0 : z.toString()) ?? l.name,
191
+ key: ((_ = l.id) == null ? void 0 : _.toString()) ?? l.name,
192
192
  disabled: t(Q)(l),
193
193
  "bg-items": e.bgItemListColor,
194
194
  "hover-bg": e.hoverItemListColor,
195
195
  activeClass: e.selectedItemListColor,
196
196
  density: e.density,
197
- id: ((A = l.id) == null ? void 0 : A.toString()) ?? l.name,
197
+ id: ((z = l.id) == null ? void 0 : z.toString()) ?? l.name,
198
198
  selectable: !0
199
199
  }, {
200
200
  default: n(() => [
201
- a(x, { class: "text-wrap" }, {
201
+ i(x, { class: "text-wrap" }, {
202
202
  default: n(() => [
203
- v(V(t(K)(l, e.itemTitle ?? t(P), "hasDefault")), 1)
203
+ y(V(t(D)(l, e.itemTitle ?? t(P), "hasDefault")), 1)
204
204
  ]),
205
205
  _: 2
206
206
  }, 1024),
207
- a(ke, {
208
- text: e.itemSubtitle ? t(K)(l, e.itemSubtitle) : ""
207
+ i(ve, {
208
+ text: e.itemSubtitle ? t(D)(l, e.itemSubtitle) : ""
209
209
  }, null, 8, ["text"])
210
210
  ]),
211
211
  _: 2
212
- }, 1032, ["value", "disabled", "bg-items", "hover-bg", "activeClass", "density", "id"])) : (i(), d(I, {
212
+ }, 1032, ["value", "disabled", "bg-items", "hover-bg", "activeClass", "density", "id"])) : (a(), c(T, {
213
213
  key: 1,
214
214
  disabled: ""
215
215
  }, {
216
216
  default: n(() => [
217
- a(x, { class: "text-center w-full text-gray-500" }, {
217
+ i(x, { class: "text-center w-full text-gray-500" }, {
218
218
  default: n(() => o[2] || (o[2] = [
219
- v(" No hay elementos disponibles ")
219
+ y(" No hay elementos disponibles ")
220
220
  ])),
221
221
  _: 1,
222
222
  __: [2]
@@ -240,7 +240,7 @@ const Ve = {
240
240
  e.hasIcons ? {
241
241
  name: "append-inner",
242
242
  fn: n(() => [
243
- e.clearable && r.value ? (i(), d(y, {
243
+ e.clearable && r.value ? (a(), c(b, {
244
244
  key: 0,
245
245
  onClick: t(L),
246
246
  size: "small",
@@ -248,14 +248,14 @@ const Ve = {
248
248
  icon: t(m).close,
249
249
  class: "mr-1 mt-1"
250
250
  }, null, 8, ["onClick", "icon"])) : k("", !0),
251
- a(y, {
251
+ i(b, {
252
252
  color: "teal-darken-1",
253
253
  size: "large",
254
254
  class: "cursor-pointer",
255
255
  icon: t(s) ? t(m).menuUpOutline : t(m).menuDownOutline,
256
- onClick: me(t(C), ["stop"])
256
+ onClick: me(t(w), ["stop"])
257
257
  }, null, 8, ["icon", "onClick"]),
258
- e.required ? (i(), d(y, {
258
+ e.required ? (a(), c(b, {
259
259
  key: 1,
260
260
  color: "teal-darken-1",
261
261
  size: "x-small",
@@ -270,5 +270,5 @@ const Ve = {
270
270
  }
271
271
  };
272
272
  export {
273
- Le as default
273
+ Ue as default
274
274
  };
@@ -1,12 +1,12 @@
1
1
  import { ref as o, computed as M, watch as H, nextTick as F } from "vue";
2
- import { isArray as g, isObject as b, fullCopy as L } from "../../../../utils/utils.js";
2
+ import { isArray as j, isObject as b, fullCopy as L } from "../../../../utils/utils.js";
3
3
  function U(t, h, c, s) {
4
- const l = o(null), d = o(null), j = o(null), f = o(!1), v = o(""), N = (e, n) => n.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e), V = M(() => l.value ? g(l.value) ? l.value.length ? x(l.value, t.itemTitle, "hasDefault") : t.placeholderText : b(l.value) ? x(l.value, t.itemTitle, "hasDefault") : l.value.toString() : s.value.length ? t.placeholderText : t.textNoItems), B = M(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
4
+ const l = o(null), d = o(null), y = o(null), f = o(!1), v = o(""), N = (e, n) => n.split(".").reduce((u, r) => u && u[r] !== void 0 ? u[r] : null, e), V = M(() => l.value ? j(l.value) ? l.value.length ? x(l.value, t.itemTitle, "hasDefault") : t.placeholderText : b(l.value) ? x(l.value, t.itemTitle, "hasDefault") : l.value.toString() : s.value.length ? t.placeholderText : t.textNoItems), B = M(() => t.itemText.includes(",") ? t.itemText.split(",") : t.itemText);
5
5
  function x(e, n, u) {
6
6
  var r;
7
7
  if (b(e)) {
8
8
  if (n) {
9
- if (g(n))
9
+ if (j(n))
10
10
  return n.map((i) => e[i] ?? "No definido").join(" - ");
11
11
  if (n.includes(","))
12
12
  return n.split(",").map((i) => e[i]).join(" - ");
@@ -22,15 +22,15 @@ function U(t, h, c, s) {
22
22
  if (u)
23
23
  return Object.values(e)[0];
24
24
  }
25
- return g(e) ? t.returnObject ? e.map((i) => i[n]).join(" - ") : e.map((i) => i).join(" - ") : u && typeof e != "number" ? e.includes(",") ? e.split(",") : e : ((r = e == null ? void 0 : e.toString) == null ? void 0 : r.call(e)) ?? "";
25
+ return j(e) ? t.returnObject ? e.map((i) => i[n]).join(" - ") : e.map((i) => i).join(" - ") : u && typeof e != "number" ? e.includes(",") ? e.split(",") : e : ((r = e == null ? void 0 : e.toString) == null ? void 0 : r.call(e)) ?? "";
26
26
  }
27
27
  function R(e) {
28
28
  try {
29
29
  let n = null;
30
30
  if (l.value = L(e), !t.multiple)
31
- t.returnObject ? n = e : b(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, f.value = !1;
32
- else if (y(e))
33
- e && S(e);
31
+ t.returnObject ? n = e : b(e) ? t.itemValue ? n = e[t.itemValue] : n = Object.values(e)[0] : n = e, f.value = !1, g();
32
+ else if (S(e))
33
+ e && T(e);
34
34
  else {
35
35
  const u = t.returnObject ? e : b(e) ? t.itemValue ? e[t.itemValue] : Object.values(e)[0] : e;
36
36
  n = [...c.value || [], u];
@@ -40,7 +40,7 @@ function U(t, h, c, s) {
40
40
  console.log(n);
41
41
  } finally {
42
42
  F(() => {
43
- T();
43
+ I();
44
44
  });
45
45
  }
46
46
  }
@@ -57,12 +57,12 @@ function U(t, h, c, s) {
57
57
  (u) => typeof u == "object" ? u[t.itemValue] === e : u === e
58
58
  ) ?? e;
59
59
  }
60
- function y(e) {
60
+ function S(e) {
61
61
  return c.value === null ? !1 : e ? c.value.some(
62
62
  (n) => t.returnObject ? n[t.itemValue] === e[t.itemValue] : n === e[t.itemValue]
63
63
  ) : !0;
64
64
  }
65
- function S(e) {
65
+ function T(e) {
66
66
  let n = c.value;
67
67
  if (t.returnObject) {
68
68
  const u = n.find(
@@ -74,10 +74,10 @@ function U(t, h, c, s) {
74
74
  n.splice(u, 1);
75
75
  }
76
76
  }
77
- function T(e) {
78
- t.clearSearchOnSelect && (v.value = ""), t.clearOnSelect && w(), t.focusOnSelect && k();
77
+ function I(e) {
78
+ t.clearSearchOnSelect && (v.value = ""), t.clearOnSelect && w(), t.focusOnSelect && g();
79
79
  }
80
- function I() {
80
+ function A() {
81
81
  f.value || (f.value = !0);
82
82
  }
83
83
  function D() {
@@ -86,18 +86,18 @@ function U(t, h, c, s) {
86
86
  function J() {
87
87
  f.value = !f.value;
88
88
  }
89
- function A(e) {
89
+ function k(e) {
90
90
  return e.length === 1 && e.match(/\w/);
91
91
  }
92
- function k() {
92
+ function g() {
93
93
  d.value.inputField.focus();
94
94
  }
95
95
  function K() {
96
- f.value = !0, j.value && d.value.$el.focus();
96
+ f.value = !0, y.value && d.value.$el.focus();
97
97
  }
98
98
  function $(e) {
99
99
  const n = e.key;
100
- (A(n) || n === "Backspace") && (I(), k(), F(() => {
100
+ (k(n) || n === "Backspace") && (A(), g(), F(() => {
101
101
  var r;
102
102
  const u = (r = d.value) == null ? void 0 : r.inputField;
103
103
  if (u) {
@@ -122,7 +122,7 @@ function U(t, h, c, s) {
122
122
  return {
123
123
  selectedItem: l,
124
124
  textFieldRef: d,
125
- listRef: j,
125
+ listRef: y,
126
126
  menuModel: f,
127
127
  search: v,
128
128
  getItemText: N,
@@ -130,10 +130,10 @@ function U(t, h, c, s) {
130
130
  textArr: B,
131
131
  itemToString: x,
132
132
  getSelectedItem: R,
133
- checkIfValueExist: y,
134
- removeFromArray: S,
135
- lightReset: T,
136
- openMenu: I,
133
+ checkIfValueExist: S,
134
+ removeFromArray: T,
135
+ lightReset: I,
136
+ openMenu: A,
137
137
  closeMenu: D,
138
138
  toggleMenu: J,
139
139
  focusOnMenu: K,
@@ -142,7 +142,7 @@ function U(t, h, c, s) {
142
142
  removeItem: z,
143
143
  clearSelection: w,
144
144
  checkDisabled: G,
145
- isAlphanumeric: A
145
+ isAlphanumeric: k
146
146
  };
147
147
  }
148
148
  export {
@@ -40,8 +40,8 @@ const G = {
40
40
  props: L,
41
41
  emits: [
42
42
  "update:modelValue",
43
- "focusInput",
44
- "blurInput",
43
+ "focus",
44
+ "blur",
45
45
  "handleClick",
46
46
  "keyDown",
47
47
  "keyUp"
@@ -123,9 +123,9 @@ const G = {
123
123
  autocomplete: "off",
124
124
  class: p(["w-full h-full bg-transparent rounded focus:outline-none", [$.value, e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
125
125
  "aria-invalid": e.error ? "true" : "false",
126
- onInput: r[1] || (r[1] = (t) => o(N)(t.target.value)),
127
- onBlur: r[2] || (r[2] = (...t) => o(C) && o(C)(...t)),
128
- onFocus: r[3] || (r[3] = (...t) => o(g) && o(g)(...t)),
126
+ onBlur: r[1] || (r[1] = (...t) => o(C) && o(C)(...t)),
127
+ onFocus: r[2] || (r[2] = (...t) => o(g) && o(g)(...t)),
128
+ onInput: r[3] || (r[3] = (t) => o(N)(t.target.value)),
129
129
  onKeydown: r[4] || (r[4] = (t) => y("keyDown", t)),
130
130
  onKeyup: r[5] || (r[5] = (t) => y("keyUp", t))
131
131
  }, null, 42, T)),
@@ -1,54 +1,54 @@
1
- import { ref as l, computed as b, watch as g, nextTick as y } from "vue";
1
+ import { ref as t, computed as p, watch as g, nextTick as y } from "vue";
2
2
  import { normalizeNumber as z } from "./numberFormatUtils.js";
3
- function N(e, c) {
4
- const n = l(e.modelValue), r = l(null), d = l(null), f = l(0);
5
- function o(u) {
6
- const t = z(u, e.separator).split(e.separator);
7
- if (t.length > 2) {
8
- m();
3
+ function N(e, a) {
4
+ const u = t(e.modelValue), r = t(null), m = t(null), f = t(0);
5
+ function c(n) {
6
+ const l = z(n, e.separator).split(e.separator);
7
+ if (l.length > 2) {
8
+ d();
9
9
  return;
10
10
  }
11
- t.length === 2 && t[1].length > e.precision && (t[1] = t[1].slice(0, e.precision));
12
- const i = t.join(e.separator);
13
- i === n.value ? m() : n.value = i, c("update:modelValue", i);
11
+ l.length === 2 && l[1].length > e.precision && (l[1] = l[1].slice(0, e.precision));
12
+ const i = l.join(e.separator);
13
+ i === u.value ? d() : u.value = i, a("update:modelValue", i);
14
14
  }
15
- function m() {
15
+ function d() {
16
16
  f.value++, y(() => {
17
- var u;
18
- (u = r.value) == null || u.focus();
17
+ var n;
18
+ (n = r.value) == null || n.focus();
19
19
  });
20
20
  }
21
- function s() {
22
- o((n.value || 0) + e.step);
23
- }
24
21
  function v() {
25
- o((n.value || 0) - e.step);
22
+ c((u.value || 0) + e.step);
23
+ }
24
+ function s() {
25
+ c((u.value || 0) - e.step);
26
26
  }
27
27
  function V() {
28
- n.value = null, c("update:modelValue", null);
28
+ u.value = null, a("update:modelValue", null);
29
29
  }
30
- const a = l(!1);
30
+ const o = t(!1);
31
31
  function h() {
32
- a.value = !0, n.value || (n.value = "");
32
+ o.value = !0, u.value || (u.value = ""), a("focus");
33
33
  }
34
34
  function I() {
35
- a.value = !1, n.value || (n.value = 0);
35
+ o.value = !1, u.value || (u.value = 0), a("blur");
36
36
  }
37
- const p = b(() => a.value || !!e.modelValue || e.dirty);
38
- return g(() => e.modelValue, (u) => {
39
- n.value = u;
37
+ const b = p(() => o.value || !!e.modelValue || e.dirty);
38
+ return g(() => e.modelValue, (n) => {
39
+ u.value = n;
40
40
  }), {
41
- inputValue: n,
41
+ inputValue: u,
42
42
  numberInput: r,
43
- rootRef: d,
43
+ rootRef: m,
44
44
  inputKey: f,
45
- updateValue: o,
46
- onIncrement: s,
47
- onDecrement: v,
45
+ updateValue: c,
46
+ onIncrement: v,
47
+ onDecrement: s,
48
48
  onClear: V,
49
- focus: a,
49
+ focus: o,
50
50
  handleFocus: h,
51
- isActive: p,
51
+ isActive: b,
52
52
  handleBlur: I
53
53
  };
54
54
  }
@@ -1,4 +1,4 @@
1
- import { getCurrentInstance as U, computed as d, useSlots as H, ref as q, createElementBlock as s, openBlock as o, createCommentVNode as r, createElementVNode as h, normalizeClass as u, toDisplayString as i, mergeProps as G, unref as t, renderSlot as k, withModifiers as J, createVNode as L } from "vue";
1
+ import { getCurrentInstance as U, computed as d, useSlots as H, ref as q, createElementBlock as n, openBlock as o, createCommentVNode as r, createElementVNode as h, normalizeClass as u, toDisplayString as i, mergeProps as G, unref as t, renderSlot as k, withModifiers as J, createVNode as L } from "vue";
2
2
  import { icons as P } from "../../../../icons/index.js";
3
3
  import Q from "../composables/KunTextFieldProps.js";
4
4
  import W from "../composables/useKunTextFieldComposable.js";
@@ -15,7 +15,7 @@ const Y = {
15
15
  }, le = {
16
16
  key: 0,
17
17
  class: "h-[1.25rem]"
18
- }, ne = ["id"], se = {
18
+ }, se = ["id"], ne = {
19
19
  key: 1,
20
20
  class: "text-xs text-center"
21
21
  }, oe = {
@@ -26,8 +26,8 @@ const Y = {
26
26
  props: { ...Q },
27
27
  emits: [
28
28
  "update:modelValue",
29
- "focusInput",
30
- "blurInput",
29
+ "focus",
30
+ "blur",
31
31
  "handleClick",
32
32
  "keyDown",
33
33
  "keyUp"
@@ -66,12 +66,12 @@ const Y = {
66
66
  const M = d(() => a.type === "password" ? v.value ? "text" : "password" : a.type), R = d(() => a.density === "compact" ? "p-1" : a.density === "comfortable" ? "p-2" : "p-3");
67
67
  return (e, l) => {
68
68
  var F;
69
- return o(), s("div", {
69
+ return o(), n("div", {
70
70
  class: "w-full flex flex-col relative",
71
71
  ref_key: "rootRef",
72
72
  ref: w
73
73
  }, [
74
- e.label ? (o(), s("label", {
74
+ e.label ? (o(), n("label", {
75
75
  key: 0,
76
76
  for: m,
77
77
  class: u([
@@ -90,8 +90,8 @@ const Y = {
90
90
  t(y) ? "bg-red-200 dark:bg-red-900" : ""
91
91
  ]])
92
92
  }, [
93
- e.prefix ? (o(), s("div", Y, i(e.prefix), 1)) : r("", !0),
94
- N.value ? (o(), s("div", {
93
+ e.prefix ? (o(), n("div", Y, i(e.prefix), 1)) : r("", !0),
94
+ N.value ? (o(), n("div", {
95
95
  key: 1,
96
96
  class: u([e.prependInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
97
97
  }, [
@@ -111,42 +111,42 @@ const Y = {
111
111
  class: u(["w-full h-full bg-transparent focus:outline-none", [R.value, e.textColor, e.placeholderColor, e.rounded, e.textCenter ? "text-center" : ""]]),
112
112
  "aria-invalid": t(y) ? "true" : "false",
113
113
  "aria-describedby": t(y) ? `error-${m}` : null,
114
- onInput: l[0] || (l[0] = (...n) => t(g) && t(g)(...n)),
115
- onBlur: l[1] || (l[1] = (...n) => t(C) && t(C)(...n)),
116
- onFocus: l[2] || (l[2] = (...n) => t(I) && t(I)(...n)),
117
- onClick: l[3] || (l[3] = J((n) => p("handleClick"), ["stop"])),
118
- onKeydown: l[4] || (l[4] = (n) => p("keyDown", n)),
119
- onKeyup: l[5] || (l[5] = (n) => p("keyUp", n))
114
+ onInput: l[0] || (l[0] = (...s) => t(g) && t(g)(...s)),
115
+ onBlur: l[1] || (l[1] = (...s) => t(C) && t(C)(...s)),
116
+ onFocus: l[2] || (l[2] = (...s) => t(I) && t(I)(...s)),
117
+ onClick: l[3] || (l[3] = J((s) => p("handleClick"), ["stop"])),
118
+ onKeydown: l[4] || (l[4] = (s) => p("keyDown", s)),
119
+ onKeyup: l[5] || (l[5] = (s) => p("keyUp", s))
120
120
  }, null, 42, Z),
121
- e.clearable && t(f) ? (o(), s("button", {
121
+ e.clearable && t(f) ? (o(), n("button", {
122
122
  key: 2,
123
123
  type: "button",
124
- onClick: l[6] || (l[6] = (...n) => t($) && t($)(...n)),
124
+ onClick: l[6] || (l[6] = (...s) => t($) && t($)(...s)),
125
125
  class: u(["ml-2", e.textColor]),
126
126
  disabled: e.disabled || e.readonly
127
127
  }, " × ", 10, _)) : r("", !0),
128
128
  k(e.$slots, "default"),
129
- e.type === "password" && e.showPasswordToggle ? (o(), s("div", ee, [
129
+ e.type === "password" && e.showPasswordToggle ? (o(), n("div", ee, [
130
130
  L(X, {
131
131
  icon: z.value,
132
132
  onClick: A
133
133
  }, null, 8, ["icon"])
134
134
  ])) : r("", !0),
135
- O.value ? (o(), s("div", {
135
+ O.value ? (o(), n("div", {
136
136
  key: 4,
137
137
  class: u([e.appendInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
138
138
  }, [
139
139
  k(e.$slots, "append-inner")
140
140
  ], 2)) : r("", !0),
141
- e.suffix ? (o(), s("div", te, i(e.suffix), 1)) : r("", !0)
141
+ e.suffix ? (o(), n("div", te, i(e.suffix), 1)) : r("", !0)
142
142
  ], 2),
143
- e.hideDetails ? r("", !0) : (o(), s("div", le, [
144
- t(y) ? (o(), s("div", {
143
+ e.hideDetails ? r("", !0) : (o(), n("div", le, [
144
+ t(y) ? (o(), n("div", {
145
145
  key: 0,
146
146
  id: `error-${m}`,
147
147
  class: "text-red-500 text-sm text-center"
148
- }, i(t(B) || e.errorMessage), 9, ne)) : e.hint && (e.persistentHint || t(b)) ? (o(), s("div", se, i(e.hint), 1)) : r("", !0),
149
- e.counter && e.maxlength ? (o(), s("div", oe, i(((F = t(f)) == null ? void 0 : F.length) || 0) + " / " + i(e.maxlength), 1)) : r("", !0)
148
+ }, i(t(B) || e.errorMessage), 9, se)) : e.hint && (e.persistentHint || t(b)) ? (o(), n("div", ne, i(e.hint), 1)) : r("", !0),
149
+ e.counter && e.maxlength ? (o(), n("div", oe, i(((F = t(f)) == null ? void 0 : F.length) || 0) + " / " + i(e.maxlength), 1)) : r("", !0)
150
150
  ]))
151
151
  ], 16)
152
152
  ], 512);
@@ -1,61 +1,62 @@
1
1
  import { ref as a, inject as V, computed as E, watch as F, onUnmounted as T } from "vue";
2
2
  import { debounce as j } from "../../../../utils/utils.js";
3
3
  function R(u, r) {
4
- const t = a(u.modelValue), o = a(!1), l = a(""), n = a(!1), g = a(null), h = a(null), s = a(!1), d = V("registerField", null), v = V("unregisterField", null), y = E(() => u.error || !!l.value && n.value), c = async () => {
4
+ const l = a(u.modelValue), o = a(!1), t = a(""), n = a(!1), g = a(null), h = a(null), s = a(!1), d = V("registerField", null), v = V("unregisterField", null), y = E(() => u.error || !!t.value && n.value), c = async () => {
5
5
  for (const e of u.rules) {
6
- const m = await Promise.resolve(e(t.value));
6
+ const m = await Promise.resolve(e(l.value));
7
7
  if (m !== !0) return m;
8
8
  }
9
9
  return !0;
10
10
  }, f = j(async () => {
11
11
  const e = await c();
12
- l.value = e === !0 ? "" : e;
12
+ t.value = e === !0 ? "" : e;
13
13
  }, u.debounce ?? 300);
14
14
  F(() => u.modelValue, (e) => {
15
- e !== t.value && (s.value = !0, t.value = e);
16
- }), F(t, () => {
15
+ e !== l.value && (s.value = !0, l.value = e);
16
+ }), F(l, () => {
17
17
  if (s.value) {
18
18
  s.value = !1;
19
19
  return;
20
20
  }
21
- n.value = !0, r("update:modelValue", t.value), u.validateOnBlur || f();
21
+ n.value = !0, r("update:modelValue", l.value), u.validateOnBlur || f();
22
22
  });
23
- const I = (e) => {
24
- t.value = e.target.value;
25
- }, b = async () => {
26
- if (o.value = !1, r("blurInput"), u.validateOnBlur) {
23
+ const b = (e) => {
24
+ l.value = e.target.value;
25
+ }, w = async () => {
26
+ if (o.value = !1, u.validateOnBlur) {
27
27
  const e = await c();
28
- l.value = e === !0 ? "" : e;
28
+ t.value = e === !0 ? "" : e;
29
29
  }
30
- }, w = () => {
31
- o.value = !0, r("focusInput");
30
+ r("blur");
32
31
  }, B = () => {
33
- t.value = "", r("update:modelValue", ""), n.value = !0, u.validateOnBlur || f();
32
+ o.value = !0, r("focus");
33
+ }, I = () => {
34
+ l.value = "", r("update:modelValue", ""), n.value = !0, u.validateOnBlur || f();
34
35
  }, i = async () => {
35
36
  n.value = !0;
36
37
  const e = await c();
37
- return l.value = e === !0 ? "" : e, e === !0;
38
+ return t.value = e === !0 ? "" : e, e === !0;
38
39
  }, O = () => {
39
- t.value = u.modelValue, n.value = !1, l.value = "";
40
+ l.value = u.modelValue, n.value = !1, t.value = "";
40
41
  }, x = () => {
41
- n.value = !1, l.value = "";
42
+ n.value = !1, t.value = "";
42
43
  };
43
44
  return d && d({ validate: i }), T(() => {
44
45
  v && v({ validate: i });
45
46
  }), {
46
47
  inputField: g,
47
- inputValue: t,
48
+ inputValue: l,
48
49
  rootRef: h,
49
50
  inputFocused: o,
50
- validationError: l,
51
+ validationError: t,
51
52
  hasError: y,
52
- handleInput: I,
53
- handleBlur: b,
54
- focusInput: w,
53
+ handleInput: b,
54
+ handleBlur: w,
55
+ focusInput: B,
55
56
  validate: i,
56
57
  reset: O,
57
58
  resetValidation: x,
58
- clearInput: B
59
+ clearInput: I
59
60
  };
60
61
  }
61
62
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.352",
3
+ "version": "0.1.354",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",