adverich-kun-ui 0.1.266 → 0.1.268

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.
@@ -35,7 +35,7 @@ const G = {
35
35
  }, de = { key: 0 }, ae = { key: 1 }, ue = {
36
36
  key: 1,
37
37
  class: "text-xs text-center"
38
- }, ke = {
38
+ }, ce = {
39
39
  __name: "KunNumberField",
40
40
  props: L,
41
41
  emits: [
@@ -47,9 +47,9 @@ const G = {
47
47
  "keyUp"
48
48
  ],
49
49
  setup(A, { expose: D, emit: F }) {
50
- const b = A, y = F, f = `number-input-${E().uid}`, k = P(), K = !!k["prepend-icon"], B = !!k["append-icon"], {
51
- inputValue: c,
52
- numberInput: m,
50
+ const b = A, y = F, c = `number-input-${E().uid}`, k = P(), K = !!k["prepend-icon"], B = !!k["append-icon"], {
51
+ inputValue: m,
52
+ numberInput: f,
53
53
  rootRef: h,
54
54
  inputKey: M,
55
55
  updateValue: N,
@@ -62,8 +62,12 @@ const G = {
62
62
  handleBlur: C
63
63
  } = q(b, y);
64
64
  D({
65
- numberInput: m,
66
- rootRef: h
65
+ numberInput: f,
66
+ rootRef: h,
67
+ focus: () => {
68
+ var e;
69
+ return (e = f.value) == null ? void 0 : e.focus();
70
+ }
67
71
  });
68
72
  const $ = R(() => b.density === "compact" ? "p-1" : b.density === "comfortable" ? "p-2" : "p-3");
69
73
  return (e, r) => (s(), l("div", {
@@ -73,7 +77,7 @@ const G = {
73
77
  }, [
74
78
  e.label ? (s(), l("label", {
75
79
  key: 0,
76
- for: f,
80
+ for: c,
77
81
  class: p([
78
82
  e.labelColor,
79
83
  "absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
@@ -106,12 +110,12 @@ const G = {
106
110
  }, null, 8, ["icon"])) : V(e.$slots, "prepend-icon", { key: 1 })
107
111
  ])) : n("", !0),
108
112
  (s(), l("input", {
109
- id: f,
113
+ id: c,
110
114
  ref_key: "numberInput",
111
- ref: m,
115
+ ref: f,
112
116
  key: o(M),
113
117
  type: "text",
114
- value: o(c),
118
+ value: o(m),
115
119
  placeholder: e.placeholder,
116
120
  readonly: e.readonly,
117
121
  disabled: e.disabled,
@@ -125,7 +129,7 @@ const G = {
125
129
  onKeydown: r[4] || (r[4] = (t) => y("keyDown", t)),
126
130
  onKeyup: r[5] || (r[5] = (t) => y("keyUp", t))
127
131
  }, null, 42, T)),
128
- e.clearable && o(c) != null ? (s(), l("button", {
132
+ e.clearable && o(m) != null ? (s(), l("button", {
129
133
  key: 3,
130
134
  type: "button",
131
135
  onClick: r[6] || (r[6] = (...t) => o(v) && o(v)(...t)),
@@ -198,5 +202,5 @@ const G = {
198
202
  }
199
203
  };
200
204
  export {
201
- ke as default
205
+ ce as default
202
206
  };
@@ -1,54 +1,50 @@
1
1
  import { ref as l, computed as b, watch as g, nextTick as y } from "vue";
2
2
  import { normalizeNumber as z } from "./numberFormatUtils.js";
3
- function N(u, o) {
4
- const e = l(u.modelValue), r = l(null), m = l(null), f = l(0);
5
- function i(n) {
6
- if (!n) {
7
- e.value = "0", o("update:modelValue", 0);
8
- return;
9
- }
10
- const t = z(n, u.separator).split(u.separator);
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);
11
7
  if (t.length > 2) {
12
- d();
8
+ m();
13
9
  return;
14
10
  }
15
- t.length === 2 && t[1].length > u.precision && (t[1] = t[1].slice(0, u.precision));
16
- const c = t.join(u.separator);
17
- c === e.value ? d() : e.value = c, o("update:modelValue", c || 0);
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);
18
14
  }
19
- function d() {
15
+ function m() {
20
16
  f.value++, y(() => {
21
- var n;
22
- (n = r.value) == null || n.focus();
17
+ var u;
18
+ (u = r.value) == null || u.focus();
23
19
  });
24
20
  }
25
- function v() {
26
- i((e.value || 0) + u.step);
27
- }
28
21
  function s() {
29
- i((e.value || 0) - u.step);
22
+ o((n.value || 0) + e.step);
23
+ }
24
+ function v() {
25
+ o((n.value || 0) - e.step);
30
26
  }
31
27
  function V() {
32
- e.value = null, o("update:modelValue", null);
28
+ n.value = null, c("update:modelValue", null);
33
29
  }
34
30
  const a = l(!1);
35
31
  function h() {
36
- a.value = !0, e.value || (e.value = "");
32
+ a.value = !0, n.value || (n.value = "");
37
33
  }
38
34
  function I() {
39
- a.value = !1, e.value || (e.value = 0);
35
+ a.value = !1, n.value || (n.value = 0);
40
36
  }
41
- const p = b(() => a.value || !!u.modelValue || u.dirty);
42
- return g(() => u.modelValue, (n) => {
43
- e.value = n;
37
+ const p = b(() => a.value || !!e.modelValue || e.dirty);
38
+ return g(() => e.modelValue, (u) => {
39
+ n.value = u;
44
40
  }), {
45
- inputValue: e,
41
+ inputValue: n,
46
42
  numberInput: r,
47
- rootRef: m,
43
+ rootRef: d,
48
44
  inputKey: f,
49
- updateValue: i,
50
- onIncrement: v,
51
- onDecrement: s,
45
+ updateValue: o,
46
+ onIncrement: s,
47
+ onDecrement: v,
52
48
  onClear: V,
53
49
  focus: a,
54
50
  handleFocus: h,
@@ -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 b, normalizeClass as u, toDisplayString as i, mergeProps as G, unref as t, renderSlot as h, withModifiers as J, createVNode as L } from "vue";
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";
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";
@@ -34,10 +34,10 @@ const Y = {
34
34
  ],
35
35
  setup(V, { expose: D, emit: j }) {
36
36
  const a = V, p = j, {
37
- inputField: k,
37
+ inputField: c,
38
38
  inputValue: f,
39
39
  rootRef: w,
40
- inputFocused: c,
40
+ inputFocused: b,
41
41
  validationError: B,
42
42
  hasError: y,
43
43
  handleInput: g,
@@ -52,10 +52,14 @@ const Y = {
52
52
  validate: E,
53
53
  reset: K,
54
54
  resetValidation: S,
55
- inputField: k,
56
- rootRef: w
55
+ inputField: c,
56
+ rootRef: w,
57
+ focus: () => {
58
+ var e;
59
+ return (e = c.value) == null ? void 0 : e.focus();
60
+ }
57
61
  });
58
- const m = `input-${U().uid}`, T = d(() => c.value || !!f.value || a.dirty), x = H(), N = d(() => !!x["prepend-inner"]), O = d(() => !!x["append-inner"]), v = q(!1), z = d(() => v.value ? P.eyeOffOutline : P.eyeOutline);
62
+ const m = `input-${U().uid}`, T = d(() => b.value || !!f.value || a.dirty), x = H(), N = d(() => !!x["prepend-inner"]), O = d(() => !!x["append-inner"]), v = q(!1), z = d(() => v.value ? P.eyeOffOutline : P.eyeOutline);
59
63
  function A() {
60
64
  v.value = !v.value;
61
65
  }
@@ -76,12 +80,12 @@ const Y = {
76
80
  T.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
77
81
  ])
78
82
  }, i(e.label), 3)) : r("", !0),
79
- b("div", G({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
80
- b("div", {
83
+ h("div", G({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
84
+ h("div", {
81
85
  class: u(["flex flex-row items-center w-full h-full border", [
82
86
  e.bgInput,
83
87
  e.rounded,
84
- t(c) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
88
+ t(b) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
85
89
  e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
86
90
  t(y) ? "bg-red-200 dark:bg-red-900" : ""
87
91
  ]])
@@ -91,11 +95,11 @@ const Y = {
91
95
  key: 1,
92
96
  class: u([e.prependInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
93
97
  }, [
94
- h(e.$slots, "prepend-inner")
98
+ k(e.$slots, "prepend-inner")
95
99
  ], 2)) : r("", !0),
96
- b("input", {
100
+ h("input", {
97
101
  ref_key: "inputField",
98
- ref: k,
102
+ ref: c,
99
103
  type: M.value,
100
104
  value: t(f),
101
105
  id: m,
@@ -121,7 +125,7 @@ const Y = {
121
125
  class: u(["ml-2", e.textColor]),
122
126
  disabled: e.disabled || e.readonly
123
127
  }, " × ", 10, _)) : r("", !0),
124
- h(e.$slots, "default"),
128
+ k(e.$slots, "default"),
125
129
  e.type === "password" && e.showPasswordToggle ? (o(), s("div", ee, [
126
130
  L(X, {
127
131
  icon: z.value,
@@ -132,7 +136,7 @@ const Y = {
132
136
  key: 4,
133
137
  class: u([e.appendInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
134
138
  }, [
135
- h(e.$slots, "append-inner")
139
+ k(e.$slots, "append-inner")
136
140
  ], 2)) : r("", !0),
137
141
  e.suffix ? (o(), s("div", te, i(e.suffix), 1)) : r("", !0)
138
142
  ], 2),
@@ -141,7 +145,7 @@ const Y = {
141
145
  key: 0,
142
146
  id: `error-${m}`,
143
147
  class: "text-red-500 text-sm text-center"
144
- }, i(t(B) || e.errorMessage), 9, ne)) : e.hint && (e.persistentHint || t(c)) ? (o(), s("div", se, i(e.hint), 1)) : r("", !0),
148
+ }, i(t(B) || e.errorMessage), 9, ne)) : e.hint && (e.persistentHint || t(b)) ? (o(), s("div", se, i(e.hint), 1)) : r("", !0),
145
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)
146
150
  ]))
147
151
  ], 16)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.266",
3
+ "version": "0.1.268",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",