@wikicasa-dev/components 2.2.8-alpha.9 → 2.2.9-alpha.1

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.
package/dist/index.js CHANGED
@@ -1,92 +1,93 @@
1
- import { default as d } from "./packages/components/lib/UIKit/Accordion/BaseAccordion.vue.js";
2
- import { default as x } from "./packages/components/lib/UIKit/Accordion/BaseAccordionBtn.vue.js";
3
- import { default as B } from "./packages/components/lib/UIKit/Accordion/BaseAccordionContent.vue.js";
4
- import { default as c } from "./packages/components/lib/UIKit/Accordion/BaseAccordionItem.vue.js";
5
- import './assets/BaseSnackbar.css';import './assets/BaseModal.css';import './assets/BaseDropDown.css';import './assets/BaseBadge.css';import './assets/ClearableAutocomplete.css';import './assets/BaseAutocomplete.css';import './assets/BaseAlert.css';import './assets/BaseAccordionItem.css';/* empty css */
6
- import { default as b } from "./packages/components/lib/UIKit/BaseSelect/SelectItem.vue.js";
7
- import { default as g } from "./packages/components/lib/UIKit/Checkbox/CheckboxBtn.vue.js";
8
- import { default as h } from "./packages/components/lib/UIKit/Checkbox/CheckboxGroup.vue.js";
9
- import { default as I } from "./packages/components/lib/UIKit/Tab/BaseTabView.vue.js";
10
- import { default as L } from "./packages/components/lib/UIKit/Tab/BaseTab.vue.js";
11
- import { default as D } from "./packages/components/lib/UIKit/Radio/RadioButton.vue.js";
12
- import { default as F } from "./packages/components/lib/UIKit/Radio/RadioGroup.vue.js";
13
- import { default as M } from "./packages/components/lib/UIKit/AccessibleSelect.vue.js";
14
- import { default as R } from "./packages/components/lib/UIKit/BaseAlert.vue.js";
1
+ import { default as u } from "./packages/components/lib/UIKit/Accordion/BaseAccordion.vue.js";
2
+ import { default as i } from "./packages/components/lib/UIKit/Accordion/BaseAccordionBtn.vue.js";
3
+ import { default as n } from "./packages/components/lib/UIKit/Accordion/BaseAccordionContent.vue.js";
4
+ import { default as S } from "./packages/components/lib/UIKit/Accordion/BaseAccordionItem.vue.js";
5
+ import './assets/BaseSnackbar.css';import './assets/BaseModal.css';import './assets/BaseDropDown.css';import './assets/BaseBadge.css';import './assets/ClearableAutocomplete.css';import './assets/BaseAutocomplete.css';import './assets/BaseAlert.css';import './assets/CheckboxBtn.css';import './assets/BaseAccordionItem.css';/* empty css */
6
+ import { default as C } from "./packages/components/lib/UIKit/BaseSelect/SelectItem.vue.js";
7
+ import { default as A } from "./packages/components/lib/UIKit/Checkbox/CheckboxBtn.vue.js";
8
+ /* empty css */
9
+ import { default as T } from "./packages/components/lib/UIKit/Checkbox/CheckboxGroup.vue.js";
10
+ import { default as w } from "./packages/components/lib/UIKit/Tab/BaseTabView.vue.js";
11
+ import { default as k } from "./packages/components/lib/UIKit/Tab/BaseTab.vue.js";
12
+ import { default as v } from "./packages/components/lib/UIKit/Radio/RadioButton.vue.js";
13
+ import { default as G } from "./packages/components/lib/UIKit/Radio/RadioGroup.vue.js";
14
+ import { default as O } from "./packages/components/lib/UIKit/AccessibleSelect.vue.js";
15
+ import { default as P } from "./packages/components/lib/UIKit/BaseAlert.vue.js";
15
16
  /* empty css */
16
- import { default as U } from "./packages/components/lib/UIKit/BaseAutocomplete.vue.js";
17
+ import { default as V } from "./packages/components/lib/UIKit/BaseAutocomplete.vue.js";
17
18
  /* empty css */
18
- import { default as j } from "./packages/components/lib/UIKit/Autocomplete/ClearableAutocomplete.vue.js";
19
+ import { default as q } from "./packages/components/lib/UIKit/Autocomplete/ClearableAutocomplete.vue.js";
19
20
  /* empty css */
20
- import { default as y } from "./packages/components/lib/UIKit/BaseBadge.vue.js";
21
+ import { default as z } from "./packages/components/lib/UIKit/BaseBadge.vue.js";
21
22
  /* empty css */
22
- import { default as E } from "./packages/components/lib/UIKit/BaseButton.vue.js";
23
- import { default as J } from "./UIKit/BaseCard.js";
24
- import { default as N } from "./UIKit/BaseComplexToggle.js";
25
- import { default as W } from "./packages/components/lib/UIKit/BaseDropDown.vue.js";
23
+ import { default as H } from "./packages/components/lib/UIKit/BaseButton.vue.js";
24
+ import { default as K } from "./UIKit/BaseCard.js";
25
+ import { default as Q } from "./UIKit/BaseComplexToggle.js";
26
+ import { default as X } from "./packages/components/lib/UIKit/BaseDropDown.vue.js";
26
27
  /* empty css */
27
- import { default as Y } from "./UIKit/BaseFloatingLabel.js";
28
- import { default as _ } from "./UIKit/BaseInput.js";
29
- import { default as ee } from "./packages/components/lib/UIKit/BasePagination.vue.js";
30
- import { default as oe } from "./UIKit/BaseSlider.js";
31
- import { default as re } from "./UIKit/BaseTextarea.js";
32
- import { default as se } from "./UIKit/BaseToggle.js";
33
- import { default as pe } from "./UIKit/BaseTooltip.js";
34
- import { default as de } from "./packages/components/lib/UIKit/BaseUploadFile.vue.js";
35
- import { default as xe } from "./packages/components/lib/UIKit/BaseModal.vue.js";
28
+ import { default as Z } from "./UIKit/BaseFloatingLabel.js";
29
+ import { default as $ } from "./UIKit/BaseInput.js";
30
+ import { default as ae } from "./packages/components/lib/UIKit/BasePagination.vue.js";
31
+ import { default as te } from "./UIKit/BaseSlider.js";
32
+ import { default as fe } from "./UIKit/BaseTextarea.js";
33
+ import { default as le } from "./UIKit/BaseToggle.js";
34
+ import { default as me } from "./UIKit/BaseTooltip.js";
35
+ import { default as ue } from "./packages/components/lib/UIKit/BaseUploadFile.vue.js";
36
+ import { default as ie } from "./packages/components/lib/UIKit/BaseModal.vue.js";
36
37
  /* empty css */
37
- import { default as Be } from "./UIKit/StaticSpinner.js";
38
- import { default as ce } from "./UIKit/ShimmerLoader/BaseShimmerLoader.js";
39
- import { default as be } from "./packages/components/lib/UIKit/ShimmerLoader/ShimmerMultiLine.vue.js";
40
- import { default as ge } from "./packages/components/lib/chart/DoughnutChart.vue.js";
41
- import { default as he } from "./packages/components/lib/chart/LineChart.vue.js";
42
- import { default as Ie } from "./UIKit/Slider/SimpleSlider.js";
43
- import { default as Le } from "./packages/components/lib/UIKit/BaseSnackbar.vue.js";
38
+ import { default as ne } from "./UIKit/StaticSpinner.js";
39
+ import { default as Se } from "./UIKit/ShimmerLoader/BaseShimmerLoader.js";
40
+ import { default as Ce } from "./packages/components/lib/UIKit/ShimmerLoader/ShimmerMultiLine.vue.js";
41
+ import { default as Ae } from "./packages/components/lib/chart/DoughnutChart.vue.js";
42
+ import { default as Te } from "./packages/components/lib/chart/LineChart.vue.js";
43
+ import { default as we } from "./UIKit/Slider/SimpleSlider.js";
44
+ import { default as ke } from "./packages/components/lib/UIKit/BaseSnackbar.vue.js";
44
45
  /* empty css */
45
- import { default as De } from "./packages/components/lib/components/IntersectionObserver/IntersectionObservable.vue.js";
46
- import { default as Fe } from "./packages/components/lib/components/IntersectionObserver/IntersectionObserver.vue.js";
47
- import { default as Me } from "./components/carousel/SwiperCarousel.js";
48
- import { default as Re } from "./components/carousel/SwiperSlide.js";
49
- import { default as Ue } from "./packages/components/lib/UIKit/BaseBreadcrumb.vue.js";
46
+ import { default as ve } from "./packages/components/lib/components/IntersectionObserver/IntersectionObservable.vue.js";
47
+ import { default as Ge } from "./packages/components/lib/components/IntersectionObserver/IntersectionObserver.vue.js";
48
+ import { default as Oe } from "./components/carousel/SwiperCarousel.js";
49
+ import { default as Pe } from "./components/carousel/SwiperSlide.js";
50
+ import { default as Ve } from "./packages/components/lib/UIKit/BaseBreadcrumb.vue.js";
50
51
  export {
51
- M as AccessibleSelect,
52
- d as BaseAccordion,
53
- x as BaseAccordionBtn,
54
- B as BaseAccordionContent,
55
- c as BaseAccordionItem,
56
- R as BaseAlert,
57
- U as BaseAutocomplete,
58
- y as BaseBadge,
59
- Ue as BaseBreadcrumb,
60
- E as BaseButton,
61
- J as BaseCard,
62
- N as BaseComplexToggle,
63
- W as BaseDropDown,
64
- Y as BaseFloatingLabel,
65
- _ as BaseInput,
66
- xe as BaseModal,
67
- ee as BasePagination,
68
- ce as BaseShimmerLoader,
69
- oe as BaseSlider,
70
- Le as BaseSnackbar,
71
- L as BaseTab,
72
- I as BaseTabView,
73
- re as BaseTextarea,
74
- se as BaseToggle,
75
- pe as BaseTooltip,
76
- de as BaseUploadFile,
77
- g as CheckboxBtn,
78
- h as CheckboxGroup,
79
- j as ClearableAutocomplete,
80
- ge as DoughnutChart,
81
- De as IntersectionObservable,
82
- Fe as IntersectionObserver,
83
- he as LineChart,
84
- D as RadioButton,
85
- F as RadioGroup,
86
- b as SelectItem,
87
- be as ShimmerMultiLine,
88
- Ie as SimpleSlider,
89
- Be as StaticSpinner,
90
- Me as SwiperCarousel,
91
- Re as SwiperSlide
52
+ O as AccessibleSelect,
53
+ u as BaseAccordion,
54
+ i as BaseAccordionBtn,
55
+ n as BaseAccordionContent,
56
+ S as BaseAccordionItem,
57
+ P as BaseAlert,
58
+ V as BaseAutocomplete,
59
+ z as BaseBadge,
60
+ Ve as BaseBreadcrumb,
61
+ H as BaseButton,
62
+ K as BaseCard,
63
+ Q as BaseComplexToggle,
64
+ X as BaseDropDown,
65
+ Z as BaseFloatingLabel,
66
+ $ as BaseInput,
67
+ ie as BaseModal,
68
+ ae as BasePagination,
69
+ Se as BaseShimmerLoader,
70
+ te as BaseSlider,
71
+ ke as BaseSnackbar,
72
+ k as BaseTab,
73
+ w as BaseTabView,
74
+ fe as BaseTextarea,
75
+ le as BaseToggle,
76
+ me as BaseTooltip,
77
+ ue as BaseUploadFile,
78
+ A as CheckboxBtn,
79
+ T as CheckboxGroup,
80
+ q as ClearableAutocomplete,
81
+ Ae as DoughnutChart,
82
+ ve as IntersectionObservable,
83
+ Ge as IntersectionObserver,
84
+ Te as LineChart,
85
+ v as RadioButton,
86
+ G as RadioGroup,
87
+ C as SelectItem,
88
+ Ce as ShimmerMultiLine,
89
+ we as SimpleSlider,
90
+ ne as StaticSpinner,
91
+ Oe as SwiperCarousel,
92
+ Pe as SwiperSlide
92
93
  };
@@ -1,7 +1,7 @@
1
- import { defineComponent as D, mergeModels as $, useModel as p, useId as F, computed as M, ref as V, watch as y, onMounted as E, onUnmounted as P, createElementBlock as u, openBlock as n, normalizeClass as a, createElementVNode as o, createCommentVNode as r, withModifiers as c, renderSlot as z, unref as b, createBlock as A, createVNode as N, Fragment as L, renderList as O } from "vue";
2
- import { useKeyboardController as S } from "@wikicasa-dev/vue-composables";
3
- import { WarningIconRounded as q, ArrowIcon as j } from "@wikicasa-dev/svg-icons";
4
- const K = ["id", "innerHTML"], R = ["id", "data-cy", "aria-required", "aria-controls", "aria-labelledby", "aria-expanded", "aria-activedescendant", "aria-invalid", "aria-describedby"], U = ["innerHTML"], W = { class: "uikit-pointer-events-none uikit-mt-1 uikit-inline-flex" }, G = ["innerHTML"], J = ["data-cy"], Q = ["id", "aria-selected", "onClick", "onMouseover"], X = { class: "uikit-inline-block uikit-cursor-pointer uikit-text-sm" }, Y = ["name", "checked", "onInput"], Z = ["innerHTML"], _ = ["id", "arial-live", "innerHTML"], ee = ["id", "arial-live", "innerHTML"], ae = /* @__PURE__ */ D({
1
+ import { defineComponent as H, mergeModels as $, useModel as p, useId as I, computed as M, ref as D, watch as h, onMounted as F, onUnmounted as P, createElementBlock as u, openBlock as n, normalizeClass as a, createElementVNode as o, createCommentVNode as r, withModifiers as c, renderSlot as z, unref as b, createBlock as A, createVNode as E, Fragment as V, renderList as N } from "vue";
2
+ import { useKeyboardController as O } from "@wikicasa-dev/vue-composables";
3
+ import { WarningIconRounded as S, ArrowIcon as q } from "@wikicasa-dev/svg-icons";
4
+ const j = ["id", "innerHTML"], K = ["id", "data-cy", "aria-required", "aria-controls", "aria-labelledby", "aria-expanded", "aria-activedescendant", "aria-invalid", "aria-describedby"], R = ["innerHTML"], U = { class: "uikit-pointer-events-none uikit-mt-1 uikit-inline-flex" }, W = ["innerHTML"], G = ["data-cy"], J = ["id", "aria-selected", "onClick", "onMouseover"], Q = { class: "uikit-inline-block uikit-cursor-pointer uikit-text-sm" }, X = ["name", "checked", "onInput"], Y = ["innerHTML"], Z = ["id", "arial-live", "innerHTML"], _ = ["id", "arial-live", "innerHTML"], le = /* @__PURE__ */ H({
5
5
  inheritAttrs: !1,
6
6
  __name: "AccessibleSelect",
7
7
  props: /* @__PURE__ */ $({
@@ -32,24 +32,24 @@ const K = ["id", "innerHTML"], R = ["id", "data-cy", "aria-required", "aria-cont
32
32
  toggleDropdownModifiers: {}
33
33
  }),
34
34
  emits: /* @__PURE__ */ $(["click", "update:dropdownState"], ["update:modelValue", "update:toggleDropdown"]),
35
- setup(e, { emit: T }) {
36
- const h = T, k = p(e, "modelValue"), g = p(e, "toggleDropdown"), B = F(), l = M(() => e.namespace || B), t = V(!1), H = V(null), m = M(() => !!k.value.label), { activeIdx: v, selectedIdx: I } = S({
35
+ setup(e, { emit: L }) {
36
+ const y = L, k = p(e, "modelValue"), g = p(e, "toggleDropdown"), T = I(), l = M(() => e.namespace || T), t = D(!1), m = M(() => !!k.value.label), { activeIdx: v, selectedIdx: B } = O({
37
37
  optionsLength: e.options.length,
38
38
  isDropdownOpen: t
39
39
  }), w = (i) => {
40
40
  t.value = !1, k.value = i;
41
41
  };
42
- y(I, (i) => {
42
+ h(B, (i) => {
43
43
  w(e.options[i]), t.value = !1;
44
- }), y(g, (i) => {
44
+ }), h(g, (i) => {
45
45
  i && (t.value = !t.value, g.value = !1);
46
- }), y(t, (i) => {
47
- h("update:dropdownState", i);
46
+ }), h(t, (i) => {
47
+ y("update:dropdownState", i);
48
48
  });
49
49
  const C = ({ target: i }) => {
50
50
  `${l.value}_btn` !== i.id && (t.value = !1);
51
51
  };
52
- return E(() => {
52
+ return F(() => {
53
53
  e.closeOnBodyPressed && document.addEventListener("click", C);
54
54
  }), P(() => {
55
55
  e.closeOnBodyPressed && document.removeEventListener("click", C);
@@ -69,7 +69,7 @@ const K = ["id", "innerHTML"], R = ["id", "data-cy", "aria-required", "aria-cont
69
69
  { "uikit-left-4": !i.$slots.lefticon && !m.value }
70
70
  ]]),
71
71
  innerHTML: e.label
72
- }, null, 10, K)) : r("", !0),
72
+ }, null, 10, j)) : r("", !0),
73
73
  i.$slots.lefticon ? (n(), u("span", {
74
74
  key: 1,
75
75
  class: "uikit-z-20 uikit-mt-2 uikit-pl-2",
@@ -79,8 +79,7 @@ const K = ["id", "innerHTML"], R = ["id", "data-cy", "aria-required", "aria-cont
79
79
  ])) : r("", !0),
80
80
  o("button", {
81
81
  id: `${l.value}_btn`,
82
- ref_key: "btnEl",
83
- ref: H,
82
+ ref: "btnEl",
84
83
  type: "button",
85
84
  "data-cy": e.dataCy,
86
85
  class: a(["uikit-peer uikit-relative uikit-z-10 uikit-flex uikit-h-full uikit-w-full uikit-items-center uikit-justify-between uikit-truncate uikit-border-0 uikit-bg-transparent uikit-pr-4 uikit-text-left focus-visible:uikit-outline-0", [i.$slots.lefticon ? "uikit-pl-2" : "uikit-pl-4", e.btnClasses]]),
@@ -94,22 +93,22 @@ const K = ["id", "innerHTML"], R = ["id", "data-cy", "aria-required", "aria-cont
94
93
  "aria-invalid": e.isValid === !1,
95
94
  "aria-describedby": e.isValid === !1 ? `${l.value}_invalid_msg` : void 0,
96
95
  onClick: s[1] || (s[1] = (d) => {
97
- t.value = !t.value, h("click", d);
96
+ t.value = !t.value, y("click", d);
98
97
  })
99
98
  }, [
100
99
  o("span", {
101
100
  class: a(["uikit-pointer-events-none uikit-mt-1", e.btnTextClasses]),
102
101
  innerHTML: k.value.visibleLabel || k.value.label
103
- }, null, 10, U),
104
- o("span", W, [
105
- e.isValid == !1 ? (n(), A(b(q), {
102
+ }, null, 10, R),
103
+ o("span", U, [
104
+ e.isValid == !1 ? (n(), A(b(S), {
106
105
  key: 0,
107
106
  class: "uikit-mr-1",
108
107
  width: 20,
109
108
  height: 20,
110
109
  "stroke-color": "#FA4F64"
111
110
  })) : r("", !0),
112
- N(b(j), {
111
+ E(b(q), {
113
112
  class: a(["uikit-transition-transform motion-reduce:uikit-transition-none", [
114
113
  t.value ? "uikit-rotate-180" : "",
115
114
  e.arrowIcon?.classes
@@ -119,7 +118,7 @@ const K = ["id", "innerHTML"], R = ["id", "data-cy", "aria-required", "aria-cont
119
118
  "stroke-color": e.isValid ? "#2B5DFF" : e.isValid === !1 ? "#FA4F64" : e.arrowIcon?.strokeColor ?? "#222"
120
119
  }, null, 8, ["class", "width", "height", "stroke-color"])
121
120
  ])
122
- ], 10, R),
121
+ ], 10, K),
123
122
  o("fieldset", {
124
123
  "aria-hidden": "true",
125
124
  class: a(["uikit-pointer-events-none uikit-absolute uikit-bottom-0 uikit-left-0 uikit-right-0 uikit-m-0 uikit-box-border uikit-h-12 uikit-cursor-pointer uikit-rounded-xs uikit-bg-white uikit-px-2 uikit-py-0 peer-focus:uikit-border-2", [
@@ -138,7 +137,7 @@ const K = ["id", "innerHTML"], R = ["id", "data-cy", "aria-required", "aria-cont
138
137
  key: 0,
139
138
  class: a(["uikit-mx-5px", [k.value.label ? "uikit-invisible" : "uikit-hidden"]]),
140
139
  innerHTML: e.label
141
- }, null, 10, G)) : r("", !0)
140
+ }, null, 10, W)) : r("", !0)
142
141
  ], 2)
143
142
  ], 2),
144
143
  o("ul", {
@@ -158,7 +157,7 @@ const K = ["id", "innerHTML"], R = ["id", "data-cy", "aria-required", "aria-cont
158
157
  onClick: s[3] || (s[3] = c(() => {
159
158
  }, ["stop"]))
160
159
  }, [
161
- (n(!0), u(L, null, O(e.options, (d, f) => (n(), u("li", {
160
+ (n(!0), u(V, null, N(e.options, (d, f) => (n(), u("li", {
162
161
  id: `${l.value}_element_${e.options[f].label}`,
163
162
  key: `${d.label}_${f}`,
164
163
  role: "option",
@@ -169,7 +168,7 @@ const K = ["id", "innerHTML"], R = ["id", "data-cy", "aria-required", "aria-cont
169
168
  onBlur: s[2] || (s[2] = c(() => {
170
169
  }, ["stop"]))
171
170
  }, [
172
- o("label", X, [
171
+ o("label", Q, [
173
172
  o("input", {
174
173
  tabindex: "-1",
175
174
  class: "uikit-m-0 uikit-appearance-none",
@@ -177,33 +176,33 @@ const K = ["id", "innerHTML"], R = ["id", "data-cy", "aria-required", "aria-cont
177
176
  type: "radio",
178
177
  checked: d.label === k.value.label,
179
178
  onInput: c((x) => w(d), ["stop"])
180
- }, null, 40, Y),
179
+ }, null, 40, X),
181
180
  o("span", {
182
181
  innerHTML: d.label
183
- }, null, 8, Z)
182
+ }, null, 8, Y)
184
183
  ])
185
- ], 42, Q))), 128))
186
- ], 10, J)
184
+ ], 42, J))), 128))
185
+ ], 10, G)
187
186
  ], 2),
188
- e.feedback ? (n(), u(L, { key: 0 }, [
187
+ e.feedback ? (n(), u(V, { key: 0 }, [
189
188
  e.feedback.valid ? (n(), u("span", {
190
189
  key: 0,
191
190
  id: `${l.value}_valid_msg`,
192
191
  "arial-live": i.$attrs["aria-live"],
193
192
  class: "uikit-mt-1 uikit-inline-block uikit-text-12",
194
193
  innerHTML: e.isValid ? e.feedback.valid : ""
195
- }, null, 8, _)) : r("", !0),
194
+ }, null, 8, Z)) : r("", !0),
196
195
  e.feedback.invalid ? (n(), u("span", {
197
196
  key: 1,
198
197
  id: `${l.value}_invalid_msg`,
199
198
  "arial-live": i.$attrs["aria-live"],
200
199
  class: "uikit-mt-1 uikit-inline-block uikit-text-12 uikit-text-w-danger",
201
200
  innerHTML: e.isValid === !1 ? e.feedback.invalid : ""
202
- }, null, 8, ee)) : r("", !0)
201
+ }, null, 8, _)) : r("", !0)
203
202
  ], 64)) : r("", !0)
204
203
  ], 2));
205
204
  }
206
205
  });
207
206
  export {
208
- ae as default
207
+ le as default
209
208
  };
@@ -1,16 +1,19 @@
1
- import { defineComponent as F, mergeModels as S, useModel as g, shallowRef as r, useTemplateRef as M, onBeforeMount as L, watch as k, nextTick as N, createBlock as $, openBlock as p, withCtx as m, createElementBlock as V, Fragment as O, renderList as U, renderSlot as c, createElementVNode as d, normalizeClass as C, withDirectives as D, createCommentVNode as E, vModelText as H, toDisplayString as K, normalizeStyle as A, createTextVNode as P } from "vue";
2
- import X from "../BaseDropDown.vue.js";
1
+ import { defineComponent as K, mergeModels as B, useModel as M, useTemplateRef as m, shallowRef as p, onBeforeMount as L, watch as b, nextTick as W, createBlock as V, openBlock as C, withCtx as y, createElementBlock as I, Fragment as N, renderList as A, renderSlot as c, createElementVNode as u, normalizeClass as f, withDirectives as F, vModelText as H, toDisplayString as G, withModifiers as P, normalizeStyle as X, createTextVNode as j, vShow 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 G = ["readonly"], J = ["innerHTML"], te = /* @__PURE__ */ F({
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__ */ S({
8
+ props: /* @__PURE__ */ B({
9
9
  dataCy: {},
10
+ placeholder: {},
11
+ enableKeyboardController: { type: Boolean, default: !0 },
10
12
  triggerWrapperClasses: {},
11
13
  inputWrapperClasses: {},
14
+ inputClasses: {},
12
15
  dropdownClasses: {},
13
- clearButtonClasses: {},
16
+ clearButton: {},
14
17
  keepState: {},
15
18
  onInputChangeCb: { type: Function },
16
19
  onOptionSelectedCb: { type: [Function, null] }
@@ -20,125 +23,146 @@ const G = ["readonly"], J = ["innerHTML"], te = /* @__PURE__ */ F({
20
23
  modelValue: { default: null },
21
24
  modelModifiers: {}
22
25
  }),
23
- emits: /* @__PURE__ */ S(["click"], ["update:open", "update:modelValue"]),
24
- setup(l, { emit: B }) {
25
- const s = g(l, "open"), i = g(l, "modelValue"), T = B, n = r(""), b = r(0), v = r(!1), y = r(null), a = r([]), x = M("dropdownRef"), f = M("hiddenSpan"), z = () => {
26
- n.value = "", i.value = null;
27
- }, W = async (t) => {
28
- if (!t) {
29
- a.value = [], s.value = !1;
26
+ emits: /* @__PURE__ */ B(["click", "inputClick", "update:inputValue", "keydown"], ["update:open", "update:modelValue"]),
27
+ setup(o, { expose: $, emit: E }) {
28
+ const r = M(o, "open"), a = M(o, "modelValue"), s = E, O = m("inputRef"), n = p(a.value?.label || ""), v = p(0), k = p(!1), w = p(null), i = p([]), g = m("dropdownRef"), h = m("hiddenSpan"), R = () => {
29
+ n.value = "", a.value = null, s("update:inputValue", "");
30
+ }, U = async (t) => {
31
+ if (s("update:inputValue", t), !t) {
32
+ i.value = [], r.value = !1;
30
33
  return;
31
34
  }
32
- a.value = await y.value?.(t) || [], v.value = !0, s.value = !!a.value.length;
33
- }, w = (t = -1) => {
34
- const e = a.value[t];
35
- !e || e.id === i.value?.id || (l.onOptionSelectedCb?.(e), n.value = e.label, s.value = !1, i.value = e, a.value = []);
35
+ i.value = await w.value?.(t) || [], k.value = !0, r.value = !!i.value.length;
36
+ }, S = (t = -1) => {
37
+ const e = i.value[t];
38
+ !e || e.id === a.value?.id || (o.onOptionSelectedCb?.(e), n.value = e.label, r.value = !1, a.value = e, i.value = []);
39
+ }, x = () => {
40
+ O.value?.select();
36
41
  };
37
42
  return L(() => {
38
- y.value = q({ delay: 300 }, l.onInputChangeCb);
39
- }), k(n, () => {
40
- N(() => {
41
- f.value && (b.value = f.value.offsetWidth);
42
- });
43
- }), k(
44
- () => x.value?.selectedIdx,
43
+ w.value = Y({ delay: 300 }, o.onInputChangeCb);
44
+ }), b(
45
+ [n, () => h.value],
46
+ ([t, e]) => {
47
+ e && W(() => {
48
+ if (!e) return;
49
+ const l = e.offsetWidth;
50
+ l !== v.value && (console.log("DEBUG:updating icon positioning", {
51
+ curInputValue: t
52
+ }), v.value = l);
53
+ });
54
+ },
55
+ { immediate: !0 }
56
+ ), b(
57
+ () => g.value?.selectedIdx,
45
58
  (t) => {
46
59
  const e = t ?? -1;
47
- e !== -1 && w(e);
60
+ e !== -1 && S(e);
48
61
  }
49
- ), k(
50
- i,
62
+ ), b(
63
+ a,
51
64
  (t, e) => {
52
65
  t === e || t?.label === n.value || (n.value = t?.label || "");
53
66
  },
54
67
  { immediate: !0 }
55
- ), (t, e) => (p(), $(X, {
68
+ ), $({
69
+ select: x,
70
+ getRootElement: () => g.value?.getRootElement()
71
+ }), (t, e) => (C(), V(J, {
56
72
  ref: "dropdownRef",
57
73
  class: "uikit-clearable-autocomplete",
58
- "data-cy": l.dataCy,
74
+ "data-cy": o.dataCy,
59
75
  "dropdown-element": "ul",
60
- "dropdown-classes": ["uikit-z-30", l.dropdownClasses],
61
- "open-dropdown": s.value,
62
- "keep-state": !a.value.length || l.keepState === "closed" ? "closed" : "opened",
63
- "reset-keyboard-controller": v.value,
64
- "onUpdate:resetKeyboardController": e[1] || (e[1] = (o) => v.value = o),
65
- "onUpdate:dropdownState": e[2] || (e[2] = (o) => s.value = o),
66
- onClick: e[3] || (e[3] = (o) => T("click"))
76
+ "dropdown-classes": ["uikit-z-30", o.dropdownClasses],
77
+ "open-dropdown": r.value,
78
+ "keep-state": !i.value.length || o.keepState === "closed" ? "closed" : "opened",
79
+ "activate-keyboard-controller": o.enableKeyboardController,
80
+ "reset-keyboard-controller": k.value,
81
+ "onUpdate:resetKeyboardController": e[4] || (e[4] = (l) => k.value = l),
82
+ "onUpdate:dropdownState": e[5] || (e[5] = (l) => r.value = l)
67
83
  }, {
68
- btn_slot: m(() => [
69
- d("div", {
70
- class: C(["uikit-text-16", l.triggerWrapperClasses])
84
+ btn_slot: y(() => [
85
+ u("div", {
86
+ class: f(["uikit-text-16", o.triggerWrapperClasses]),
87
+ onClick: e[3] || (e[3] = (l) => s("click", l))
71
88
  }, [
72
89
  c(t.$slots, "left-icon"),
73
- d("div", {
74
- class: C(["uikit-relative", l.inputWrapperClasses])
90
+ u("div", {
91
+ class: f(["uikit-relative", o.inputWrapperClasses])
75
92
  }, [
76
- D(d("input", {
93
+ F(u("input", {
94
+ ref: "inputRef",
77
95
  "onUpdate:modelValue": [
78
- e[0] || (e[0] = (o) => n.value = o),
79
- W
96
+ e[0] || (e[0] = (l) => n.value = l),
97
+ U
80
98
  ],
81
- readonly: !!i.value?.label,
82
- class: "uikit-w-full uikit-border-none focus-visible:uikit-outline-none",
99
+ readonly: !!a.value?.label,
100
+ type: "text",
101
+ autocomplete: "off",
102
+ class: f(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", o.inputClasses]),
83
103
  style: {
84
104
  font: "inherit",
85
105
  fontSize: "inherit"
86
- }
87
- }, null, 8, G), [
106
+ },
107
+ placeholder: o.placeholder,
108
+ onKeydown: e[1] || (e[1] = (l) => s("keydown", l)),
109
+ onClick: e[2] || (e[2] = (l) => s("inputClick", l))
110
+ }, null, 42, Z), [
88
111
  [H, n.value]
89
112
  ]),
90
- d("span", {
113
+ u("span", {
91
114
  ref_key: "hiddenSpan",
92
- ref: f,
115
+ ref: h,
93
116
  class: "uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre",
94
117
  style: {
95
118
  font: "inherit",
96
119
  fontSize: "inherit"
97
120
  }
98
- }, K(n.value), 513),
99
- i.value?.label ? (p(), V("button", {
100
- key: 0,
121
+ }, G(n.value), 513),
122
+ F(u("button", {
101
123
  type: "button",
102
- class: C(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", l.clearButtonClasses]),
124
+ class: f(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", o.clearButton?.classes]),
103
125
  "aria-label": "Clear input",
104
- style: A({
105
- left: `${b.value + 16}px`
126
+ style: X({
127
+ left: `${v.value + (o.clearButton?.offset || 10)}px`
106
128
  }),
107
- onClick: z
129
+ onClick: P(R, ["stop"])
108
130
  }, [
109
131
  c(t.$slots, "clear-icon", {}, () => [
110
- e[4] || (e[4] = P("X", -1))
132
+ e[6] || (e[6] = j("X", -1))
111
133
  ])
112
- ], 6)) : E("", !0)
134
+ ], 6), [
135
+ [q, a.value?.label]
136
+ ])
113
137
  ], 2),
114
138
  c(t.$slots, "right-icon")
115
139
  ], 2)
116
140
  ]),
117
- default: m(({ activeIdx: o, setActiveIdx: I }) => [
118
- (p(!0), V(O, null, U(a.value, (h, u) => (p(), $(j, {
119
- key: u,
120
- active: o === u,
141
+ default: y(({ activeIdx: l, setActiveIdx: z }) => [
142
+ (C(!0), I(N, null, A(i.value, (T, d) => (C(), V(Q, {
143
+ key: d,
144
+ active: l === d,
121
145
  class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
122
- onClick: (R) => w(u),
123
- onMouseover: (R) => I(u)
146
+ onClick: (D) => S(d),
147
+ onMouseover: (D) => z(d)
124
148
  }, {
125
- default: m(() => [
149
+ default: y(() => [
126
150
  c(t.$slots, "option-content", {
127
- option: h,
128
- idx: u
151
+ option: T,
152
+ idx: d
129
153
  }, () => [
130
- d("span", {
131
- innerHTML: h.label
132
- }, null, 8, J)
154
+ u("span", {
155
+ innerHTML: T.label
156
+ }, null, 8, _)
133
157
  ])
134
158
  ]),
135
159
  _: 2
136
160
  }, 1032, ["active", "onClick", "onMouseover"]))), 128))
137
161
  ]),
138
162
  _: 3
139
- }, 8, ["data-cy", "dropdown-classes", "open-dropdown", "keep-state", "reset-keyboard-controller"]));
163
+ }, 8, ["data-cy", "dropdown-classes", "open-dropdown", "keep-state", "activate-keyboard-controller", "reset-keyboard-controller"]));
140
164
  }
141
165
  });
142
166
  export {
143
- te as default
167
+ ie as default
144
168
  };