@wikicasa-dev/components 2.2.8-alpha.33 → 2.2.8-alpha.4
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/Accordion/BaseAccordionItem.d.ts +1 -6
- package/dist/UIKit/BaseAutocomplete.d.ts +7 -7
- package/dist/UIKit/BaseDropDown.d.ts +1 -10
- package/dist/UIKit/BaseFloatingLabel.js +4 -4
- package/dist/UIKit/BaseModal.d.ts +0 -4
- package/dist/UIKit/Checkbox/CheckboxBtn.d.ts +38 -34
- package/dist/UIKit/Checkbox/CheckboxBtn.js +2 -3
- package/dist/UIKit/Checkbox/CheckboxGroup.d.ts +9 -6
- package/dist/assets/BaseFloatingLabel.css +1 -1
- package/dist/assets/tailwind.css +1 -1
- package/dist/components/carousel/SwiperCarousel.d.ts +8 -8
- package/dist/index.d.ts +0 -1
- package/dist/index.js +81 -85
- package/dist/packages/components/lib/UIKit/AccessibleSelect.vue.js +31 -30
- package/dist/packages/components/lib/UIKit/Accordion/BaseAccordionItem.vue.js +17 -21
- package/dist/packages/components/lib/UIKit/BaseAutocomplete.vue.js +4 -1
- package/dist/packages/components/lib/UIKit/BaseDropDown.vue.js +86 -104
- package/dist/packages/components/lib/UIKit/BaseFloatingLabel.vue.js +8 -8
- package/dist/packages/components/lib/UIKit/BaseModal.vue.js +10 -11
- package/dist/packages/components/lib/UIKit/Checkbox/CheckboxBtn.vue.js +3 -3
- package/dist/packages/components/lib/UIKit/Checkbox/CheckboxGroup.vue.js +39 -42
- package/package.json +3 -3
- package/dist/UIKit/Autocomplete/ClearableAutocomplete.d.ts +0 -54
- package/dist/UIKit/Autocomplete/ClearableAutocomplete.js +0 -5
- package/dist/assets/CheckboxBtn.css +0 -1
- package/dist/assets/ClearableAutocomplete.css +0 -1
- package/dist/packages/components/lib/UIKit/Autocomplete/ClearableAutocomplete.vue.js +0 -166
- /package/dist/assets/{swiper-keyboard.css → swiper-autoplay.css} +0 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { ArrowIcon as
|
|
4
|
-
import { useKeyboardController as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as L, mergeModels as b, useId as M, useModel as A, ref as h, computed as E, useTemplateRef as O, watch as d, onBeforeMount as W, onMounted as $, onUnmounted as H, createElementBlock as K, openBlock as c, withModifiers as y, normalizeClass as l, renderSlot as C, createBlock as g, createVNode as N, unref as n, withCtx as D, createElementVNode as T, createCommentVNode as V, resolveDynamicComponent as q } from "vue";
|
|
2
|
+
import z from "./BaseButton.vue.js";
|
|
3
|
+
import { ArrowIcon as R } from "@wikicasa-dev/svg-icons";
|
|
4
|
+
import { useKeyboardController as U } from "@wikicasa-dev/vue-composables";
|
|
5
|
+
const j = ["innerHTML"], X = /* @__PURE__ */ L({
|
|
6
6
|
inheritAttrs: !1,
|
|
7
7
|
__name: "BaseDropDown",
|
|
8
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ b({
|
|
9
9
|
dropdownClasses: { default: "" },
|
|
10
10
|
btnClasses: { default: "" },
|
|
11
11
|
withArrowIcon: { type: Boolean, default: !1 },
|
|
@@ -23,123 +23,105 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ T({
|
|
|
23
23
|
dataCy: { default: "" }
|
|
24
24
|
}, {
|
|
25
25
|
toggleDropdown: { type: Boolean, default: void 0 },
|
|
26
|
-
toggleDropdownModifiers: {}
|
|
27
|
-
resetKeyboardController: { type: Boolean, default: !1 },
|
|
28
|
-
resetKeyboardControllerModifiers: {}
|
|
26
|
+
toggleDropdownModifiers: {}
|
|
29
27
|
}),
|
|
30
|
-
emits: /* @__PURE__ */
|
|
31
|
-
setup(
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
isDropdownOpen: t,
|
|
40
|
-
activate: n.activateKeyboardController
|
|
41
|
-
}), O = () => {
|
|
42
|
-
t.value = !1;
|
|
43
|
-
}, b = ({ target: e }) => {
|
|
44
|
-
s.value?.contains(e) || O();
|
|
45
|
-
}, C = (e) => {
|
|
46
|
-
t.value && s.value?.contains(document.activeElement) && (console.log("DEBUG:closing dropdown", document.activeElement), e.key === "Tab" && (t.value = !1));
|
|
47
|
-
}, c = () => {
|
|
48
|
-
n.keepState === "closed" && !t.value || n.keepState === "opened" && t.value || (t.value = !t.value);
|
|
49
|
-
}, W = (e) => {
|
|
50
|
-
e != null && (d.value = e);
|
|
51
|
-
}, $ = (e) => {
|
|
52
|
-
e != null && (a.value = e);
|
|
53
|
-
}, h = () => {
|
|
54
|
-
y.value && (u.value = Array.from(y.value.children));
|
|
55
|
-
};
|
|
56
|
-
return R(() => {
|
|
57
|
-
h();
|
|
58
|
-
}), V(() => {
|
|
59
|
-
n.closeWhenClickedOutside && (document.removeEventListener("click", b), document.removeEventListener("keydown", C));
|
|
60
|
-
}), l(w, (e) => {
|
|
61
|
-
e && (d.value = -1, a.value = -1, z(() => {
|
|
62
|
-
h(), w.value = !1;
|
|
63
|
-
}));
|
|
64
|
-
}), l(
|
|
65
|
-
() => n.openDropdown,
|
|
28
|
+
emits: /* @__PURE__ */ b(["click", "update:dropdownState"], ["update:toggleDropdown"]),
|
|
29
|
+
setup(t, { emit: B }) {
|
|
30
|
+
const i = t, f = M(), k = B, w = A(t, "toggleDropdown"), o = h(!1), r = h([]), x = E(() => r.value.length), v = O("dropdown"), { activeIdx: m, selectedIdx: u } = U({
|
|
31
|
+
optionsLength: x,
|
|
32
|
+
isDropdownOpen: o,
|
|
33
|
+
activate: i.activateKeyboardController
|
|
34
|
+
});
|
|
35
|
+
d(
|
|
36
|
+
() => i.openDropdown,
|
|
66
37
|
(e) => {
|
|
67
|
-
|
|
38
|
+
o.value = e;
|
|
68
39
|
},
|
|
69
40
|
{
|
|
70
41
|
immediate: !0
|
|
71
42
|
}
|
|
72
|
-
),
|
|
73
|
-
|
|
74
|
-
}),
|
|
75
|
-
|
|
76
|
-
}),
|
|
77
|
-
e
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
43
|
+
), d(o, (e) => {
|
|
44
|
+
k("update:dropdownState", e);
|
|
45
|
+
}), d(w, (e) => {
|
|
46
|
+
e && (o.value = !o.value, w.value = !1);
|
|
47
|
+
}), d(u, (e) => {
|
|
48
|
+
e !== -1 && r.value[e].querySelector("a")?.click();
|
|
49
|
+
});
|
|
50
|
+
const p = () => {
|
|
51
|
+
o.value = !1;
|
|
52
|
+
}, s = () => {
|
|
53
|
+
i.keepState === "closed" && !o.value || i.keepState === "opened" && o.value || (o.value = !o.value);
|
|
54
|
+
}, I = (e) => {
|
|
55
|
+
e != null && (m.value = e);
|
|
56
|
+
}, S = (e) => {
|
|
57
|
+
e != null && (u.value = e);
|
|
58
|
+
};
|
|
59
|
+
return W(() => {
|
|
60
|
+
i.closeWhenClickedOutside && document.body.addEventListener("click", p);
|
|
61
|
+
}), $(() => {
|
|
62
|
+
v.value && (r.value = v.value.children || []);
|
|
63
|
+
}), H(() => {
|
|
64
|
+
i.closeWhenClickedOutside && document.body.removeEventListener("click", p);
|
|
65
|
+
}), (e, a) => (c(), K("div", {
|
|
66
|
+
class: l(["uikit-relative uikit-block", e.$attrs.class]),
|
|
67
|
+
onClick: a[1] || (a[1] = y((F) => {
|
|
68
|
+
k("click"), s();
|
|
69
|
+
}, ["stop"]))
|
|
87
70
|
}, [
|
|
88
|
-
|
|
89
|
-
toggleDropdown:
|
|
90
|
-
isOpen:
|
|
71
|
+
C(e.$slots, "btn_slot", {
|
|
72
|
+
toggleDropdown: s,
|
|
73
|
+
isOpen: o.value
|
|
91
74
|
}, () => [
|
|
92
|
-
|
|
93
|
-
id:
|
|
75
|
+
N(z, {
|
|
76
|
+
id: n(f),
|
|
94
77
|
type: "button",
|
|
95
|
-
"data-cy":
|
|
96
|
-
class:
|
|
78
|
+
"data-cy": t.dataCy,
|
|
79
|
+
class: l([
|
|
97
80
|
"!uikit-flex uikit-w-full uikit-items-center uikit-truncate",
|
|
98
|
-
|
|
81
|
+
t.btnClasses
|
|
99
82
|
]),
|
|
100
|
-
"aria-expanded":
|
|
101
|
-
"btn-class": "uikit-btn-single-selection"
|
|
102
|
-
onClick: g[0] || (g[0] = (Y) => {
|
|
103
|
-
v("click"), c();
|
|
104
|
-
})
|
|
83
|
+
"aria-expanded": o.value,
|
|
84
|
+
"btn-class": "uikit-btn-single-selection"
|
|
105
85
|
}, {
|
|
106
|
-
default:
|
|
107
|
-
|
|
108
|
-
class:
|
|
109
|
-
innerHTML:
|
|
110
|
-
}, null, 10,
|
|
111
|
-
|
|
86
|
+
default: D(() => [
|
|
87
|
+
T("span", {
|
|
88
|
+
class: l(["uikit-mr-5px", t.labelClasses]),
|
|
89
|
+
innerHTML: t.btnLabel
|
|
90
|
+
}, null, 10, j),
|
|
91
|
+
t.withArrowIcon ? (c(), g(n(R), {
|
|
112
92
|
key: 0,
|
|
113
|
-
class:
|
|
114
|
-
width:
|
|
115
|
-
height:
|
|
116
|
-
"stroke-color":
|
|
117
|
-
}, null, 8, ["class", "width", "height", "stroke-color"])) :
|
|
93
|
+
class: l(["uikit-shrink-0 uikit-transition-transform motion-reduce:uikit-transition-none", o.value ? "uikit-rotate-180" : ""]),
|
|
94
|
+
width: t.arrowWidth,
|
|
95
|
+
height: t.arrowWidth,
|
|
96
|
+
"stroke-color": t.arrowStrokeColor
|
|
97
|
+
}, null, 8, ["class", "width", "height", "stroke-color"])) : V("", !0)
|
|
118
98
|
]),
|
|
119
99
|
_: 1
|
|
120
100
|
}, 8, ["id", "data-cy", "class", "aria-expanded"])
|
|
121
101
|
]),
|
|
122
|
-
(
|
|
123
|
-
id: "dropdown_" +
|
|
102
|
+
(c(), g(q(t.dropdownElement), {
|
|
103
|
+
id: "dropdown_" + n(f),
|
|
124
104
|
ref: "dropdown",
|
|
125
|
-
"data-cy":
|
|
126
|
-
class:
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
{ "uikit-bottom-[55px] uikit-rounded-xs":
|
|
130
|
-
{ "uikit-rounded-b uikit-border-t-0":
|
|
131
|
-
{ "uikit-absolute":
|
|
105
|
+
"data-cy": t.dataCy && `${t.dataCy}_dropdown`,
|
|
106
|
+
class: l(["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", [
|
|
107
|
+
t.dropdownClasses,
|
|
108
|
+
o.value ? "uikit-flex" : "uikit-hidden",
|
|
109
|
+
{ "uikit-bottom-[55px] uikit-rounded-xs": t.direction === "up" },
|
|
110
|
+
{ "uikit-rounded-b uikit-border-t-0": t.direction === "down" },
|
|
111
|
+
{ "uikit-absolute": t.isAbsolute }
|
|
132
112
|
]]),
|
|
133
|
-
"aria-hidden": !
|
|
113
|
+
"aria-hidden": !o.value,
|
|
114
|
+
onClick: a[0] || (a[0] = y(() => {
|
|
115
|
+
}, ["stop"]))
|
|
134
116
|
}, {
|
|
135
|
-
default:
|
|
136
|
-
|
|
137
|
-
isOpen:
|
|
138
|
-
toggleDropdown:
|
|
139
|
-
activeIdx:
|
|
140
|
-
selectedIdx:
|
|
141
|
-
setActiveIdx:
|
|
142
|
-
setSelectedIdx:
|
|
117
|
+
default: D(() => [
|
|
118
|
+
C(e.$slots, "default", {
|
|
119
|
+
isOpen: o.value,
|
|
120
|
+
toggleDropdown: s,
|
|
121
|
+
activeIdx: n(m),
|
|
122
|
+
selectedIdx: n(u),
|
|
123
|
+
setActiveIdx: I,
|
|
124
|
+
setSelectedIdx: S
|
|
143
125
|
})
|
|
144
126
|
]),
|
|
145
127
|
_: 3
|
|
@@ -148,5 +130,5 @@ const X = ["innerHTML"], oe = /* @__PURE__ */ T({
|
|
|
148
130
|
}
|
|
149
131
|
});
|
|
150
132
|
export {
|
|
151
|
-
|
|
133
|
+
X as default
|
|
152
134
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as d, createElementBlock as a, openBlock as s, withModifiers as
|
|
1
|
+
import { defineComponent as d, createElementBlock as a, openBlock as s, withModifiers as o, normalizeClass as t, createElementVNode as k, createCommentVNode as r } from "vue";
|
|
2
2
|
const b = ["for"], c = ["innerHTML"], x = /* @__PURE__ */ d({
|
|
3
3
|
__name: "BaseFloatingLabel",
|
|
4
4
|
props: {
|
|
@@ -11,14 +11,14 @@ const b = ["for"], c = ["innerHTML"], x = /* @__PURE__ */ d({
|
|
|
11
11
|
},
|
|
12
12
|
emits: ["click"],
|
|
13
13
|
setup(e, { emit: n }) {
|
|
14
|
-
const
|
|
14
|
+
const u = n;
|
|
15
15
|
return (i, l) => (s(), a("label", {
|
|
16
16
|
for: i.$attrs.for,
|
|
17
|
-
class: t(["uikit-pointer-events-none uikit-absolute uikit-left-15px uikit-h-5", [e.labelState, { "uikit-text-w-secondary": e.disabled }, e.labelClasses]]),
|
|
18
|
-
onClick: l[0] || (l[0] =
|
|
17
|
+
class: t(["uikit-pointer-events-none uikit-absolute uikit-left-15px uikit-h-5 uikit-text-sm", [e.labelState, { "uikit-text-w-secondary": e.disabled }, e.labelClasses]]),
|
|
18
|
+
onClick: l[0] || (l[0] = o((m) => u("click"), ["stop"]))
|
|
19
19
|
}, [
|
|
20
|
-
|
|
21
|
-
class: t(["uikit-font-medium
|
|
20
|
+
k("span", {
|
|
21
|
+
class: t(["uikit-text uikit-font-medium", [
|
|
22
22
|
e.disabled ? "uikit-text-w-secondary" : "uikit-text-w-black",
|
|
23
23
|
e.labelTextClasses
|
|
24
24
|
]]),
|
|
@@ -26,12 +26,12 @@ const b = ["for"], c = ["innerHTML"], x = /* @__PURE__ */ d({
|
|
|
26
26
|
}, null, 10, c),
|
|
27
27
|
i.$attrs.required ? (s(), a("sup", {
|
|
28
28
|
key: 0,
|
|
29
|
-
class: t(["uikit-absolute -uikit-top-[0.3rem]
|
|
29
|
+
class: t(["uikit-absolute -uikit-top-[0.3rem] uikit-text", [
|
|
30
30
|
{ "uikit-text-w-secondary": e.disabled },
|
|
31
31
|
{ "uikit-text-w-danger": e.isValid === !1 },
|
|
32
32
|
{ "uikit-text-w-primary": (e.isValid || e.isValid === null) && !e.disabled }
|
|
33
33
|
]])
|
|
34
|
-
}, " *", 2)) :
|
|
34
|
+
}, " *", 2)) : r("", !0)
|
|
35
35
|
], 10, b));
|
|
36
36
|
}
|
|
37
37
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as T, ref as n, useTemplateRef as z, onUnmounted as H, watch as I, createBlock as O, openBlock as r, Teleport as $, createElementVNode as l, normalizeClass as s, withModifiers as y, createElementBlock as h, createCommentVNode as w, renderSlot as d, createVNode as D, unref as K, nextTick as N } from "vue";
|
|
2
2
|
import { isWindows as C, awaitableSetTimeout as S } from "@wikicasa-dev/utilities";
|
|
3
3
|
import { CloseIcon as V } from "@wikicasa-dev/svg-icons";
|
|
4
|
-
const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */
|
|
4
|
+
const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ T({
|
|
5
5
|
__name: "BaseModal",
|
|
6
6
|
props: {
|
|
7
7
|
id: { default: "base-bt-modal" },
|
|
@@ -11,7 +11,6 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
|
|
|
11
11
|
customModalHeaderClasses: {},
|
|
12
12
|
customModalBodyClasses: {},
|
|
13
13
|
customModalFooterClasses: {},
|
|
14
|
-
closeIcon: {},
|
|
15
14
|
withCloseIcon: { type: Boolean, default: !0 },
|
|
16
15
|
showModal: { type: Boolean, default: !0 },
|
|
17
16
|
headerTitle: { default: "" },
|
|
@@ -25,7 +24,7 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
|
|
|
25
24
|
},
|
|
26
25
|
emits: ["closed", "opened", "dialogClick"],
|
|
27
26
|
setup(e, { emit: g }) {
|
|
28
|
-
const c = g, i = n(!1), m = n(null), a =
|
|
27
|
+
const c = g, i = n(!1), m = n(null), a = z("modalDialog"), k = n(!1), u = n(!1), f = ({ key: t }) => {
|
|
29
28
|
t === "Escape" && o();
|
|
30
29
|
}, x = () => {
|
|
31
30
|
document?.body.addEventListener("keydown", f);
|
|
@@ -54,9 +53,9 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
|
|
|
54
53
|
m.value?.classList.add("uikit-hidden"), c("closed");
|
|
55
54
|
}, 250);
|
|
56
55
|
};
|
|
57
|
-
return
|
|
56
|
+
return H(() => {
|
|
58
57
|
b(), document?.documentElement.classList.remove("uikit-no-scrolling"), C() ? document?.body.classList.remove("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.remove("uikit-no-scrolling");
|
|
59
|
-
}),
|
|
58
|
+
}), I(
|
|
60
59
|
() => e.showModal,
|
|
61
60
|
async (t) => {
|
|
62
61
|
!t && !i.value ? k.value = !0 : k.value = !1, t && !i.value && await p(), !t && i.value && await o(), i.value = t;
|
|
@@ -103,16 +102,16 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
|
|
|
103
102
|
key: 0,
|
|
104
103
|
id: "close-icon-btn",
|
|
105
104
|
"data-cy": "bbt-default-close-icon-btn",
|
|
106
|
-
class: s(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent
|
|
105
|
+
class: s(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent", e.closeIconBtnClasses]),
|
|
107
106
|
type: "button",
|
|
108
107
|
"aria-label": "Close",
|
|
109
108
|
onClick: y(o, ["prevent", "stop"])
|
|
110
109
|
}, [
|
|
111
110
|
D(K(V), {
|
|
112
|
-
class:
|
|
113
|
-
width:
|
|
114
|
-
height:
|
|
115
|
-
}
|
|
111
|
+
class: "bbt-close-icon uikit-box-border uikit-p-5px",
|
|
112
|
+
width: 30,
|
|
113
|
+
height: 30
|
|
114
|
+
})
|
|
116
115
|
], 2)) : w("", !0),
|
|
117
116
|
d(t.$slots, "header", { closeModal: o }, () => [
|
|
118
117
|
l("span", {
|
|
@@ -14,7 +14,7 @@ const N = ["for"], j = /* @__PURE__ */ m({
|
|
|
14
14
|
label: { default: "" },
|
|
15
15
|
modelValue: { type: Boolean, default: !1 }
|
|
16
16
|
},
|
|
17
|
-
emits: ["click", "
|
|
17
|
+
emits: ["click", "change", "update:modelValue"],
|
|
18
18
|
setup(e, { emit: r }) {
|
|
19
19
|
const l = f(), d = h(() => `${e.id ?? l}`), a = r;
|
|
20
20
|
b(
|
|
@@ -31,7 +31,7 @@ const N = ["for"], j = /* @__PURE__ */ m({
|
|
|
31
31
|
}), a("update:modelValue", t));
|
|
32
32
|
};
|
|
33
33
|
return (t, o) => (u(), C("label", {
|
|
34
|
-
class: "uikit-
|
|
34
|
+
class: "uikit-flex uikit-items-center uikit-gap-[12px] uikit-text-16",
|
|
35
35
|
for: d.value,
|
|
36
36
|
onClick: o[0] || (o[0] = (s) => a("click", s))
|
|
37
37
|
}, [
|
|
@@ -40,7 +40,7 @@ const N = ["for"], j = /* @__PURE__ */ m({
|
|
|
40
40
|
"model-value": e.modelValue,
|
|
41
41
|
"data-cy": e.dataCy,
|
|
42
42
|
disabled: e.disabled,
|
|
43
|
-
class: y(["uikit-inline-flex uikit-size-[20px] uikit-items-center uikit-justify-center uikit-rounded-[4px] uikit-p-0 data-[state='unchecked']:uikit-border data-[state='unchecked']:uikit-border-solid
|
|
43
|
+
class: y(["data-[state='unchecked']:uikit-border-w-lightgray uikit-inline-flex uikit-size-[20px] uikit-items-center uikit-justify-center uikit-rounded-[4px] uikit-p-0 data-[state='unchecked']:uikit-border data-[state='unchecked']:uikit-border-solid", [
|
|
44
44
|
{
|
|
45
45
|
"uikit-bg-white": !e.modelValue,
|
|
46
46
|
"uikit-bg-w-primary": e.modelValue
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { stringToHyphened as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
const T = ["id", "data-cy"], j = /* @__PURE__ */ p({
|
|
1
|
+
import { defineComponent as x, ref as p, computed as h, watch as v, renderSlot as b, createElementVNode as D, normalizeClass as E, createElementBlock as $, createCommentVNode as B, openBlock as g, Fragment as A, renderList as I, createBlock as R, unref as K } from "vue";
|
|
2
|
+
import { stringToHyphened as V, isArrNullOrEmpty as L } from "@wikicasa-dev/utilities";
|
|
3
|
+
import G from "./CheckboxBtn.vue.js";
|
|
4
|
+
const N = ["id", "data-cy"], O = /* @__PURE__ */ x({
|
|
6
5
|
inheritAttrs: !1,
|
|
7
6
|
__name: "CheckboxGroup",
|
|
8
7
|
props: {
|
|
@@ -15,38 +14,36 @@ const T = ["id", "data-cy"], j = /* @__PURE__ */ p({
|
|
|
15
14
|
autoCheckResetAll: { type: Boolean, default: !1 },
|
|
16
15
|
autoCheckResetEmpty: { type: Boolean, default: !1 },
|
|
17
16
|
manualToggleResetButton: { type: Boolean, default: !1 },
|
|
18
|
-
getKey: { type: Function, default: (
|
|
17
|
+
getKey: { type: Function, default: (t) => typeof t == "string" || typeof t == "number" ? `${t}` : `${t.id}` },
|
|
19
18
|
groupId: { default: "" },
|
|
20
19
|
dataCy: { default: "" }
|
|
21
20
|
},
|
|
22
21
|
emits: ["resetted", "update:modelValue", "checkedGroup"],
|
|
23
|
-
setup(
|
|
24
|
-
const o =
|
|
25
|
-
/* @__PURE__ */ new Map()
|
|
26
|
-
), r = h(() => {
|
|
22
|
+
setup(t, { emit: C }) {
|
|
23
|
+
const o = t, s = C, l = p(/* @__PURE__ */ new Map()), r = h(() => {
|
|
27
24
|
for (const e of o.checkboxData)
|
|
28
25
|
if (e.reset) return e;
|
|
29
26
|
return null;
|
|
30
27
|
}), y = h(() => o.checkboxData.length), f = h(() => {
|
|
31
28
|
let e = 0;
|
|
32
|
-
return l.value.forEach((
|
|
33
|
-
|
|
29
|
+
return l.value.forEach((a) => {
|
|
30
|
+
a.checked && e++;
|
|
34
31
|
}), e;
|
|
35
32
|
});
|
|
36
33
|
(() => {
|
|
37
34
|
const e = [];
|
|
38
|
-
for (const
|
|
39
|
-
l.value.set(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
35
|
+
for (const a of o.checkboxData)
|
|
36
|
+
a.checked = !!a.checked, l.value.set(
|
|
37
|
+
`${a.id}`,
|
|
38
|
+
a
|
|
39
|
+
), a.checked && e.push(a);
|
|
43
40
|
s("update:modelValue", e);
|
|
44
41
|
})();
|
|
45
|
-
const u = (e,
|
|
42
|
+
const u = (e, a) => {
|
|
46
43
|
const c = l.value.get(e);
|
|
47
44
|
if (c) {
|
|
48
|
-
if (
|
|
49
|
-
l.value.set(e, { ...c, ...
|
|
45
|
+
if (a) {
|
|
46
|
+
l.value.set(e, { ...c, ...a });
|
|
50
47
|
return;
|
|
51
48
|
}
|
|
52
49
|
l.value.set(e, { ...c, checked: !c.checked });
|
|
@@ -58,55 +55,55 @@ const T = ["id", "data-cy"], j = /* @__PURE__ */ p({
|
|
|
58
55
|
}, m = () => {
|
|
59
56
|
k(), s("update:modelValue", []), s("resetted");
|
|
60
57
|
}, d = (e) => l.value.get(o.getKey(e))?.checked ?? !1, i = (e) => {
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
|
|
58
|
+
if (L(o.checkboxData)) return;
|
|
59
|
+
const a = l.value.get(e.id);
|
|
60
|
+
a?.reset && e.checked ? k() : r.value && !a?.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
61
|
n.checked = !!n.reset;
|
|
65
|
-
}), o.autoCheckResetEmpty && r.value && !f.value && (!o.manualToggleResetButton || !
|
|
62
|
+
}), o.autoCheckResetEmpty && r.value && !f.value && (!o.manualToggleResetButton || !a?.reset) && u(o.getKey(r.value), { checked: !0 });
|
|
66
63
|
const c = [];
|
|
67
64
|
l.value.forEach((n) => {
|
|
68
65
|
n.checked && c.push(n);
|
|
69
66
|
}), s("update:modelValue", c), s("checkedGroup", o.groupId);
|
|
70
67
|
};
|
|
71
|
-
return
|
|
68
|
+
return v(
|
|
72
69
|
() => o.reset,
|
|
73
70
|
(e) => {
|
|
74
71
|
e && m();
|
|
75
72
|
}
|
|
76
|
-
), (e,
|
|
73
|
+
), (e, a) => b(e.$slots, "default", {
|
|
77
74
|
isActive: d,
|
|
78
75
|
handleChange: i,
|
|
79
|
-
checkboxesData:
|
|
76
|
+
checkboxesData: t.checkboxData
|
|
80
77
|
}, () => [
|
|
81
|
-
|
|
82
|
-
id:
|
|
83
|
-
class:
|
|
84
|
-
"data-cy":
|
|
78
|
+
D("div", {
|
|
79
|
+
id: t.groupId,
|
|
80
|
+
class: E(["checkbox-group-container", e.$attrs.class || ""]),
|
|
81
|
+
"data-cy": t.dataCy
|
|
85
82
|
}, [
|
|
86
83
|
b(e.$slots, "checkbox_elements", {
|
|
87
84
|
isActive: d,
|
|
88
85
|
handleChange: i,
|
|
89
|
-
checkboxesData:
|
|
86
|
+
checkboxesData: t.checkboxData,
|
|
90
87
|
reset: m
|
|
91
88
|
}, () => [
|
|
92
|
-
|
|
93
|
-
id:
|
|
89
|
+
t.checkboxData ? (g(!0), $(A, { key: 0 }, I(t.checkboxData, (c, n) => (g(), R(G, {
|
|
90
|
+
id: t.getKey(c),
|
|
94
91
|
key: n,
|
|
95
|
-
"data-cy": c.dataCy ?? `checkbox_${V
|
|
92
|
+
"data-cy": c.dataCy ?? `checkbox_${K(V)(`${c.label}`)}`,
|
|
96
93
|
label: c.label,
|
|
97
|
-
inline:
|
|
94
|
+
inline: t.formCheckInline,
|
|
98
95
|
"model-value": d(c),
|
|
99
96
|
"container-class": [
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
t.formCheckInline ? "uikit-mr-10px" : "uikit-mb-10px",
|
|
98
|
+
t.checkboxContainerClasses
|
|
102
99
|
],
|
|
103
|
-
onChange:
|
|
104
|
-
}, null, 8, ["id", "data-cy", "label", "inline", "model-value", "container-class"]))), 128)) :
|
|
100
|
+
onChange: i
|
|
101
|
+
}, null, 8, ["id", "data-cy", "label", "inline", "model-value", "container-class"]))), 128)) : B("", !0)
|
|
105
102
|
])
|
|
106
|
-
], 10,
|
|
103
|
+
], 10, N)
|
|
107
104
|
]);
|
|
108
105
|
}
|
|
109
106
|
});
|
|
110
107
|
export {
|
|
111
|
-
|
|
108
|
+
O as default
|
|
112
109
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wikicasa-dev/components",
|
|
3
|
-
"version": "2.2.8-alpha.
|
|
3
|
+
"version": "2.2.8-alpha.4",
|
|
4
4
|
"description": "Wikicasa frontend components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"vue": "^3.5.0",
|
|
45
45
|
"date-fns": "^4.0.0",
|
|
46
46
|
"@wikicasa-dev/svg-icons": "^1.2.24",
|
|
47
|
-
"@wikicasa-dev/vue-composables": "^0.0.
|
|
47
|
+
"@wikicasa-dev/vue-composables": "^0.0.25",
|
|
48
48
|
"@wikicasa-dev/types": "^2.4.0",
|
|
49
49
|
"@wikicasa-dev/utilities": "^1.2.0"
|
|
50
50
|
},
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@vue/eslint-config-prettier": "^10.2.0",
|
|
65
65
|
"@vue/eslint-config-typescript": "^14.6.0",
|
|
66
66
|
"@wikicasa-dev/svg-icons": "1.2.24",
|
|
67
|
-
"@wikicasa-dev/vue-composables": "0.0.
|
|
67
|
+
"@wikicasa-dev/vue-composables": "0.0.25",
|
|
68
68
|
"@wikicasa-dev/tailwind-plugins": "^0.0.3",
|
|
69
69
|
"@wikicasa-dev/types": "2.4.6",
|
|
70
70
|
"@wikicasa-dev/utilities": "1.2.0",
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { AccessibleSelectOptions } from '../AccessibleSelect';
|
|
2
|
-
import { ClassTypeProp } from '../types';
|
|
3
|
-
import { Nullable } from '@wikicasa-dev/types';
|
|
4
|
-
export interface ClearableAutocompleteProps<TID extends string | number | undefined, TPayload> {
|
|
5
|
-
dataCy?: string;
|
|
6
|
-
placeholder?: string;
|
|
7
|
-
enableKeyboardController?: boolean;
|
|
8
|
-
triggerWrapperClasses?: ClassTypeProp;
|
|
9
|
-
inputWrapperClasses?: ClassTypeProp;
|
|
10
|
-
inputClasses?: ClassTypeProp;
|
|
11
|
-
dropdownClasses?: ClassTypeProp;
|
|
12
|
-
clearButton?: {
|
|
13
|
-
classes?: ClassTypeProp;
|
|
14
|
-
/** Space between the input element and the clear button */
|
|
15
|
-
offset?: number;
|
|
16
|
-
};
|
|
17
|
-
keepState?: Nullable<"closed" | "open">;
|
|
18
|
-
onInputChangeCb: (v: string) => Promise<AccessibleSelectOptions<TPayload, TID>[]>;
|
|
19
|
-
onOptionSelectedCb?: Nullable<(v: AccessibleSelectOptions<TPayload, TID>) => void>;
|
|
20
|
-
}
|
|
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<{
|
|
22
|
-
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
23
|
-
readonly "onUpdate:modelValue"?: ((value: Nullable<AccessibleSelectOptions<TPayload, TID>>) => any) | undefined;
|
|
24
|
-
readonly onClick?: ((args_0: MouseEvent) => any) | undefined;
|
|
25
|
-
readonly onKeydown?: ((args_0: KeyboardEvent) => any) | undefined;
|
|
26
|
-
readonly "onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
27
|
-
readonly onInputClick?: ((args_0: MouseEvent) => any) | undefined;
|
|
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"> & ({
|
|
30
|
-
open?: boolean;
|
|
31
|
-
modelValue?: Nullable<AccessibleSelectOptions<TPayload, TID>>;
|
|
32
|
-
} & ClearableAutocompleteProps<TID, TPayload>) & Partial<{}>> & import('vue').PublicProps;
|
|
33
|
-
expose(exposed: import('vue').ShallowUnwrapRef<{
|
|
34
|
-
select: () => void;
|
|
35
|
-
getRootElement: () => HTMLDivElement | null | undefined;
|
|
36
|
-
}>): void;
|
|
37
|
-
attrs: any;
|
|
38
|
-
slots: {
|
|
39
|
-
'left-icon'?(_: {}): any;
|
|
40
|
-
'clear-icon'?(_: {}): any;
|
|
41
|
-
'right-icon'?(_: {}): any;
|
|
42
|
-
'option-content'?(_: {
|
|
43
|
-
option: AccessibleSelectOptions<TPayload, TID>;
|
|
44
|
-
idx: number;
|
|
45
|
-
}): any;
|
|
46
|
-
};
|
|
47
|
-
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));
|
|
48
|
-
}>) => import('vue').VNode & {
|
|
49
|
-
__ctx?: Awaited<typeof __VLS_setup>;
|
|
50
|
-
};
|
|
51
|
-
export default _default;
|
|
52
|
-
type __VLS_PrettifyLocal<T> = {
|
|
53
|
-
[K in keyof T]: T[K];
|
|
54
|
-
} & {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.uikit-checkbox-btn{--font-size: 16px;font-size:var(--font-size)}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
.uikit-clearable-autocomplete{--input-padding: 0;--input-margin: 0}.uikit-clearable-autocomplete input{margin:var(--input-margin);padding:var(--input-padding)}.uikit-clearable-autocomplete .uikit-clear-btn{--bg-color: transparent;background-color:var(--bg-color)}
|