@wikicasa-dev/components 2.2.9-alpha.22 → 2.2.9-alpha.24

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