@wikicasa-dev/components 2.2.9-alpha.11 → 2.2.9-alpha.12

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,5 +1,5 @@
1
1
  import { Autoplay as t } from "swiper/modules";
2
- import '../assets/swiper-controller.css';/* empty css */
2
+ import '../assets/swiper-keyboard.css';/* empty css */
3
3
  export {
4
4
  t as Autoplay
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { Controller as e } from "swiper/modules";
2
- import '../assets/swiper-controller.css';/* empty css */
2
+ import '../assets/swiper-keyboard.css';/* empty css */
3
3
  export {
4
4
  e as Controller
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { Keyboard as m } from "swiper/modules";
2
- import '../assets/swiper-controller.css';/* empty css */
2
+ import '../assets/swiper-keyboard.css';/* empty css */
3
3
  export {
4
4
  m as Keyboard
5
5
  };
@@ -1,5 +1,5 @@
1
1
  import { Thumbs as p } from "swiper/modules";
2
- import '../assets/swiper-controller.css';/* empty css */
2
+ import '../assets/swiper-keyboard.css';/* empty css */
3
3
  export {
4
4
  p as Thumbs
5
5
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as N, mergeModels as $, useModel as C, shallowRef as d, useId as A, useTemplateRef as y, onBeforeMount as H, watch as w, nextTick as G, createBlock as F, openBlock as h, withCtx as g, createElementBlock as P, Fragment as X, renderList as j, renderSlot as p, createElementVNode as u, normalizeClass as f, withDirectives as E, unref as q, vModelText as J, toDisplayString as Q, withModifiers as Y, normalizeStyle as Z, createTextVNode as _, vShow as ee } from "vue";
2
- import te from "../BaseDropDown.vue.js";
1
+ import { defineComponent as W, mergeModels as V, useModel as C, useId as D, useTemplateRef as b, shallowRef as c, onBeforeMount as N, watch as y, nextTick as A, createBlock as $, openBlock as w, withCtx as h, createElementBlock as H, Fragment as P, renderList as X, renderSlot as p, createElementVNode as u, normalizeClass as f, withDirectives as F, unref as j, vModelText as q, toDisplayString as G, withModifiers as J, normalizeStyle as Q, createTextVNode as Y, vShow as Z } from "vue";
2
+ import _ from "../BaseDropDown.vue.js";
3
3
  import '../../../../../assets/BaseDropDown.css';/* empty css */
4
- import le from "../BaseSelect/SelectItem.vue.js";
5
- import { debounce as ne } from "@wikicasa-dev/utilities";
6
- const oe = ["id", "data-cy", "placeholder"], ae = ["innerHTML"], pe = /* @__PURE__ */ N({
4
+ import ee from "../BaseSelect/SelectItem.vue.js";
5
+ import { debounce as te } from "@wikicasa-dev/utilities";
6
+ const le = ["id", "data-cy", "placeholder"], ne = ["innerHTML"], de = /* @__PURE__ */ W({
7
7
  __name: "ClearableAutocomplete",
8
- props: /* @__PURE__ */ $({
8
+ props: /* @__PURE__ */ V({
9
9
  dataCy: {},
10
10
  placeholder: {},
11
11
  enableKeyboardController: { type: Boolean, default: !0 },
@@ -28,78 +28,68 @@ const oe = ["id", "data-cy", "placeholder"], ae = ["innerHTML"], pe = /* @__PURE
28
28
  },
29
29
  inputValueModifiers: {}
30
30
  }),
31
- emits: /* @__PURE__ */ $(["click", "inputClick", "keydown"], ["update:open", "update:modelValue", "update:inputValue"]),
31
+ emits: /* @__PURE__ */ V(["click", "inputClick", "keydown"], ["update:open", "update:modelValue", "update:inputValue"]),
32
32
  setup(l, { expose: O, emit: R }) {
33
- const s = C(l, "open"), a = C(l, "modelValue"), o = C(l, "inputValue");
34
- o.value = o.value ?? a.value?.label ?? "";
35
- const v = R, k = d(!1), U = A(), m = y("inputRef"), c = d(0), b = d(!1), S = d(null), i = d([]), T = y("dropdownRef"), B = y("hiddenSpan"), x = () => {
36
- o.value = "", a.value = null;
37
- }, I = async (t) => {
33
+ const s = C(l, "open"), i = C(l, "modelValue"), o = C(l, "inputValue");
34
+ o.value = o.value ?? i.value?.label ?? "";
35
+ const v = R, x = D(), k = b("inputRef"), d = c(0), m = c(!1), g = c(null), a = c([]), S = b("dropdownRef"), T = b("hiddenSpan"), E = () => {
36
+ o.value = "", i.value = null;
37
+ }, U = async (t) => {
38
38
  if (!t) {
39
- i.value = [], s.value = !1;
39
+ a.value = [], s.value = !1;
40
40
  return;
41
41
  }
42
- l.disableCb || (i.value = await S.value?.(t) || [], b.value = !0, s.value = !!i.value.length);
43
- }, M = (t = -1) => {
44
- const e = i.value[t];
45
- !e || e.id === a.value?.id || (l.onOptionSelectedCb?.(e), o.value = e.label, s.value = !1, a.value = e, i.value = []);
46
- }, W = () => {
47
- m.value?.select();
42
+ l.disableCb || (a.value = await g.value?.(t) || [], m.value = !0, s.value = !!a.value.length);
43
+ }, B = (t = -1) => {
44
+ const e = a.value[t];
45
+ !e || e.id === i.value?.id || (l.onOptionSelectedCb?.(e), o.value = e.label, s.value = !1, i.value = e, a.value = []);
46
+ }, I = () => {
47
+ k.value?.select();
48
48
  }, z = () => {
49
- m.value?.focus();
49
+ k.value?.focus();
50
50
  };
51
- H(() => {
52
- S.value = ne({ delay: 300 }, l.onInputChangeCb);
53
- }), w(
54
- [o, () => B.value],
51
+ return N(() => {
52
+ g.value = te({ delay: 300 }, l.onInputChangeCb);
53
+ }), y(
54
+ [o, () => T.value],
55
55
  ([, t]) => {
56
- t && G(() => {
56
+ t && A(() => {
57
57
  if (!t) return;
58
58
  const e = t.offsetWidth;
59
- e !== c.value && (c.value = e);
59
+ e !== d.value && (d.value = e);
60
60
  });
61
61
  },
62
62
  { immediate: !0 }
63
- ), w(
64
- () => T.value?.selectedIdx,
63
+ ), y(
64
+ () => S.value?.selectedIdx,
65
65
  (t) => {
66
66
  const e = t ?? -1;
67
- e !== -1 && M(e);
67
+ e !== -1 && B(e);
68
68
  }
69
- ), w(
70
- a,
69
+ ), y(
70
+ i,
71
71
  (t, e) => {
72
- if (!(t === e || t?.label === o.value)) {
73
- if (k.value) {
74
- k.value = !1;
75
- return;
76
- }
77
- o.value = t?.label || "";
78
- }
72
+ t === e || t?.label === o.value || (o.value = t?.label || "");
79
73
  },
80
74
  { immediate: !0 }
81
75
  ), O({
82
- getRootElement: () => T.value?.getRootElement(),
83
- select: W,
76
+ getRootElement: () => S.value?.getRootElement(),
77
+ select: I,
84
78
  focus: z
85
- });
86
- const D = (t) => {
87
- console.log("DEBUG:", t);
88
- };
89
- return (t, e) => (h(), F(te, {
79
+ }), (t, e) => (w(), $(_, {
90
80
  ref: "dropdownRef",
91
81
  class: "uikit-clearable-autocomplete",
92
82
  "data-cy": l.dataCy,
93
83
  "dropdown-element": "ul",
94
84
  "dropdown-classes": ["uikit-z-30", l.dropdownClasses],
95
85
  "open-dropdown": s.value,
96
- "keep-state": !i.value.length || l.keepState === "closed" ? "closed" : "opened",
86
+ "keep-state": !a.value.length || l.keepState === "closed" ? "closed" : "opened",
97
87
  "activate-keyboard-controller": l.enableKeyboardController,
98
- "reset-keyboard-controller": b.value,
99
- "onUpdate:resetKeyboardController": e[4] || (e[4] = (n) => b.value = n),
88
+ "reset-keyboard-controller": m.value,
89
+ "onUpdate:resetKeyboardController": e[4] || (e[4] = (n) => m.value = n),
100
90
  "onUpdate:dropdownState": e[5] || (e[5] = (n) => s.value = n)
101
91
  }, {
102
- btn_slot: g(() => [
92
+ btn_slot: h(() => [
103
93
  u("div", {
104
94
  class: f(["uikit-text-16", l.triggerWrapperClasses]),
105
95
  onClick: e[3] || (e[3] = (n) => v("click", n))
@@ -108,13 +98,13 @@ const oe = ["id", "data-cy", "placeholder"], ae = ["innerHTML"], pe = /* @__PURE
108
98
  u("div", {
109
99
  class: f(["uikit-relative", l.inputWrapperClasses])
110
100
  }, [
111
- E(u("input", {
101
+ F(u("input", {
112
102
  ref: "inputRef",
113
103
  "onUpdate:modelValue": [
114
104
  e[0] || (e[0] = (n) => o.value = n),
115
- I
105
+ U
116
106
  ],
117
- id: q(U),
107
+ id: j(x),
118
108
  "data-cy": l.dataCy ? `ac_input_${l.dataCy}` : "",
119
109
  type: "text",
120
110
  autocomplete: "off",
@@ -124,59 +114,57 @@ const oe = ["id", "data-cy", "placeholder"], ae = ["innerHTML"], pe = /* @__PURE
124
114
  fontSize: "inherit"
125
115
  },
126
116
  placeholder: l.placeholder,
127
- onKeydown: e[1] || (e[1] = (n) => {
128
- v("keydown", n), o.value && a.value?.label && (D("keydown"), k.value = !0, a.value = null);
129
- }),
117
+ onKeydown: e[1] || (e[1] = (n) => v("keydown", n)),
130
118
  onClick: e[2] || (e[2] = (n) => {
131
- v("inputClick", n), m.value?.select();
119
+ v("inputClick", n), k.value?.select();
132
120
  })
133
- }, null, 42, oe), [
134
- [J, o.value]
121
+ }, null, 42, le), [
122
+ [q, o.value]
135
123
  ]),
136
124
  u("span", {
137
125
  ref_key: "hiddenSpan",
138
- ref: B,
126
+ ref: T,
139
127
  class: "uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre",
140
128
  style: {
141
129
  font: "inherit",
142
130
  fontSize: "inherit"
143
131
  }
144
- }, Q(o.value), 513),
145
- E(u("button", {
132
+ }, G(o.value), 513),
133
+ F(u("button", {
146
134
  type: "button",
147
135
  class: f(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", l.clearButton?.classes]),
148
136
  "aria-label": "Clear input",
149
- style: Z({
150
- left: `${c.value + (l.clearButton?.offset || 10)}px`
137
+ style: Q({
138
+ left: `${d.value + (l.clearButton?.offset || 10)}px`
151
139
  }),
152
- onClick: Y(x, ["stop"])
140
+ onClick: J(E, ["stop"])
153
141
  }, [
154
142
  p(t.$slots, "clear-icon", {}, () => [
155
- e[6] || (e[6] = _("X", -1))
143
+ e[6] || (e[6] = Y("X", -1))
156
144
  ])
157
145
  ], 6), [
158
- [ee, a.value?.label && c.value]
146
+ [Z, i.value?.label && d.value]
159
147
  ])
160
148
  ], 2),
161
149
  p(t.$slots, "right-icon")
162
150
  ], 2)
163
151
  ]),
164
- default: g(({ activeIdx: n, setActiveIdx: K }) => [
165
- (h(!0), P(X, null, j(i.value, (V, r) => (h(), F(le, {
152
+ default: h(({ activeIdx: n, setActiveIdx: K }) => [
153
+ (w(!0), H(P, null, X(a.value, (M, r) => (w(), $(ee, {
166
154
  key: r,
167
155
  active: n === r,
168
156
  class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
169
- onClick: (L) => M(r),
157
+ onClick: (L) => B(r),
170
158
  onMouseover: (L) => K(r)
171
159
  }, {
172
- default: g(() => [
160
+ default: h(() => [
173
161
  p(t.$slots, "option-content", {
174
- option: V,
162
+ option: M,
175
163
  idx: r
176
164
  }, () => [
177
165
  u("span", {
178
- innerHTML: V.label
179
- }, null, 8, ae)
166
+ innerHTML: M.label
167
+ }, null, 8, ne)
180
168
  ])
181
169
  ]),
182
170
  _: 2
@@ -187,5 +175,5 @@ const oe = ["id", "data-cy", "placeholder"], ae = ["innerHTML"], pe = /* @__PURE
187
175
  }
188
176
  });
189
177
  export {
190
- pe as default
178
+ de as default
191
179
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.2.9-alpha.11",
3
+ "version": "2.2.9-alpha.12",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",