adverich-kun-ui 0.1.352 → 0.1.353

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.
@@ -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.353",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",