adverich-kun-ui 0.1.329 → 0.1.330

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,10 +1,10 @@
1
- import { ref as D, watch as E, computed as f, createElementBlock as r, openBlock as o, normalizeStyle as F, normalizeClass as y, unref as t, createCommentVNode as a, createElementVNode as w, withDirectives as M, renderSlot as s, createBlock as C, withKeys as j, withModifiers as H, createVNode as K, createTextVNode as V, toDisplayString as g, Fragment as R, renderList as T } from "vue";
1
+ import { ref as D, watch as E, computed as f, createElementBlock as r, openBlock as o, mergeProps as F, unref as t, createCommentVNode as a, createElementVNode as $, withDirectives as M, renderSlot as s, createBlock as w, withKeys as j, normalizeClass as C, withModifiers as H, createVNode as K, createTextVNode as V, toDisplayString as g, Fragment as R, renderList as T } from "vue";
2
2
  import h from "../../../KunIcon/src/components/KunIcon.vue.js";
3
3
  import { useCheckboxModel as L } from "../composables/useCheckboxModel.js";
4
- import { useValidation as q } from "../composables/useValidation.js";
5
- import { vRipple as G } from "../../../../directives/ripple.js";
6
- import { icons as v } from "../../../../icons/index.js";
7
- const J = ["name", "checked", "value"], P = ["aria-checked", "aria-disabled", "tabindex"], Q = {
4
+ import { useValidation as P } from "../composables/useValidation.js";
5
+ import { vRipple as q } from "../../../../directives/ripple.js";
6
+ import { icons as y } from "../../../../icons/index.js";
7
+ const G = ["name", "checked", "value"], J = ["aria-checked", "aria-disabled", "tabindex"], Q = {
8
8
  key: 1,
9
9
  class: "cursor-pointer"
10
10
  }, U = {
@@ -60,49 +60,49 @@ const J = ["name", "checked", "value"], P = ["aria-checked", "aria-disabled", "t
60
60
  "click:append",
61
61
  "click:prepend"
62
62
  ],
63
- setup(b, { expose: I, emit: N }) {
64
- const c = N, e = b, d = D(e.focused ?? !1);
65
- E(() => e.focused, (i) => d.value = i);
63
+ setup(v, { expose: I, emit: N }) {
64
+ const c = N, e = v, d = D(e.focused ?? !1);
65
+ E(() => e.focused, (n) => d.value = n);
66
66
  const {
67
67
  isChecked: p,
68
68
  toggle: u,
69
69
  internalValue: W
70
70
  } = L(e, c), {
71
71
  errorMessages: m,
72
- isValid: k,
73
- validate: x,
72
+ isValid: b,
73
+ validate: k,
74
74
  resetValidation: z
75
- } = q(e, W);
76
- I({ validate: x, resetValidation: z });
77
- const O = f(() => e.indeterminate ? e.indeterminateIcon || v.checkboxIndeterminate : p.value ? e.trueIcon || v.checkboxOn : e.falseIcon || v.checkboxBlank), A = f(() => [
75
+ } = P(e, W);
76
+ I({ validate: k, resetValidation: z });
77
+ const O = f(() => e.indeterminate ? e.indeterminateIcon || y.checkboxIndeterminate : p.value ? e.trueIcon || y.checkboxOn : e.falseIcon || y.checkboxBlank), A = f(() => [
78
78
  typeof e.iconColor == "string" ? `text-${e.iconColor}` : "",
79
79
  e.glow && d.value ? "opacity-100" : "opacity-70"
80
- ]), S = f(() => ({
80
+ ]), x = f(() => ({
81
81
  sm: "w-4 h-4 text-sm",
82
82
  md: "w-5 h-5 text-base",
83
83
  lg: "w-6 h-6 text-lg"
84
84
  })[e.size] || e.size);
85
- return (i, n) => {
86
- var B;
87
- return o(), r("div", {
88
- class: y([
85
+ return (n, i) => {
86
+ var S;
87
+ return o(), r("div", F({
88
+ class: [
89
89
  "kun-checkbox",
90
90
  "flex",
91
- b.direction === "vertical" ? "flex-col items-start" : "flex-row items-center",
91
+ v.direction === "vertical" ? "flex-col items-start" : "flex-row items-center",
92
92
  "gap-2",
93
93
  e.color && `text-${e.color}`,
94
94
  {
95
95
  "opacity-50 pointer-events-none": e.disabled || e.readonly,
96
- "text-red-600": e.error || !t(k),
96
+ "text-red-600": e.error || !t(b),
97
97
  "focus-within:ring-2 ring-primary-500": d.value
98
98
  }
99
- ]),
100
- style: F({
99
+ ],
100
+ style: {
101
101
  width: e.width && `${e.width}px`,
102
102
  minWidth: e.minWidth && `${e.minWidth}px`,
103
103
  maxWidth: e.maxWidth && `${e.maxWidth}px`
104
- })
105
- }, [
104
+ }
105
+ }, n.$attrs), [
106
106
  e.name ? (o(), r("input", {
107
107
  key: 0,
108
108
  type: "checkbox",
@@ -110,71 +110,71 @@ const J = ["name", "checked", "value"], P = ["aria-checked", "aria-disabled", "t
110
110
  checked: t(p),
111
111
  value: e.value ?? e.trueValue,
112
112
  class: "hidden"
113
- }, null, 8, J)) : a("", !0),
114
- w("div", {
113
+ }, null, 8, G)) : a("", !0),
114
+ $("div", {
115
115
  class: "flex items-center gap-2",
116
- onClick: n[0] || (n[0] = (l) => i.$emit("click:prepend"))
116
+ onClick: i[0] || (i[0] = (l) => n.$emit("click:prepend"))
117
117
  }, [
118
- s(i.$slots, "prepend"),
119
- e.prependIcon ? (o(), C(h, {
118
+ s(n.$slots, "prepend"),
119
+ e.prependIcon ? (o(), w(h, {
120
120
  key: 0,
121
121
  icon: e.prependIcon
122
122
  }, null, 8, ["icon"])) : a("", !0)
123
123
  ]),
124
124
  M((o(), r("div", {
125
- class: y(["relative inline-flex items-center justify-center cursor-pointer", [S.value]]),
125
+ class: C(["relative inline-flex items-center justify-center cursor-pointer", [x.value]]),
126
126
  role: "checkbox",
127
127
  "aria-checked": e.indeterminate ? "mixed" : t(p),
128
128
  "aria-disabled": e.disabled,
129
129
  tabindex: e.disabled ? -1 : 0,
130
- onClick: n[1] || (n[1] = (...l) => t(u) && t(u)(...l)),
131
- onFocus: n[2] || (n[2] = () => {
130
+ onClick: i[1] || (i[1] = (...l) => t(u) && t(u)(...l)),
131
+ onFocus: i[2] || (i[2] = () => {
132
132
  d.value = !0, c("update:focused", !0);
133
133
  }),
134
- onBlur: n[3] || (n[3] = () => {
134
+ onBlur: i[3] || (i[3] = () => {
135
135
  var l;
136
- d.value = !1, c("update:focused", !1), (l = e.validateOn) != null && l.includes("blur") && t(x)();
136
+ d.value = !1, c("update:focused", !1), (l = e.validateOn) != null && l.includes("blur") && t(k)();
137
137
  }),
138
- onKeydown: n[4] || (n[4] = j(H((...l) => t(u) && t(u)(...l), ["prevent"]), ["space"]))
138
+ onKeydown: i[4] || (i[4] = j(H((...l) => t(u) && t(u)(...l), ["prevent"]), ["space"]))
139
139
  }, [
140
140
  K(h, {
141
141
  icon: O.value,
142
- class: y([...A.value, S.value])
142
+ class: C([...A.value, x.value])
143
143
  }, null, 8, ["icon", "class"]),
144
- s(i.$slots, "input")
145
- ], 42, P)), [
146
- [t(G), e.ripple]
144
+ s(n.$slots, "input")
145
+ ], 42, J)), [
146
+ [t(q), e.ripple]
147
147
  ]),
148
- e.label || i.$slots.label ? (o(), r("div", Q, [
149
- s(i.$slots, "label", {
148
+ e.label || n.$slots.label ? (o(), r("div", Q, [
149
+ s(n.$slots, "label", {
150
150
  label: e.label
151
151
  }, () => [
152
152
  V(g(e.label), 1)
153
153
  ])
154
154
  ])) : a("", !0),
155
- w("div", {
155
+ $("div", {
156
156
  class: "flex items-center gap-2",
157
- onClick: n[5] || (n[5] = (l) => i.$emit("click:append"))
157
+ onClick: i[5] || (i[5] = (l) => n.$emit("click:append"))
158
158
  }, [
159
- s(i.$slots, "append"),
160
- e.appendIcon ? (o(), C(h, {
159
+ s(n.$slots, "append"),
160
+ e.appendIcon ? (o(), w(h, {
161
161
  key: 0,
162
162
  icon: e.appendIcon
163
163
  }, null, 8, ["icon"])) : a("", !0)
164
164
  ]),
165
- !e.hideDetails && ((B = t(m)) != null && B.length || e.hint || e.persistentHint) ? (o(), r("div", U, [
166
- s(i.$slots, "details", {}, () => {
165
+ !e.hideDetails && ((S = t(m)) != null && S.length || e.hint || e.persistentHint) ? (o(), r("div", U, [
166
+ s(n.$slots, "details", {}, () => {
167
167
  var l;
168
168
  return [
169
- (e.error || !t(k)) && ((l = t(m)) != null && l.length) ? (o(), r("div", X, [
170
- (o(!0), r(R, null, T(t(m).slice(0, Number(e.maxErrors)), ($) => s(i.$slots, "message", { message: $ }, () => [
171
- V(g($), 1)
169
+ (e.error || !t(b)) && ((l = t(m)) != null && l.length) ? (o(), r("div", X, [
170
+ (o(!0), r(R, null, T(t(m).slice(0, Number(e.maxErrors)), (B) => s(n.$slots, "message", { message: B }, () => [
171
+ V(g(B), 1)
172
172
  ])), 256))
173
173
  ])) : e.hint || e.persistentHint ? (o(), r("div", Y, g(e.hint), 1)) : a("", !0)
174
174
  ];
175
175
  })
176
176
  ])) : a("", !0)
177
- ], 6);
177
+ ], 16);
178
178
  };
179
179
  }
180
180
  };
@@ -1,4 +1,4 @@
1
- import { ref as L, computed as p, createElementBlock as l, openBlock as s, normalizeClass as m, renderSlot as i, createElementVNode as a, normalizeProps as y, guardReactiveProps as k, unref as n, createCommentVNode as d, toDisplayString as b, createBlock as h, resolveDynamicComponent as C, Fragment as q, renderList as J, withDirectives as O, vShow as Q, createTextVNode as U } from "vue";
1
+ import { ref as L, computed as p, createElementBlock as l, openBlock as s, normalizeClass as m, renderSlot as i, createElementVNode as a, normalizeProps as y, guardReactiveProps as k, unref as t, createCommentVNode as d, toDisplayString as b, createBlock as h, resolveDynamicComponent as C, Fragment as q, renderList as J, withDirectives as O, vShow as Q, createTextVNode as U } from "vue";
2
2
  import { kunTextareaProps as W } from "../composables/KunTextareaProps.js";
3
3
  import { useKunTextarea as X } from "../composables/useKunTextareaComposable.js";
4
4
  import { renderIconSlot as $ } from "../../../../utils/renderIcon.js";
@@ -11,37 +11,37 @@ const Y = {
11
11
  }, _ = {
12
12
  key: 1,
13
13
  class: "absolute left-2 top-2 ml-1"
14
- }, ee = ["value", "rows", "disabled", "readonly", "placeholder"], re = {
14
+ }, ee = ["value", "rows", "disabled", "readonly", "placeholder"], oe = {
15
15
  key: 3,
16
16
  class: "absolute right-2 top-2 mr-1"
17
- }, oe = {
17
+ }, re = {
18
18
  key: 4,
19
19
  class: "absolute right-2 top-2 flex items-center"
20
- }, ne = {
20
+ }, te = {
21
21
  key: 5,
22
22
  class: "mt-1"
23
- }, te = { class: "h-1 w-full bg-gray-200 rounded overflow-hidden" }, se = {
23
+ }, ne = { class: "h-1 w-full bg-gray-200 rounded overflow-hidden" }, se = {
24
24
  key: 7,
25
25
  class: "text-xs text-right mt-1 text-gray-400"
26
26
  }, le = { key: 0 }, pe = {
27
27
  __name: "KunTextarea",
28
28
  props: W,
29
29
  emits: ["update:modelValue", "click:clear", "click:control", "update:focused", "mousedown:control"],
30
- setup(B, { expose: R, emit: S }) {
31
- const r = B, V = S, u = L(null), {
30
+ setup(z, { expose: B, emit: S }) {
31
+ const o = z, R = S, u = L(null), {
32
32
  isFocused: v,
33
33
  internalValue: c,
34
34
  updateValue: D,
35
- handleClear: z,
35
+ handleClear: V,
36
36
  adjustHeight: F,
37
37
  validate: M,
38
38
  reset: T,
39
39
  resetValidation: A,
40
40
  hasError: f,
41
41
  displayedMessages: w
42
- } = X(r, V, u), E = p(() => {
43
- const e = !!r.bgColor;
44
- switch (r.variant) {
42
+ } = X(o, R, u), E = p(() => {
43
+ const e = !!o.bgColor;
44
+ switch (o.variant) {
45
45
  case "filled":
46
46
  return [
47
47
  e ? "" : "bg-gray-100 dark:bg-gray-900",
@@ -60,7 +60,7 @@ const Y = {
60
60
  return "";
61
61
  }
62
62
  }), G = p(() => {
63
- switch (r.density) {
63
+ switch (o.density) {
64
64
  case "comfortable":
65
65
  return "py-2";
66
66
  case "compact":
@@ -70,102 +70,108 @@ const Y = {
70
70
  }
71
71
  }), N = p(() => [
72
72
  "w-full resize-none p-2 transition-colors duration-150",
73
- r.inputClass,
73
+ o.inputClass,
74
74
  {
75
- "rounded-md": !r.tile,
76
- "rounded-none": r.tile,
77
- [`rounded-${r.rounded}`]: typeof r.rounded == "string" || typeof r.rounded == "number",
78
- "shadow-md": r.variant === "solo" && !r.flat,
79
- "shadow-none": r.flat,
80
- [`text-${r.textColor}`]: r.textColor,
81
- [`${r.bgColor}`]: r.bgColor,
82
- "text-gray-500 bg-gray-200": r.disabled,
83
- "focus:outline-none focus:ring-2": !r.disabled,
84
- [`focus:ring-${r.color}`]: r.color && !r.disabled && !f.value,
75
+ "rounded-md": !o.tile,
76
+ "rounded-none": o.tile,
77
+ [`rounded-${o.rounded}`]: typeof o.rounded == "string" || typeof o.rounded == "number",
78
+ "shadow-md": o.variant === "solo" && !o.flat,
79
+ "shadow-none": o.flat,
80
+ [`text-${o.textColor}`]: o.textColor,
81
+ [`${o.bgColor}`]: o.bgColor,
82
+ "text-gray-500 bg-gray-200": o.disabled,
83
+ "focus:outline-none focus:ring-2": !o.disabled,
84
+ [`focus:ring-${o.color}`]: o.color && !o.disabled && !f.value,
85
85
  "border-red-500 ring-red-500 focus:ring-red-500": f.value,
86
- "resize-none": r.noResize || r.autoGrow,
87
- resize: !r.noResize && !r.autoGrow
86
+ "resize-none": o.noResize || o.autoGrow,
87
+ resize: !o.noResize && !o.autoGrow
88
88
  }
89
89
  ]), P = p(() => [
90
90
  "relative w-full",
91
- r.class,
92
- r.wrapperClass
93
- ]), I = p(() => r.counter === !0 ? 25 : typeof r.counter == "number" || typeof r.counter == "string" ? r.counter : null), H = p(() => r.persistentCounter ? !0 : !!r.counter && v.value), K = p(() => typeof r.clearIcon == "string" ? r.clearIcon : "i-heroicons-x-mark-20-solid");
94
- function g(e, t) {
95
- V(`click:${t}`, e);
91
+ o.class,
92
+ o.wrapperClass
93
+ ]), I = p(() => o.counter === !0 ? 25 : typeof o.counter == "number" || typeof o.counter == "string" ? o.counter : null), H = p(() => o.persistentCounter ? !0 : !!o.counter && v.value), K = p(() => typeof o.clearIcon == "string" ? o.clearIcon : "i-heroicons-x-mark-20-solid");
94
+ function g(e, n) {
95
+ R(`click:${n}`, e);
96
96
  }
97
- return R({
97
+ return B({
98
98
  validate: M,
99
99
  reset: T,
100
100
  resetValidation: A,
101
101
  errorMessages: w,
102
- isValid: p(() => !f.value)
103
- }), (e, t) => (s(), l("div", {
104
- class: m(P.value)
102
+ isValid: p(() => !f.value),
103
+ rootRef,
104
+ focus: () => {
105
+ var e;
106
+ return (e = u.value) == null ? void 0 : e.focus();
107
+ }
108
+ }), (e, n) => (s(), l("div", {
109
+ class: m(P.value),
110
+ ref: "rootRef"
105
111
  }, [
106
- i(e.$slots, "label", y(k({ label: e.label, isFocused: n(v), isActive: !!n(c), controlRef: u.value, focus: () => {
107
- var o;
108
- return (o = u.value) == null ? void 0 : o.focus();
112
+ i(e.$slots, "label", y(k({ label: e.label, isFocused: t(v), isActive: !!t(c), controlRef: u.value, focus: () => {
113
+ var r;
114
+ return (r = u.value) == null ? void 0 : r.focus();
109
115
  }, blur: () => {
110
- var o;
111
- return (o = u.value) == null ? void 0 : o.blur();
112
- }, props: r })), () => [
116
+ var r;
117
+ return (r = u.value) == null ? void 0 : r.blur();
118
+ }, props: o })), () => [
113
119
  e.label ? (s(), l("label", Y, b(e.label), 1)) : d("", !0)
114
120
  ]),
115
121
  a("div", Z, [
116
122
  e.prependIcon || e.$slots.prepend ? (s(), l("div", x, [
117
123
  i(e.$slots, "prepend", y(k(e.prependSlotBindings)), () => [
118
124
  a("div", {
119
- onClick: t[0] || (t[0] = (o) => g(o, "prepend"))
125
+ onClick: n[0] || (n[0] = (r) => g(r, "prepend"))
120
126
  }, [
121
- (s(), h(C(n($)(e.prependIcon))))
127
+ (s(), h(C(t($)(e.prependIcon))))
122
128
  ])
123
129
  ])
124
130
  ])) : d("", !0),
125
131
  e.prependInnerIcon || e.$slots["prepend-inner"] ? (s(), l("div", _, [
126
132
  i(e.$slots, "prepend-inner", {}, () => [
127
133
  a("div", {
128
- onClick: t[1] || (t[1] = (o) => g(o, "prependInner"))
134
+ onClick: n[1] || (n[1] = (r) => g(r, "prependInner"))
129
135
  }, [
130
- (s(), h(C(n($)(e.prependInnerIcon))))
136
+ (s(), h(C(t($)(e.prependInnerIcon))))
131
137
  ])
132
138
  ])
133
139
  ])) : d("", !0),
134
140
  a("textarea", {
135
141
  ref_key: "textareaRef",
136
142
  ref: u,
137
- value: n(c),
143
+ value: t(c),
138
144
  rows: e.rows,
139
145
  disabled: e.disabled,
140
146
  readonly: e.readonly,
141
147
  placeholder: e.placeholder,
142
- onInput: t[2] || (t[2] = (o) => {
143
- n(D)(o.target.value), e.autoGrow && n(F)();
148
+ onInput: n[2] || (n[2] = (r) => {
149
+ t(D)(r.target.value), e.autoGrow && t(F)();
144
150
  }),
145
- onFocus: t[3] || (t[3] = (o) => {
151
+ onFocus: n[3] || (n[3] = (r) => {
146
152
  v.value = !0, e.$emit("update:focused", !0);
147
153
  }),
148
- onBlur: t[4] || (t[4] = (o) => {
154
+ onBlur: n[4] || (n[4] = (r) => {
149
155
  v.value = !1, e.$emit("update:focused", !1);
150
156
  }),
151
- onClick: t[5] || (t[5] = (o) => e.$emit("click:control", o)),
152
- onMousedown: t[6] || (t[6] = (o) => e.$emit("mousedown:control", o)),
157
+ onClick: n[5] || (n[5] = (r) => e.$emit("click:control", r)),
158
+ onMousedown: n[6] || (n[6] = (r) => e.$emit("mousedown:control", r)),
153
159
  class: m([E.value, G.value, N.value])
154
160
  }, null, 42, ee),
155
- e.clearable && n(c) ? (s(), l("div", {
161
+ e.clearable && t(c) ? (s(), l("div", {
156
162
  key: 2,
157
163
  class: m(["absolute right-2 top-2", { "opacity-100": e.persistentClear, "hover:opacity-100 opacity-0 transition-opacity duration-200": !e.persistentClear }])
158
164
  }, [
159
- i(e.$slots, "clear", y(k({ isActive: !!n(c), isFocused: n(v), controlRef: u.value, focus: () => {
160
- var o;
161
- return (o = u.value) == null ? void 0 : o.focus();
165
+ i(e.$slots, "clear", y(k({ isActive: !!t(c), isFocused: t(v), controlRef: u.value, focus: () => {
166
+ var r;
167
+ return (r = u.value) == null ? void 0 : r.focus();
162
168
  }, blur: () => {
163
- var o;
164
- return (o = u.value) == null ? void 0 : o.blur();
165
- }, props: r })), () => [
169
+ var r;
170
+ return (r = u.value) == null ? void 0 : r.blur();
171
+ }, props: o })), () => [
166
172
  a("button", {
167
173
  type: "button",
168
- onClick: t[7] || (t[7] = (...o) => n(z) && n(z)(...o)),
174
+ onClick: n[7] || (n[7] = (...r) => t(V) && t(V)(...r)),
169
175
  class: "text-gray-500 hover:text-gray-700"
170
176
  }, [
171
177
  a("span", {
@@ -174,30 +180,30 @@ const Y = {
174
180
  ])
175
181
  ])
176
182
  ], 2)) : d("", !0),
177
- e.appendInnerIcon || e.$slots["append-inner"] ? (s(), l("div", re, [
183
+ e.appendInnerIcon || e.$slots["append-inner"] ? (s(), l("div", oe, [
178
184
  i(e.$slots, "append-inner", {}, () => [
179
185
  a("div", {
180
- onClick: t[8] || (t[8] = (o) => g(o, "appendInner"))
186
+ onClick: n[8] || (n[8] = (r) => g(r, "appendInner"))
181
187
  }, [
182
- (s(), h(C(n($)(e.appendInnerIcon))))
188
+ (s(), h(C(t($)(e.appendInnerIcon))))
183
189
  ])
184
190
  ])
185
191
  ])) : d("", !0),
186
- e.appendIcon || e.$slots.append ? (s(), l("div", oe, [
192
+ e.appendIcon || e.$slots.append ? (s(), l("div", re, [
187
193
  i(e.$slots, "append", y(k(e.appendSlotBindings)), () => [
188
194
  a("div", {
189
- onClick: t[9] || (t[9] = (o) => g(o, "append"))
195
+ onClick: n[9] || (n[9] = (r) => g(r, "append"))
190
196
  }, [
191
- (s(), h(C(n($)(e.appendIcon))))
197
+ (s(), h(C(t($)(e.appendIcon))))
192
198
  ])
193
199
  ])
194
200
  ])) : d("", !0),
195
- e.loading ? (s(), l("div", ne, [
201
+ e.loading ? (s(), l("div", te, [
196
202
  i(e.$slots, "loader", {
197
203
  color: e.loadingColor,
198
204
  isActive: !0
199
205
  }, () => [
200
- a("div", te, [
206
+ a("div", ne, [
201
207
  a("div", {
202
208
  class: m(["h-full transition-all duration-300", [`${e.loadingColor}`]]),
203
209
  style: { width: "100%" }
@@ -205,33 +211,33 @@ const Y = {
205
211
  ])
206
212
  ])
207
213
  ])) : d("", !0),
208
- !e.hideDetails || e.hideDetails === "auto" && (n(w).length || e.hint) ? (s(), l("div", {
214
+ !e.hideDetails || e.hideDetails === "auto" && (t(w).length || e.hint) ? (s(), l("div", {
209
215
  key: 6,
210
- class: m(["text-xs mt-1 space-y-1", { "text-red-500": n(f), "text-gray-500": !n(f) }])
216
+ class: m(["text-xs mt-1 space-y-1", { "text-red-500": t(f), "text-gray-500": !t(f) }])
211
217
  }, [
212
218
  i(e.$slots, "details", {}, () => [
213
- n(f) ? (s(!0), l(q, { key: 0 }, J(n(w), (o, j) => i(e.$slots, "message", {
219
+ t(f) ? (s(!0), l(q, { key: 0 }, J(t(w), (r, j) => i(e.$slots, "message", {
214
220
  key: j,
215
- message: o
221
+ message: r
216
222
  }, () => [
217
- a("div", null, b(o), 1)
223
+ a("div", null, b(r), 1)
218
224
  ])), 128)) : e.hint ? i(e.$slots, "hint", {
219
225
  key: 1,
220
226
  hint: e.hint
221
227
  }, () => [
222
228
  O(a("div", null, b(e.hint), 513), [
223
- [Q, e.persistentHint || n(v)]
229
+ [Q, e.persistentHint || t(v)]
224
230
  ])
225
231
  ]) : d("", !0)
226
232
  ])
227
233
  ], 2)) : d("", !0),
228
234
  H.value ? (s(), l("div", se, [
229
235
  i(e.$slots, "counter", {
230
- counter: n(c).length,
236
+ counter: t(c).length,
231
237
  max: I.value,
232
- value: n(c).length
238
+ value: t(c).length
233
239
  }, () => [
234
- U(b(n(c).length), 1),
240
+ U(b(t(c).length), 1),
235
241
  I.value ? (s(), l("span", le, " / " + b(I.value), 1)) : d("", !0)
236
242
  ])
237
243
  ])) : d("", !0)
@@ -1,6 +1,6 @@
1
- import { ref as n, watch as N, nextTick as M, onMounted as T, computed as V } from "vue";
2
- function k(t, s, l) {
3
- const h = n(!1), w = n(t.modelValue), g = (e) => {
1
+ import { ref as o, watch as T, nextTick as M, onMounted as b, computed as V } from "vue";
2
+ function A(t, s, a) {
3
+ const h = o(!1), w = o(t.modelValue), H = o(null), g = (e) => {
4
4
  if (t.formatModel === "raw") return String(e ?? "");
5
5
  if ((t.formatModel === "json" || t.formatModel === "auto") && typeof e == "object" && e !== null)
6
6
  try {
@@ -12,65 +12,66 @@ function k(t, s, l) {
12
12
  }, m = (e) => {
13
13
  if (t.formatModel === "raw") return e;
14
14
  try {
15
- const a = JSON.parse(e);
15
+ const l = JSON.parse(e);
16
16
  if (t.formatModel === "json" || t.formatModel === "auto")
17
- return a;
17
+ return l;
18
18
  } catch {
19
19
  }
20
20
  return e;
21
- }, o = n(g(t.modelValue));
22
- N(() => t.modelValue, (e) => {
23
- w.value = e, o.value = g(e), t.autoGrow && M(c);
21
+ }, u = o(g(t.modelValue));
22
+ T(() => t.modelValue, (e) => {
23
+ w.value = e, u.value = g(e), t.autoGrow && M(c);
24
24
  });
25
25
  const v = (e) => {
26
- o.value = e;
27
- const a = m(e);
28
- s("update:modelValue", a);
29
- }, H = () => {
26
+ u.value = e;
27
+ const l = m(e);
28
+ s("update:modelValue", l);
29
+ }, S = () => {
30
30
  v(""), s("click:clear");
31
31
  }, c = () => {
32
- if (!l.value) return;
33
- l.value.style.height = "auto", l.value.style.overflowY = "hidden";
34
- const e = l.value.scrollHeight, a = parseFloat(getComputedStyle(l.value).lineHeight || "24"), i = Number(t.maxRows || 0);
32
+ if (!a.value) return;
33
+ a.value.style.height = "auto", a.value.style.overflowY = "hidden";
34
+ const e = a.value.scrollHeight, l = parseFloat(getComputedStyle(a.value).lineHeight || "24"), i = Number(t.maxRows || 0);
35
35
  if (t.maxRows && i > 0) {
36
- const u = i * a;
37
- l.value.style.height = Math.min(e, u) + "px";
36
+ const n = i * l;
37
+ a.value.style.height = Math.min(e, n) + "px";
38
38
  } else
39
- l.value.style.height = e + "px";
39
+ a.value.style.height = e + "px";
40
40
  };
41
- T(() => {
41
+ b(() => {
42
42
  t.autoGrow && M(c);
43
43
  });
44
- const r = n([]), S = n(!0), j = (e = !1) => {
45
- const a = t.validationValue ?? m(o.value), i = t.rules ?? [], u = [];
44
+ const r = o([]), j = o(!0), x = (e = !1) => {
45
+ const l = t.validationValue ?? m(u.value), i = t.rules ?? [], n = [];
46
46
  for (const d of i) {
47
- const f = typeof d == "function" ? d(a) : d;
48
- typeof f == "string" ? u.push(f) : f === !1 && u.push("Campo inválido");
47
+ const f = typeof d == "function" ? d(l) : d;
48
+ typeof f == "string" ? n.push(f) : f === !1 && n.push("Campo inválido");
49
49
  }
50
- return r.value = u.slice(0, t.maxErrors ?? 1), e || s("update:focused", h.value), r.value;
50
+ return r.value = n.slice(0, t.maxErrors ?? 1), e || s("update:focused", h.value), r.value;
51
51
  }, y = () => {
52
52
  r.value = [];
53
- }, x = () => {
54
- o.value = "", y(), s("update:modelValue", "");
55
- }, C = V(() => t.error || r.value.length > 0), E = V(() => {
53
+ }, C = () => {
54
+ u.value = "", y(), s("update:modelValue", "");
55
+ }, E = V(() => t.error || r.value.length > 0), N = V(() => {
56
56
  var e;
57
57
  return (e = t.errorMessages) != null && e.length ? Array.isArray(t.errorMessages) ? t.errorMessages : [t.errorMessages] : r.value;
58
58
  });
59
59
  return {
60
60
  isFocused: h,
61
- internalValue: o,
61
+ internalValue: u,
62
+ rootRef: H,
62
63
  updateValue: v,
63
- handleClear: H,
64
+ handleClear: S,
64
65
  adjustHeight: c,
65
- isPristine: S,
66
- validate: j,
67
- reset: x,
66
+ isPristine: j,
67
+ validate: x,
68
+ reset: C,
68
69
  resetValidation: y,
69
70
  validationErrors: r,
70
- hasError: C,
71
- displayedMessages: E
71
+ hasError: E,
72
+ displayedMessages: N
72
73
  };
73
74
  }
74
75
  export {
75
- k as useKunTextarea
76
+ A as useKunTextarea
76
77
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.329",
3
+ "version": "0.1.330",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",