@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/Swiper/autoplay.js +1 -1
- package/dist/Swiper/controller.js +1 -1
- package/dist/Swiper/keyboard.js +1 -1
- package/dist/Swiper/thumbs.js +1 -1
- package/dist/UIKit/Autocomplete/ClearableAutocomplete.d.ts +18 -5
- package/dist/UIKit/BaseDropDown.d.ts +3 -0
- package/dist/UIKit/BaseFloatingLabel.js +4 -4
- package/dist/UIKit/BaseModal.d.ts +4 -0
- package/dist/UIKit/Checkbox/CheckboxBtn.d.ts +34 -38
- package/dist/UIKit/Checkbox/CheckboxBtn.js +3 -2
- package/dist/UIKit/Checkbox/CheckboxGroup.d.ts +6 -9
- package/dist/assets/BaseFloatingLabel.css +1 -1
- package/dist/assets/CheckboxBtn.css +1 -0
- package/dist/assets/tailwind.css +1 -1
- package/dist/components/carousel/SwiperCarousel.d.ts +8 -8
- package/dist/index.js +84 -83
- package/dist/packages/components/lib/UIKit/AccessibleSelect.vue.js +30 -31
- package/dist/packages/components/lib/UIKit/Autocomplete/ClearableAutocomplete.vue.js +98 -74
- package/dist/packages/components/lib/UIKit/BaseDropDown.vue.js +101 -96
- package/dist/packages/components/lib/UIKit/BaseFloatingLabel.vue.js +8 -8
- package/dist/packages/components/lib/UIKit/BaseModal.vue.js +11 -10
- package/dist/packages/components/lib/UIKit/Checkbox/CheckboxBtn.vue.js +3 -3
- package/dist/packages/components/lib/UIKit/Checkbox/CheckboxGroup.vue.js +42 -39
- package/package.json +3 -3
- /package/dist/assets/{swiper-autoplay.css → swiper-thumbs.css} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,92 +1,93 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { default as
|
|
3
|
-
import { default as
|
|
4
|
-
import { default as
|
|
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
|
|
7
|
-
import { default as
|
|
8
|
-
|
|
9
|
-
import { default as
|
|
10
|
-
import { default as
|
|
11
|
-
import { default as
|
|
12
|
-
import { default as
|
|
13
|
-
import { default as
|
|
14
|
-
import { default as
|
|
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
|
|
17
|
+
import { default as V } from "./packages/components/lib/UIKit/BaseAutocomplete.vue.js";
|
|
17
18
|
/* empty css */
|
|
18
|
-
import { default as
|
|
19
|
+
import { default as q } from "./packages/components/lib/UIKit/Autocomplete/ClearableAutocomplete.vue.js";
|
|
19
20
|
/* empty css */
|
|
20
|
-
import { default as
|
|
21
|
+
import { default as z } from "./packages/components/lib/UIKit/BaseBadge.vue.js";
|
|
21
22
|
/* empty css */
|
|
22
|
-
import { default as
|
|
23
|
-
import { default as
|
|
24
|
-
import { default as
|
|
25
|
-
import { default as
|
|
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
|
|
28
|
-
import { default as
|
|
29
|
-
import { default as
|
|
30
|
-
import { default as
|
|
31
|
-
import { default as
|
|
32
|
-
import { default as
|
|
33
|
-
import { default as
|
|
34
|
-
import { default as
|
|
35
|
-
import { default as
|
|
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
|
|
38
|
-
import { default as
|
|
39
|
-
import { default as
|
|
40
|
-
import { default as
|
|
41
|
-
import { default as
|
|
42
|
-
import { default as
|
|
43
|
-
import { default as
|
|
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
|
|
46
|
-
import { default as
|
|
47
|
-
import { default as
|
|
48
|
-
import { default as
|
|
49
|
-
import { default as
|
|
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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
|
2
|
-
import { useKeyboardController as
|
|
3
|
-
import { WarningIconRounded as
|
|
4
|
-
const
|
|
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:
|
|
36
|
-
const
|
|
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
|
-
|
|
42
|
+
h(B, (i) => {
|
|
43
43
|
w(e.options[i]), t.value = !1;
|
|
44
|
-
}),
|
|
44
|
+
}), h(g, (i) => {
|
|
45
45
|
i && (t.value = !t.value, g.value = !1);
|
|
46
|
-
}),
|
|
47
|
-
|
|
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
|
|
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,
|
|
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
|
-
|
|
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,
|
|
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,
|
|
104
|
-
o("span",
|
|
105
|
-
e.isValid == !1 ? (n(), A(b(
|
|
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
|
-
|
|
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,
|
|
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,
|
|
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(
|
|
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",
|
|
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,
|
|
179
|
+
}, null, 40, X),
|
|
181
180
|
o("span", {
|
|
182
181
|
innerHTML: d.label
|
|
183
|
-
}, null, 8,
|
|
182
|
+
}, null, 8, Y)
|
|
184
183
|
])
|
|
185
|
-
], 42,
|
|
186
|
-
], 10,
|
|
184
|
+
], 42, J))), 128))
|
|
185
|
+
], 10, G)
|
|
187
186
|
], 2),
|
|
188
|
-
e.feedback ? (n(), u(
|
|
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,
|
|
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,
|
|
201
|
+
}, null, 8, _)) : r("", !0)
|
|
203
202
|
], 64)) : r("", !0)
|
|
204
203
|
], 2));
|
|
205
204
|
}
|
|
206
205
|
});
|
|
207
206
|
export {
|
|
208
|
-
|
|
207
|
+
le as default
|
|
209
208
|
};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
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
|
|
5
|
-
import { debounce as
|
|
6
|
-
const
|
|
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__ */
|
|
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
|
-
|
|
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__ */
|
|
24
|
-
setup(
|
|
25
|
-
const
|
|
26
|
-
n.value = "",
|
|
27
|
-
},
|
|
28
|
-
if (!t) {
|
|
29
|
-
|
|
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
|
-
|
|
33
|
-
},
|
|
34
|
-
const e =
|
|
35
|
-
!e || e.id ===
|
|
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
|
-
|
|
39
|
-
}),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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 &&
|
|
60
|
+
e !== -1 && S(e);
|
|
48
61
|
}
|
|
49
|
-
),
|
|
50
|
-
|
|
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
|
-
),
|
|
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":
|
|
74
|
+
"data-cy": o.dataCy,
|
|
59
75
|
"dropdown-element": "ul",
|
|
60
|
-
"dropdown-classes": ["uikit-z-30",
|
|
61
|
-
"open-dropdown":
|
|
62
|
-
"keep-state": !
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"onUpdate:
|
|
66
|
-
|
|
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:
|
|
69
|
-
|
|
70
|
-
class:
|
|
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
|
-
|
|
74
|
-
class:
|
|
90
|
+
u("div", {
|
|
91
|
+
class: f(["uikit-relative", o.inputWrapperClasses])
|
|
75
92
|
}, [
|
|
76
|
-
|
|
93
|
+
F(u("input", {
|
|
94
|
+
ref: "inputRef",
|
|
77
95
|
"onUpdate:modelValue": [
|
|
78
|
-
e[0] || (e[0] = (
|
|
79
|
-
|
|
96
|
+
e[0] || (e[0] = (l) => n.value = l),
|
|
97
|
+
U
|
|
80
98
|
],
|
|
81
|
-
readonly: !!
|
|
82
|
-
|
|
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
|
-
|
|
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
|
-
|
|
113
|
+
u("span", {
|
|
91
114
|
ref_key: "hiddenSpan",
|
|
92
|
-
ref:
|
|
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
|
-
},
|
|
99
|
-
|
|
100
|
-
key: 0,
|
|
121
|
+
}, G(n.value), 513),
|
|
122
|
+
F(u("button", {
|
|
101
123
|
type: "button",
|
|
102
|
-
class:
|
|
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:
|
|
105
|
-
left: `${
|
|
126
|
+
style: X({
|
|
127
|
+
left: `${v.value + (o.clearButton?.offset || 10)}px`
|
|
106
128
|
}),
|
|
107
|
-
onClick:
|
|
129
|
+
onClick: P(R, ["stop"])
|
|
108
130
|
}, [
|
|
109
131
|
c(t.$slots, "clear-icon", {}, () => [
|
|
110
|
-
e[
|
|
132
|
+
e[6] || (e[6] = j("X", -1))
|
|
111
133
|
])
|
|
112
|
-
], 6)
|
|
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:
|
|
118
|
-
(
|
|
119
|
-
key:
|
|
120
|
-
active:
|
|
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: (
|
|
123
|
-
onMouseover: (
|
|
146
|
+
onClick: (D) => S(d),
|
|
147
|
+
onMouseover: (D) => z(d)
|
|
124
148
|
}, {
|
|
125
|
-
default:
|
|
149
|
+
default: y(() => [
|
|
126
150
|
c(t.$slots, "option-content", {
|
|
127
|
-
option:
|
|
128
|
-
idx:
|
|
151
|
+
option: T,
|
|
152
|
+
idx: d
|
|
129
153
|
}, () => [
|
|
130
|
-
|
|
131
|
-
innerHTML:
|
|
132
|
-
}, null, 8,
|
|
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
|
-
|
|
167
|
+
ie as default
|
|
144
168
|
};
|