adverich-kun-ui 0.1.403 → 0.1.404

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,39 +1,43 @@
1
- import { mergeModels as R, useModel as S, onMounted as te, ref as _, watch as oe, createElementBlock as w, openBlock as s, createVNode as n, unref as l, isRef as $, createSlots as ie, withCtx as i, createCommentVNode as C, Fragment as ne, renderList as ae, createBlock as m, createElementVNode as re, createTextVNode as V, toDisplayString as x, withModifiers as se } from "vue";
1
+ import { mergeModels as $, useModel as z, onMounted as oe, ref as R, watch as ie, createElementBlock as v, openBlock as n, createVNode as a, unref as l, isRef as S, createSlots as ae, withCtx as i, createCommentVNode as k, Fragment as ne, renderList as re, createBlock as m, createElementVNode as se, createTextVNode as y, toDisplayString as I, normalizeClass as ue, withModifiers as de } from "vue";
2
2
  import { icons as f } from "../../../../icons/index.js";
3
- import { isNotEmpty as ue, isArray as A } from "../../../../utils/utils.js";
4
- import de from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
- import ce from "../../../KunList/src/components/KunList.vue.js";
6
- import z from "../../../KunListItem/src/components/KunListItem.vue.js";
3
+ import { isNotEmpty as ce, isArray as A } from "../../../../utils/utils.js";
4
+ import me from "../../../KunInfiniteScroll/src/components/KunInfiniteScroll.vue.js";
5
+ import fe from "../../../KunList/src/components/KunList.vue.js";
6
+ import B from "../../../KunListItem/src/components/KunListItem.vue.js";
7
7
  import F from "../../../KunListItemTitle/src/components/KunListItemTitle.vue.js";
8
- import me from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
- import fe from "../../../KunMenu/src/components/KunMenu.vue.js";
10
- import { useAutocomplete as pe } from "../composables/useAutocomplete.js";
11
- import { KunAutocompleteProps as he } from "../composables/KunAutocompleteProps.js";
12
- import ve from "../../../KunTextField/src/components/KunTextField.vue.js";
13
- import ke from "../../../KunChip/src/components/KunChip.vue.js";
14
- import v from "../../../KunIcon/src/components/KunIcon.vue.js";
15
- const ye = {
8
+ import pe from "../../../KunListItemSubtitle/src/components/KunListItemSubtitle.vue.js";
9
+ import he from "../../../KunMenu/src/components/KunMenu.vue.js";
10
+ import { useAutocomplete as ve } from "../composables/useAutocomplete.js";
11
+ import { KunAutocompleteProps as ke } from "../composables/KunAutocompleteProps.js";
12
+ import ye from "../../../KunTextField/src/components/KunTextField.vue.js";
13
+ import be from "../../../KunBtn/src/components/KunBtn.vue.js";
14
+ import Ce from "../../../KunChip/src/components/KunChip.vue.js";
15
+ import b from "../../../KunIcon/src/components/KunIcon.vue.js";
16
+ const ge = {
16
17
  key: 0,
17
18
  class: "w-full flex overflow-x-auto whitespace-nowrap space-x-1"
18
- }, be = { class: "flex items-center" }, ze = {
19
+ }, we = { class: "flex items-center" }, Ve = {
20
+ key: 0,
21
+ class: "sticky top-0 z-10 p-2 border-b"
22
+ }, Ne = {
19
23
  __name: "KunAutocomplete",
20
- props: /* @__PURE__ */ R(he, {
24
+ props: /* @__PURE__ */ $(ke, {
21
25
  modelValue: { default: null },
22
26
  modelModifiers: {},
23
27
  items: { default: [], type: Array, required: !0 },
24
28
  itemsModifiers: {}
25
29
  }),
26
- emits: /* @__PURE__ */ R(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
27
- setup(k, { emit: B }) {
28
- const a = S(k, "modelValue"), I = S(k, "items"), u = k, p = B, {
29
- textFieldRef: y,
30
- listRef: b,
31
- menuModel: r,
30
+ emits: /* @__PURE__ */ $(["update:modelValue", "selectedItem", "createItem", "validation", "search"], ["update:modelValue", "update:items"]),
31
+ setup(C, { emit: T }) {
32
+ const r = z(C, "modelValue"), D = z(C, "items"), u = C, p = T, {
33
+ textFieldRef: g,
34
+ listRef: w,
35
+ menuModel: s,
32
36
  search: c,
33
- removeItem: E,
34
- clearSelection: N,
35
- lightReset: T,
36
- openMenu: g,
37
+ removeItem: x,
38
+ clearSelection: E,
39
+ lightReset: N,
40
+ openMenu: V,
37
41
  closeMenu: L,
38
42
  toggleMenu: U,
39
43
  onMenuKeydown: H,
@@ -41,14 +45,15 @@ const ye = {
41
45
  textArr: q,
42
46
  getItemText: P,
43
47
  isAlphanumeric: W,
44
- checkDisabled: j,
45
- itemToString: D,
46
- placeholder: G
47
- } = pe(u, p, a, I);
48
- te(() => {
49
- u.focusOnRender && y.value.focus();
48
+ createItem: j,
49
+ checkDisabled: G,
50
+ itemToString: K,
51
+ placeholder: J
52
+ } = ve(u, p, r, D);
53
+ oe(() => {
54
+ u.focusOnRender && g.value.focus();
50
55
  });
51
- const K = _(null), h = _(""), M = (e) => {
56
+ const M = R(null), h = R(""), _ = (e) => {
52
57
  for (const o of u.rules) {
53
58
  const t = o(e);
54
59
  if (t !== !0)
@@ -56,121 +61,133 @@ const ye = {
56
61
  }
57
62
  return h.value = "", p("validation", !0), !0;
58
63
  };
59
- oe(() => a.value, (e, o) => {
60
- ue(u.rules) && M(e);
64
+ ie(() => r.value, (e, o) => {
65
+ ce(u.rules) && _(e);
61
66
  });
62
- function J() {
67
+ function Q() {
63
68
  var e;
64
- r.value = !1, (e = y.value.inputField) == null || e.focus();
69
+ s.value = !1, (e = g.value.inputField) == null || e.focus();
65
70
  }
66
- function Q(e) {
71
+ function X(e) {
67
72
  var t, d;
68
73
  const o = e.key;
69
74
  if (o === "Tab" || o === "Shift") {
70
75
  L();
71
76
  return;
72
77
  }
73
- (W(o) || o === "Backspace") && g(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), r.value || g(), console.log("listRef.value", b.value), (d = (t = b.value) == null ? void 0 : t.focusWithKey) == null || d.call(t, o));
78
+ (W(o) || o === "Backspace") && V(), ["ArrowUp", "ArrowDown"].includes(o) && (e.preventDefault(), s.value || V(), console.log("listRef.value", w.value), (d = (t = w.value) == null ? void 0 : t.focusWithKey) == null || d.call(t, o));
74
79
  }
75
- function X(e) {
80
+ function Y(e) {
76
81
  p("search", c);
77
82
  }
78
- function Y() {
79
- M(a);
83
+ function Z() {
84
+ _(r);
80
85
  }
81
- function Z(e) {
86
+ function ee(e) {
82
87
  H(e);
83
88
  }
84
- function ee() {
89
+ function le() {
85
90
  }
86
- return (e, o) => (s(), w("div", {
91
+ return (e, o) => (n(), v("div", {
87
92
  class: "w-full h-fit",
88
93
  ref_key: "parentRef",
89
- ref: K
94
+ ref: M
90
95
  }, [
91
- n(ve, {
96
+ a(ye, {
92
97
  modelValue: l(c),
93
98
  "onUpdate:modelValue": [
94
- o[1] || (o[1] = (t) => $(c) ? c.value = t : null),
95
- X
99
+ o[1] || (o[1] = (t) => S(c) ? c.value = t : null),
100
+ Y
96
101
  ],
97
102
  label: e.label,
98
103
  dirty: "",
99
104
  "hide-details": e.hideDetails,
100
105
  density: e.density,
101
106
  ref_key: "textFieldRef",
102
- ref: y,
107
+ ref: g,
103
108
  autocomplete: "off",
104
- onFocusInput: Y,
109
+ onFocusInput: Z,
105
110
  onHandleClick: l(U),
106
- rounded: l(r) ? "rounded-t" : "rounded",
107
- onBlur: ee,
108
- onKeyDown: Q,
109
- placeholder: u.multiple && l(A)(a.value) && a.value.length ? "" : l(G),
111
+ rounded: l(s) ? "rounded-t" : "rounded",
112
+ onBlur: le,
113
+ onKeyDown: X,
114
+ placeholder: u.multiple && l(A)(r.value) && r.value.length ? "" : l(J),
110
115
  error: !!h.value,
111
116
  "error-messages": h.value
112
- }, ie({
117
+ }, ae({
113
118
  default: i(() => [
114
- l(A)(a.value) ? (s(), w("div", ye, [
115
- (s(!0), w(ne, null, ae(a.value, (t) => (s(), m(ke, {
119
+ l(A)(r.value) ? (n(), v("div", ge, [
120
+ (n(!0), v(ne, null, re(r.value, (t) => (n(), m(Ce, {
116
121
  key: t.id ?? t.name,
117
122
  size: "small"
118
123
  }, {
119
124
  default: i(() => [
120
- re("div", be, [
121
- V(x(l(P)(t, e.itemTitle)) + " ", 1),
122
- n(v, {
125
+ se("div", we, [
126
+ y(I(l(P)(t, e.itemTitle)) + " ", 1),
127
+ a(b, {
123
128
  color: "error",
124
129
  icon: l(f).close,
125
130
  size: "small",
126
131
  class: "ml-1",
127
- onClick: (d) => l(E)(t)
132
+ onClick: (d) => l(x)(t)
128
133
  }, null, 8, ["icon", "onClick"])
129
134
  ])
130
135
  ]),
131
136
  _: 2
132
137
  }, 1024))), 128))
133
- ])) : C("", !0),
134
- n(fe, {
138
+ ])) : k("", !0),
139
+ a(he, {
135
140
  transition: "fade",
136
- "onClick:outside": l(T),
137
- modelValue: l(r),
138
- "onUpdate:modelValue": o[0] || (o[0] = (t) => $(r) ? r.value = t : null),
141
+ "onClick:outside": l(N),
142
+ modelValue: l(s),
143
+ "onUpdate:modelValue": o[0] || (o[0] = (t) => S(s) ? s.value = t : null),
139
144
  activator: "parent",
140
145
  "z-index": e.zIndex,
141
- "parent-ref": K.value,
146
+ "parent-ref": M.value,
142
147
  location: "bottom",
143
148
  origin: "bottom left",
144
- onHandleEscape: J,
149
+ onHandleEscape: Q,
145
150
  "close-on-content-click": e.closeOnSelect,
146
151
  width: "w-full",
147
152
  "max-height": e.maxHeight,
148
153
  "hide-details": e.hideDetails
149
154
  }, {
150
155
  default: i(() => [
151
- n(ce, {
156
+ e.hasCreateItem ? (n(), v("div", Ve, [
157
+ a(be, {
158
+ onClick: l(j),
159
+ bgColor: e.btnCreateBg,
160
+ class: ue(e.btnCreateClass)
161
+ }, {
162
+ default: i(() => [
163
+ y(I(e.btnCreateText), 1)
164
+ ]),
165
+ _: 1
166
+ }, 8, ["onClick", "bgColor", "class"])
167
+ ])) : k("", !0),
168
+ a(fe, {
152
169
  "onClick:select": l(O),
153
170
  ref_key: "listRef",
154
- ref: b,
155
- onKeyDown: Z,
171
+ ref: w,
172
+ onKeyDown: ee,
156
173
  selectable: !0
157
174
  }, {
158
175
  default: i(() => [
159
- n(de, {
160
- items: I.value,
176
+ a(me, {
177
+ items: D.value,
161
178
  search: l(c),
162
179
  "searchable-keys": u.searchableKeys,
163
180
  virtual: !1,
164
181
  "items-per-intersection": 10,
165
- enabled: l(r),
182
+ enabled: l(s),
166
183
  "item-height": 48
167
184
  }, {
168
- default: i(({ item: t, index: d, empty: le }) => [
169
- !le && t ? (s(), m(z, {
185
+ default: i(({ item: t, index: d, empty: te }) => [
186
+ !te && t ? (n(), m(B, {
170
187
  value: t,
171
188
  key: `kun-list-${d + 1}`,
172
189
  id: `kun-item-${d + 1}`,
173
- disabled: l(j)(t),
190
+ disabled: l(G)(t),
174
191
  "bg-items": e.bgItemListColor,
175
192
  "hover-bg": e.hoverItemListColor,
176
193
  activeClass: e.selectedItemListColor,
@@ -178,25 +195,25 @@ const ye = {
178
195
  selectable: !0
179
196
  }, {
180
197
  default: i(() => [
181
- n(F, { class: "text-wrap" }, {
198
+ a(F, { class: "text-wrap" }, {
182
199
  default: i(() => [
183
- V(x(l(D)(t, e.itemTitle ?? l(q), "hasDefault")), 1)
200
+ y(I(l(K)(t, e.itemTitle ?? l(q), "hasDefault")), 1)
184
201
  ]),
185
202
  _: 2
186
203
  }, 1024),
187
- n(me, {
188
- text: e.itemSubtitle ? l(D)(t, e.itemSubtitle) : ""
204
+ a(pe, {
205
+ text: e.itemSubtitle ? l(K)(t, e.itemSubtitle) : ""
189
206
  }, null, 8, ["text"])
190
207
  ]),
191
208
  _: 2
192
- }, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (s(), m(z, {
209
+ }, 1032, ["value", "id", "disabled", "bg-items", "hover-bg", "activeClass", "density"])) : (n(), m(B, {
193
210
  key: 1,
194
211
  disabled: ""
195
212
  }, {
196
213
  default: i(() => [
197
- n(F, { class: "text-center w-full text-gray-500" }, {
214
+ a(F, { class: "text-center w-full text-gray-500" }, {
198
215
  default: i(() => o[2] || (o[2] = [
199
- V(" No hay elementos disponibles ")
216
+ y(" No hay elementos disponibles ")
200
217
  ])),
201
218
  _: 1,
202
219
  __: [2]
@@ -219,28 +236,28 @@ const ye = {
219
236
  e.hasIcons ? {
220
237
  name: "append-inner",
221
238
  fn: i(() => [
222
- e.clearable && a.value ? (s(), m(v, {
239
+ e.clearable && r.value ? (n(), m(b, {
223
240
  key: 0,
224
- onClick: l(N),
241
+ onClick: l(E),
225
242
  size: "small",
226
243
  color: "error",
227
244
  icon: l(f).close,
228
245
  class: "mr-1 mt-1"
229
- }, null, 8, ["onClick", "icon"])) : C("", !0),
230
- n(v, {
246
+ }, null, 8, ["onClick", "icon"])) : k("", !0),
247
+ a(b, {
231
248
  color: "teal-darken-1",
232
249
  size: "large",
233
250
  class: "cursor-pointer",
234
- icon: l(r) ? l(f).menuUpOutline : l(f).menuDownOutline,
235
- onClick: se(l(g), ["stop"])
251
+ icon: l(s) ? l(f).menuUpOutline : l(f).menuDownOutline,
252
+ onClick: de(l(V), ["stop"])
236
253
  }, null, 8, ["icon", "onClick"]),
237
- e.required ? (s(), m(v, {
254
+ e.required ? (n(), m(b, {
238
255
  key: 1,
239
256
  color: "teal-darken-1",
240
257
  size: "x-small",
241
258
  class: "mb-4",
242
259
  icon: l(f).asterisk
243
- }, null, 8, ["icon"])) : C("", !0)
260
+ }, null, 8, ["icon"])) : k("", !0)
244
261
  ]),
245
262
  key: "0"
246
263
  } : void 0
@@ -249,5 +266,5 @@ const ye = {
249
266
  }
250
267
  };
251
268
  export {
252
- ze as default
269
+ Ne as default
253
270
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adverich-kun-ui",
3
- "version": "0.1.403",
3
+ "version": "0.1.404",
4
4
  "type": "module",
5
5
  "description": "Una librería de componentes Vue.js con Tailwind CSS",
6
6
  "main": "dist/index.js",