@wikicasa-dev/components 1.3.0 → 1.3.2

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.B5kRg12j.js";
1
+ import { _ as f } from "./chunks/BaseAutocomplete.vue_vue_type_script_setup_true_lang.KqJ6OB8f.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { AccessibleSelectOptions, Nullable } from "@wikicasa-dev/types";
1
+ import { AccessibleSelectOptions, Nullable, BaseAutocompleteThemes } from "@wikicasa-dev/types";
2
2
  type ModelValueType<T = unknown> = AccessibleSelectOptions<T>;
3
3
  declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
4
4
  modelValue: import("vue").PropType<ModelValueType<unknown> | undefined>;
@@ -11,7 +11,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
11
11
  default: null;
12
12
  };
13
13
  theme: {
14
- type: import("vue").PropType<"" | "bordered" | "all-bordered" | "all-bordered-thick">;
14
+ type: import("vue").PropType<BaseAutocompleteThemes>;
15
15
  default: string;
16
16
  };
17
17
  border: {
@@ -42,6 +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
+ keydown: (args_0: KeyboardEvent) => void;
45
46
  dropdownClosed: (args_0: boolean) => void;
46
47
  changedValue: (args_0: string) => void;
47
48
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -55,7 +56,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
55
56
  default: null;
56
57
  };
57
58
  theme: {
58
- type: import("vue").PropType<"" | "bordered" | "all-bordered" | "all-bordered-thick">;
59
+ type: import("vue").PropType<BaseAutocompleteThemes>;
59
60
  default: string;
60
61
  };
61
62
  border: {
@@ -83,13 +84,14 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
83
84
  default: boolean;
84
85
  };
85
86
  }>> & {
87
+ onKeydown?: ((args_0: KeyboardEvent) => any) | undefined;
86
88
  onClick?: (() => any) | undefined;
87
89
  onDropdownClosed?: ((args_0: boolean) => any) | undefined;
88
90
  onChangedValue?: ((args_0: string) => any) | undefined;
89
91
  }, {
90
92
  label: string;
91
93
  isValid: Nullable<boolean>;
92
- theme: "" | "bordered" | "all-bordered" | "all-bordered-thick";
94
+ theme: BaseAutocompleteThemes;
93
95
  border: boolean;
94
96
  keepState: Nullable<"closed" | "open">;
95
97
  disableCb: boolean;
@@ -26,6 +26,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
26
26
  activeValue: {
27
27
  id?: string | number | null | undefined;
28
28
  label: string | number;
29
+ payload?: unknown;
29
30
  } | null;
30
31
  reset: () => void;
31
32
  isActive: (elem: RadioButtonType) => boolean;
@@ -35,6 +36,7 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
35
36
  activeValue: {
36
37
  id?: string | number | null | undefined;
37
38
  label: string | number;
39
+ payload?: unknown;
38
40
  } | null;
39
41
  reset: () => void;
40
42
  isActive: (elem: RadioButtonType) => boolean;
@@ -1,19 +1,19 @@
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";
1
+ import { defineComponent as H, mergeModels as S, useModel as z, ref as s, computed as k, onBeforeMount as E, watch as C, openBlock as g, createBlock as V, normalizeClass as J, withCtx as c, createVNode as K, renderSlot as B, createElementBlock as U, Fragment as A, renderList as F, unref as P, createElementVNode as W } from "vue";
2
2
  import j from "../BaseInput.js";
3
3
  import { _ as q } from "./BaseDropDown.vue_vue_type_script_setup_true_lang.C4VH7V0e.js";
4
4
  import "./js.cookie.BQua9eWh.js";
5
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(r, k) {
7
+ function R(u, f) {
8
8
  return (...v) => new Promise((t, n) => {
9
- r.id && clearTimeout(r.id), r.id = setTimeout(() => {
9
+ u.id && clearTimeout(u.id), u.id = setTimeout(() => {
10
10
  try {
11
- const i = k(...v);
11
+ const i = f(...v);
12
12
  t(i);
13
13
  } catch (i) {
14
14
  n(i);
15
15
  }
16
- }, r.delay);
16
+ }, u.delay);
17
17
  });
18
18
  }
19
19
  const X = ["innerHTML"], oe = /* @__PURE__ */ H({
@@ -36,9 +36,9 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ H({
36
36
  },
37
37
  modelModifiers: {}
38
38
  }),
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);
39
+ emits: /* @__PURE__ */ S(["dropdownClosed", "changedValue", "click", "keydown"], ["update:modelValue"]),
40
+ setup(u, { expose: f, emit: v }) {
41
+ const t = u, n = z(u, "modelValue"), i = v, d = s(""), a = s([]), m = s(null), p = s(!1), l = s(!1), y = s(null), O = k(() => a.value.length);
42
42
  E(() => {
43
43
  d.value = n.value?.label || "", m.value = R({ delay: 300 }, t.onInputChangeCb);
44
44
  });
@@ -46,7 +46,7 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ H({
46
46
  optionsLength: O,
47
47
  isDropdownOpen: l,
48
48
  disableSpaceHandler: !0
49
- }), M = f(() => {
49
+ }), M = k(() => {
50
50
  switch (t.theme) {
51
51
  case "bordered":
52
52
  return "";
@@ -57,7 +57,7 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ H({
57
57
  default:
58
58
  return "";
59
59
  }
60
- }), I = f(() => {
60
+ }), I = k(() => {
61
61
  switch (t.theme) {
62
62
  case "bordered":
63
63
  return "";
@@ -68,7 +68,7 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ H({
68
68
  default:
69
69
  return "";
70
70
  }
71
- }), T = f(() => {
71
+ }), T = k(() => {
72
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":
@@ -83,33 +83,33 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ H({
83
83
  }), L = async (e) => {
84
84
  if (d.value !== e && (i("changedValue", e), d.value = e, !!t.onInputChangeCb)) {
85
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);
86
+ a.value = [], p.value = !1, w.value = -1, h.value = -1, await m.value(null);
87
87
  return;
88
88
  }
89
- t.disableCb || (o.value = await m.value(e), console.log({ options: JSON.parse(JSON.stringify(o.value)) }), o.value.length && (l.value = !0));
89
+ t.disableCb || (a.value = await m.value(e), console.log({ options: JSON.parse(JSON.stringify(a.value)) }), a.value.length && (l.value = !0));
90
90
  }
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;
91
+ }, $ = (e, o) => {
92
+ t.onOptionSelectedCb && t.onOptionSelectedCb(e), p.value = !0, d.value = e.label, n.value = e, l.value = !1, w.value = o;
93
93
  }, N = () => {
94
- o.value.length && t.keepState !== "closed" && (l.value = !0);
94
+ a.value.length && t.keepState !== "closed" && (l.value = !0);
95
95
  };
96
- return C(n, (e, a) => {
97
- e !== a && (d.value = e?.label || "");
96
+ return C(n, (e, o) => {
97
+ e !== o && (d.value = e?.label || "");
98
98
  }), C(w, (e) => {
99
99
  if (e === -1)
100
100
  return;
101
- const a = o.value[e];
102
- p.value && a.label === n.value?.label || y(a, e);
101
+ const o = a.value[e];
102
+ p.value && o.label === n.value?.label || $(o, e);
103
103
  }), C(
104
104
  () => t.keepState,
105
105
  (e) => {
106
- e === "closed" ? l.value = !1 : e === "open" && o.value.length && (l.value = !0), t.cleanupOnClose && (o.value = []), i("dropdownClosed", l.value);
106
+ e === "closed" ? l.value = !1 : e === "open" && a.value.length && (l.value = !0), t.cleanupOnClose && (a.value = []), i("dropdownClosed", l.value);
107
107
  }
108
- ), k({
108
+ ), f({
109
109
  select: () => {
110
- $.value?.select();
110
+ y.value?.select();
111
111
  }
112
- }), (e, a) => (g(), V(q, {
112
+ }), (e, o) => (g(), V(q, {
113
113
  class: J(e.$attrs["root-classes"]),
114
114
  "data-cy": `ac_${e.$attrs.id}`,
115
115
  "dropdown-element": "ul",
@@ -125,17 +125,17 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ H({
125
125
  e.$attrs["dropdown-classes"]
126
126
  ],
127
127
  "open-dropdown": l.value,
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) => {
128
+ "keep-state": !a.value.length || t.keepState === "closed" ? "closed" : "opened",
129
+ "onUpdate:dropdownState": o[1] || (o[1] = (r) => l.value = r),
130
+ onClick: o[2] || (o[2] = (r) => {
131
131
  i("click"), N();
132
132
  })
133
133
  }, {
134
134
  btn_slot: c(() => [
135
- U(j, {
135
+ K(j, {
136
136
  id: `ac_input_${e.$attrs.id}`,
137
137
  ref_key: "baseInput",
138
- ref: $,
138
+ ref: y,
139
139
  "data-cy": `ac_input_${e.$attrs.id}`,
140
140
  "label-text": e.label,
141
141
  "model-value": n.value?.label || "",
@@ -149,28 +149,29 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ H({
149
149
  "input-class": [M.value, e.$attrs["input-classes"]],
150
150
  "fieldset-classes": [I.value, e.$attrs["fieldset-classes"]],
151
151
  "keep-floating-label": !!d.value,
152
- "onUpdate:modelValue": L
152
+ "onUpdate:modelValue": L,
153
+ onKeydown: o[0] || (o[0] = (r) => i("keydown", r))
153
154
  }, {
154
155
  leftIcon: c(() => [
155
156
  B(e.$slots, "lefticon")
156
157
  ]),
157
- righticon: c(({ handleClean: u }) => [
158
- B(e.$slots, "righticon", { handleClean: u })
158
+ righticon: c(({ handleClean: r }) => [
159
+ B(e.$slots, "righticon", { handleClean: r })
159
160
  ]),
160
161
  _: 3
161
162
  }, 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
163
  ]),
163
164
  default: c(() => [
164
- (g(!0), A(F, null, K(o.value, (u, b) => (g(), V(G, {
165
+ (g(!0), U(A, null, F(a.value, (r, b) => (g(), V(G, {
165
166
  key: b,
166
167
  active: P(h) === b,
167
168
  class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
168
- onClick: (D) => y(u, b),
169
+ onClick: (D) => $(r, b),
169
170
  onMouseover: (D) => h.value = b
170
171
  }, {
171
172
  default: c(() => [
172
173
  W("span", {
173
- innerHTML: u.label
174
+ innerHTML: r.label
174
175
  }, null, 8, X)
175
176
  ]),
176
177
  _: 2
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.B5kRg12j.js";
13
+ import { _ as T } from "./chunks/BaseAutocomplete.vue_vue_type_script_setup_true_lang.KqJ6OB8f.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.3.0",
3
+ "version": "1.3.2",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -48,7 +48,7 @@
48
48
  "@storybook/vue3-vite": "^8.0.2",
49
49
  "@types/node": "^20.5.0",
50
50
  "@vitejs/plugin-vue": "^5.0.4",
51
- "@wikicasa-dev/types": "^1.0.3",
51
+ "@wikicasa-dev/types": "^1.0.4",
52
52
  "@wikicasa-dev/utilities": "^0.2.1",
53
53
  "@wikicasa-dev/svg-icons": "^0.0.1",
54
54
  "@wikicasa-dev/vue-composables": "^0.0.3",