@wikicasa-dev/components 2.6.14-alpha.0 → 2.7.0

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.
@@ -20,6 +20,7 @@ export interface ClearableAutocompleteProps<TID extends string | number | undefi
20
20
  offset?: number;
21
21
  width?: number;
22
22
  height?: number;
23
+ dataCy?: string;
23
24
  };
24
25
  keepState?: Nullable<"closed" | "open">;
25
26
  disableCb?: boolean;
@@ -1,17 +1,17 @@
1
1
  import e from "../BaseSelect/SelectItem.js";
2
2
  import t from "../BaseDropDown.js";
3
- import { Fragment as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, defineComponent as c, mergeModels as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onBeforeMount as p, onMounted as m, onUnmounted as h, openBlock as g, renderList as ee, renderSlot as _, shallowRef as v, toDisplayString as y, unref as b, useId as x, useModel as S, useTemplateRef as C, vModelText as w, vShow as T, watch as E, withCtx as D, withDirectives as O, withModifiers as te } from "vue";
3
+ import { Fragment as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, defineComponent as c, mergeModels as l, nextTick as u, normalizeClass as d, normalizeStyle as f, onBeforeMount as p, onMounted as m, onUnmounted as h, openBlock as g, renderList as _, renderSlot as v, shallowRef as y, toDisplayString as b, unref as x, useId as S, useModel as C, useTemplateRef as w, vModelText as T, vShow as ee, watch as E, withCtx as D, withDirectives as O, withModifiers as te } from "vue";
4
4
  import { debounce as ne } from "@wikicasa-dev/utilities";
5
5
  import '../../assets/ClearableAutocomplete.css';//#region lib/UIKit/Autocomplete/ClearableAutocomplete.vue?vue&type=script&setup=true&lang.ts
6
6
  var re = [
7
7
  "id",
8
8
  "data-cy",
9
9
  "placeholder"
10
- ], k = {
10
+ ], k = ["data-cy"], A = {
11
11
  key: 1,
12
12
  name: "loading-state",
13
13
  class: "uikit-progress-bar-track uikit-absolute uikit-left-0 uikit-top-0 uikit-w-full"
14
- }, A = ["innerHTML"], j = /*@__PURE__*/ c({
14
+ }, j = ["innerHTML"], M = /*@__PURE__*/ c({
15
15
  __name: "ClearableAutocomplete",
16
16
  props: /*@__PURE__*/ l({
17
17
  dataCy: {},
@@ -54,24 +54,24 @@ var re = [
54
54
  "update:modelValue",
55
55
  "update:inputValue"
56
56
  ]),
57
- setup(c, { expose: l, emit: j }) {
58
- let M = S(c, "open"), N = S(c, "modelValue"), P = S(c, "inputValue"), F = j, I = x(), L = C("inputRef"), R = v(0), z = v(!1), B = v(!1), V = v(-1), H = v(-1), U = v(null), W = v([]), G = C("dropdownRef"), K = C("hiddenSpan"), q = C("inputWrapperRef"), J = C("clearButtonRef"), Y = () => {
59
- V.value = -1, H.value = -1;
60
- }, ie = () => {
61
- P.value = "", N.value = null, z.value = !1, Y();
62
- }, ae = async (e) => {
57
+ setup(c, { expose: l, emit: M }) {
58
+ let N = C(c, "open"), P = C(c, "modelValue"), F = C(c, "inputValue"), I = M, L = S(), R = w("inputRef"), z = y(0), B = y(!1), V = y(!1), H = y(-1), U = y(-1), W = y(null), G = y([]), ie = w("dropdownRef"), K = w("hiddenSpan"), q = w("inputWrapperRef"), J = w("clearButtonRef"), Y = () => {
59
+ H.value = -1, U.value = -1;
60
+ }, ae = () => {
61
+ F.value = "", P.value = null, B.value = !1, Y();
62
+ }, oe = async (e) => {
63
63
  if (!e) {
64
- W.value = [], M.value = !1, Y();
64
+ G.value = [], N.value = !1, Y();
65
65
  return;
66
66
  }
67
- c.disableCb || (B.value = !0, W.value = await U.value?.(e)?.catch(() => []) || [], Y(), B.value = !1, M.value = !!W.value.length);
68
- }, oe = (e) => {
69
- F("input", e), z.value = !1;
67
+ c.disableCb || (V.value = !0, G.value = await W.value?.(e)?.catch(() => []) || [], Y(), V.value = !1, N.value = !!G.value.length);
68
+ }, se = (e) => {
69
+ I("input", e), B.value = !1;
70
70
  }, X = (e = -1, t) => {
71
- let n = W.value[e];
72
- !n || n.id === N.value?.id || (H.value = e, c.onOptionSelectedCb?.(n, { trigger: t }), P.value = n.label, M.value = !1, N.value = n, z.value = !0, W.value = []);
71
+ let n = G.value[e];
72
+ !n || n.id === P.value?.id || (U.value = e, c.onOptionSelectedCb?.(n, { trigger: t }), F.value = n.label, N.value = !1, P.value = n, B.value = !0, G.value = []);
73
73
  }, Z = (e) => {
74
- if (!c.enableKeyboardController || !M.value || ![
74
+ if (!c.enableKeyboardController || !N.value || ![
75
75
  "ArrowUp",
76
76
  "ArrowDown",
77
77
  "Enter",
@@ -82,11 +82,11 @@ var re = [
82
82
  "End"
83
83
  ].includes(e.key)) return;
84
84
  if (e.key === "Escape") {
85
- V.value = H.value, M.value = !1, e.stopPropagation();
85
+ H.value = U.value, N.value = !1, e.stopPropagation();
86
86
  return;
87
87
  }
88
- if (!W.value.length) return;
89
- let t = W.value.length - 1;
88
+ if (!G.value.length) return;
89
+ let t = G.value.length - 1;
90
90
  if ([
91
91
  "ArrowUp",
92
92
  "ArrowDown",
@@ -94,27 +94,27 @@ var re = [
94
94
  "Home",
95
95
  "PageDown",
96
96
  "End"
97
- ].includes(e.key) && e.preventDefault(), e.key === "ArrowUp") V.value = V.value <= 0 ? t : V.value - 1;
98
- else if (e.key === "ArrowDown") V.value = V.value >= t ? 0 : V.value + 1;
97
+ ].includes(e.key) && e.preventDefault(), e.key === "ArrowUp") H.value = H.value <= 0 ? t : H.value - 1;
98
+ else if (e.key === "ArrowDown") H.value = H.value >= t ? 0 : H.value + 1;
99
99
  else if (e.key === "Enter") {
100
- if (V.value === -1) return;
101
- e.preventDefault(), X(V.value, "enter");
102
- } else e.key === "PageUp" || e.key === "Home" ? V.value = 0 : (e.key === "PageDown" || e.key === "End") && (V.value = t);
100
+ if (H.value === -1) return;
101
+ e.preventDefault(), X(H.value, "enter");
102
+ } else e.key === "PageUp" || e.key === "Home" ? H.value = 0 : (e.key === "PageDown" || e.key === "End") && (H.value = t);
103
103
  e.stopPropagation();
104
- }, se = (e) => {
105
- F("keydown", e), Z(e);
106
- }, ce = () => {
107
- L.value?.select();
104
+ }, ce = (e) => {
105
+ I("keydown", e), Z(e);
108
106
  }, le = () => {
109
- L.value?.focus();
107
+ R.value?.select();
108
+ }, ue = () => {
109
+ R.value?.focus();
110
110
  }, Q = null, $ = () => {
111
111
  let e = K.value, t = q.value, n = J.value;
112
112
  if (!e || !t) return;
113
113
  let r = e.offsetWidth, i = t.offsetWidth, a = c.clearButton?.offset || 0, o = c.clearButton?.width || n?.offsetWidth || 0, s = i - a - o, l = Math.min(r, s);
114
- l !== R.value && (R.value = l);
114
+ l !== z.value && (z.value = l);
115
115
  };
116
116
  return p(() => {
117
- U.value = ne({ delay: 300 }, async (e = "") => (M.value = !0, await c.onInputChangeCb(e)));
117
+ W.value = ne({ delay: 300 }, async (e = "") => (N.value = !0, await c.onInputChangeCb(e)));
118
118
  }), m(() => {
119
119
  q.value && (Q = new ResizeObserver(() => {
120
120
  $();
@@ -122,19 +122,19 @@ var re = [
122
122
  }), h(() => {
123
123
  Q?.disconnect();
124
124
  }), E([
125
- P,
125
+ F,
126
126
  K,
127
127
  J
128
128
  ], () => {
129
129
  u($);
130
- }), E(N, (e) => {
131
- if (e?.label === P.value) return;
130
+ }), E(P, (e) => {
131
+ if (e?.label === F.value) return;
132
132
  let t = e?.label || "";
133
- P.value = t, t && (z.value = !0);
133
+ F.value = t, t && (B.value = !0);
134
134
  }, { immediate: !0 }), l({
135
- getRootElement: () => G.value?.getRootElement(),
136
- select: ce,
137
- focus: le
135
+ getRootElement: () => ie.value?.getRootElement(),
136
+ select: le,
137
+ focus: ue
138
138
  }), (l, u) => (g(), r(t, {
139
139
  ref: "dropdownRef",
140
140
  class: "uikit-clearable-autocomplete",
@@ -143,22 +143,22 @@ var re = [
143
143
  "dropdown-classes": ["uikit-z-30", c.dropdownClasses],
144
144
  "keep-state": c.keepState === "closed" ? "closed" : "opened",
145
145
  "activate-keyboard-controller": !1,
146
- open: M.value,
147
- "onUpdate:open": u[3] ||= (e) => M.value = e
146
+ open: N.value,
147
+ "onUpdate:open": u[3] ||= (e) => N.value = e
148
148
  }, {
149
149
  btn_slot: D(() => [o("div", {
150
150
  class: d(["uikit-text-16", c.triggerWrapperClasses]),
151
- onClick: u[2] ||= (e) => F("click", e)
151
+ onClick: u[2] ||= (e) => I("click", e)
152
152
  }, [
153
- _(l.$slots, "left-icon"),
153
+ v(l.$slots, "left-icon"),
154
154
  o("div", {
155
155
  ref: "inputWrapperRef",
156
156
  class: d(["uikit-relative", c.inputWrapperClasses])
157
157
  }, [
158
158
  O(o("input", {
159
159
  ref: "inputRef",
160
- "onUpdate:modelValue": [u[0] ||= (e) => P.value = e, ae],
161
- id: b(I),
160
+ "onUpdate:modelValue": [u[0] ||= (e) => F.value = e, oe],
161
+ id: x(L),
162
162
  "data-cy": c.dataCy ? `ac_input_${c.dataCy}` : "",
163
163
  type: "text",
164
164
  autocomplete: "off",
@@ -168,12 +168,12 @@ var re = [
168
168
  fontSize: "inherit"
169
169
  },
170
170
  placeholder: c.placeholder,
171
- onKeydown: se,
172
- onInput: oe,
171
+ onKeydown: ce,
172
+ onInput: se,
173
173
  onClick: u[1] ||= (e) => {
174
- F("inputClick", e), L.value?.select();
174
+ I("inputClick", e), R.value?.select();
175
175
  }
176
- }, null, 42, re), [[w, P.value]]),
176
+ }, null, 42, re), [[T, F.value]]),
177
177
  o("span", {
178
178
  ref_key: "hiddenSpan",
179
179
  ref: K,
@@ -182,37 +182,38 @@ var re = [
182
182
  font: "inherit",
183
183
  fontSize: "inherit"
184
184
  }
185
- }, y(P.value), 3),
185
+ }, b(F.value), 3),
186
186
  O(o("button", {
187
187
  ref: "clearButtonRef",
188
188
  type: "button",
189
189
  class: d(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", c.clearButton?.classes]),
190
+ "data-cy": c.clearButton?.dataCy || "clear-btn",
190
191
  "aria-label": "Clear input",
191
192
  style: f({
192
- left: `${R.value + (c.clearButton?.offset || 0)}px`,
193
+ left: `${z.value + (c.clearButton?.offset || 0)}px`,
193
194
  width: c.clearButton?.width ? `${c.clearButton.width}px` : "auto",
194
195
  height: c.clearButton?.height ? `${c.clearButton.height}px` : "auto"
195
196
  }),
196
- onClick: te(ie, ["stop"])
197
- }, [_(l.$slots, "clear-icon", {}, () => [u[4] ||= s("X", -1)])], 6), [[T, z.value && R.value]])
197
+ onClick: te(ae, ["stop"])
198
+ }, [v(l.$slots, "clear-icon", {}, () => [u[4] ||= s("X", -1)])], 14, k), [[ee, B.value && z.value]])
198
199
  ], 2),
199
- _(l.$slots, "right-icon")
200
+ v(l.$slots, "right-icon")
200
201
  ], 2)]),
201
202
  default: D(() => [
202
- B.value && !W.value.length ? _(l.$slots, "loading-state", { key: 0 }) : i("", !0),
203
- B.value && W.value.length ? (g(), a("div", k, [...u[5] ||= [o("div", { class: "uikit-progress-bar-fill" }, null, -1)]])) : i("", !0),
204
- W.value.length ? (g(!0), a(n, { key: 2 }, ee(W.value, (t, n) => (g(), r(e, {
203
+ V.value && !G.value.length ? v(l.$slots, "loading-state", { key: 0 }) : i("", !0),
204
+ V.value && G.value.length ? (g(), a("div", A, [...u[5] ||= [o("div", { class: "uikit-progress-bar-fill" }, null, -1)]])) : i("", !0),
205
+ G.value.length ? (g(!0), a(n, { key: 2 }, _(G.value, (t, n) => (g(), r(e, {
205
206
  key: n,
206
- active: V.value === n,
207
+ active: H.value === n,
207
208
  class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
208
209
  onClick: (e) => X(n, "click"),
209
210
  onKeydown: Z,
210
- onMouseover: (e) => V.value = n
211
+ onMouseover: (e) => H.value = n
211
212
  }, {
212
- default: D(() => [_(l.$slots, "option-content", {
213
+ default: D(() => [v(l.$slots, "option-content", {
213
214
  option: t,
214
215
  idx: n
215
- }, () => [o("span", { innerHTML: t.label }, null, 8, A)])]),
216
+ }, () => [o("span", { innerHTML: t.label }, null, 8, j)])]),
216
217
  _: 2
217
218
  }, 1032, [
218
219
  "active",
@@ -230,4 +231,4 @@ var re = [
230
231
  }
231
232
  });
232
233
  //#endregion
233
- export { j as default };
234
+ export { M as default };
@@ -1,3 +1,3 @@
1
- import '../../../assets/swiper-thumbs.css';/* empty css */
1
+ import '../../../assets/swiper-controller.css';/* empty css */
2
2
  import { Autoplay as e } from "swiper/modules";
3
3
  export { e as default };
@@ -1,3 +1,3 @@
1
- import '../../../assets/swiper-thumbs.css';/* empty css */
1
+ import '../../../assets/swiper-controller.css';/* empty css */
2
2
  import { Controller as e } from "swiper/modules";
3
3
  export { e as default };
@@ -1,3 +1,3 @@
1
- import '../../../assets/swiper-thumbs.css';/* empty css */
1
+ import '../../../assets/swiper-controller.css';/* empty css */
2
2
  import { Keyboard as e } from "swiper/modules";
3
3
  export { e as default };
@@ -1,3 +1,3 @@
1
- import '../../../assets/swiper-thumbs.css';/* empty css */
1
+ import '../../../assets/swiper-controller.css';/* empty css */
2
2
  import { Thumbs as e } from "swiper/modules";
3
3
  export { e as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.6.14-alpha.0",
3
+ "version": "2.7.0",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -82,13 +82,13 @@
82
82
  "vitest-browser-vue": "^2.1.0",
83
83
  "vue-router": "^5.1.0",
84
84
  "vue-tsc": "^3.3.3",
85
- "@wikicasa-dev/eslint-config": "0.0.0",
86
- "@wikicasa-dev/tsconfig": "0.0.0",
87
- "@wikicasa-dev/svg-icons": "1.3.7",
88
85
  "@wikicasa-dev/tailwind-plugins": "0.0.7",
86
+ "@wikicasa-dev/svg-icons": "1.3.7",
89
87
  "@wikicasa-dev/types": "2.8.0",
90
- "@wikicasa-dev/utilities": "1.2.11",
91
- "@wikicasa-dev/vue-composables": "0.2.0"
88
+ "@wikicasa-dev/eslint-config": "0.0.0",
89
+ "@wikicasa-dev/tsconfig": "0.0.0",
90
+ "@wikicasa-dev/vue-composables": "0.2.0",
91
+ "@wikicasa-dev/utilities": "1.2.11"
92
92
  },
93
93
  "readme": "ERROR: No README data found!",
94
94
  "scripts": {