adverich-kun-ui 0.1.56 → 0.1.57

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