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