@wikicasa-dev/components 2.2.9-alpha.9 → 2.3.1-alpha.0
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/AccessibleSelect.d.ts +5 -4
- package/dist/UIKit/AccessibleSelect.js +3 -2
- package/dist/UIKit/Autocomplete/ClearableAutocomplete.d.ts +7 -2
- package/dist/UIKit/BaseAutocomplete.d.ts +4 -4
- package/dist/UIKit/BaseButton.d.ts +14 -8
- package/dist/UIKit/BaseCard.js +1 -3
- package/dist/UIKit/BaseDropDown.d.ts +19 -13
- package/dist/UIKit/BaseFloatingLabel.js +4 -4
- package/dist/UIKit/BaseInput.d.ts +3 -2
- package/dist/UIKit/BaseInput.js +1 -1
- package/dist/UIKit/BaseSnackbar.d.ts +2 -2
- package/dist/UIKit/BaseTextarea.d.ts +2 -2
- package/dist/UIKit/BaseToggle.d.ts +5 -8
- package/dist/UIKit/BaseToggle.js +1 -4
- package/dist/UIKit/Checkbox/CheckboxBtn.d.ts +14 -7
- package/dist/UIKit/Checkbox/CheckboxGroup.d.ts +5 -2
- package/dist/UIKit/Checkbox/v2/CheckboxButtonGroup.d.ts +40 -0
- package/dist/UIKit/Checkbox/v2/CheckboxButtonGroup.js +4 -0
- package/dist/UIKit/Radio/RadioButton.d.ts +28 -23
- package/dist/UIKit/Radio/RadioGroup.d.ts +49 -50
- package/dist/UIKit/Radio/v2/RadioButtonGroup.d.ts +29 -0
- package/dist/UIKit/Radio/v2/RadioButtonGroup.js +4 -0
- package/dist/UIKit/Radio/v2/RadioButtonItem.d.ts +16 -0
- package/dist/UIKit/Radio/v2/RadioButtonItem.js +5 -0
- package/dist/assets/AccessibleSelect.css +1 -0
- package/dist/assets/BaseCard.css +1 -1
- package/dist/assets/BaseDropDown.css +1 -1
- package/dist/assets/BaseFloatingLabel.css +1 -1
- package/dist/assets/BaseInput.css +1 -1
- package/dist/assets/RadioButtonItem.css +1 -0
- package/dist/assets/tailwind.css +1 -1
- package/dist/composables/mock.d.ts +25 -0
- package/dist/composables/mock.js +49 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +94 -83
- package/dist/packages/components/lib/UIKit/AccessibleSelect.vue.js +158 -160
- package/dist/packages/components/lib/UIKit/Accordion/BaseAccordionItem.vue.js +4 -6
- package/dist/packages/components/lib/UIKit/Autocomplete/ClearableAutocomplete.vue.js +112 -106
- package/dist/packages/components/lib/UIKit/BaseAutocomplete.vue.js +36 -36
- package/dist/packages/components/lib/UIKit/BaseButton.vue.js +28 -24
- package/dist/packages/components/lib/UIKit/BaseCard.vue.js +13 -13
- package/dist/packages/components/lib/UIKit/BaseDropDown.vue.js +102 -105
- package/dist/packages/components/lib/UIKit/BaseFloatingLabel.vue.js +8 -8
- package/dist/packages/components/lib/UIKit/BaseInput.vue.js +65 -64
- package/dist/packages/components/lib/UIKit/BaseModal.vue.js +42 -36
- package/dist/packages/components/lib/UIKit/BaseSelect/SelectItem.vue.js +18 -17
- package/dist/packages/components/lib/UIKit/BaseToggle.vue.js +25 -29
- package/dist/packages/components/lib/UIKit/Checkbox/CheckboxBtn.vue.js +48 -41
- package/dist/packages/components/lib/UIKit/Checkbox/CheckboxGroup.vue.js +60 -55
- package/dist/packages/components/lib/UIKit/Checkbox/v2/CheckboxButtonGroup.vue.js +78 -0
- package/dist/packages/components/lib/UIKit/Radio/RadioButton.vue.js +16 -14
- package/dist/packages/components/lib/UIKit/Radio/RadioGroup.vue.js +37 -33
- package/dist/packages/components/lib/UIKit/Radio/v2/RadioButtonGroup.vue.js +49 -0
- package/dist/packages/components/lib/UIKit/Radio/v2/RadioButtonItem.vue.js +45 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +8 -7
- package/dist/assets/BaseToggle.css +0 -1
- /package/dist/assets/{swiper-thumbs.css → swiper-controller.css} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as I, ref as n, useTemplateRef as T, onUnmounted as z, watch as H, createBlock as O, openBlock as
|
|
2
|
-
import { isWindows as
|
|
1
|
+
import { defineComponent as I, ref as n, useTemplateRef as T, onUnmounted as z, watch as H, createBlock as O, openBlock as m, Teleport as $, createElementVNode as a, normalizeClass as s, createElementBlock as y, createCommentVNode as h, renderSlot as d, withModifiers as D, createVNode as F, unref as K, nextTick as N } from "vue";
|
|
2
|
+
import { isWindows as g, awaitableSetTimeout as S } from "@wikicasa-dev/utilities";
|
|
3
3
|
import { CloseIcon as V } from "@wikicasa-dev/svg-icons";
|
|
4
|
-
const
|
|
4
|
+
const P = ["id", "data-cy"], U = ["innerHTML"], j = /* @__PURE__ */ I({
|
|
5
5
|
__name: "BaseModal",
|
|
6
6
|
props: {
|
|
7
7
|
id: { default: "base-bt-modal" },
|
|
@@ -24,25 +24,25 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
|
|
|
24
24
|
titleClasses: {}
|
|
25
25
|
},
|
|
26
26
|
emits: ["closed", "opened", "dialogClick"],
|
|
27
|
-
setup(e, { emit:
|
|
28
|
-
const c =
|
|
27
|
+
setup(e, { emit: w }) {
|
|
28
|
+
const c = w, i = n(!1), r = n(null), l = T("modalDialog"), k = n(!1), u = n(!1), f = ({ key: t }) => {
|
|
29
29
|
t === "Escape" && o();
|
|
30
|
-
},
|
|
30
|
+
}, C = () => {
|
|
31
31
|
document?.body.addEventListener("keydown", f);
|
|
32
32
|
}, b = () => {
|
|
33
33
|
document?.body.removeEventListener("keydown", f);
|
|
34
|
-
},
|
|
34
|
+
}, x = async () => {
|
|
35
35
|
i.value = !0, N(() => {
|
|
36
|
-
|
|
36
|
+
C(), g() ? document?.body.classList.add("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.add("uikit-no-scrolling");
|
|
37
37
|
}), c("opened"), e.autoClose !== void 0 && setTimeout(() => {
|
|
38
38
|
o();
|
|
39
39
|
}, e.autoClose);
|
|
40
|
+
}, p = (t) => {
|
|
41
|
+
l.value && l.value.contains(t.target) && (u.value = !0);
|
|
40
42
|
}, M = (t) => {
|
|
41
|
-
|
|
42
|
-
}, B = (t) => {
|
|
43
|
-
|
|
44
|
-
}, L = async () => {
|
|
45
|
-
if (e.closeOnClickOut) {
|
|
43
|
+
l.value && l.value.contains(t.target) && (u.value = !1);
|
|
44
|
+
}, B = async (t) => {
|
|
45
|
+
if (!r.value?.contains(t.target) && e.closeOnClickOut) {
|
|
46
46
|
if (u.value) {
|
|
47
47
|
u.value = !1;
|
|
48
48
|
return;
|
|
@@ -51,21 +51,25 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
|
|
|
51
51
|
}
|
|
52
52
|
}, o = async () => {
|
|
53
53
|
i.value = !1, b(), document?.documentElement.classList.remove("uikit-no-scrolling"), navigator.userAgent.includes("Windows") ? document?.body.classList.remove("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.remove("uikit-no-scrolling"), await S(() => {
|
|
54
|
-
|
|
54
|
+
r.value?.classList.add("uikit-hidden"), c("closed");
|
|
55
55
|
}, 250);
|
|
56
56
|
};
|
|
57
|
-
|
|
58
|
-
b(), document?.documentElement.classList.remove("uikit-no-scrolling"),
|
|
57
|
+
z(() => {
|
|
58
|
+
b(), document?.documentElement.classList.remove("uikit-no-scrolling"), g() ? document?.body.classList.remove("uikit-no-scrolling", "sm:uikit-pr-15px") : document?.body.classList.remove("uikit-no-scrolling");
|
|
59
59
|
}), H(
|
|
60
60
|
() => e.showModal,
|
|
61
61
|
async (t) => {
|
|
62
|
-
!t && !i.value ? k.value = !0 : k.value = !1, t && !i.value && await
|
|
62
|
+
!t && !i.value ? k.value = !0 : k.value = !1, t && !i.value && await x(), !t && i.value && await o(), i.value = t;
|
|
63
63
|
},
|
|
64
64
|
{ immediate: !0 }
|
|
65
|
-
)
|
|
66
|
-
|
|
65
|
+
);
|
|
66
|
+
const L = (t) => {
|
|
67
|
+
l.value === t.target && t.stopPropagation();
|
|
68
|
+
};
|
|
69
|
+
return (t, v) => (m(), O($, { to: "body" }, [
|
|
70
|
+
a("div", {
|
|
67
71
|
ref_key: "backdropEl",
|
|
68
|
-
ref:
|
|
72
|
+
ref: r,
|
|
69
73
|
class: s(["bbt-backdrop uikit-fixed uikit-left-0 uikit-top-0 uikit-h-full uikit-w-full", [
|
|
70
74
|
e.customBackdropClasses,
|
|
71
75
|
{
|
|
@@ -76,11 +80,11 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
|
|
|
76
80
|
{ hide: k.value }
|
|
77
81
|
]]),
|
|
78
82
|
style: { "z-index": "1062" },
|
|
79
|
-
onClick:
|
|
80
|
-
onMousedown:
|
|
81
|
-
onMouseup:
|
|
83
|
+
onClick: B,
|
|
84
|
+
onMousedown: p,
|
|
85
|
+
onMouseup: M
|
|
82
86
|
}, [
|
|
83
|
-
|
|
87
|
+
a("dialog", {
|
|
84
88
|
id: e.id,
|
|
85
89
|
ref: "modalDialog",
|
|
86
90
|
"data-cy": e.dataCy,
|
|
@@ -94,50 +98,52 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ I({
|
|
|
94
98
|
`base-${e.size}`,
|
|
95
99
|
e.fullHeight ? "uikit-h-[95%]" : "uikit-h-auto"
|
|
96
100
|
]]),
|
|
97
|
-
|
|
101
|
+
tabindex: "-1",
|
|
102
|
+
onClick: v[0] || (v[0] = (E) => c("dialogClick", E)),
|
|
103
|
+
onFocusin: L
|
|
98
104
|
}, [
|
|
99
|
-
|
|
105
|
+
a("div", {
|
|
100
106
|
class: s(["default-header uikit-sticky uikit-top-0 uikit-z-10 uikit-rounded-t uikit-border-0 uikit-bg-white uikit-px-4 uikit-pb-10px uikit-pt-20px sm:uikit-px-6", [e.customModalHeaderClasses]])
|
|
101
107
|
}, [
|
|
102
|
-
e.withCloseIcon ? (
|
|
108
|
+
e.withCloseIcon ? (m(), y("button", {
|
|
103
109
|
key: 0,
|
|
104
110
|
id: "close-icon-btn",
|
|
105
111
|
"data-cy": "bbt-default-close-icon-btn",
|
|
106
112
|
class: s(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent uikit-p-5px", e.closeIconBtnClasses]),
|
|
107
113
|
type: "button",
|
|
108
114
|
"aria-label": "Close",
|
|
109
|
-
onClick:
|
|
115
|
+
onClick: D(o, ["prevent", "stop"])
|
|
110
116
|
}, [
|
|
111
|
-
|
|
117
|
+
F(K(V), {
|
|
112
118
|
class: s(["bbt-close-icon uikit-box-border", e.closeIcon?.classes]),
|
|
113
119
|
width: e.closeIcon?.size || 20,
|
|
114
120
|
height: e.closeIcon?.size || 20
|
|
115
121
|
}, null, 8, ["class", "width", "height"])
|
|
116
|
-
], 2)) :
|
|
122
|
+
], 2)) : h("", !0),
|
|
117
123
|
d(t.$slots, "header", { closeModal: o }, () => [
|
|
118
|
-
|
|
124
|
+
a("span", {
|
|
119
125
|
class: s(["uikit-w-auto uikit-text-18 uikit-font-semibold sm:uikit-text-22", e.titleClasses]),
|
|
120
126
|
innerHTML: e.headerTitle
|
|
121
127
|
}, null, 10, U)
|
|
122
128
|
])
|
|
123
129
|
], 2),
|
|
124
|
-
|
|
130
|
+
a("div", {
|
|
125
131
|
class: s(["uikit-bbt-body uikit-flex-auto uikit-overflow-y-auto uikit-overflow-x-hidden uikit-px-4 uikit-pb-0 uikit-no-scrollbar sm:uikit-px-6 sm:uikit-pb-25px", [e.customModalBodyClasses]])
|
|
126
132
|
}, [
|
|
127
133
|
d(t.$slots, "body", { closeModal: o })
|
|
128
134
|
], 2),
|
|
129
|
-
t.$slots.footer ? (
|
|
135
|
+
t.$slots.footer ? (m(), y("div", {
|
|
130
136
|
key: 0,
|
|
131
137
|
class: s(["uikit-bbt-footer uikit-sticky uikit-bottom-0 uikit-border-0 uikit-bg-white uikit-px-4 uikit-py-15px sm:uikit-px-6", e.customModalFooterClasses])
|
|
132
138
|
}, [
|
|
133
139
|
d(t.$slots, "footer", { closeModal: o })
|
|
134
|
-
], 2)) :
|
|
140
|
+
], 2)) : h("", !0),
|
|
135
141
|
d(t.$slots, "fixed-bottom")
|
|
136
|
-
],
|
|
142
|
+
], 42, P)
|
|
137
143
|
], 34)
|
|
138
144
|
]));
|
|
139
145
|
}
|
|
140
146
|
});
|
|
141
147
|
export {
|
|
142
|
-
|
|
148
|
+
j as default
|
|
143
149
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as u, useTemplateRef as
|
|
2
|
-
const
|
|
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({
|
|
3
3
|
__name: "SelectItem",
|
|
4
4
|
props: {
|
|
5
5
|
label: { default: "" },
|
|
@@ -7,33 +7,34 @@ const p = ["tabindex"], b = ["innerHTML"], $ = /* @__PURE__ */ u({
|
|
|
7
7
|
idx: { default: -1 }
|
|
8
8
|
},
|
|
9
9
|
emits: ["click", "mouseover"],
|
|
10
|
-
setup(
|
|
11
|
-
const
|
|
12
|
-
return
|
|
13
|
-
() =>
|
|
10
|
+
setup(t, { emit: o }) {
|
|
11
|
+
const a = o, i = t, n = c("liItem");
|
|
12
|
+
return d(
|
|
13
|
+
() => i.active,
|
|
14
14
|
(e) => {
|
|
15
|
-
e &&
|
|
16
|
-
|
|
15
|
+
e && m(() => {
|
|
16
|
+
n.value && n.value.focus();
|
|
17
17
|
});
|
|
18
18
|
},
|
|
19
19
|
{ immediate: !0 }
|
|
20
|
-
), (e,
|
|
20
|
+
), (e, l) => (f(), r("li", {
|
|
21
21
|
ref: "liItem",
|
|
22
|
-
class:
|
|
23
|
-
{ "active uikit-bg-w-cultured":
|
|
22
|
+
class: v(["uikit-list-none uikit-text-w-black", [
|
|
23
|
+
{ "active uikit-bg-w-cultured": t.active },
|
|
24
24
|
"uikit-outline-none",
|
|
25
25
|
e.$attrs.class
|
|
26
26
|
]]),
|
|
27
|
+
"data-active": t.active,
|
|
27
28
|
tabindex: e.$attrs.tabindex ?? -1,
|
|
28
|
-
onClick:
|
|
29
|
-
onMouseover:
|
|
29
|
+
onClick: l[0] || (l[0] = (s) => a("click", i.idx)),
|
|
30
|
+
onMouseover: l[1] || (l[1] = (s) => a("mouseover", i.idx))
|
|
30
31
|
}, [
|
|
31
|
-
|
|
32
|
+
k(e.$slots, "default", { itemIdx: t.idx }, () => [
|
|
32
33
|
x("span", {
|
|
33
|
-
innerHTML:
|
|
34
|
-
}, null, 8,
|
|
34
|
+
innerHTML: i.label
|
|
35
|
+
}, null, 8, p)
|
|
35
36
|
])
|
|
36
|
-
], 42,
|
|
37
|
+
], 42, b));
|
|
37
38
|
}
|
|
38
39
|
});
|
|
39
40
|
export {
|
|
@@ -1,40 +1,36 @@
|
|
|
1
|
-
import { defineComponent as s, mergeModels as n, useModel as d, createElementBlock as k, openBlock as
|
|
2
|
-
|
|
1
|
+
import { defineComponent as s, mergeModels as n, useModel as d, createElementBlock as k, openBlock as c, renderSlot as u, createVNode as a, createCommentVNode as m, unref as o, withCtx as f, createElementVNode as p } from "vue";
|
|
2
|
+
import { SwitchRoot as b, SwitchThumb as h } from "reka-ui";
|
|
3
|
+
const g = { class: "uikit-flex uikit-items-center uikit-gap-[8px]" }, w = ["innerHTML"], y = /* @__PURE__ */ s({
|
|
3
4
|
inheritAttrs: !1,
|
|
4
5
|
__name: "BaseToggle",
|
|
5
6
|
props: /* @__PURE__ */ n({
|
|
6
|
-
|
|
7
|
-
label: { default: "" }
|
|
7
|
+
label: {}
|
|
8
8
|
}, {
|
|
9
9
|
modelValue: { type: Boolean, default: !1 },
|
|
10
10
|
modelModifiers: {}
|
|
11
11
|
}),
|
|
12
12
|
emits: ["update:modelValue"],
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
innerHTML: o.label
|
|
35
|
-
}, null, 8, g)
|
|
36
|
-
], !0) : f("", !0)
|
|
37
|
-
], 2));
|
|
13
|
+
setup(t) {
|
|
14
|
+
const i = d(t, "modelValue");
|
|
15
|
+
return (e, l) => (c(), k("div", g, [
|
|
16
|
+
u(e.$slots, "leftLabel"),
|
|
17
|
+
a(o(b), {
|
|
18
|
+
modelValue: i.value,
|
|
19
|
+
"onUpdate:modelValue": l[0] || (l[0] = (r) => i.value = r),
|
|
20
|
+
class: "uikit-flex uikit-h-[20px] uikit-w-[40px] uikit-cursor-pointer uikit-rounded-full uikit-p-0 uikit-transition-[background] uikit-will-change-[background] focus-visible:uikit-outline-w-primary data-[state=checked]:uikit-bg-w-primary data-[state=unchecked]:uikit-bg-w-cultured"
|
|
21
|
+
}, {
|
|
22
|
+
default: f(() => [
|
|
23
|
+
a(o(h), { class: "uikit-box-border uikit-flex uikit-size-[20px] uikit-translate-x-0 uikit-items-center uikit-justify-center uikit-rounded-full uikit-border uikit-border-solid uikit-border-w-lightgray uikit-bg-white uikit-shadow-xl uikit-transition-transform uikit-will-change-transform data-[state=checked]:uikit-translate-x-full" })
|
|
24
|
+
]),
|
|
25
|
+
_: 1
|
|
26
|
+
}, 8, ["modelValue"]),
|
|
27
|
+
e.$slots.leftLabel ? m("", !0) : u(e.$slots, "rightLabel", { key: 0 }, () => [
|
|
28
|
+
p("span", {
|
|
29
|
+
class: "uikit-ml-[10px]",
|
|
30
|
+
innerHTML: t.label
|
|
31
|
+
}, null, 8, w)
|
|
32
|
+
])
|
|
33
|
+
]));
|
|
38
34
|
}
|
|
39
35
|
});
|
|
40
36
|
export {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { CheckIcon as
|
|
3
|
-
import { CheckboxRoot as
|
|
4
|
-
const
|
|
1
|
+
import { defineComponent as y, mergeModels as c, useId as p, useTemplateRef as u, useModel as B, watch as I, inject as n, onMounted as V, onUnmounted as R, createElementBlock as w, openBlock as r, createVNode as s, renderSlot as E, unref as l, normalizeClass as M, withCtx as k, createBlock as N, createCommentVNode as j, createTextVNode as z, toDisplayString as S } from "vue";
|
|
2
|
+
import { CheckIcon as T } from "@wikicasa-dev/svg-icons";
|
|
3
|
+
import { CheckboxRoot as U, CheckboxIndicator as $ } from "reka-ui";
|
|
4
|
+
const F = /* @__PURE__ */ y({
|
|
5
5
|
__name: "CheckboxBtn",
|
|
6
|
-
props: {
|
|
6
|
+
props: /* @__PURE__ */ c({
|
|
7
7
|
id: {},
|
|
8
8
|
dataCy: {},
|
|
9
9
|
disabled: { type: Boolean },
|
|
@@ -12,64 +12,71 @@ const N = ["for"], j = /* @__PURE__ */ m({
|
|
|
12
12
|
required: { type: Boolean },
|
|
13
13
|
inputClass: {},
|
|
14
14
|
label: { default: "" },
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
value: {}
|
|
16
|
+
}, {
|
|
17
|
+
modelValue: { type: Boolean, default: !1 },
|
|
18
|
+
modelModifiers: {}
|
|
19
|
+
}),
|
|
20
|
+
emits: /* @__PURE__ */ c(["click", "change"], ["update:modelValue"]),
|
|
21
|
+
setup(e, { expose: m, emit: f }) {
|
|
22
|
+
const h = p(), o = u("root"), b = u("checkboxRoot"), a = B(e, "modelValue"), i = f;
|
|
23
|
+
I(
|
|
21
24
|
() => e.checked,
|
|
22
25
|
(t) => {
|
|
23
|
-
t !== void 0 && a
|
|
26
|
+
t !== void 0 && (a.value = t);
|
|
24
27
|
}
|
|
25
28
|
);
|
|
26
|
-
const
|
|
27
|
-
t !== "indeterminate" && (
|
|
28
|
-
id: e.id ??
|
|
29
|
+
const x = (t) => {
|
|
30
|
+
t !== "indeterminate" && (i("change", {
|
|
31
|
+
id: e.id ?? h,
|
|
29
32
|
label: e.label,
|
|
30
33
|
checked: t
|
|
31
|
-
}), a
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
+
}), a.value = t);
|
|
35
|
+
}, v = n("addItem", void 0), C = n(
|
|
36
|
+
"removeItem",
|
|
37
|
+
void 0
|
|
38
|
+
);
|
|
39
|
+
return V(() => {
|
|
40
|
+
v?.(e.value, o.value);
|
|
41
|
+
}), R(() => {
|
|
42
|
+
C?.(e.value);
|
|
43
|
+
}), m({
|
|
44
|
+
getRootElement: () => o.value,
|
|
45
|
+
getCheckboxElement: () => b.value?.$el
|
|
46
|
+
}), (t, d) => (r(), w("label", {
|
|
47
|
+
ref: "root",
|
|
34
48
|
class: "uikit-checkbox-btn uikit-flex uikit-items-center uikit-gap-[12px]",
|
|
35
|
-
|
|
36
|
-
onClick: o[0] || (o[0] = (s) => a("click", s))
|
|
49
|
+
onClick: d[0] || (d[0] = (g) => i("click", g))
|
|
37
50
|
}, [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"model-value":
|
|
51
|
+
s(l(U), {
|
|
52
|
+
ref: "checkboxRoot",
|
|
53
|
+
"model-value": a.value,
|
|
41
54
|
"data-cy": e.dataCy,
|
|
42
55
|
disabled: e.disabled,
|
|
43
|
-
class:
|
|
44
|
-
|
|
45
|
-
"uikit-bg-white": !e.modelValue,
|
|
46
|
-
"uikit-bg-w-primary": e.modelValue
|
|
47
|
-
},
|
|
48
|
-
e.inputClass
|
|
49
|
-
]]),
|
|
50
|
-
"onUpdate:modelValue": k
|
|
56
|
+
class: M(["uikit-inline-flex uikit-size-[20px] uikit-shrink-0 uikit-items-center uikit-justify-center uikit-rounded-[4px] uikit-p-0 data-[state='unchecked']:uikit-border data-[state='unchecked']:uikit-border-solid data-[state='unchecked']:uikit-border-w-lightgray data-[state='checked']:uikit-bg-w-primary data-[state='unchecked']:uikit-bg-white", e.inputClass]),
|
|
57
|
+
"onUpdate:modelValue": x
|
|
51
58
|
}, {
|
|
52
|
-
default:
|
|
53
|
-
|
|
54
|
-
default:
|
|
55
|
-
|
|
59
|
+
default: k(() => [
|
|
60
|
+
s(l($), { class: "uikit-flex" }, {
|
|
61
|
+
default: k(() => [
|
|
62
|
+
a.value === !0 ? (r(), N(l(T), {
|
|
56
63
|
key: 0,
|
|
57
64
|
"fill-color": "#fff",
|
|
58
65
|
width: 12,
|
|
59
66
|
height: 14
|
|
60
|
-
})) :
|
|
67
|
+
})) : j("", !0)
|
|
61
68
|
]),
|
|
62
69
|
_: 1
|
|
63
70
|
})
|
|
64
71
|
]),
|
|
65
72
|
_: 1
|
|
66
|
-
}, 8, ["
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
}, 8, ["model-value", "data-cy", "disabled", "class"]),
|
|
74
|
+
E(t.$slots, "label", {}, () => [
|
|
75
|
+
z(S(e.label), 1)
|
|
69
76
|
])
|
|
70
|
-
],
|
|
77
|
+
], 512));
|
|
71
78
|
}
|
|
72
79
|
});
|
|
73
80
|
export {
|
|
74
|
-
|
|
81
|
+
F as default
|
|
75
82
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { stringToHyphened as
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as B, mergeModels as y, useModel as A, ref as I, computed as i, watch as C, renderSlot as p, createElementVNode as M, normalizeClass as x, createElementBlock as R, createCommentVNode as K, openBlock as v, Fragment as V, renderList as w, createBlock as L, unref as G } from "vue";
|
|
2
|
+
import { stringToHyphened as N, isArrNullOrEmpty as T } from "@wikicasa-dev/utilities";
|
|
3
|
+
import F from "./CheckboxBtn.vue.js";
|
|
4
4
|
import '../../../../../assets/CheckboxBtn.css';/* empty css */
|
|
5
|
-
const
|
|
5
|
+
const O = ["id", "data-cy"], q = /* @__PURE__ */ B({
|
|
6
6
|
inheritAttrs: !1,
|
|
7
7
|
__name: "CheckboxGroup",
|
|
8
|
-
props: {
|
|
8
|
+
props: /* @__PURE__ */ y({
|
|
9
9
|
checkboxData: { default() {
|
|
10
10
|
return [];
|
|
11
11
|
} },
|
|
@@ -18,95 +18,100 @@ const T = ["id", "data-cy"], j = /* @__PURE__ */ v({
|
|
|
18
18
|
getKey: { type: Function, default: (a) => typeof a == "string" || typeof a == "number" ? `${a}` : `${a.id}` },
|
|
19
19
|
groupId: { default: "" },
|
|
20
20
|
dataCy: { default: "" }
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
}, {
|
|
22
|
+
refresh: { type: Boolean, default: !1 },
|
|
23
|
+
refreshModifiers: {}
|
|
24
|
+
}),
|
|
25
|
+
emits: /* @__PURE__ */ y(["resetted", "update:modelValue", "checkedGroup"], ["update:refresh"]),
|
|
26
|
+
setup(a, { emit: D }) {
|
|
27
|
+
const o = a, s = D, f = A(a, "refresh"), l = I(
|
|
25
28
|
/* @__PURE__ */ new Map()
|
|
26
|
-
), r =
|
|
29
|
+
), r = i(() => {
|
|
27
30
|
for (const e of o.checkboxData)
|
|
28
31
|
if (e.reset) return e;
|
|
29
32
|
return null;
|
|
30
|
-
}),
|
|
33
|
+
}), E = i(() => o.checkboxData.length), k = i(() => {
|
|
31
34
|
let e = 0;
|
|
32
|
-
return l.value.forEach((
|
|
33
|
-
|
|
35
|
+
return l.value.forEach((c) => {
|
|
36
|
+
c.checked && e++;
|
|
34
37
|
}), e;
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const e = [];
|
|
38
|
+
}), m = () => {
|
|
39
|
+
const e = [], c = /* @__PURE__ */ new Map();
|
|
38
40
|
for (const t of o.checkboxData)
|
|
39
|
-
|
|
41
|
+
c.set(`${t.id}`, {
|
|
40
42
|
...t,
|
|
41
43
|
checked: !!t.checked
|
|
42
44
|
}), t.checked && e.push(t);
|
|
43
|
-
s("update:modelValue", e);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
l.value = c, s("update:modelValue", e);
|
|
46
|
+
};
|
|
47
|
+
m();
|
|
48
|
+
const u = (e, c) => {
|
|
49
|
+
const t = l.value.get(e);
|
|
50
|
+
if (t) {
|
|
51
|
+
if (c) {
|
|
52
|
+
l.value.set(e, { ...t, ...c });
|
|
50
53
|
return;
|
|
51
54
|
}
|
|
52
|
-
l.value.set(e, { ...
|
|
55
|
+
l.value.set(e, { ...t, checked: !t.checked });
|
|
53
56
|
}
|
|
54
|
-
},
|
|
57
|
+
}, b = () => {
|
|
55
58
|
l.value.forEach((e) => {
|
|
56
59
|
e.checked = !1;
|
|
57
60
|
});
|
|
58
|
-
},
|
|
59
|
-
|
|
60
|
-
}, d = (e) => l.value.get(o.getKey(e))?.checked ?? !1,
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
|
|
61
|
+
}, g = () => {
|
|
62
|
+
b(), s("update:modelValue", []), s("resetted");
|
|
63
|
+
}, d = (e) => l.value.get(o.getKey(e))?.checked ?? !1, h = (e) => {
|
|
64
|
+
if (T(o.checkboxData)) return;
|
|
65
|
+
const c = l.value.get(e.id);
|
|
66
|
+
c?.reset && e.checked ? b() : r.value && !c?.reset && u(o.getKey(r.value), { checked: !1 }), u(`${e.id}`), o.autoCheckResetAll && r.value && k.value === E.value - 1 && l.value.forEach((n) => {
|
|
64
67
|
n.checked = !!n.reset;
|
|
65
|
-
}), o.autoCheckResetEmpty && r.value && !
|
|
66
|
-
const
|
|
68
|
+
}), o.autoCheckResetEmpty && r.value && !k.value && (!o.manualToggleResetButton || !c?.reset) && u(o.getKey(r.value), { checked: !0 });
|
|
69
|
+
const t = [];
|
|
67
70
|
l.value.forEach((n) => {
|
|
68
|
-
n.checked &&
|
|
69
|
-
}), s("update:modelValue",
|
|
71
|
+
n.checked && t.push(n);
|
|
72
|
+
}), s("update:modelValue", t), s("checkedGroup", o.groupId);
|
|
70
73
|
};
|
|
71
|
-
return
|
|
74
|
+
return C(
|
|
72
75
|
() => o.reset,
|
|
73
76
|
(e) => {
|
|
74
|
-
e &&
|
|
77
|
+
e && g();
|
|
75
78
|
}
|
|
76
|
-
), (
|
|
79
|
+
), C(f, (e) => {
|
|
80
|
+
e && (m(), f.value = !1);
|
|
81
|
+
}), (e, c) => p(e.$slots, "default", {
|
|
77
82
|
isActive: d,
|
|
78
|
-
handleChange:
|
|
83
|
+
handleChange: h,
|
|
79
84
|
checkboxesData: a.checkboxData
|
|
80
85
|
}, () => [
|
|
81
|
-
|
|
86
|
+
M("div", {
|
|
82
87
|
id: a.groupId,
|
|
83
|
-
class:
|
|
88
|
+
class: x(["checkbox-group-container", e.$attrs.class || ""]),
|
|
84
89
|
"data-cy": a.dataCy
|
|
85
90
|
}, [
|
|
86
|
-
|
|
91
|
+
p(e.$slots, "checkbox_elements", {
|
|
87
92
|
isActive: d,
|
|
88
|
-
handleChange:
|
|
93
|
+
handleChange: h,
|
|
89
94
|
checkboxesData: a.checkboxData,
|
|
90
|
-
reset:
|
|
95
|
+
reset: g
|
|
91
96
|
}, () => [
|
|
92
|
-
a.checkboxData ? (
|
|
93
|
-
id: a.getKey(
|
|
97
|
+
a.checkboxData ? (v(!0), R(V, { key: 0 }, w(a.checkboxData, (t, n) => (v(), L(F, {
|
|
98
|
+
id: a.getKey(t),
|
|
94
99
|
key: n,
|
|
95
|
-
"data-cy":
|
|
96
|
-
label:
|
|
100
|
+
"data-cy": t.dataCy ?? `checkbox_${G(N)(`${t.label}`)}`,
|
|
101
|
+
label: t.label,
|
|
97
102
|
inline: a.formCheckInline,
|
|
98
|
-
"model-value": d(
|
|
99
|
-
class:
|
|
103
|
+
"model-value": d(t),
|
|
104
|
+
class: x([
|
|
100
105
|
a.formCheckInline ? "uikit-mr-10px" : "uikit-mb-10px",
|
|
101
106
|
a.checkboxContainerClasses
|
|
102
107
|
]),
|
|
103
|
-
onChange:
|
|
104
|
-
}, null, 8, ["id", "data-cy", "label", "inline", "model-value", "class"]))), 128)) :
|
|
108
|
+
onChange: c[0] || (c[0] = ($) => h($))
|
|
109
|
+
}, null, 8, ["id", "data-cy", "label", "inline", "model-value", "class"]))), 128)) : K("", !0)
|
|
105
110
|
])
|
|
106
|
-
], 10,
|
|
111
|
+
], 10, O)
|
|
107
112
|
]);
|
|
108
113
|
}
|
|
109
114
|
});
|
|
110
115
|
export {
|
|
111
|
-
|
|
116
|
+
q as default
|
|
112
117
|
};
|