adverich-kun-ui 0.1.541 → 0.1.543

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,161 +1,165 @@
1
- import { nextTick as U, getCurrentInstance as H, computed as d, useSlots as q, ref as G, createElementBlock as n, openBlock as o, createCommentVNode as r, createElementVNode as k, normalizeClass as u, toDisplayString as i, mergeProps as J, unref as t, renderSlot as c, withModifiers as L, createVNode as Q } from "vue";
2
- import { icons as P } from "../../../../icons/index.js";
3
- import W from "../composables/KunTextFieldProps.js";
4
- import X from "../composables/useKunTextFieldComposable.js";
5
- import Y from "../../../KunIcon/src/components/KunIcon.vue.js";
6
- const Z = {
1
+ import { nextTick as H, getCurrentInstance as q, computed as d, useSlots as G, ref as J, createElementBlock as n, openBlock as s, createCommentVNode as o, createElementVNode as k, normalizeClass as u, toDisplayString as i, mergeProps as L, unref as t, renderSlot as h, withModifiers as Q, createVNode as W } from "vue";
2
+ import { icons as F } from "../../../../icons/index.js";
3
+ import X from "../composables/KunTextFieldProps.js";
4
+ import Y from "../composables/useKunTextFieldComposable.js";
5
+ import Z from "../../../KunIcon/src/components/KunIcon.vue.js";
6
+ const _ = {
7
7
  key: 0,
8
8
  class: "mr-2"
9
- }, _ = ["type", "value", "placeholder", "disabled", "readonly", "maxlength", "aria-invalid", "aria-describedby"], ee = ["disabled"], te = {
9
+ }, ee = ["type", "value", "placeholder", "disabled", "readonly", "maxlength", "aria-invalid", "aria-describedby"], te = ["disabled"], le = {
10
10
  key: 3,
11
11
  class: "flex items-center justify-center min-w-[32px] h-full px-1"
12
- }, le = {
12
+ }, ne = {
13
13
  key: 5,
14
14
  class: "ml-2"
15
15
  }, se = {
16
16
  key: 0,
17
17
  class: "h-[1.25rem]"
18
- }, ne = ["id"], oe = {
18
+ }, re = ["id"], oe = {
19
19
  key: 1,
20
20
  class: "text-xs text-center"
21
- }, re = {
21
+ }, ie = {
22
22
  key: 2,
23
23
  class: "text-xs text-right"
24
- }, fe = {
24
+ }, ye = /* @__PURE__ */ Object.assign({
25
+ inheritAttrs: !1
26
+ }, {
25
27
  __name: "KunTextField",
26
- props: { ...W },
28
+ props: { ...X },
27
29
  emits: [
28
30
  "update:modelValue",
29
31
  "focus",
30
32
  "blur",
31
33
  "handleClick",
32
34
  "keyDown",
33
- "keyUp"
35
+ "keyUp",
36
+ "enter"
34
37
  ],
35
- setup(V, { expose: D, emit: T }) {
36
- const a = V, p = T, {
37
- inputField: b,
38
- inputValue: f,
38
+ setup(P, { expose: V, emit: j }) {
39
+ const a = P, p = j, {
40
+ inputField: f,
41
+ inputValue: y,
39
42
  rootRef: w,
40
- inputFocused: h,
41
- validationError: j,
42
- hasError: y,
43
+ inputFocused: b,
44
+ validationError: E,
45
+ hasError: m,
43
46
  handleInput: g,
44
47
  handleBlur: C,
45
48
  focusInput: I,
46
- validate: B,
47
- reset: E,
48
- resetValidation: K,
49
+ validate: K,
50
+ reset: T,
51
+ resetValidation: B,
49
52
  clearInput: $
50
- } = X(a, p);
51
- D({
52
- validate: B,
53
- reset: E,
54
- resetValidation: K,
55
- inputField: b,
53
+ } = Y(a, p), O = (e) => {
54
+ p("keyDown", e), e.key === "Enter" && (e.preventDefault(), p("enter", e));
55
+ };
56
+ V({
57
+ validate: K,
58
+ reset: T,
59
+ resetValidation: B,
60
+ inputField: f,
56
61
  rootRef: w,
57
62
  focus: () => {
58
- U(() => {
59
- var e;
60
- (e = b.value) == null || e.focus();
63
+ H(() => {
64
+ f.value && f.value.focus();
61
65
  });
62
66
  }
63
67
  });
64
- const m = `input-${H().uid}`, S = d(() => h.value || f.value !== "" || a.dirty), x = q(), N = d(() => !!x["prepend-inner"]), O = d(() => !!x["append-inner"]), v = G(!1), z = d(() => v.value ? P.eyeOffOutline : P.eyeOutline);
65
- function A() {
68
+ const c = `input-${q().uid}`, S = d(() => b.value || y.value !== "" || a.dirty), x = G(), A = d(() => !!x["prepend-inner"]), N = d(() => !!x["append-inner"]), v = J(!1), z = d(() => v.value ? F.eyeOffOutline : F.eyeOutline);
69
+ function M() {
66
70
  v.value = !v.value;
67
71
  }
68
- 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");
72
+ const R = d(() => a.type === "password" ? v.value ? "text" : "password" : a.type), U = d(() => a.density === "compact" ? "p-1" : a.density === "comfortable" ? "p-2" : "p-3");
69
73
  return (e, l) => {
70
- var F;
71
- return o(), n("div", {
74
+ var D;
75
+ return s(), n("div", {
72
76
  class: "w-full flex flex-col relative",
73
77
  ref_key: "rootRef",
74
78
  ref: w
75
79
  }, [
76
- e.label ? (o(), n("label", {
80
+ e.label ? (s(), n("label", {
77
81
  key: 0,
78
- for: m,
82
+ for: c,
79
83
  class: u([
80
84
  e.labelColor,
81
85
  "absolute left-2 transition-all duration-200 ease-in-out pointer-events-none select-none z-10",
82
86
  S.value || e.placeholder ? "-top-2.25 text-xs opacity-80" : "top-3 text-sm opacity-80"
83
87
  ])
84
- }, i(e.label), 3)) : r("", !0),
85
- k("div", J({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
88
+ }, i(e.label), 3)) : o("", !0),
89
+ k("div", L({ class: "w-full flex flex-col justify-center relative" }, e.$attrs), [
86
90
  k("div", {
87
91
  class: u(["flex flex-row items-center w-full h-full border", [
88
92
  e.bgInput,
89
93
  e.rounded,
90
- t(h) ? "border-slate-400 dark:border-slate-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
94
+ t(b) ? "border-slate-400 dark:border-slate-600 shadow-[0_0_0_1px_rgba(59,130,246,0.5)]" : e.borderColor,
91
95
  e.disabled ? "opacity-60 cursor-not-allowed" : "cursor-text",
92
- t(y) ? "bg-red-200 dark:bg-red-900" : ""
96
+ t(m) ? "bg-red-200 dark:bg-red-900" : ""
93
97
  ]])
94
98
  }, [
95
- e.prefix ? (o(), n("div", Z, i(e.prefix), 1)) : r("", !0),
96
- N.value ? (o(), n("div", {
99
+ e.prefix ? (s(), n("div", _, i(e.prefix), 1)) : o("", !0),
100
+ A.value ? (s(), n("div", {
97
101
  key: 1,
98
102
  class: u([e.prependInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
99
103
  }, [
100
- c(e.$slots, "prepend-inner")
101
- ], 2)) : r("", !0),
102
- c(e.$slots, "prepend-input-content"),
104
+ h(e.$slots, "prepend-inner")
105
+ ], 2)) : o("", !0),
106
+ h(e.$slots, "prepend-input-content"),
103
107
  k("input", {
104
108
  ref_key: "inputField",
105
- ref: b,
106
- type: M.value,
107
- value: t(f),
108
- id: m,
109
+ ref: f,
110
+ type: R.value,
111
+ value: t(y),
112
+ id: c,
109
113
  placeholder: e.placeholder,
110
114
  disabled: e.disabled,
111
115
  readonly: e.readonly,
112
116
  maxlength: e.maxlength,
113
117
  autocomplete: "off",
114
- class: u(["w-full h-full bg-transparent focus:outline-none", [R.value, e.textColor, e.placeholderColor, e.rounded, e.textCenter ? "text-center" : ""]]),
115
- "aria-invalid": t(y) ? "true" : "false",
116
- "aria-describedby": t(y) ? `error-${m}` : null,
117
- onInput: l[0] || (l[0] = (...s) => t(g) && t(g)(...s)),
118
- onBlur: l[1] || (l[1] = (...s) => t(C) && t(C)(...s)),
119
- onFocus: l[2] || (l[2] = (...s) => t(I) && t(I)(...s)),
120
- onClick: l[3] || (l[3] = L((s) => p("handleClick"), ["stop"])),
121
- onKeydown: l[4] || (l[4] = (s) => p("keyDown", s)),
122
- onKeyup: l[5] || (l[5] = (s) => p("keyUp", s))
123
- }, null, 42, _),
124
- e.clearable && t(f) ? (o(), n("button", {
118
+ class: u(["w-full h-full bg-transparent focus:outline-none", [U.value, e.textColor, e.placeholderColor, e.rounded, e.textCenter ? "text-center" : ""]]),
119
+ "aria-invalid": t(m) ? "true" : "false",
120
+ "aria-describedby": t(m) ? `error-${c}` : null,
121
+ onInput: l[0] || (l[0] = (...r) => t(g) && t(g)(...r)),
122
+ onBlur: l[1] || (l[1] = (...r) => t(C) && t(C)(...r)),
123
+ onFocus: l[2] || (l[2] = (...r) => t(I) && t(I)(...r)),
124
+ onClick: l[3] || (l[3] = Q((r) => p("handleClick"), ["stop"])),
125
+ onKeydown: O,
126
+ onKeyup: l[4] || (l[4] = (r) => p("keyUp", r))
127
+ }, null, 42, ee),
128
+ e.clearable && t(y) ? (s(), n("button", {
125
129
  key: 2,
126
130
  type: "button",
127
- onClick: l[6] || (l[6] = (...s) => t($) && t($)(...s)),
131
+ onClick: l[5] || (l[5] = (...r) => t($) && t($)(...r)),
128
132
  class: u(["ml-2", e.textColor]),
129
133
  disabled: e.disabled || e.readonly
130
- }, " × ", 10, ee)) : r("", !0),
131
- c(e.$slots, "default"),
132
- e.type === "password" && e.showPasswordToggle ? (o(), n("div", te, [
133
- Q(Y, {
134
+ }, " × ", 10, te)) : o("", !0),
135
+ h(e.$slots, "default"),
136
+ e.type === "password" && e.showPasswordToggle ? (s(), n("div", le, [
137
+ W(Z, {
134
138
  icon: z.value,
135
- onClick: A
139
+ onClick: M
136
140
  }, null, 8, ["icon"])
137
- ])) : r("", !0),
138
- O.value ? (o(), n("div", {
141
+ ])) : o("", !0),
142
+ N.value ? (s(), n("div", {
139
143
  key: 4,
140
144
  class: u([e.appendInnerClass, "flex items-center justify-center min-w-[32px] h-full px-1"])
141
145
  }, [
142
- c(e.$slots, "append-inner")
143
- ], 2)) : r("", !0),
144
- e.suffix ? (o(), n("div", le, i(e.suffix), 1)) : r("", !0)
146
+ h(e.$slots, "append-inner")
147
+ ], 2)) : o("", !0),
148
+ e.suffix ? (s(), n("div", ne, i(e.suffix), 1)) : o("", !0)
145
149
  ], 2),
146
- e.hideDetails ? r("", !0) : (o(), n("div", se, [
147
- t(y) ? (o(), n("div", {
150
+ e.hideDetails ? o("", !0) : (s(), n("div", se, [
151
+ t(m) ? (s(), n("div", {
148
152
  key: 0,
149
- id: `error-${m}`,
153
+ id: `error-${c}`,
150
154
  class: "text-red-500 text-sm text-center"
151
- }, i(t(j) || e.errorMessage), 9, ne)) : e.hint && (e.persistentHint || t(h)) ? (o(), n("div", oe, i(e.hint), 1)) : r("", !0),
152
- e.counter && e.maxlength ? (o(), n("div", re, i(((F = t(f)) == null ? void 0 : F.length) || 0) + " / " + i(e.maxlength), 1)) : r("", !0)
155
+ }, i(t(E) || e.errorMessage), 9, re)) : e.hint && (e.persistentHint || t(b)) ? (s(), n("div", oe, i(e.hint), 1)) : o("", !0),
156
+ e.counter && e.maxlength ? (s(), n("div", ie, i(((D = t(y)) == null ? void 0 : D.length) || 0) + " / " + i(e.maxlength), 1)) : o("", !0)
153
157
  ]))
154
158
  ], 16)
155
159
  ], 512);
156
160
  };
157
161
  }
158
- };
162
+ });
159
163
  export {
160
- fe as default
164
+ ye as default
161
165
  };
@@ -1,54 +1,54 @@
1
- import { ref as a, inject as V, computed as E, watch as F, onUnmounted as T } from "vue";
1
+ import { ref as a, inject as F, computed as E, watch as V, onUnmounted as T } from "vue";
2
2
  import { debounce as j } from "../../../../utils/utils.js";
3
3
  function R(u, r) {
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 () => {
4
+ const t = a(u.modelValue ?? ""), o = a(!1), l = a(""), n = a(!1), g = a(null), h = a(null), s = a(!1), v = F("registerField", null), d = F("unregisterField", null), y = E(() => u.error || !!l.value && n.value), c = async () => {
5
5
  for (const e of u.rules) {
6
- const m = await Promise.resolve(e(l.value));
6
+ const m = await Promise.resolve(e(t.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
- t.value = e === !0 ? "" : e;
12
+ l.value = e === !0 ? "" : e;
13
13
  }, u.debounce ?? 300);
14
- F(() => u.modelValue, (e) => {
15
- e !== l.value && (s.value = !0, l.value = e ?? "");
16
- }), F(l, () => {
14
+ V(() => u.modelValue, (e) => {
15
+ e !== t.value && (s.value = !0, t.value = e ?? "");
16
+ }), V(t, () => {
17
17
  if (s.value) {
18
18
  s.value = !1;
19
19
  return;
20
20
  }
21
- n.value = !0, r("update:modelValue", l.value), u.validateOnBlur || f();
21
+ n.value = !0, r("update:modelValue", t.value), u.validateOnBlur || f();
22
22
  });
23
23
  const b = (e) => {
24
- l.value = e.target.value;
24
+ t.value = e.target.value;
25
25
  }, w = async () => {
26
26
  if (o.value = !1, u.validateOnBlur) {
27
27
  const e = await c();
28
- t.value = e === !0 ? "" : e;
28
+ l.value = e === !0 ? "" : e;
29
29
  }
30
30
  r("blur");
31
31
  }, B = () => {
32
32
  o.value = !0, r("focus");
33
33
  }, I = () => {
34
- l.value = "", r("update:modelValue", ""), n.value = !0, u.validateOnBlur || f();
34
+ t.value = "", n.value = !0, u.validateOnBlur || f();
35
35
  }, i = async () => {
36
36
  n.value = !0;
37
37
  const e = await c();
38
- return t.value = e === !0 ? "" : e, e === !0;
38
+ return l.value = e === !0 ? "" : e, e === !0;
39
39
  }, O = () => {
40
- l.value = u.modelValue, n.value = !1, t.value = "";
40
+ t.value = u.modelValue, n.value = !1, l.value = "";
41
41
  }, x = () => {
42
- n.value = !1, t.value = "";
42
+ n.value = !1, l.value = "";
43
43
  };
44
- return d && d({ validate: i }), T(() => {
45
- v && v({ validate: i });
44
+ return v && v({ validate: i }), T(() => {
45
+ d && d({ validate: i });
46
46
  }), {
47
47
  inputField: g,
48
- inputValue: l,
48
+ inputValue: t,
49
49
  rootRef: h,
50
50
  inputFocused: o,
51
- validationError: t,
51
+ validationError: l,
52
52
  hasError: y,
53
53
  handleInput: b,
54
54
  handleBlur: w,
@@ -57,7 +57,7 @@ const i = {
57
57
  var r;
58
58
  if (!t || t === "0000-00-00" || !a(t)) return "Nunca";
59
59
  const n = new Date(t), o = c.current, e = o.locale;
60
- return console.log(o), new Intl.DateTimeFormat(e, {
60
+ return new Intl.DateTimeFormat(e, {
61
61
  weekday: "short",
62
62
  day: "2-digit",
63
63
  month: "short",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.541",
3
+ "version": "0.1.543",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",