adverich-kun-ui 0.1.264 → 0.1.266

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