adverich-kun-ui 0.1.365 → 0.1.366

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