@wikicasa-dev/components 2.2.8-alpha.17 → 2.2.8-alpha.19

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