@wikicasa-dev/components 1.2.58 → 1.3.0

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,4 +1,4 @@
1
- import { _ as f } from "./chunks/BaseAutocomplete.vue_vue_type_script_setup_true_lang.3aynnDI5.js";
1
+ import { _ as f } from "./chunks/BaseAutocomplete.vue_vue_type_script_setup_true_lang.B5kRg12j.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -34,7 +34,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
34
34
  type: import("vue").PropType<Nullable<(v: AccessibleSelectOptions) => void>>;
35
35
  default: null;
36
36
  };
37
- manualClose: {
37
+ cleanupOnClose: {
38
38
  type: import("vue").PropType<boolean>;
39
39
  default: boolean;
40
40
  };
@@ -42,7 +42,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
42
42
  select: () => void;
43
43
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
44
44
  click: () => void;
45
- dropdownClosed: () => void;
45
+ dropdownClosed: (args_0: boolean) => void;
46
46
  changedValue: (args_0: string) => void;
47
47
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
48
48
  modelValue: import("vue").PropType<ModelValueType<unknown> | undefined>;
@@ -78,13 +78,13 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
78
78
  type: import("vue").PropType<Nullable<(v: AccessibleSelectOptions) => void>>;
79
79
  default: null;
80
80
  };
81
- manualClose: {
81
+ cleanupOnClose: {
82
82
  type: import("vue").PropType<boolean>;
83
83
  default: boolean;
84
84
  };
85
85
  }>> & {
86
86
  onClick?: (() => any) | undefined;
87
- onDropdownClosed?: (() => any) | undefined;
87
+ onDropdownClosed?: ((args_0: boolean) => any) | undefined;
88
88
  onChangedValue?: ((args_0: string) => any) | undefined;
89
89
  }, {
90
90
  label: string;
@@ -94,7 +94,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
94
94
  keepState: Nullable<"closed" | "open">;
95
95
  disableCb: boolean;
96
96
  onOptionSelectedCb: Nullable<(v: AccessibleSelectOptions) => void>;
97
- manualClose: boolean;
97
+ cleanupOnClose: boolean;
98
98
  }, {}>, {
99
99
  lefticon?(_: {}): any;
100
100
  righticon?(_: {
@@ -1,24 +1,24 @@
1
- import { defineComponent as z, mergeModels as V, useModel as E, ref as s, computed as f, onBeforeMount as N, watch as C, openBlock as g, createBlock as S, normalizeClass as U, withCtx as b, createVNode as A, renderSlot as B, createElementBlock as F, Fragment as K, renderList as P, unref as W, createElementVNode as j } from "vue";
2
- import q from "../BaseInput.js";
3
- import { _ as G } from "./BaseDropDown.vue_vue_type_script_setup_true_lang.C4VH7V0e.js";
1
+ import { defineComponent as H, mergeModels as S, useModel as z, ref as s, computed as f, onBeforeMount as E, watch as C, openBlock as g, createBlock as V, normalizeClass as J, withCtx as c, createVNode as U, renderSlot as B, createElementBlock as A, Fragment as F, renderList as K, unref as P, createElementVNode as W } from "vue";
2
+ import j from "../BaseInput.js";
3
+ import { _ as q } from "./BaseDropDown.vue_vue_type_script_setup_true_lang.C4VH7V0e.js";
4
4
  import "./js.cookie.BQua9eWh.js";
5
- import { _ as J } from "./SelectItem.vue_vue_type_script_setup_true_lang.BOLdDTLM.js";
5
+ import { _ as G } from "./SelectItem.vue_vue_type_script_setup_true_lang.BOLdDTLM.js";
6
6
  import { useKeyboardController as Q } from "../useKeyboardController.js";
7
- function R(i, k) {
8
- return (...m) => new Promise((t, a) => {
9
- i.id && clearTimeout(i.id), i.id = setTimeout(() => {
7
+ function R(r, k) {
8
+ return (...v) => new Promise((t, n) => {
9
+ r.id && clearTimeout(r.id), r.id = setTimeout(() => {
10
10
  try {
11
- const n = k(...m);
12
- t(n);
13
- } catch (n) {
14
- a(n);
11
+ const i = k(...v);
12
+ t(i);
13
+ } catch (i) {
14
+ n(i);
15
15
  }
16
- }, i.delay);
16
+ }, r.delay);
17
17
  });
18
18
  }
19
- const X = ["innerHTML"], oe = /* @__PURE__ */ z({
19
+ const X = ["innerHTML"], oe = /* @__PURE__ */ H({
20
20
  __name: "BaseAutocomplete",
21
- props: /* @__PURE__ */ V({
21
+ props: /* @__PURE__ */ S({
22
22
  border: { type: Boolean, default: !0 },
23
23
  isValid: { default: null },
24
24
  theme: { default: "" },
@@ -26,8 +26,8 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ z({
26
26
  disableCb: { type: Boolean, default: !1 },
27
27
  onInputChangeCb: {},
28
28
  onOptionSelectedCb: { default: null },
29
- manualClose: { type: Boolean, default: !1 },
30
- keepState: { default: null }
29
+ keepState: { default: null },
30
+ cleanupOnClose: { type: Boolean, default: !0 }
31
31
  }, {
32
32
  modelValue: {
33
33
  default() {
@@ -36,17 +36,17 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ z({
36
36
  },
37
37
  modelModifiers: {}
38
38
  }),
39
- emits: /* @__PURE__ */ V(["dropdownClosed", "changedValue", "click"], ["update:modelValue"]),
40
- setup(i, { expose: k, emit: m }) {
41
- const t = i, a = E(i, "modelValue"), n = m, d = s(""), r = s([]), v = s(null), c = s(!1), l = s(!1), $ = s(null), M = f(() => r.value.length);
42
- N(() => {
43
- d.value = a.value?.label || "", v.value = R({ delay: 300 }, t.onInputChangeCb);
39
+ emits: /* @__PURE__ */ S(["dropdownClosed", "changedValue", "click"], ["update:modelValue"]),
40
+ setup(r, { expose: k, emit: v }) {
41
+ const t = r, n = z(r, "modelValue"), i = v, d = s(""), o = s([]), m = s(null), p = s(!1), l = s(!1), $ = s(null), O = f(() => o.value.length);
42
+ E(() => {
43
+ d.value = n.value?.label || "", m.value = R({ delay: 300 }, t.onInputChangeCb);
44
44
  });
45
45
  const { activeIdx: h, selectedIdx: w } = Q({
46
- optionsLength: M,
46
+ optionsLength: O,
47
47
  isDropdownOpen: l,
48
48
  disableSpaceHandler: !0
49
- }), I = f(() => {
49
+ }), M = f(() => {
50
50
  switch (t.theme) {
51
51
  case "bordered":
52
52
  return "";
@@ -57,7 +57,7 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ z({
57
57
  default:
58
58
  return "";
59
59
  }
60
- }), O = f(() => {
60
+ }), I = f(() => {
61
61
  switch (t.theme) {
62
62
  case "bordered":
63
63
  return "";
@@ -69,7 +69,7 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ z({
69
69
  return "";
70
70
  }
71
71
  }), T = f(() => {
72
- let e = "uikit-rounded-b-xl uikit-shadow uikit-rounded-t-none uikit-mb-0 !uikit-mt-0 uikit-text-w-black !uikit-rounded-b-xl !uikit-rounded-t-none";
72
+ const e = "uikit-rounded-b-xl uikit-shadow uikit-rounded-t-none uikit-mb-0 !uikit-mt-0 uikit-text-w-black !uikit-rounded-b-xl !uikit-rounded-t-none";
73
73
  switch (t.theme) {
74
74
  case "bordered":
75
75
  return "before:uikit-content-[''] before:uikit-absolute before:uikit-w-1/2 before:uikit-border-b before:uikit-border-b-w-lavender before:[border-bottom-style:solid] before:uikit-right-1/4 uikit-rounded-b-xl uikit-shadow uikit-rounded-t-none uikit-mt-5px uikit-mb-0";
@@ -81,36 +81,36 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ z({
81
81
  return "";
82
82
  }
83
83
  }), L = async (e) => {
84
- if (d.value !== e && (n("changedValue", e), d.value = e, !!t.onInputChangeCb)) {
85
- if (a.value && !e && (a.value.label = "", l.value = !1), !e || c.value) {
86
- r.value = [], c.value = !1, w.value = -1, h.value = -1, await v.value(null);
84
+ if (d.value !== e && (i("changedValue", e), d.value = e, !!t.onInputChangeCb)) {
85
+ if (n.value && !e && (n.value.label = "", l.value = !1), !e || p.value) {
86
+ o.value = [], p.value = !1, w.value = -1, h.value = -1, await m.value(null);
87
87
  return;
88
88
  }
89
- t.disableCb || (r.value = await v.value(e), r.value.length && (l.value = !0));
89
+ t.disableCb || (o.value = await m.value(e), console.log({ options: JSON.parse(JSON.stringify(o.value)) }), o.value.length && (l.value = !0));
90
90
  }
91
- }, y = (e, o) => {
92
- t.onOptionSelectedCb && t.onOptionSelectedCb(e), c.value = !0, d.value = e.label, a.value = e, l.value = !1, w.value = o;
93
- }, D = () => {
94
- r.value.length && t.keepState !== "closed" && (l.value = !0);
91
+ }, y = (e, a) => {
92
+ t.onOptionSelectedCb && t.onOptionSelectedCb(e), p.value = !0, d.value = e.label, n.value = e, l.value = !1, w.value = a;
93
+ }, N = () => {
94
+ o.value.length && t.keepState !== "closed" && (l.value = !0);
95
95
  };
96
- return C(a, (e, o) => {
97
- e !== o && (d.value = e?.label || "");
96
+ return C(n, (e, a) => {
97
+ e !== a && (d.value = e?.label || "");
98
98
  }), C(w, (e) => {
99
99
  if (e === -1)
100
100
  return;
101
- const o = r.value[e];
102
- c.value && o.label === a.value?.label || y(o, e);
101
+ const a = o.value[e];
102
+ p.value && a.label === n.value?.label || y(a, e);
103
103
  }), C(
104
- () => t.manualClose,
104
+ () => t.keepState,
105
105
  (e) => {
106
- e && (c.value && (r.value = []), n("dropdownClosed"));
106
+ e === "closed" ? l.value = !1 : e === "open" && o.value.length && (l.value = !0), t.cleanupOnClose && (o.value = []), i("dropdownClosed", l.value);
107
107
  }
108
108
  ), k({
109
109
  select: () => {
110
110
  $.value?.select();
111
111
  }
112
- }), (e, o) => (g(), S(G, {
113
- class: U(e.$attrs["root-classes"]),
112
+ }), (e, a) => (g(), V(q, {
113
+ class: J(e.$attrs["root-classes"]),
114
114
  "data-cy": `ac_${e.$attrs.id}`,
115
115
  "dropdown-element": "ul",
116
116
  "dropdown-classes": [
@@ -125,20 +125,20 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ z({
125
125
  e.$attrs["dropdown-classes"]
126
126
  ],
127
127
  "open-dropdown": l.value,
128
- "keep-state": r.value.length ? "" : "closed",
129
- "onUpdate:dropdownState": o[0] || (o[0] = (u) => l.value = u),
130
- onClick: o[1] || (o[1] = (u) => {
131
- n("click"), D();
128
+ "keep-state": !o.value.length || t.keepState === "closed" ? "closed" : "opened",
129
+ "onUpdate:dropdownState": a[0] || (a[0] = (u) => l.value = u),
130
+ onClick: a[1] || (a[1] = (u) => {
131
+ i("click"), N();
132
132
  })
133
133
  }, {
134
- btn_slot: b(() => [
135
- A(q, {
134
+ btn_slot: c(() => [
135
+ U(j, {
136
136
  id: `ac_input_${e.$attrs.id}`,
137
137
  ref_key: "baseInput",
138
138
  ref: $,
139
139
  "data-cy": `ac_input_${e.$attrs.id}`,
140
140
  "label-text": e.label,
141
- "model-value": a.value?.label || "",
141
+ "model-value": n.value?.label || "",
142
142
  "is-valid": e.isValid,
143
143
  disabled: e.$attrs.disabled,
144
144
  placeholder: e.$attrs.placeholder,
@@ -146,30 +146,30 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ z({
146
146
  "with-right-icon": !!e.$slots.righticon,
147
147
  border: !e.theme,
148
148
  radius: !e.theme || e.theme === "bordered",
149
- "input-class": [I.value, e.$attrs["input-classes"]],
150
- "fieldset-classes": [O.value, e.$attrs["fieldset-classes"]],
149
+ "input-class": [M.value, e.$attrs["input-classes"]],
150
+ "fieldset-classes": [I.value, e.$attrs["fieldset-classes"]],
151
151
  "keep-floating-label": !!d.value,
152
152
  "onUpdate:modelValue": L
153
153
  }, {
154
- leftIcon: b(() => [
154
+ leftIcon: c(() => [
155
155
  B(e.$slots, "lefticon")
156
156
  ]),
157
- righticon: b(({ handleClean: u }) => [
157
+ righticon: c(({ handleClean: u }) => [
158
158
  B(e.$slots, "righticon", { handleClean: u })
159
159
  ]),
160
160
  _: 3
161
161
  }, 8, ["id", "data-cy", "label-text", "model-value", "is-valid", "disabled", "placeholder", "with-left-icon", "with-right-icon", "border", "radius", "input-class", "fieldset-classes", "keep-floating-label"])
162
162
  ]),
163
- default: b(() => [
164
- (g(!0), F(K, null, P(r.value, (u, p) => (g(), S(J, {
165
- key: p,
166
- active: W(h) === p,
163
+ default: c(() => [
164
+ (g(!0), A(F, null, K(o.value, (u, b) => (g(), V(G, {
165
+ key: b,
166
+ active: P(h) === b,
167
167
  class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
168
- onClick: (H) => y(u, p),
169
- onMouseover: (H) => h.value = p
168
+ onClick: (D) => y(u, b),
169
+ onMouseover: (D) => h.value = b
170
170
  }, {
171
- default: b(() => [
172
- j("span", {
171
+ default: c(() => [
172
+ W("span", {
173
173
  innerHTML: u.label
174
174
  }, null, 8, X)
175
175
  ]),
package/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { _ as c } from "./chunks/RadioButton.vue_vue_type_script_setup_true_lang
10
10
  import { _ as b } from "./chunks/RadioGroup.vue_vue_type_script_setup_true_lang.C-jm5z4e.js";
11
11
  import { _ as A } from "./chunks/AccessibleSelect.vue_vue_type_script_setup_true_lang.lyHlWiC5.js";
12
12
  import { _ as C } from "./chunks/BaseAlert.vue_vue_type_script_setup_true_lang.HqYdk4yE.js";
13
- import { _ as T } from "./chunks/BaseAutocomplete.vue_vue_type_script_setup_true_lang.3aynnDI5.js";
13
+ import { _ as T } from "./chunks/BaseAutocomplete.vue_vue_type_script_setup_true_lang.B5kRg12j.js";
14
14
  import { _ as w } from "./chunks/BaseBadge.vue_vue_type_style_index_0_lang.BOA1gBKu.js";
15
15
  import { _ as k } from "./chunks/BaseButton.vue_vue_type_script_setup_true_lang.BrJbAMJ8.js";
16
16
  import { _ as F } from "./chunks/BaseCard.vue_vue_type_style_index_0_lang.w5aEohzG.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "1.2.58",
3
+ "version": "1.3.0",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",