@wikicasa-dev/components 2.2.9-alpha.21 → 2.2.9-alpha.23

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