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