@wikicasa-dev/components 2.2.9-alpha.48 → 2.2.9-alpha.49

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