@wikicasa-dev/components 2.2.9-alpha.17 → 2.2.9-alpha.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.
@@ -15,23 +15,20 @@ export interface ClearableAutocompleteProps<TID extends string | number | undefi
15
15
  offset?: number;
16
16
  };
17
17
  keepState?: Nullable<"closed" | "open">;
18
- disableCb?: boolean;
19
18
  onInputChangeCb: (v: string) => Promise<AccessibleSelectOptions<TPayload, TID>[]>;
20
19
  onOptionSelectedCb?: Nullable<(v: AccessibleSelectOptions<TPayload, TID>) => void>;
21
20
  }
22
21
  declare const _default: <TID extends string | number | undefined, TPayload>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
23
22
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
24
23
  readonly "onUpdate:modelValue"?: ((value: Nullable<AccessibleSelectOptions<TPayload, TID>>) => any) | undefined;
25
- readonly onInput?: ((args_0: InputEvent) => any) | undefined;
26
24
  readonly onClick?: ((args_0: MouseEvent) => any) | undefined;
27
25
  readonly onKeydown?: ((args_0: KeyboardEvent) => any) | undefined;
28
26
  readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
29
- readonly "onUpdate:inputValue"?: ((value: string) => any) | undefined;
30
27
  readonly onInputClick?: ((args_0: MouseEvent) => any) | undefined;
31
- } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:modelValue" | "onClick" | "onInput" | "onKeydown" | "onUpdate:open" | "onUpdate:inputValue" | "onInputClick"> & ({
28
+ readonly "onUpdate:inputValue"?: ((args_0: string) => any) | undefined;
29
+ } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onUpdate:modelValue" | "onClick" | "onKeydown" | "onUpdate:open" | "onInputClick" | "onUpdate:inputValue"> & ({
32
30
  open?: boolean;
33
31
  modelValue?: Nullable<AccessibleSelectOptions<TPayload, TID>>;
34
- inputValue?: string;
35
32
  } & ClearableAutocompleteProps<TID, TPayload>) & Partial<{}>> & import('vue').PublicProps;
36
33
  expose(exposed: import('vue').ShallowUnwrapRef<{
37
34
  getRootElement: () => HTMLDivElement | null | undefined;
@@ -48,7 +45,7 @@ declare const _default: <TID extends string | number | undefined, TPayload>(__VL
48
45
  idx: number;
49
46
  }): any;
50
47
  };
51
- emit: (((evt: "input", args_0: InputEvent) => void) & ((evt: "click", args_0: MouseEvent) => void) & ((evt: "keydown", args_0: KeyboardEvent) => void) & ((evt: "inputClick", args_0: MouseEvent) => void)) & (((evt: "update:modelValue", value: Nullable<AccessibleSelectOptions<TPayload, TID>>) => void) & ((evt: "update:open", value: boolean) => void) & ((evt: "update:inputValue", value: string) => void));
48
+ emit: (((evt: "click", args_0: MouseEvent) => void) & ((evt: "keydown", args_0: KeyboardEvent) => void) & ((evt: "inputClick", args_0: MouseEvent) => void) & ((evt: "update:inputValue", args_0: string) => void)) & (((evt: "update:modelValue", value: Nullable<AccessibleSelectOptions<TPayload, TID>>) => void) & ((evt: "update:open", value: boolean) => void));
52
49
  }>) => import('vue').VNode & {
53
50
  __ctx?: Awaited<typeof __VLS_setup>;
54
51
  };
@@ -16,9 +16,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
16
16
  title?: string;
17
17
  dataCy?: string;
18
18
  type?: "button" | "submit" | "reset" | undefined;
19
- }, {
20
- getRootElement: () => HTMLButtonElement | null;
21
- }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
19
+ }, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
22
20
  click: (e: Event) => any;
23
21
  mouseover: (e: Event) => any;
24
22
  mouseout: (e: Event) => any;
@@ -41,9 +39,7 @@ declare const _default: __VLS_WithTemplateSlots<import('vue').DefineComponent<{
41
39
  onClick?: ((e: Event) => any) | undefined;
42
40
  onMouseover?: ((e: Event) => any) | undefined;
43
41
  onMouseout?: ((e: Event) => any) | undefined;
44
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
45
- buttonEl: HTMLButtonElement;
46
- }, HTMLButtonElement>, {
42
+ }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLButtonElement>, {
47
43
  default?(_: {
48
44
  hover: boolean;
49
45
  }): any;
@@ -51,7 +51,6 @@ 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
53
  getRootElement: () => HTMLDivElement | null;
54
- getContentElement: () => HTMLElement | null;
55
54
  }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
56
55
  click: () => any;
57
56
  "update:toggleDropdown": (value: Optional<boolean>) => any;
@@ -1,11 +1,11 @@
1
- import { defineComponent as D, mergeModels as $, useModel as b, useId as N, useTemplateRef as y, shallowRef as d, onBeforeMount as A, watch as w, nextTick as H, createBlock as F, openBlock as h, withCtx as g, createElementBlock as P, Fragment as X, renderList as j, renderSlot as f, createElementVNode as u, normalizeClass as v, withDirectives as O, unref as q, vModelText as G, toDisplayString as J, withModifiers as Q, normalizeStyle as Y, createTextVNode as Z, vShow as _ } from "vue";
2
- import ee from "../BaseDropDown.vue.js";
1
+ import { defineComponent as L, mergeModels as M, useModel as V, useTemplateRef as m, shallowRef as p, onBeforeMount as W, watch as b, nextTick as I, createBlock as F, openBlock as C, withCtx as y, createElementBlock as N, Fragment as A, renderList as H, renderSlot as c, createElementVNode as u, normalizeClass as f, withDirectives as $, vModelText as G, toDisplayString as P, withModifiers as X, normalizeStyle as j, createTextVNode as q, vShow as J } from "vue";
2
+ import Q from "../BaseDropDown.vue.js";
3
3
  import '../../../../../assets/BaseDropDown.css';/* empty css */
4
- import te from "../BaseSelect/SelectItem.vue.js";
5
- import { debounce as le } from "@wikicasa-dev/utilities";
6
- const ne = ["id", "data-cy", "placeholder"], oe = ["innerHTML"], pe = /* @__PURE__ */ D({
4
+ import Y from "../BaseSelect/SelectItem.vue.js";
5
+ import { debounce as Z } from "@wikicasa-dev/utilities";
6
+ const _ = ["readonly", "placeholder"], ee = ["innerHTML"], ue = /* @__PURE__ */ L({
7
7
  __name: "ClearableAutocomplete",
8
- props: /* @__PURE__ */ $({
8
+ props: /* @__PURE__ */ M({
9
9
  dataCy: {},
10
10
  placeholder: {},
11
11
  enableKeyboardController: { type: Boolean, default: !0 },
@@ -15,159 +15,148 @@ const ne = ["id", "data-cy", "placeholder"], oe = ["innerHTML"], pe = /* @__PURE
15
15
  dropdownClasses: {},
16
16
  clearButton: {},
17
17
  keepState: {},
18
- disableCb: { type: Boolean, default: !1 },
19
18
  onInputChangeCb: { type: Function },
20
19
  onOptionSelectedCb: { type: [Function, null] }
21
20
  }, {
22
21
  open: { type: Boolean, default: !1 },
23
22
  openModifiers: {},
24
23
  modelValue: { default: null },
25
- modelModifiers: {},
26
- inputValue: {
27
- default: ""
28
- },
29
- inputValueModifiers: {}
24
+ modelModifiers: {}
30
25
  }),
31
- emits: /* @__PURE__ */ $(["input", "click", "inputClick", "keydown"], ["update:open", "update:modelValue", "update:inputValue"]),
32
- setup(l, { expose: R, emit: x }) {
33
- const s = b(l, "open"), i = b(l, "modelValue"), o = b(l, "inputValue");
34
- o.value = o.value ?? i.value?.label ?? "";
35
- const p = x, E = N(), k = y("inputRef"), c = d(0), m = d(!1), C = d(!!i.value?.label), S = d(null), a = d([]), T = y("dropdownRef"), B = y("hiddenSpan"), I = () => {
36
- o.value = "", i.value = null;
26
+ emits: /* @__PURE__ */ M(["click", "inputClick", "update:inputValue", "keydown"], ["update:open", "update:modelValue"]),
27
+ setup(o, { expose: E, emit: O }) {
28
+ const s = V(o, "open"), a = V(o, "modelValue"), r = O, w = m("inputRef"), n = p(a.value?.label || ""), v = p(0), k = p(!1), g = p(null), i = p([]), h = m("dropdownRef"), S = m("hiddenSpan"), R = () => {
29
+ n.value = "", a.value = null, r("update:inputValue", "");
37
30
  }, U = async (t) => {
38
- if (!t) {
39
- a.value = [], s.value = !1;
31
+ if (r("update:inputValue", t), !t) {
32
+ i.value = [], s.value = !1;
40
33
  return;
41
34
  }
42
- l.disableCb || (a.value = await S.value?.(t) || [], m.value = !0, s.value = !!a.value.length);
43
- }, M = (t = -1) => {
44
- const e = a.value[t];
45
- !e || e.id === i.value?.id || (l.onOptionSelectedCb?.(e), o.value = e.label, s.value = !1, i.value = e, C.value = !0, a.value = []);
35
+ i.value = await g.value?.(t) || [], k.value = !0, s.value = !!i.value.length;
36
+ }, T = (t = -1) => {
37
+ const e = i.value[t];
38
+ !e || e.id === a.value?.id || (o.onOptionSelectedCb?.(e), n.value = e.label, s.value = !1, a.value = e, i.value = []);
39
+ }, x = () => {
40
+ w.value?.select();
46
41
  }, z = () => {
47
- k.value?.select();
48
- }, K = () => {
49
- k.value?.focus();
42
+ w.value?.focus();
50
43
  };
51
- return A(() => {
52
- S.value = le({ delay: 300 }, l.onInputChangeCb);
53
- }), w(
54
- [o, () => B.value],
55
- ([, t]) => {
56
- t && H(() => {
57
- if (!t) return;
58
- const e = t.offsetWidth;
59
- e !== c.value && (c.value = e);
44
+ return W(() => {
45
+ g.value = Z({ delay: 300 }, o.onInputChangeCb);
46
+ }), b(
47
+ [n, () => S.value],
48
+ ([t, e]) => {
49
+ e && I(() => {
50
+ if (!e) return;
51
+ const l = e.offsetWidth;
52
+ l !== v.value && (console.log("DEBUG:updating icon positioning", {
53
+ curInputValue: t
54
+ }), v.value = l);
60
55
  });
61
56
  },
62
57
  { immediate: !0 }
63
- ), w(
64
- () => T.value?.selectedIdx,
58
+ ), b(
59
+ () => h.value?.selectedIdx,
65
60
  (t) => {
66
61
  const e = t ?? -1;
67
- e !== -1 && M(e);
62
+ e !== -1 && T(e);
68
63
  }
69
- ), w(
70
- i,
64
+ ), b(
65
+ a,
71
66
  (t, e) => {
72
- t === e || t?.label === o.value || (o.value = t?.label || "");
67
+ t === e || t?.label === n.value || (n.value = t?.label || "");
73
68
  },
74
69
  { immediate: !0 }
75
- ), R({
76
- getRootElement: () => T.value?.getRootElement(),
77
- select: z,
78
- focus: K
79
- }), (t, e) => (h(), F(ee, {
70
+ ), E({
71
+ getRootElement: () => h.value?.getRootElement(),
72
+ select: x,
73
+ focus: z
74
+ }), (t, e) => (C(), F(Q, {
80
75
  ref: "dropdownRef",
81
76
  class: "uikit-clearable-autocomplete",
82
- "data-cy": l.dataCy,
77
+ "data-cy": o.dataCy,
83
78
  "dropdown-element": "ul",
84
- "dropdown-classes": ["uikit-z-30", l.dropdownClasses],
79
+ "dropdown-classes": ["uikit-z-30", o.dropdownClasses],
85
80
  "open-dropdown": s.value,
86
- "keep-state": !a.value.length || l.keepState === "closed" ? "closed" : "opened",
87
- "activate-keyboard-controller": l.enableKeyboardController,
88
- "reset-keyboard-controller": m.value,
89
- "onUpdate:resetKeyboardController": e[5] || (e[5] = (n) => m.value = n),
90
- "onUpdate:dropdownState": e[6] || (e[6] = (n) => s.value = n)
81
+ "keep-state": !i.value.length || o.keepState === "closed" ? "closed" : "opened",
82
+ "activate-keyboard-controller": o.enableKeyboardController,
83
+ "reset-keyboard-controller": k.value,
84
+ "onUpdate:resetKeyboardController": e[4] || (e[4] = (l) => k.value = l),
85
+ "onUpdate:dropdownState": e[5] || (e[5] = (l) => s.value = l)
91
86
  }, {
92
- btn_slot: g(() => [
87
+ btn_slot: y(() => [
93
88
  u("div", {
94
- class: v(["uikit-text-16", l.triggerWrapperClasses]),
95
- onClick: e[4] || (e[4] = (n) => p("click", n))
89
+ class: f(["uikit-text-16", o.triggerWrapperClasses]),
90
+ onClick: e[3] || (e[3] = (l) => r("click", l))
96
91
  }, [
97
- f(t.$slots, "left-icon"),
92
+ c(t.$slots, "left-icon"),
98
93
  u("div", {
99
- class: v(["uikit-relative", l.inputWrapperClasses])
94
+ class: f(["uikit-relative", o.inputWrapperClasses])
100
95
  }, [
101
- O(u("input", {
96
+ $(u("input", {
102
97
  ref: "inputRef",
103
98
  "onUpdate:modelValue": [
104
- e[0] || (e[0] = (n) => o.value = n),
99
+ e[0] || (e[0] = (l) => n.value = l),
105
100
  U
106
101
  ],
107
- id: q(E),
108
- "data-cy": l.dataCy ? `ac_input_${l.dataCy}` : "",
102
+ readonly: !!a.value?.label,
109
103
  type: "text",
110
104
  autocomplete: "off",
111
- class: v(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", l.inputClasses]),
105
+ class: f(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", o.inputClasses]),
112
106
  style: {
113
107
  font: "inherit",
114
108
  fontSize: "inherit"
115
109
  },
116
- placeholder: l.placeholder,
117
- onKeydown: e[1] || (e[1] = (n) => p("keydown", n)),
118
- onInput: e[2] || (e[2] = (n) => {
119
- p("input", n), C.value = !1;
120
- }),
121
- onClick: e[3] || (e[3] = (n) => {
122
- p("inputClick", n), k.value?.select();
123
- })
124
- }, null, 42, ne), [
125
- [G, o.value]
110
+ placeholder: o.placeholder,
111
+ onKeydown: e[1] || (e[1] = (l) => r("keydown", l)),
112
+ onClick: e[2] || (e[2] = (l) => r("inputClick", l))
113
+ }, null, 42, _), [
114
+ [G, n.value]
126
115
  ]),
127
116
  u("span", {
128
117
  ref_key: "hiddenSpan",
129
- ref: B,
118
+ ref: S,
130
119
  class: "uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre",
131
120
  style: {
132
121
  font: "inherit",
133
122
  fontSize: "inherit"
134
123
  }
135
- }, J(o.value), 513),
136
- O(u("button", {
124
+ }, P(n.value), 513),
125
+ $(u("button", {
137
126
  type: "button",
138
- class: v(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", l.clearButton?.classes]),
127
+ class: f(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", o.clearButton?.classes]),
139
128
  "aria-label": "Clear input",
140
- style: Y({
141
- left: `${c.value + (l.clearButton?.offset || 10)}px`
129
+ style: j({
130
+ left: `${v.value + (o.clearButton?.offset || 10)}px`
142
131
  }),
143
- onClick: Q(I, ["stop"])
132
+ onClick: X(R, ["stop"])
144
133
  }, [
145
- f(t.$slots, "clear-icon", {}, () => [
146
- e[7] || (e[7] = Z("X", -1))
134
+ c(t.$slots, "clear-icon", {}, () => [
135
+ e[6] || (e[6] = q("X", -1))
147
136
  ])
148
137
  ], 6), [
149
- [_, C.value && c.value]
138
+ [J, a.value?.label]
150
139
  ])
151
140
  ], 2),
152
- f(t.$slots, "right-icon")
141
+ c(t.$slots, "right-icon")
153
142
  ], 2)
154
143
  ]),
155
- default: g(({ activeIdx: n, setActiveIdx: L }) => [
156
- (h(!0), P(X, null, j(a.value, (V, r) => (h(), F(te, {
157
- key: r,
158
- active: n === r,
144
+ default: y(({ activeIdx: l, setActiveIdx: D }) => [
145
+ (C(!0), N(A, null, H(i.value, (B, d) => (C(), F(Y, {
146
+ key: d,
147
+ active: l === d,
159
148
  class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
160
- onClick: (W) => M(r),
161
- onMouseover: (W) => L(r)
149
+ onClick: (K) => T(d),
150
+ onMouseover: (K) => D(d)
162
151
  }, {
163
- default: g(() => [
164
- f(t.$slots, "option-content", {
165
- option: V,
166
- idx: r
152
+ default: y(() => [
153
+ c(t.$slots, "option-content", {
154
+ option: B,
155
+ idx: d
167
156
  }, () => [
168
157
  u("span", {
169
- innerHTML: V.label
170
- }, null, 8, oe)
158
+ innerHTML: B.label
159
+ }, null, 8, ee)
171
160
  ])
172
161
  ]),
173
162
  _: 2
@@ -178,5 +167,5 @@ const ne = ["id", "data-cy", "placeholder"], oe = ["innerHTML"], pe = /* @__PURE
178
167
  }
179
168
  });
180
169
  export {
181
- pe as default
170
+ ue as default
182
171
  };
@@ -1,6 +1,6 @@
1
- import { defineComponent as y, useTemplateRef as v, shallowRef as B, computed as n, createElementBlock as C, openBlock as M, withModifiers as s, normalizeStyle as h, normalizeClass as z, renderSlot as u, createVNode as L } from "vue";
2
- import g from "../../../../UIKit/StaticSpinner.js";
3
- const w = ["id", "data-cy", "type", "data-active", "disabled", "aria-label", "title"], A = /* @__PURE__ */ y({
1
+ import { defineComponent as c, ref as b, computed as l, createElementBlock as f, openBlock as v, withModifiers as s, normalizeStyle as B, normalizeClass as C, renderSlot as u, createVNode as M } from "vue";
2
+ import z from "../../../../UIKit/StaticSpinner.js";
3
+ const L = ["id", "data-cy", "type", "data-active", "disabled", "aria-label", "title"], $ = /* @__PURE__ */ c({
4
4
  __name: "BaseButton",
5
5
  props: {
6
6
  btnClass: { default: "uikit-btn-w-primary" },
@@ -16,20 +16,17 @@ const w = ["id", "data-cy", "type", "data-active", "disabled", "aria-label", "ti
16
16
  type: {}
17
17
  },
18
18
  emits: ["mouseover", "mouseout", "click"],
19
- setup(e, { expose: d, emit: r }) {
20
- const a = r, m = v("buttonEl"), l = B(!1), b = n(() => e.size ? `uikit-btn-${e.size}` : ""), c = n(() => e.outlined ? "uikit-btn-outline" : ""), f = () => {
21
- l.value = !0;
22
- }, k = () => {
23
- l.value = !1;
19
+ setup(e, { emit: d }) {
20
+ const o = d, n = b(!1), r = l(() => e.size ? `uikit-btn-${e.size}` : ""), m = l(() => e.outlined ? "uikit-btn-outline" : ""), k = () => {
21
+ n.value = !0;
22
+ }, y = () => {
23
+ n.value = !1;
24
24
  };
25
- return d({
26
- getRootElement: () => m.value
27
- }), (o, t) => (M(), C("button", {
28
- ref: "buttonEl",
29
- id: o.$attrs.id,
25
+ return (a, t) => (v(), f("button", {
26
+ id: a.$attrs.id,
30
27
  "data-cy": e.dataCy,
31
28
  type: e.type,
32
- class: z([
29
+ class: C([
33
30
  "uikit-btn",
34
31
  {
35
32
  "uikit-btn-empty": !e.withMinWidth,
@@ -37,33 +34,33 @@ const w = ["id", "data-cy", "type", "data-active", "disabled", "aria-label", "ti
37
34
  "uikit-flex uikit-items-center uikit-justify-center": e.isLoading
38
35
  },
39
36
  e.btnClass,
40
- b.value,
41
- c.value
37
+ r.value,
38
+ m.value
42
39
  ]),
43
- style: h(o.$attrs.style),
40
+ style: B(a.$attrs.style),
44
41
  "data-active": e.keepActive,
45
42
  disabled: e.isLoading || e.disabled,
46
43
  "aria-label": e.ariaLabel,
47
44
  title: e.title,
48
45
  onMouseover: t[0] || (t[0] = s((i) => {
49
- f(), a("mouseover", i);
46
+ k(), o("mouseover", i);
50
47
  }, ["stop"])),
51
48
  onMouseout: t[1] || (t[1] = s((i) => {
52
- k(), a("mouseout", i);
49
+ y(), o("mouseout", i);
53
50
  }, ["stop"])),
54
- onClick: t[2] || (t[2] = (i) => a("click", i))
51
+ onClick: t[2] || (t[2] = (i) => o("click", i))
55
52
  }, [
56
- e.isLoading ? u(o.$slots, "spinner", { key: 1 }, () => [
57
- L(g, {
53
+ e.isLoading ? u(a.$slots, "spinner", { key: 1 }, () => [
54
+ M(z, {
58
55
  "stroke-color": e.outlined ? "#ACB4C3" : "#fff"
59
56
  }, null, 8, ["stroke-color"])
60
- ]) : u(o.$slots, "default", {
57
+ ]) : u(a.$slots, "default", {
61
58
  key: 0,
62
- hover: l.value
59
+ hover: n.value
63
60
  })
64
- ], 46, w));
61
+ ], 46, L));
65
62
  }
66
63
  });
67
64
  export {
68
- A as default
65
+ $ as default
69
66
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as N, mergeModels as D, useId as R, useModel as E, shallowRef as x, computed as V, useTemplateRef as I, onMounted as z, onUnmounted as q, watch as l, nextTick as U, createElementBlock as j, openBlock as k, normalizeClass as i, renderSlot as K, createBlock as B, createVNode as F, unref as r, withCtx as L, createElementVNode as G, createCommentVNode as J, resolveDynamicComponent as P } from "vue";
1
+ import { defineComponent as N, mergeModels as D, useId as R, useModel as E, shallowRef as x, computed as V, useTemplateRef as I, onMounted as z, onUnmounted as q, watch as l, nextTick as U, createElementBlock as j, openBlock as f, normalizeClass as i, renderSlot as K, createBlock as B, createVNode as F, unref as r, withCtx as L, createElementVNode as G, createCommentVNode as J, resolveDynamicComponent as P } from "vue";
2
2
  import Q from "./BaseButton.vue.js";
3
3
  import { ArrowIcon as X } from "@wikicasa-dev/svg-icons";
4
4
  import { useKeyboardController as Y } from "@wikicasa-dev/vue-composables";
@@ -29,12 +29,12 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
29
29
  }),
30
30
  emits: /* @__PURE__ */ D(["click", "update:dropdownState"], ["update:toggleDropdown", "update:resetKeyboardController"]),
31
31
  setup(o, { expose: S, emit: A }) {
32
- const n = o, v = R(), w = A, m = E(o, "toggleDropdown"), p = E(
32
+ const n = o, k = R(), v = A, w = E(o, "toggleDropdown"), m = E(
33
33
  o,
34
34
  "resetKeyboardController"
35
35
  );
36
- let y = !1;
37
- const t = x(!1), u = x([]), M = V(() => u.value.length), s = I("container"), c = I("dropdown"), { activeIdx: d, selectedIdx: a, onKeyDownHandler: O } = Y({
36
+ let p = !1;
37
+ const t = x(!1), u = x([]), M = V(() => u.value.length), s = I("container"), y = I("dropdown"), { activeIdx: d, selectedIdx: a, onKeyDownHandler: O } = Y({
38
38
  optionsLength: M,
39
39
  isDropdownOpen: t,
40
40
  global: !1
@@ -42,26 +42,26 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
42
42
  t.value = !1;
43
43
  }, b = ({ target: e }) => {
44
44
  s.value?.contains(e) || W();
45
- }, C = (e) => {
45
+ }, h = (e) => {
46
46
  t.value && s.value?.contains(document.activeElement) && e.key === "Tab" && (t.value = !1);
47
47
  }, $ = (e) => {
48
48
  n.activateKeyboardController && O(e);
49
- }, f = () => {
49
+ }, c = () => {
50
50
  n.keepState === "closed" && !t.value || n.keepState === "opened" && t.value || (t.value = !t.value);
51
51
  }, T = (e) => {
52
52
  e != null && (d.value = e);
53
53
  }, H = (e) => {
54
54
  e != null && (a.value = e);
55
- }, h = () => {
56
- c.value && (u.value = Array.from(c.value.children));
55
+ }, C = () => {
56
+ y.value && (u.value = Array.from(y.value.children));
57
57
  };
58
58
  return z(() => {
59
- h();
59
+ C();
60
60
  }), q(() => {
61
- n.closeWhenClickedOutside && (document.removeEventListener("click", b), document.removeEventListener("keydown", C));
62
- }), l(p, (e) => {
61
+ n.closeWhenClickedOutside && (document.removeEventListener("click", b), document.removeEventListener("keydown", h));
62
+ }), l(m, (e) => {
63
63
  e && (d.value = -1, a.value = -1, U(() => {
64
- h(), p.value = !1;
64
+ C(), m.value = !1;
65
65
  }));
66
66
  }), l(
67
67
  () => n.openDropdown,
@@ -72,29 +72,28 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
72
72
  immediate: !0
73
73
  }
74
74
  ), l(t, (e) => {
75
- w("update:dropdownState", e);
75
+ v("update:dropdownState", e);
76
76
  }), l(t, (e) => {
77
- !e || y || !n.closeWhenClickedOutside || (document.addEventListener("click", b), document.addEventListener("keydown", C), y = !0);
78
- }), l(m, (e) => {
79
- e && (t.value = !t.value, m.value = !1);
77
+ !e || p || !n.closeWhenClickedOutside || (document.addEventListener("click", b), document.addEventListener("keydown", h), p = !0);
78
+ }), l(w, (e) => {
79
+ e && (t.value = !t.value, w.value = !1);
80
80
  }), l(a, (e) => {
81
81
  e !== -1 && u.value[e].querySelector("a")?.click();
82
82
  }), S({
83
83
  activeIdx: d,
84
84
  selectedIdx: a,
85
- getRootElement: () => s.value,
86
- getContentElement: () => c.value
87
- }), (e, g) => (k(), j("div", {
85
+ getRootElement: () => s.value
86
+ }), (e, g) => (f(), j("div", {
88
87
  ref: "container",
89
88
  class: i(["uikit-relative uikit-block", e.$attrs.class]),
90
89
  onKeydown: $
91
90
  }, [
92
91
  K(e.$slots, "btn_slot", {
93
- toggleDropdown: f,
92
+ toggleDropdown: c,
94
93
  isOpen: t.value
95
94
  }, () => [
96
95
  F(Q, {
97
- id: r(v),
96
+ id: r(k),
98
97
  type: "button",
99
98
  "data-cy": o.dataCy,
100
99
  class: i([
@@ -104,7 +103,7 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
104
103
  "aria-expanded": t.value,
105
104
  "btn-class": "uikit-btn-single-selection",
106
105
  onClick: g[0] || (g[0] = (_) => {
107
- w("click"), f();
106
+ v("click"), c();
108
107
  })
109
108
  }, {
110
109
  default: L(() => [
@@ -112,7 +111,7 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
112
111
  class: i(["uikit-mr-5px", o.labelClasses]),
113
112
  innerHTML: o.btnLabel
114
113
  }, null, 10, Z),
115
- o.withArrowIcon ? (k(), B(r(X), {
114
+ o.withArrowIcon ? (f(), B(r(X), {
116
115
  key: 0,
117
116
  class: i(["uikit-shrink-0 uikit-transition-transform motion-reduce:uikit-transition-none", t.value ? "uikit-rotate-180" : ""]),
118
117
  width: o.arrowWidth,
@@ -123,8 +122,8 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
123
122
  _: 1
124
123
  }, 8, ["id", "data-cy", "class", "aria-expanded"])
125
124
  ]),
126
- (k(), B(P(o.dropdownElement), {
127
- id: "dropdown_" + r(v),
125
+ (f(), B(P(o.dropdownElement), {
126
+ id: "dropdown_" + r(k),
128
127
  ref: "dropdown",
129
128
  "data-cy": o.dataCy && `${o.dataCy}_dropdown`,
130
129
  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", [
@@ -139,7 +138,7 @@ const Z = ["innerHTML"], le = /* @__PURE__ */ N({
139
138
  default: L(() => [
140
139
  K(e.$slots, "default", {
141
140
  isOpen: t.value,
142
- toggleDropdown: f,
141
+ toggleDropdown: c,
143
142
  activeIdx: r(d),
144
143
  selectedIdx: r(a),
145
144
  setActiveIdx: T,
@@ -110,8 +110,8 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
110
110
  }, [
111
111
  D(K(V), {
112
112
  class: s(["bbt-close-icon uikit-box-border", e.closeIcon?.classes]),
113
- width: e.closeIcon?.size || 20,
114
- height: e.closeIcon?.size || 20
113
+ width: e.closeIcon?.size || 30,
114
+ height: e.closeIcon?.size || 30
115
115
  }, null, 8, ["class", "width", "height"])
116
116
  ], 2)) : w("", !0),
117
117
  d(t.$slots, "header", { closeModal: o }, () => [
@@ -1,5 +1,5 @@
1
- import { defineComponent as u, useTemplateRef as c, watch as d, nextTick as m, createElementBlock as r, openBlock as f, normalizeClass as v, renderSlot as k, createElementVNode as x } from "vue";
2
- const b = ["data-active", "tabindex"], p = ["innerHTML"], $ = /* @__PURE__ */ u({
1
+ import { defineComponent as u, useTemplateRef as r, watch as m, nextTick as c, createElementBlock as d, openBlock as f, normalizeClass as k, renderSlot as v, createElementVNode as x } from "vue";
2
+ const p = ["tabindex"], b = ["innerHTML"], $ = /* @__PURE__ */ u({
3
3
  __name: "SelectItem",
4
4
  props: {
5
5
  label: { default: "" },
@@ -7,34 +7,33 @@ const b = ["data-active", "tabindex"], p = ["innerHTML"], $ = /* @__PURE__ */ u(
7
7
  idx: { default: -1 }
8
8
  },
9
9
  emits: ["click", "mouseover"],
10
- setup(t, { emit: o }) {
11
- const a = o, i = t, n = c("liItem");
12
- return d(
13
- () => i.active,
10
+ setup(l, { emit: a }) {
11
+ const n = a, t = l, o = r("liItem");
12
+ return m(
13
+ () => t.active,
14
14
  (e) => {
15
- e && m(() => {
16
- n.value && n.value.focus();
15
+ e && c(() => {
16
+ o.value && o.value.focus();
17
17
  });
18
18
  },
19
19
  { immediate: !0 }
20
- ), (e, l) => (f(), r("li", {
20
+ ), (e, i) => (f(), d("li", {
21
21
  ref: "liItem",
22
- class: v(["uikit-list-none uikit-text-w-black", [
23
- { "active uikit-bg-w-cultured": t.active },
22
+ class: k(["uikit-list-none uikit-text-w-black", [
23
+ { "active uikit-bg-w-cultured": l.active },
24
24
  "uikit-outline-none",
25
25
  e.$attrs.class
26
26
  ]]),
27
- "data-active": t.active,
28
27
  tabindex: e.$attrs.tabindex ?? -1,
29
- onClick: l[0] || (l[0] = (s) => a("click", i.idx)),
30
- onMouseover: l[1] || (l[1] = (s) => a("mouseover", i.idx))
28
+ onClick: i[0] || (i[0] = (s) => n("click", t.idx)),
29
+ onMouseover: i[1] || (i[1] = (s) => n("mouseover", t.idx))
31
30
  }, [
32
- k(e.$slots, "default", { itemIdx: t.idx }, () => [
31
+ v(e.$slots, "default", { itemIdx: l.idx }, () => [
33
32
  x("span", {
34
- innerHTML: i.label
35
- }, null, 8, p)
33
+ innerHTML: t.label
34
+ }, null, 8, b)
36
35
  ])
37
- ], 42, b));
36
+ ], 42, p));
38
37
  }
39
38
  });
40
39
  export {
@@ -1,8 +1,8 @@
1
- import { defineComponent as v, ref as D, computed as h, watch as E, renderSlot as b, createElementVNode as $, normalizeClass as g, createElementBlock as B, createCommentVNode as A, openBlock as C, Fragment as I, renderList as R, createBlock as K, unref as V } from "vue";
1
+ import { defineComponent as p, ref as v, computed as h, watch as D, renderSlot as b, createElementVNode as E, normalizeClass as $, createElementBlock as B, createCommentVNode as A, openBlock as g, Fragment as I, renderList as R, createBlock as K, unref as V } from "vue";
2
2
  import { stringToHyphened as L, isArrNullOrEmpty as G } from "@wikicasa-dev/utilities";
3
3
  import N from "./CheckboxBtn.vue.js";
4
4
  import '../../../../../assets/CheckboxBtn.css';/* empty css */
5
- const T = ["id", "data-cy"], j = /* @__PURE__ */ v({
5
+ const T = ["id", "data-cy"], j = /* @__PURE__ */ p({
6
6
  inheritAttrs: !1,
7
7
  __name: "CheckboxGroup",
8
8
  props: {
@@ -20,14 +20,14 @@ const T = ["id", "data-cy"], j = /* @__PURE__ */ v({
20
20
  dataCy: { default: "" }
21
21
  },
22
22
  emits: ["resetted", "update:modelValue", "checkedGroup"],
23
- setup(a, { emit: y }) {
24
- const o = a, s = y, l = D(
23
+ setup(a, { emit: C }) {
24
+ const o = a, s = C, l = v(
25
25
  /* @__PURE__ */ new Map()
26
26
  ), r = h(() => {
27
27
  for (const e of o.checkboxData)
28
28
  if (e.reset) return e;
29
29
  return null;
30
- }), x = h(() => o.checkboxData.length), f = h(() => {
30
+ }), y = h(() => o.checkboxData.length), f = h(() => {
31
31
  let e = 0;
32
32
  return l.value.forEach((t) => {
33
33
  t.checked && e++;
@@ -60,7 +60,7 @@ const T = ["id", "data-cy"], j = /* @__PURE__ */ v({
60
60
  }, d = (e) => l.value.get(o.getKey(e))?.checked ?? !1, i = (e) => {
61
61
  if (G(o.checkboxData)) return;
62
62
  const t = l.value.get(e.id);
63
- t?.reset && e.checked ? k() : r.value && !t?.reset && u(o.getKey(r.value), { checked: !1 }), u(`${e.id}`), o.autoCheckResetAll && r.value && f.value === x.value - 1 && l.value.forEach((n) => {
63
+ t?.reset && e.checked ? k() : r.value && !t?.reset && u(o.getKey(r.value), { checked: !1 }), u(`${e.id}`), o.autoCheckResetAll && r.value && f.value === y.value - 1 && l.value.forEach((n) => {
64
64
  n.checked = !!n.reset;
65
65
  }), o.autoCheckResetEmpty && r.value && !f.value && (!o.manualToggleResetButton || !t?.reset) && u(o.getKey(r.value), { checked: !0 });
66
66
  const c = [];
@@ -68,7 +68,7 @@ const T = ["id", "data-cy"], j = /* @__PURE__ */ v({
68
68
  n.checked && c.push(n);
69
69
  }), s("update:modelValue", c), s("checkedGroup", o.groupId);
70
70
  };
71
- return E(
71
+ return D(
72
72
  () => o.reset,
73
73
  (e) => {
74
74
  e && m();
@@ -78,9 +78,9 @@ const T = ["id", "data-cy"], j = /* @__PURE__ */ v({
78
78
  handleChange: i,
79
79
  checkboxesData: a.checkboxData
80
80
  }, () => [
81
- $("div", {
81
+ E("div", {
82
82
  id: a.groupId,
83
- class: g(["checkbox-group-container", e.$attrs.class || ""]),
83
+ class: $(["checkbox-group-container", e.$attrs.class || ""]),
84
84
  "data-cy": a.dataCy
85
85
  }, [
86
86
  b(e.$slots, "checkbox_elements", {
@@ -89,19 +89,19 @@ const T = ["id", "data-cy"], j = /* @__PURE__ */ v({
89
89
  checkboxesData: a.checkboxData,
90
90
  reset: m
91
91
  }, () => [
92
- a.checkboxData ? (C(!0), B(I, { key: 0 }, R(a.checkboxData, (c, n) => (C(), K(N, {
92
+ a.checkboxData ? (g(!0), B(I, { key: 0 }, R(a.checkboxData, (c, n) => (g(), K(N, {
93
93
  id: a.getKey(c),
94
94
  key: n,
95
95
  "data-cy": c.dataCy ?? `checkbox_${V(L)(`${c.label}`)}`,
96
96
  label: c.label,
97
97
  inline: a.formCheckInline,
98
98
  "model-value": d(c),
99
- class: g([
99
+ "container-class": [
100
100
  a.formCheckInline ? "uikit-mr-10px" : "uikit-mb-10px",
101
101
  a.checkboxContainerClasses
102
- ]),
103
- onChange: t[0] || (t[0] = (p) => i(p))
104
- }, null, 8, ["id", "data-cy", "label", "inline", "model-value", "class"]))), 128)) : A("", !0)
102
+ ],
103
+ onChange: t[0] || (t[0] = (x) => i(x))
104
+ }, null, 8, ["id", "data-cy", "label", "inline", "model-value", "container-class"]))), 128)) : A("", !0)
105
105
  ])
106
106
  ], 10, T)
107
107
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikicasa-dev/components",
3
- "version": "2.2.9-alpha.17",
3
+ "version": "2.2.9-alpha.2",
4
4
  "description": "Wikicasa frontend components",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",