adverich-kun-ui 0.1.264 → 0.1.265

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,8 +1,11 @@
1
- import { getCurrentInstance as $, useSlots as z, computed as E, createElementBlock as l, openBlock as s, createCommentVNode as n, createElementVNode as i, normalizeClass as p, unref as o, toDisplayString as u, mergeProps as P, createBlock as g, renderSlot as C, Fragment as I, renderList as U } from "vue";
1
+ import { getCurrentInstance as z, useSlots as E, computed as P, createElementBlock as l, openBlock as s, createCommentVNode as n, createElementVNode as i, normalizeClass as p, unref as o, toDisplayString as u, mergeProps as R, createBlock as C, renderSlot as I, Fragment as V, renderList as U } from "vue";
2
2
  import { KunNumberFieldProps as H } from "../composables/KunNumberFieldProps.js";
3
3
  import { useKunNumberField as L } from "../composables/useKunNumberFieldComposable.js";
4
- import V from "../../../KunIcon/src/components/KunIcon.vue.js";
5
- const q = { class: "w-full flex flex-col relative" }, G = {
4
+ import j from "../../../KunIcon/src/components/KunIcon.vue.js";
5
+ const q = {
6
+ class: "w-full flex flex-col relative",
7
+ ref: "rootRef"
8
+ }, G = {
6
9
  key: 0,
7
10
  class: "h-full"
8
11
  }, J = ["disabled"], O = {
@@ -11,31 +14,31 @@ const q = { class: "w-full flex flex-col relative" }, G = {
11
14
  }, Q = {
12
15
  key: 2,
13
16
  class: "flex items-center justify-center h-full pl-1"
14
- }, R = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], T = ["disabled"], W = {
17
+ }, T = ["value", "placeholder", "readonly", "disabled", "maxlength", "aria-invalid"], W = ["disabled"], X = {
15
18
  key: 0,
16
19
  class: "flex items-center h-full"
17
- }, X = ["disabled"], Y = ["disabled"], Z = {
20
+ }, Y = ["disabled"], Z = ["disabled"], _ = {
18
21
  key: 1,
19
22
  class: "flex flex-col items-center justify-center border-l border-slate-600"
20
- }, _ = ["disabled"], ee = ["disabled"], te = {
23
+ }, ee = ["disabled"], te = ["disabled"], oe = {
21
24
  key: 5,
22
25
  class: "flex items-center justify-center h-full pr-1"
23
- }, oe = {
26
+ }, re = {
24
27
  key: 6,
25
28
  class: "h-full"
26
- }, re = ["disabled"], se = {
29
+ }, se = ["disabled"], le = {
27
30
  key: 7,
28
31
  class: "ml-2"
29
- }, le = {
32
+ }, ne = {
30
33
  key: 0,
31
34
  class: "h-[1.25rem]"
32
- }, ne = {
35
+ }, ie = {
33
36
  key: 0,
34
37
  class: "text-red-500 text-sm text-center"
35
- }, ie = { key: 0 }, de = { key: 1 }, ae = {
38
+ }, de = { key: 0 }, ae = { key: 1 }, ue = {
36
39
  key: 1,
37
40
  class: "text-xs text-center"
38
- }, ce = {
41
+ }, fe = {
39
42
  __name: "KunNumberField",
40
43
  props: H,
41
44
  emits: [
@@ -46,20 +49,25 @@ const q = { class: "w-full flex flex-col relative" }, G = {
46
49
  "keyDown",
47
50
  "keyUp"
48
51
  ],
49
- setup(j, { emit: A }) {
50
- const b = j, y = A, c = `number-input-${$().uid}`, k = z(), D = !!k["prepend-icon"], F = !!k["append-icon"], {
51
- inputValue: f,
52
- numberInput: K,
53
- inputKey: x,
54
- updateValue: B,
52
+ setup(x, { expose: A, emit: D }) {
53
+ const b = x, y = D, c = `number-input-${z().uid}`, f = E(), F = !!f["prepend-icon"], K = !!f["append-icon"], {
54
+ inputValue: k,
55
+ numberInput: m,
56
+ inputKey: B,
57
+ updateValue: M,
55
58
  onIncrement: d,
56
59
  onDecrement: a,
57
- onClear: m,
58
- focus: h,
59
- handleFocus: v,
60
- isActive: M,
61
- handleBlur: w
62
- } = L(b, y), N = E(() => b.density === "compact" ? "p-1" : b.density === "comfortable" ? "p-2" : "p-3");
60
+ onClear: h,
61
+ focus: v,
62
+ handleFocus: w,
63
+ isActive: N,
64
+ handleBlur: g
65
+ } = L(b, y);
66
+ A({
67
+ numberInput: m,
68
+ rootRef
69
+ });
70
+ const S = P(() => b.density === "compact" ? "p-1" : b.density === "comfortable" ? "p-2" : "p-3");
63
71
  return (e, r) => (s(), l("div", q, [
64
72
  e.label ? (s(), l("label", {
65
73
  key: 0,
@@ -67,15 +75,15 @@ const q = { class: "w-full flex flex-col relative" }, G = {
67
75
  class: p([
68
76
  e.labelColor,
69
77
  "absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
70
- o(M) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
78
+ o(N) || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
71
79
  ])
72
80
  }, u(e.label), 3)) : n("", !0),
73
- i("div", P({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
81
+ i("div", R({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
74
82
  i("div", {
75
83
  class: p(["flex items-center w-full h-full border", [
76
84
  e.bgInput,
77
85
  e.rounded,
78
- o(h) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
86
+ o(v) ? "border-blue-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
79
87
  e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
80
88
  e.error ? "bg-red-200 dark:bg-red-900" : ""
81
89
  ]])
@@ -89,55 +97,55 @@ const q = { class: "w-full flex flex-col relative" }, G = {
89
97
  }, "−", 8, J)
90
98
  ])) : n("", !0),
91
99
  e.prefix ? (s(), l("div", O, u(e.prefix), 1)) : n("", !0),
92
- e.prependIcon || D ? (s(), l("div", Q, [
93
- e.prependIcon ? (s(), g(V, {
100
+ e.prependIcon || F ? (s(), l("div", Q, [
101
+ e.prependIcon ? (s(), C(j, {
94
102
  key: 0,
95
103
  icon: e.prependIcon
96
- }, null, 8, ["icon"])) : C(e.$slots, "prepend-icon", { key: 1 })
104
+ }, null, 8, ["icon"])) : I(e.$slots, "prepend-icon", { key: 1 })
97
105
  ])) : n("", !0),
98
106
  (s(), l("input", {
99
107
  id: c,
100
108
  ref_key: "numberInput",
101
- ref: K,
102
- key: o(x),
109
+ ref: m,
110
+ key: o(B),
103
111
  type: "text",
104
- value: o(f),
112
+ value: o(k),
105
113
  placeholder: e.placeholder,
106
114
  readonly: e.readonly,
107
115
  disabled: e.disabled,
108
116
  maxlength: e.maxlength,
109
117
  autocomplete: "off",
110
- class: p(["w-full h-full bg-transparent rounded focus:outline-none", [N.value, e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
118
+ class: p(["w-full h-full bg-transparent rounded focus:outline-none", [S.value, e.textColor, e.placeholderColor, e.textCenter ? "text-center" : ""]]),
111
119
  "aria-invalid": e.error ? "true" : "false",
112
- onInput: r[1] || (r[1] = (t) => o(B)(t.target.value)),
113
- onBlur: r[2] || (r[2] = (...t) => o(w) && o(w)(...t)),
114
- onFocus: r[3] || (r[3] = (...t) => o(v) && o(v)(...t)),
120
+ onInput: r[1] || (r[1] = (t) => o(M)(t.target.value)),
121
+ onBlur: r[2] || (r[2] = (...t) => o(g) && o(g)(...t)),
122
+ onFocus: r[3] || (r[3] = (...t) => o(w) && o(w)(...t)),
115
123
  onKeydown: r[4] || (r[4] = (t) => y("keyDown", t)),
116
124
  onKeyup: r[5] || (r[5] = (t) => y("keyUp", t))
117
- }, null, 42, R)),
118
- e.clearable && o(f) != null ? (s(), l("button", {
125
+ }, null, 42, T)),
126
+ e.clearable && o(k) != null ? (s(), l("button", {
119
127
  key: 3,
120
128
  type: "button",
121
- onClick: r[6] || (r[6] = (...t) => o(m) && o(m)(...t)),
129
+ onClick: r[6] || (r[6] = (...t) => o(h) && o(h)(...t)),
122
130
  class: p(["ml-2", e.textColor]),
123
131
  disabled: e.disabled || e.readonly
124
- }, " × ", 10, T)) : n("", !0),
125
- e.noArrows ? n("", !0) : (s(), l(I, { key: 4 }, [
126
- e.controlVariant === "default" ? (s(), l("div", W, [
132
+ }, " × ", 10, W)) : n("", !0),
133
+ e.noArrows ? n("", !0) : (s(), l(V, { key: 4 }, [
134
+ e.controlVariant === "default" ? (s(), l("div", X, [
127
135
  i("button", {
128
136
  type: "button",
129
137
  class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
130
138
  onClick: r[7] || (r[7] = (...t) => o(d) && o(d)(...t)),
131
139
  disabled: e.disabled || e.readonly
132
- }, " ▲ ", 8, X),
140
+ }, " ▲ ", 8, Y),
133
141
  i("button", {
134
142
  type: "button",
135
143
  class: "flex items-center border-l border-slate-600 p-3 justify-center text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer hover:opacity-80",
136
144
  onClick: r[8] || (r[8] = (...t) => o(a) && o(a)(...t)),
137
145
  disabled: e.disabled || e.readonly
138
- }, " ▼ ", 8, Y)
146
+ }, " ▼ ", 8, Z)
139
147
  ])) : n("", !0),
140
- e.controlVariant === "stacked" ? (s(), l("div", Z, [
148
+ e.controlVariant === "stacked" ? (s(), l("div", _, [
141
149
  i("div", {
142
150
  class: "border-b border-slate-600 pb-1 px-3 flex hover:opacity-80 cursor-pointer",
143
151
  onClick: r[9] || (r[9] = (...t) => o(d) && o(d)(...t))
@@ -146,7 +154,7 @@ const q = { class: "w-full flex flex-col relative" }, G = {
146
154
  type: "button",
147
155
  class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
148
156
  disabled: e.disabled || e.readonly
149
- }, "▲", 8, _)
157
+ }, "▲", 8, ee)
150
158
  ]),
151
159
  i("div", {
152
160
  class: "border-t border-slate-600 pt-1 px-3 flex hover:opacity-80 cursor-pointer",
@@ -156,37 +164,37 @@ const q = { class: "w-full flex flex-col relative" }, G = {
156
164
  type: "button",
157
165
  class: "text-xs text-black dark:text-white hover:text-black/80 dark:hover:text-white/80 disabled:opacity-50 cursor-pointer",
158
166
  disabled: e.disabled || e.readonly
159
- }, "▼", 8, ee)
167
+ }, "▼", 8, te)
160
168
  ])
161
169
  ])) : n("", !0)
162
170
  ], 64)),
163
- e.appendIcon || F ? (s(), l("div", te, [
164
- e.appendIcon ? (s(), g(V, {
171
+ e.appendIcon || K ? (s(), l("div", oe, [
172
+ e.appendIcon ? (s(), C(j, {
165
173
  key: 0,
166
174
  icon: e.appendIcon
167
- }, null, 8, ["icon"])) : C(e.$slots, "append-icon", { key: 1 })
175
+ }, null, 8, ["icon"])) : I(e.$slots, "append-icon", { key: 1 })
168
176
  ])) : n("", !0),
169
- !e.noArrows && e.controlVariant === "split" ? (s(), l("div", oe, [
177
+ !e.noArrows && e.controlVariant === "split" ? (s(), l("div", re, [
170
178
  i("button", {
171
179
  type: "button",
172
180
  class: "p-3 text-lg border-l border-slate-600 text-black dark:text-white disabled:opacity-50 cursor-pointer hover:opacity-80",
173
181
  onClick: r[11] || (r[11] = (...t) => o(d) && o(d)(...t)),
174
182
  disabled: e.disabled || e.readonly
175
- }, "+", 8, re)
183
+ }, "+", 8, se)
176
184
  ])) : n("", !0),
177
- e.suffix ? (s(), l("div", se, u(e.suffix), 1)) : n("", !0)
185
+ e.suffix ? (s(), l("div", le, u(e.suffix), 1)) : n("", !0)
178
186
  ], 2),
179
- e.hideDetails ? n("", !0) : (s(), l("div", le, [
180
- e.error || e.errorMessages ? (s(), l("div", ne, [
181
- Array.isArray(e.errorMessages) ? (s(), l("div", ie, [
182
- (s(!0), l(I, null, U(e.errorMessages, (t, S) => (s(), l("div", { key: S }, u(t), 1))), 128))
183
- ])) : typeof e.errorMessages == "string" ? (s(), l("div", de, u(e.errorMessages), 1)) : n("", !0)
184
- ])) : e.hint && (e.persistentHint || o(h)) ? (s(), l("div", ae, u(e.hint), 1)) : n("", !0)
187
+ e.hideDetails ? n("", !0) : (s(), l("div", ne, [
188
+ e.error || e.errorMessages ? (s(), l("div", ie, [
189
+ Array.isArray(e.errorMessages) ? (s(), l("div", de, [
190
+ (s(!0), l(V, null, U(e.errorMessages, (t, $) => (s(), l("div", { key: $ }, u(t), 1))), 128))
191
+ ])) : typeof e.errorMessages == "string" ? (s(), l("div", ae, u(e.errorMessages), 1)) : n("", !0)
192
+ ])) : e.hint && (e.persistentHint || o(v)) ? (s(), l("div", ue, u(e.hint), 1)) : n("", !0)
185
193
  ]))
186
194
  ], 16)
187
- ]));
195
+ ], 512));
188
196
  }
189
197
  };
190
198
  export {
191
- ce as default
199
+ fe as default
192
200
  };
@@ -1,13 +1,13 @@
1
- import { ref as a, computed as p, watch as b, nextTick as g } from "vue";
2
- import { normalizeNumber as y } from "./numberFormatUtils.js";
3
- function F(u, o) {
4
- const e = a(u.modelValue), r = a(null), f = a(0);
1
+ import { ref as l, computed as b, watch as g, nextTick as y } from "vue";
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
5
  function i(n) {
6
6
  if (!n) {
7
7
  e.value = "0", o("update:modelValue", 0);
8
8
  return;
9
9
  }
10
- const t = y(n, u.separator).split(u.separator);
10
+ const t = z(n, u.separator).split(u.separator);
11
11
  if (t.length > 2) {
12
12
  d();
13
13
  return;
@@ -17,44 +17,45 @@ function F(u, o) {
17
17
  c === e.value ? d() : e.value = c, o("update:modelValue", c || 0);
18
18
  }
19
19
  function d() {
20
- f.value++, g(() => {
20
+ f.value++, y(() => {
21
21
  var n;
22
22
  (n = r.value) == null || n.focus();
23
23
  });
24
24
  }
25
- function m() {
26
- i((e.value || 0) + u.step);
27
- }
28
25
  function v() {
29
- i((e.value || 0) - u.step);
26
+ i((e.value || 0) + u.step);
30
27
  }
31
28
  function s() {
32
- e.value = null, o("update:modelValue", null);
29
+ i((e.value || 0) - u.step);
33
30
  }
34
- const l = a(!1);
35
31
  function V() {
36
- l.value = !0, e.value || (e.value = "");
32
+ e.value = null, o("update:modelValue", null);
37
33
  }
34
+ const a = l(!1);
38
35
  function h() {
39
- l.value = !1, e.value || (e.value = 0);
36
+ a.value = !0, e.value || (e.value = "");
37
+ }
38
+ function I() {
39
+ a.value = !1, e.value || (e.value = 0);
40
40
  }
41
- const I = p(() => l.value || !!u.modelValue || u.dirty);
42
- return b(() => u.modelValue, (n) => {
41
+ const p = b(() => a.value || !!u.modelValue || u.dirty);
42
+ return g(() => u.modelValue, (n) => {
43
43
  e.value = n;
44
44
  }), {
45
45
  inputValue: e,
46
46
  numberInput: r,
47
+ rootRef: m,
47
48
  inputKey: f,
48
49
  updateValue: i,
49
- onIncrement: m,
50
- onDecrement: v,
51
- onClear: s,
52
- focus: l,
53
- handleFocus: V,
54
- isActive: I,
55
- handleBlur: h
50
+ onIncrement: v,
51
+ onDecrement: s,
52
+ onClear: V,
53
+ focus: a,
54
+ handleFocus: h,
55
+ isActive: p,
56
+ handleBlur: I
56
57
  };
57
58
  }
58
59
  export {
59
- F as useKunNumberField
60
+ N as useKunNumberField
60
61
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.264",
3
+ "version": "0.1.265",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",