@wikicasa-dev/components 2.2.8-alpha.26 → 2.2.8-alpha.28

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.
@@ -31,6 +31,7 @@ declare const _default: <TID extends string | number | undefined, TPayload>(__VL
31
31
  } & ClearableAutocompleteProps<TID, TPayload>) & Partial<{}>> & import('vue').PublicProps;
32
32
  expose(exposed: import('vue').ShallowUnwrapRef<{
33
33
  select: () => void;
34
+ getRootElement: () => HTMLDivElement | null | undefined;
34
35
  }>): void;
35
36
  attrs: any;
36
37
  slots: {
@@ -50,6 +50,7 @@ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
50
50
  declare const __VLS_component: import('vue').DefineComponent<__VLS_PublicProps, {
51
51
  activeIdx: import('vue').Ref<number, number>;
52
52
  selectedIdx: import('vue').Ref<number, number>;
53
+ getRootElement: () => HTMLDivElement | null;
53
54
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
54
55
  click: () => any;
55
56
  "update:toggleDropdown": (value: Optional<boolean>) => any;
@@ -1,11 +1,11 @@
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 V, openBlock as c, withCtx as C, createElementBlock as M, 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, normalizeStyle as X, createTextVNode as j } from "vue";
2
- import q from "../BaseDropDown.vue.js";
1
+ import { defineComponent as K, mergeModels as B, useModel as M, useTemplateRef as b, shallowRef as s, onBeforeMount as L, watch as y, nextTick as N, createBlock as V, openBlock as c, withCtx as C, createElementBlock as F, 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
+ import J from "../BaseDropDown.vue.js";
3
3
  import '../../../../../assets/BaseDropDown.css';/* empty css */
4
- import J from "../BaseSelect/SelectItem.vue.js";
5
- import { debounce as Q } from "@wikicasa-dev/utilities";
6
- const Y = ["readonly", "placeholder"], Z = ["innerHTML"], ae = /* @__PURE__ */ K({
4
+ import Q from "../BaseSelect/SelectItem.vue.js";
5
+ import { debounce as Y } from "@wikicasa-dev/utilities";
6
+ const Z = ["readonly", "placeholder"], _ = ["innerHTML"], ie = /* @__PURE__ */ K({
7
7
  __name: "ClearableAutocomplete",
8
- props: /* @__PURE__ */ T({
8
+ props: /* @__PURE__ */ B({
9
9
  dataCy: {},
10
10
  placeholder: {},
11
11
  enableKeyboardController: { type: Boolean, default: !0 },
@@ -23,51 +23,52 @@ const Y = ["readonly", "placeholder"], Z = ["innerHTML"], ae = /* @__PURE__ */ K
23
23
  modelValue: { default: null },
24
24
  modelModifiers: {}
25
25
  }),
26
- emits: /* @__PURE__ */ T(["click", "update:inputValue", "keydown"], ["update:open", "update:modelValue"]),
27
- setup(l, { expose: F, emit: $ }) {
28
- const u = B(l, "open"), a = B(l, "modelValue"), p = $, 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
- o.value = "", a.value = null, p("update:inputValue", "");
30
- }, E = async (t) => {
26
+ emits: /* @__PURE__ */ B(["click", "update:inputValue", "keydown"], ["update:open", "update:modelValue"]),
27
+ setup(l, { expose: $, emit: E }) {
28
+ const u = M(l, "open"), a = M(l, "modelValue"), p = E, O = b("inputRef"), n = s(a.value?.label || ""), k = s(0), m = s(!1), w = s(null), i = s([]), h = b("dropdownRef"), g = b("hiddenSpan"), R = () => {
29
+ n.value = "", a.value = null, p("update:inputValue", "");
30
+ }, U = async (t) => {
31
31
  if (p("update:inputValue", t), !t) {
32
32
  i.value = [], u.value = !1;
33
33
  return;
34
34
  }
35
35
  i.value = await w.value?.(t) || [], m.value = !0, u.value = !!i.value.length;
36
- }, g = (t = -1) => {
36
+ }, S = (t = -1) => {
37
37
  const e = i.value[t];
38
- !e || e.id === a.value?.id || (l.onOptionSelectedCb?.(e), o.value = e.label, u.value = !1, a.value = e, i.value = []);
39
- }, R = () => {
38
+ !e || e.id === a.value?.id || (l.onOptionSelectedCb?.(e), n.value = e.label, u.value = !1, a.value = e, i.value = []);
39
+ }, x = () => {
40
40
  O.value?.select();
41
41
  };
42
42
  return L(() => {
43
- w.value = Q({ delay: 300 }, l.onInputChangeCb);
43
+ w.value = Y({ delay: 300 }, l.onInputChangeCb);
44
44
  }), y(
45
- [o, () => h.value],
45
+ [n, () => g.value],
46
46
  ([t, e]) => {
47
47
  e && N(() => {
48
48
  if (!e) return;
49
- const n = e.offsetWidth;
50
- n !== k.value && (console.log("DEBUG:updating icon positioning", {
49
+ const o = e.offsetWidth;
50
+ o !== k.value && (console.log("DEBUG:updating icon positioning", {
51
51
  curInputValue: t
52
- }), k.value = n);
52
+ }), k.value = o);
53
53
  });
54
54
  },
55
55
  { immediate: !0 }
56
56
  ), y(
57
- () => U.value?.selectedIdx,
57
+ () => h.value?.selectedIdx,
58
58
  (t) => {
59
59
  const e = t ?? -1;
60
- e !== -1 && g(e);
60
+ e !== -1 && S(e);
61
61
  }
62
62
  ), y(
63
63
  a,
64
64
  (t, e) => {
65
- t === e || t?.label === o.value || (o.value = t?.label || "");
65
+ t === e || t?.label === n.value || (n.value = t?.label || "");
66
66
  },
67
67
  { immediate: !0 }
68
- ), F({
69
- select: R
70
- }), (t, e) => (c(), V(q, {
68
+ ), $({
69
+ select: x,
70
+ getRootElement: () => h.value?.getRootElement()
71
+ }), (t, e) => (c(), V(J, {
71
72
  ref: "dropdownRef",
72
73
  class: "uikit-clearable-autocomplete",
73
74
  "data-cy": l.dataCy,
@@ -77,13 +78,13 @@ const Y = ["readonly", "placeholder"], Z = ["innerHTML"], ae = /* @__PURE__ */ K
77
78
  "keep-state": !i.value.length || l.keepState === "closed" ? "closed" : "opened",
78
79
  "activate-keyboard-controller": l.enableKeyboardController,
79
80
  "reset-keyboard-controller": m.value,
80
- "onUpdate:resetKeyboardController": e[3] || (e[3] = (n) => m.value = n),
81
- "onUpdate:dropdownState": e[4] || (e[4] = (n) => u.value = n)
81
+ "onUpdate:resetKeyboardController": e[3] || (e[3] = (o) => m.value = o),
82
+ "onUpdate:dropdownState": e[4] || (e[4] = (o) => u.value = o)
82
83
  }, {
83
84
  btn_slot: C(() => [
84
85
  d("div", {
85
86
  class: v(["uikit-text-16", l.triggerWrapperClasses]),
86
- onClick: e[2] || (e[2] = (n) => p("click", n))
87
+ onClick: e[2] || (e[2] = (o) => p("click", o))
87
88
  }, [
88
89
  f(t.$slots, "left-icon"),
89
90
  d("div", {
@@ -92,8 +93,8 @@ const Y = ["readonly", "placeholder"], Z = ["innerHTML"], ae = /* @__PURE__ */ K
92
93
  A(d("input", {
93
94
  ref: "inputRef",
94
95
  "onUpdate:modelValue": [
95
- e[0] || (e[0] = (n) => o.value = n),
96
- E
96
+ e[0] || (e[0] = (o) => n.value = o),
97
+ U
97
98
  ],
98
99
  readonly: !!a.value?.label,
99
100
  class: v(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", l.inputClasses]),
@@ -102,53 +103,53 @@ const Y = ["readonly", "placeholder"], Z = ["innerHTML"], ae = /* @__PURE__ */ K
102
103
  fontSize: "inherit"
103
104
  },
104
105
  placeholder: l.placeholder,
105
- onKeydown: e[1] || (e[1] = (n) => p("keydown", n))
106
- }, null, 42, Y), [
107
- [G, o.value]
106
+ onKeydown: e[1] || (e[1] = (o) => p("keydown", o))
107
+ }, null, 42, Z), [
108
+ [G, n.value]
108
109
  ]),
109
110
  d("span", {
110
111
  ref_key: "hiddenSpan",
111
- ref: h,
112
+ ref: g,
112
113
  class: "uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre",
113
114
  style: {
114
115
  font: "inherit",
115
116
  fontSize: "inherit"
116
117
  }
117
- }, P(o.value), 513),
118
- a.value?.label ? (c(), M("button", {
118
+ }, P(n.value), 513),
119
+ a.value?.label ? (c(), F("button", {
119
120
  key: 0,
120
121
  type: "button",
121
122
  class: v(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", l.clearButton?.classes]),
122
123
  "aria-label": "Clear input",
123
- style: X({
124
+ style: j({
124
125
  left: `${k.value + (l.clearButton?.offset || 10)}px`
125
126
  }),
126
- onClick: x
127
+ onClick: X(R, ["stop"])
127
128
  }, [
128
129
  f(t.$slots, "clear-icon", {}, () => [
129
- e[5] || (e[5] = j("X", -1))
130
+ e[5] || (e[5] = q("X", -1))
130
131
  ])
131
132
  ], 6)) : H("", !0)
132
133
  ], 2),
133
134
  f(t.$slots, "right-icon")
134
135
  ], 2)
135
136
  ]),
136
- default: C(({ activeIdx: n, setActiveIdx: z }) => [
137
- (c(!0), M(W, null, I(i.value, (S, r) => (c(), V(J, {
137
+ default: C(({ activeIdx: o, setActiveIdx: z }) => [
138
+ (c(!0), F(W, null, I(i.value, (T, r) => (c(), V(Q, {
138
139
  key: r,
139
- active: n === r,
140
+ active: o === r,
140
141
  class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
141
- onClick: (D) => g(r),
142
+ onClick: (D) => S(r),
142
143
  onMouseover: (D) => z(r)
143
144
  }, {
144
145
  default: C(() => [
145
146
  f(t.$slots, "option-content", {
146
- option: S,
147
+ option: T,
147
148
  idx: r
148
149
  }, () => [
149
150
  d("span", {
150
- innerHTML: S.label
151
- }, null, 8, Z)
151
+ innerHTML: T.label
152
+ }, null, 8, _)
152
153
  ])
153
154
  ]),
154
155
  _: 2
@@ -159,5 +160,5 @@ const Y = ["readonly", "placeholder"], Z = ["innerHTML"], ae = /* @__PURE__ */ K
159
160
  }
160
161
  });
161
162
  export {
162
- ae as default
163
+ ie as default
163
164
  };
@@ -1,11 +1,11 @@
1
- import { defineComponent as T, mergeModels as D, useId as H, useModel as E, shallowRef as x, computed as N, useTemplateRef as B, onMounted as V, onUnmounted as z, watch as l, nextTick as R, createElementBlock as U, openBlock as c, normalizeClass as a, renderSlot as I, createBlock as L, createVNode as q, unref as r, withCtx as S, createElementVNode as G, createCommentVNode as j, resolveDynamicComponent as F } from "vue";
1
+ import { defineComponent as T, mergeModels as E, useId as H, useModel as D, shallowRef as x, computed as N, useTemplateRef as B, onMounted as R, onUnmounted as V, watch as l, nextTick as z, createElementBlock as U, openBlock as f, normalizeClass as i, renderSlot as I, createBlock as L, createVNode as q, unref as r, withCtx as S, createElementVNode as G, createCommentVNode as j, resolveDynamicComponent as F } from "vue";
2
2
  import J from "./BaseButton.vue.js";
3
3
  import { ArrowIcon as P } from "@wikicasa-dev/svg-icons";
4
4
  import { useKeyboardController as Q } from "@wikicasa-dev/vue-composables";
5
5
  const X = ["innerHTML"], oe = /* @__PURE__ */ T({
6
6
  inheritAttrs: !1,
7
7
  __name: "BaseDropDown",
8
- props: /* @__PURE__ */ D({
8
+ props: /* @__PURE__ */ E({
9
9
  dropdownClasses: { default: "" },
10
10
  btnClasses: { default: "" },
11
11
  withArrowIcon: { type: Boolean, default: !1 },
@@ -27,38 +27,38 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ T({
27
27
  resetKeyboardController: { type: Boolean, default: !1 },
28
28
  resetKeyboardControllerModifiers: {}
29
29
  }),
30
- emits: /* @__PURE__ */ D(["click", "update:dropdownState"], ["update:toggleDropdown", "update:resetKeyboardController"]),
30
+ emits: /* @__PURE__ */ E(["click", "update:dropdownState"], ["update:toggleDropdown", "update:resetKeyboardController"]),
31
31
  setup(o, { expose: K, emit: A }) {
32
- const n = o, f = H(), k = A, v = E(o, "toggleDropdown"), w = E(
32
+ const n = o, k = H(), v = A, m = D(o, "toggleDropdown"), w = D(
33
33
  o,
34
34
  "resetKeyboardController"
35
35
  );
36
- let m = !1;
37
- const t = x(!1), u = x([]), M = N(() => u.value.length), p = B("container"), y = B("dropdown"), { activeIdx: d, selectedIdx: i } = Q({
36
+ let p = !1;
37
+ const t = x(!1), u = x([]), M = N(() => u.value.length), s = B("container"), y = B("dropdown"), { activeIdx: d, selectedIdx: a } = Q({
38
38
  optionsLength: M,
39
39
  isDropdownOpen: t,
40
40
  activate: n.activateKeyboardController
41
41
  }), O = () => {
42
42
  t.value = !1;
43
43
  }, b = ({ target: e }) => {
44
- p.value?.contains(e) || O();
44
+ s.value?.contains(e) || O();
45
45
  }, C = (e) => {
46
- t.value && p.value?.contains(document.activeElement) && (console.log("DEBUG:closing dropdown", document.activeElement), e.key === "Tab" && (t.value = !1));
47
- }, s = () => {
46
+ t.value && s.value?.contains(document.activeElement) && (console.log("DEBUG:closing dropdown", document.activeElement), e.key === "Tab" && (t.value = !1));
47
+ }, c = () => {
48
48
  n.keepState === "closed" && !t.value || n.keepState === "opened" && t.value || (t.value = !t.value);
49
49
  }, W = (e) => {
50
50
  e != null && (d.value = e);
51
51
  }, $ = (e) => {
52
- e != null && (i.value = e);
52
+ e != null && (a.value = e);
53
53
  }, h = () => {
54
54
  y.value && (u.value = Array.from(y.value.children));
55
55
  };
56
- return V(() => {
56
+ return R(() => {
57
57
  h();
58
- }), z(() => {
58
+ }), V(() => {
59
59
  n.closeWhenClickedOutside && (document.removeEventListener("click", b), document.removeEventListener("keydown", C));
60
60
  }), l(w, (e) => {
61
- e && (d.value = -1, i.value = -1, R(() => {
61
+ e && (d.value = -1, a.value = -1, z(() => {
62
62
  h(), w.value = !1;
63
63
  }));
64
64
  }), l(
@@ -70,46 +70,47 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ T({
70
70
  immediate: !0
71
71
  }
72
72
  ), l(t, (e) => {
73
- k("update:dropdownState", e);
73
+ v("update:dropdownState", e);
74
74
  }), l(t, (e) => {
75
- !e || m || !n.closeWhenClickedOutside || (document.addEventListener("click", b), document.addEventListener("keydown", C), m = !0);
76
- }), l(v, (e) => {
77
- e && (t.value = !t.value, v.value = !1);
78
- }), l(i, (e) => {
75
+ !e || p || !n.closeWhenClickedOutside || (document.addEventListener("click", b), document.addEventListener("keydown", C), p = !0);
76
+ }), l(m, (e) => {
77
+ e && (t.value = !t.value, m.value = !1);
78
+ }), l(a, (e) => {
79
79
  e !== -1 && u.value[e].querySelector("a")?.click();
80
80
  }), K({
81
81
  activeIdx: d,
82
- selectedIdx: i
83
- }), (e, g) => (c(), U("div", {
82
+ selectedIdx: a,
83
+ getRootElement: () => s.value
84
+ }), (e, g) => (f(), U("div", {
84
85
  ref: "container",
85
- class: a(["uikit-relative uikit-block", e.$attrs.class])
86
+ class: i(["uikit-relative uikit-block", e.$attrs.class])
86
87
  }, [
87
88
  I(e.$slots, "btn_slot", {
88
- toggleDropdown: s,
89
+ toggleDropdown: c,
89
90
  isOpen: t.value
90
91
  }, () => [
91
92
  q(J, {
92
- id: r(f),
93
+ id: r(k),
93
94
  type: "button",
94
95
  "data-cy": o.dataCy,
95
- class: a([
96
+ class: i([
96
97
  "!uikit-flex uikit-w-full uikit-items-center uikit-truncate",
97
98
  o.btnClasses
98
99
  ]),
99
100
  "aria-expanded": t.value,
100
101
  "btn-class": "uikit-btn-single-selection",
101
102
  onClick: g[0] || (g[0] = (Y) => {
102
- k("click"), s();
103
+ v("click"), c();
103
104
  })
104
105
  }, {
105
106
  default: S(() => [
106
107
  G("span", {
107
- class: a(["uikit-mr-5px", o.labelClasses]),
108
+ class: i(["uikit-mr-5px", o.labelClasses]),
108
109
  innerHTML: o.btnLabel
109
110
  }, null, 10, X),
110
- o.withArrowIcon ? (c(), L(r(P), {
111
+ o.withArrowIcon ? (f(), L(r(P), {
111
112
  key: 0,
112
- class: a(["uikit-shrink-0 uikit-transition-transform motion-reduce:uikit-transition-none", t.value ? "uikit-rotate-180" : ""]),
113
+ class: i(["uikit-shrink-0 uikit-transition-transform motion-reduce:uikit-transition-none", t.value ? "uikit-rotate-180" : ""]),
113
114
  width: o.arrowWidth,
114
115
  height: o.arrowWidth,
115
116
  "stroke-color": o.arrowStrokeColor
@@ -118,11 +119,11 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ T({
118
119
  _: 1
119
120
  }, 8, ["id", "data-cy", "class", "aria-expanded"])
120
121
  ]),
121
- (c(), L(F(o.dropdownElement), {
122
- id: "dropdown_" + r(f),
122
+ (f(), L(F(o.dropdownElement), {
123
+ id: "dropdown_" + r(k),
123
124
  ref: "dropdown",
124
125
  "data-cy": o.dataCy && `${o.dataCy}_dropdown`,
125
- class: a(["uikit-dropdown-content uikit-w-full uikit-flex-col uikit-overflow-y-auto uikit-border uikit-border-solid uikit-bg-white uikit-pl-0 uikit-opacity-100 uikit-shadow uikit-no-scrollbar", [
126
+ class: i(["uikit-dropdown-content uikit-w-full uikit-flex-col uikit-overflow-y-auto uikit-border uikit-border-solid uikit-bg-white uikit-pl-0 uikit-opacity-100 uikit-shadow uikit-no-scrollbar", [
126
127
  o.dropdownClasses,
127
128
  t.value ? "uikit-flex" : "uikit-hidden",
128
129
  { "uikit-bottom-[55px] uikit-rounded-xs": o.direction === "up" },
@@ -134,9 +135,9 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ T({
134
135
  default: S(() => [
135
136
  I(e.$slots, "default", {
136
137
  isOpen: t.value,
137
- toggleDropdown: s,
138
+ toggleDropdown: c,
138
139
  activeIdx: r(d),
139
- selectedIdx: r(i),
140
+ selectedIdx: r(a),
140
141
  setActiveIdx: W,
141
142
  setSelectedIdx: $
142
143
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.2.8-alpha.26",
3
+ "version": "2.2.8-alpha.28",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",