@wikicasa-dev/components 2.2.8-alpha.3 → 2.2.8-alpha.30
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 +6 -1
- package/dist/UIKit/Autocomplete/ClearableAutocomplete.d.ts +53 -0
- package/dist/UIKit/Autocomplete/ClearableAutocomplete.js +5 -0
- package/dist/UIKit/BaseAutocomplete.d.ts +7 -7
- package/dist/UIKit/BaseDropDown.d.ts +10 -1
- 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/CheckboxBtn.css +1 -0
- package/dist/assets/ClearableAutocomplete.css +1 -0
- package/dist/assets/tailwind.css +1 -1
- package/dist/components/carousel/SwiperCarousel.d.ts +8 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +85 -81
- package/dist/packages/components/lib/UIKit/AccessibleSelect.vue.js +30 -31
- package/dist/packages/components/lib/UIKit/Accordion/BaseAccordionItem.vue.js +30 -24
- package/dist/packages/components/lib/UIKit/Autocomplete/ClearableAutocomplete.vue.js +165 -0
- package/dist/packages/components/lib/UIKit/BaseAutocomplete.vue.js +1 -4
- package/dist/packages/components/lib/UIKit/BaseDropDown.vue.js +104 -86
- 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
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { defineComponent as K, mergeModels as B, useModel as M, useTemplateRef as m, shallowRef as d, onBeforeMount as L, watch as b, nextTick as W, createBlock as V, openBlock as y, withCtx as C, 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
|
+
import '../../../../../assets/BaseDropDown.css';/* empty css */
|
|
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
|
+
__name: "ClearableAutocomplete",
|
|
8
|
+
props: /* @__PURE__ */ B({
|
|
9
|
+
dataCy: {},
|
|
10
|
+
placeholder: {},
|
|
11
|
+
enableKeyboardController: { type: Boolean, default: !0 },
|
|
12
|
+
triggerWrapperClasses: {},
|
|
13
|
+
inputWrapperClasses: {},
|
|
14
|
+
inputClasses: {},
|
|
15
|
+
dropdownClasses: {},
|
|
16
|
+
clearButton: {},
|
|
17
|
+
keepState: {},
|
|
18
|
+
onInputChangeCb: { type: Function },
|
|
19
|
+
onOptionSelectedCb: { type: [Function, null] }
|
|
20
|
+
}, {
|
|
21
|
+
open: { type: Boolean, default: !1 },
|
|
22
|
+
openModifiers: {},
|
|
23
|
+
modelValue: { default: null },
|
|
24
|
+
modelModifiers: {}
|
|
25
|
+
}),
|
|
26
|
+
emits: /* @__PURE__ */ B(["click", "update:inputValue", "keydown"], ["update:open", "update:modelValue"]),
|
|
27
|
+
setup(l, { expose: $, emit: E }) {
|
|
28
|
+
const r = M(l, "open"), a = M(l, "modelValue"), p = E, O = m("inputRef"), n = d(a.value?.label || ""), v = d(0), k = d(!1), w = d(null), i = d([]), h = m("dropdownRef"), g = m("hiddenSpan"), R = () => {
|
|
29
|
+
n.value = "", a.value = null, p("update:inputValue", "");
|
|
30
|
+
}, U = async (t) => {
|
|
31
|
+
if (p("update:inputValue", t), !t) {
|
|
32
|
+
i.value = [], r.value = !1;
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
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 || (l.onOptionSelectedCb?.(e), n.value = e.label, r.value = !1, a.value = e, i.value = []);
|
|
39
|
+
}, x = () => {
|
|
40
|
+
O.value?.select();
|
|
41
|
+
};
|
|
42
|
+
return L(() => {
|
|
43
|
+
w.value = Y({ delay: 300 }, l.onInputChangeCb);
|
|
44
|
+
}), b(
|
|
45
|
+
[n, () => g.value],
|
|
46
|
+
([t, e]) => {
|
|
47
|
+
e && W(() => {
|
|
48
|
+
if (!e) return;
|
|
49
|
+
const o = e.offsetWidth;
|
|
50
|
+
o !== v.value && (console.log("DEBUG:updating icon positioning", {
|
|
51
|
+
curInputValue: t
|
|
52
|
+
}), v.value = o);
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
{ immediate: !0 }
|
|
56
|
+
), b(
|
|
57
|
+
() => h.value?.selectedIdx,
|
|
58
|
+
(t) => {
|
|
59
|
+
const e = t ?? -1;
|
|
60
|
+
e !== -1 && S(e);
|
|
61
|
+
}
|
|
62
|
+
), b(
|
|
63
|
+
a,
|
|
64
|
+
(t, e) => {
|
|
65
|
+
t === e || t?.label === n.value || (n.value = t?.label || "");
|
|
66
|
+
},
|
|
67
|
+
{ immediate: !0 }
|
|
68
|
+
), $({
|
|
69
|
+
select: x,
|
|
70
|
+
getRootElement: () => h.value?.getRootElement()
|
|
71
|
+
}), (t, e) => (y(), V(J, {
|
|
72
|
+
ref: "dropdownRef",
|
|
73
|
+
class: "uikit-clearable-autocomplete",
|
|
74
|
+
"data-cy": l.dataCy,
|
|
75
|
+
"dropdown-element": "ul",
|
|
76
|
+
"dropdown-classes": ["uikit-z-30", l.dropdownClasses],
|
|
77
|
+
"open-dropdown": r.value,
|
|
78
|
+
"keep-state": !i.value.length || l.keepState === "closed" ? "closed" : "opened",
|
|
79
|
+
"activate-keyboard-controller": l.enableKeyboardController,
|
|
80
|
+
"reset-keyboard-controller": k.value,
|
|
81
|
+
"onUpdate:resetKeyboardController": e[3] || (e[3] = (o) => k.value = o),
|
|
82
|
+
"onUpdate:dropdownState": e[4] || (e[4] = (o) => r.value = o)
|
|
83
|
+
}, {
|
|
84
|
+
btn_slot: C(() => [
|
|
85
|
+
u("div", {
|
|
86
|
+
class: f(["uikit-text-16", l.triggerWrapperClasses]),
|
|
87
|
+
onClick: e[2] || (e[2] = (o) => p("click", o))
|
|
88
|
+
}, [
|
|
89
|
+
c(t.$slots, "left-icon"),
|
|
90
|
+
u("div", {
|
|
91
|
+
class: f(["uikit-relative", l.inputWrapperClasses])
|
|
92
|
+
}, [
|
|
93
|
+
F(u("input", {
|
|
94
|
+
ref: "inputRef",
|
|
95
|
+
"onUpdate:modelValue": [
|
|
96
|
+
e[0] || (e[0] = (o) => n.value = o),
|
|
97
|
+
U
|
|
98
|
+
],
|
|
99
|
+
readonly: !!a.value?.label,
|
|
100
|
+
class: f(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", l.inputClasses]),
|
|
101
|
+
style: {
|
|
102
|
+
font: "inherit",
|
|
103
|
+
fontSize: "inherit"
|
|
104
|
+
},
|
|
105
|
+
placeholder: l.placeholder,
|
|
106
|
+
onKeydown: e[1] || (e[1] = (o) => p("keydown", o))
|
|
107
|
+
}, null, 42, Z), [
|
|
108
|
+
[H, n.value]
|
|
109
|
+
]),
|
|
110
|
+
u("span", {
|
|
111
|
+
ref_key: "hiddenSpan",
|
|
112
|
+
ref: g,
|
|
113
|
+
class: "uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre",
|
|
114
|
+
style: {
|
|
115
|
+
font: "inherit",
|
|
116
|
+
fontSize: "inherit"
|
|
117
|
+
}
|
|
118
|
+
}, G(n.value), 513),
|
|
119
|
+
F(u("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
class: f(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", l.clearButton?.classes]),
|
|
122
|
+
"aria-label": "Clear input",
|
|
123
|
+
style: X({
|
|
124
|
+
left: `${v.value + (l.clearButton?.offset || 10)}px`
|
|
125
|
+
}),
|
|
126
|
+
onClick: P(R, ["stop"])
|
|
127
|
+
}, [
|
|
128
|
+
c(t.$slots, "clear-icon", {}, () => [
|
|
129
|
+
e[5] || (e[5] = j("X", -1))
|
|
130
|
+
])
|
|
131
|
+
], 6), [
|
|
132
|
+
[q, a.value?.label]
|
|
133
|
+
])
|
|
134
|
+
], 2),
|
|
135
|
+
c(t.$slots, "right-icon")
|
|
136
|
+
], 2)
|
|
137
|
+
]),
|
|
138
|
+
default: C(({ activeIdx: o, setActiveIdx: z }) => [
|
|
139
|
+
(y(!0), I(N, null, A(i.value, (T, s) => (y(), V(Q, {
|
|
140
|
+
key: s,
|
|
141
|
+
active: o === s,
|
|
142
|
+
class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
|
|
143
|
+
onClick: (D) => S(s),
|
|
144
|
+
onMouseover: (D) => z(s)
|
|
145
|
+
}, {
|
|
146
|
+
default: C(() => [
|
|
147
|
+
c(t.$slots, "option-content", {
|
|
148
|
+
option: T,
|
|
149
|
+
idx: s
|
|
150
|
+
}, () => [
|
|
151
|
+
u("span", {
|
|
152
|
+
innerHTML: T.label
|
|
153
|
+
}, null, 8, _)
|
|
154
|
+
])
|
|
155
|
+
]),
|
|
156
|
+
_: 2
|
|
157
|
+
}, 1032, ["active", "onClick", "onMouseover"]))), 128))
|
|
158
|
+
]),
|
|
159
|
+
_: 3
|
|
160
|
+
}, 8, ["data-cy", "dropdown-classes", "open-dropdown", "keep-state", "activate-keyboard-controller", "reset-keyboard-controller"]));
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
export {
|
|
164
|
+
ie as default
|
|
165
|
+
};
|
|
@@ -31,10 +31,7 @@ const Q = ["innerHTML"], ne = /* @__PURE__ */ x({
|
|
|
31
31
|
}),
|
|
32
32
|
emits: /* @__PURE__ */ $(["update:dropdownState", "changedValue", "click", "keydown", "keydownEnterPressed"], ["update:modelValue"]),
|
|
33
33
|
setup(t, { expose: S, emit: V }) {
|
|
34
|
-
const u = F(
|
|
35
|
-
t,
|
|
36
|
-
"modelValue"
|
|
37
|
-
), r = V, i = d(""), a = d([]), v = d(null), b = d(!1), n = d(!1), C = d(null), B = k(() => a.value.length);
|
|
34
|
+
const u = F(t, "modelValue"), r = V, i = d(""), a = d([]), v = d(null), b = d(!1), n = d(!1), C = d(null), B = k(() => a.value.length);
|
|
38
35
|
L(() => {
|
|
39
36
|
v.value = q({ delay: 300 }, t.onInputChangeCb);
|
|
40
37
|
});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { ArrowIcon as
|
|
4
|
-
import { useKeyboardController as
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as T, mergeModels as E, useId as H, useModel as D, shallowRef as x, computed as N, useTemplateRef as B, onMounted as R, onUnmounted as V, watch as l, nextTick as z, createElementBlock as U, openBlock as f, normalizeClass as i, renderSlot as I, createBlock as L, createVNode as q, unref as r, withCtx as S, createElementVNode as G, createCommentVNode as j, resolveDynamicComponent as F } from "vue";
|
|
2
|
+
import J from "./BaseButton.vue.js";
|
|
3
|
+
import { ArrowIcon as P } from "@wikicasa-dev/svg-icons";
|
|
4
|
+
import { useKeyboardController as Q } from "@wikicasa-dev/vue-composables";
|
|
5
|
+
const X = ["innerHTML"], oe = /* @__PURE__ */ T({
|
|
6
6
|
inheritAttrs: !1,
|
|
7
7
|
__name: "BaseDropDown",
|
|
8
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ E({
|
|
9
9
|
dropdownClasses: { default: "" },
|
|
10
10
|
btnClasses: { default: "" },
|
|
11
11
|
withArrowIcon: { type: Boolean, default: !1 },
|
|
@@ -23,105 +23,123 @@ const j = ["innerHTML"], X = /* @__PURE__ */ L({
|
|
|
23
23
|
dataCy: { default: "" }
|
|
24
24
|
}, {
|
|
25
25
|
toggleDropdown: { type: Boolean, default: void 0 },
|
|
26
|
-
toggleDropdownModifiers: {}
|
|
26
|
+
toggleDropdownModifiers: {},
|
|
27
|
+
resetKeyboardController: { type: Boolean, default: !1 },
|
|
28
|
+
resetKeyboardControllerModifiers: {}
|
|
27
29
|
}),
|
|
28
|
-
emits: /* @__PURE__ */
|
|
29
|
-
setup(
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
d(
|
|
36
|
-
|
|
30
|
+
emits: /* @__PURE__ */ E(["click", "update:dropdownState"], ["update:toggleDropdown", "update:resetKeyboardController"]),
|
|
31
|
+
setup(o, { expose: K, emit: A }) {
|
|
32
|
+
const n = o, k = H(), v = A, m = D(o, "toggleDropdown"), w = D(
|
|
33
|
+
o,
|
|
34
|
+
"resetKeyboardController"
|
|
35
|
+
);
|
|
36
|
+
let p = !1;
|
|
37
|
+
const t = x(!1), u = x([]), M = N(() => u.value.length), s = B("container"), y = B("dropdown"), { activeIdx: d, selectedIdx: a } = Q({
|
|
38
|
+
optionsLength: M,
|
|
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,
|
|
37
66
|
(e) => {
|
|
38
|
-
|
|
67
|
+
t.value = e;
|
|
39
68
|
},
|
|
40
69
|
{
|
|
41
70
|
immediate: !0
|
|
42
71
|
}
|
|
43
|
-
),
|
|
44
|
-
|
|
45
|
-
}),
|
|
46
|
-
e
|
|
47
|
-
}),
|
|
48
|
-
e
|
|
49
|
-
})
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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"]))
|
|
72
|
+
), l(t, (e) => {
|
|
73
|
+
v("update:dropdownState", e);
|
|
74
|
+
}), l(t, (e) => {
|
|
75
|
+
!e || p || !n.closeWhenClickedOutside || (document.addEventListener("click", b), document.addEventListener("keydown", C), p = !0);
|
|
76
|
+
}), l(m, (e) => {
|
|
77
|
+
e && (t.value = !t.value, m.value = !1);
|
|
78
|
+
}), l(a, (e) => {
|
|
79
|
+
e !== -1 && u.value[e].querySelector("a")?.click();
|
|
80
|
+
}), K({
|
|
81
|
+
activeIdx: d,
|
|
82
|
+
selectedIdx: a,
|
|
83
|
+
getRootElement: () => s.value
|
|
84
|
+
}), (e, g) => (f(), U("div", {
|
|
85
|
+
ref: "container",
|
|
86
|
+
class: i(["uikit-relative uikit-block", e.$attrs.class])
|
|
70
87
|
}, [
|
|
71
|
-
|
|
72
|
-
toggleDropdown:
|
|
73
|
-
isOpen:
|
|
88
|
+
I(e.$slots, "btn_slot", {
|
|
89
|
+
toggleDropdown: c,
|
|
90
|
+
isOpen: t.value
|
|
74
91
|
}, () => [
|
|
75
|
-
|
|
76
|
-
id:
|
|
92
|
+
q(J, {
|
|
93
|
+
id: r(k),
|
|
77
94
|
type: "button",
|
|
78
|
-
"data-cy":
|
|
79
|
-
class:
|
|
95
|
+
"data-cy": o.dataCy,
|
|
96
|
+
class: i([
|
|
80
97
|
"!uikit-flex uikit-w-full uikit-items-center uikit-truncate",
|
|
81
|
-
|
|
98
|
+
o.btnClasses
|
|
82
99
|
]),
|
|
83
|
-
"aria-expanded":
|
|
84
|
-
"btn-class": "uikit-btn-single-selection"
|
|
100
|
+
"aria-expanded": t.value,
|
|
101
|
+
"btn-class": "uikit-btn-single-selection",
|
|
102
|
+
onClick: g[0] || (g[0] = (Y) => {
|
|
103
|
+
v("click"), c();
|
|
104
|
+
})
|
|
85
105
|
}, {
|
|
86
|
-
default:
|
|
87
|
-
|
|
88
|
-
class:
|
|
89
|
-
innerHTML:
|
|
90
|
-
}, null, 10,
|
|
91
|
-
|
|
106
|
+
default: S(() => [
|
|
107
|
+
G("span", {
|
|
108
|
+
class: i(["uikit-mr-5px", o.labelClasses]),
|
|
109
|
+
innerHTML: o.btnLabel
|
|
110
|
+
}, null, 10, X),
|
|
111
|
+
o.withArrowIcon ? (f(), L(r(P), {
|
|
92
112
|
key: 0,
|
|
93
|
-
class:
|
|
94
|
-
width:
|
|
95
|
-
height:
|
|
96
|
-
"stroke-color":
|
|
97
|
-
}, null, 8, ["class", "width", "height", "stroke-color"])) :
|
|
113
|
+
class: i(["uikit-shrink-0 uikit-transition-transform motion-reduce:uikit-transition-none", t.value ? "uikit-rotate-180" : ""]),
|
|
114
|
+
width: o.arrowWidth,
|
|
115
|
+
height: o.arrowWidth,
|
|
116
|
+
"stroke-color": o.arrowStrokeColor
|
|
117
|
+
}, null, 8, ["class", "width", "height", "stroke-color"])) : j("", !0)
|
|
98
118
|
]),
|
|
99
119
|
_: 1
|
|
100
120
|
}, 8, ["id", "data-cy", "class", "aria-expanded"])
|
|
101
121
|
]),
|
|
102
|
-
(
|
|
103
|
-
id: "dropdown_" +
|
|
122
|
+
(f(), L(F(o.dropdownElement), {
|
|
123
|
+
id: "dropdown_" + r(k),
|
|
104
124
|
ref: "dropdown",
|
|
105
|
-
"data-cy":
|
|
106
|
-
class:
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
{ "uikit-bottom-[55px] uikit-rounded-xs":
|
|
110
|
-
{ "uikit-rounded-b uikit-border-t-0":
|
|
111
|
-
{ "uikit-absolute":
|
|
125
|
+
"data-cy": o.dataCy && `${o.dataCy}_dropdown`,
|
|
126
|
+
class: i(["uikit-dropdown-content uikit-w-full uikit-flex-col uikit-overflow-y-auto uikit-border uikit-border-solid uikit-bg-white uikit-pl-0 uikit-opacity-100 uikit-shadow uikit-no-scrollbar", [
|
|
127
|
+
o.dropdownClasses,
|
|
128
|
+
t.value ? "uikit-flex" : "uikit-hidden",
|
|
129
|
+
{ "uikit-bottom-[55px] uikit-rounded-xs": o.direction === "up" },
|
|
130
|
+
{ "uikit-rounded-b uikit-border-t-0": o.direction === "down" },
|
|
131
|
+
{ "uikit-absolute": o.isAbsolute }
|
|
112
132
|
]]),
|
|
113
|
-
"aria-hidden": !
|
|
114
|
-
onClick: a[0] || (a[0] = y(() => {
|
|
115
|
-
}, ["stop"]))
|
|
133
|
+
"aria-hidden": !t.value
|
|
116
134
|
}, {
|
|
117
|
-
default:
|
|
118
|
-
|
|
119
|
-
isOpen:
|
|
120
|
-
toggleDropdown:
|
|
121
|
-
activeIdx:
|
|
122
|
-
selectedIdx:
|
|
123
|
-
setActiveIdx:
|
|
124
|
-
setSelectedIdx:
|
|
135
|
+
default: S(() => [
|
|
136
|
+
I(e.$slots, "default", {
|
|
137
|
+
isOpen: t.value,
|
|
138
|
+
toggleDropdown: c,
|
|
139
|
+
activeIdx: r(d),
|
|
140
|
+
selectedIdx: r(a),
|
|
141
|
+
setActiveIdx: W,
|
|
142
|
+
setSelectedIdx: $
|
|
125
143
|
})
|
|
126
144
|
]),
|
|
127
145
|
_: 3
|
|
@@ -130,5 +148,5 @@ const j = ["innerHTML"], X = /* @__PURE__ */ L({
|
|
|
130
148
|
}
|
|
131
149
|
});
|
|
132
150
|
export {
|
|
133
|
-
|
|
151
|
+
oe as default
|
|
134
152
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as I, ref as n, useTemplateRef as T, onUnmounted as z, watch as H, 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__ */ I({
|
|
5
5
|
__name: "BaseModal",
|
|
6
6
|
props: {
|
|
7
7
|
id: { default: "base-bt-modal" },
|
|
@@ -11,6 +11,7 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ T({
|
|
|
11
11
|
customModalHeaderClasses: {},
|
|
12
12
|
customModalBodyClasses: {},
|
|
13
13
|
customModalFooterClasses: {},
|
|
14
|
+
closeIcon: {},
|
|
14
15
|
withCloseIcon: { type: Boolean, default: !0 },
|
|
15
16
|
showModal: { type: Boolean, default: !0 },
|
|
16
17
|
headerTitle: { default: "" },
|
|
@@ -24,7 +25,7 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ T({
|
|
|
24
25
|
},
|
|
25
26
|
emits: ["closed", "opened", "dialogClick"],
|
|
26
27
|
setup(e, { emit: g }) {
|
|
27
|
-
const c = g, i = n(!1), m = n(null), a =
|
|
28
|
+
const c = g, i = n(!1), m = n(null), a = T("modalDialog"), k = n(!1), u = n(!1), f = ({ key: t }) => {
|
|
28
29
|
t === "Escape" && o();
|
|
29
30
|
}, x = () => {
|
|
30
31
|
document?.body.addEventListener("keydown", f);
|
|
@@ -53,9 +54,9 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ T({
|
|
|
53
54
|
m.value?.classList.add("uikit-hidden"), c("closed");
|
|
54
55
|
}, 250);
|
|
55
56
|
};
|
|
56
|
-
return
|
|
57
|
+
return z(() => {
|
|
57
58
|
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");
|
|
58
|
-
}),
|
|
59
|
+
}), H(
|
|
59
60
|
() => e.showModal,
|
|
60
61
|
async (t) => {
|
|
61
62
|
!t && !i.value ? k.value = !0 : k.value = !1, t && !i.value && await p(), !t && i.value && await o(), i.value = t;
|
|
@@ -102,16 +103,16 @@ const F = ["id", "data-cy"], U = ["innerHTML"], R = /* @__PURE__ */ T({
|
|
|
102
103
|
key: 0,
|
|
103
104
|
id: "close-icon-btn",
|
|
104
105
|
"data-cy": "bbt-default-close-icon-btn",
|
|
105
|
-
class: s(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent", e.closeIconBtnClasses]),
|
|
106
|
+
class: s(["uikit-absolute uikit-right-15px uikit-top-15px uikit-z-10 uikit-bg-transparent uikit-p-5px", e.closeIconBtnClasses]),
|
|
106
107
|
type: "button",
|
|
107
108
|
"aria-label": "Close",
|
|
108
109
|
onClick: y(o, ["prevent", "stop"])
|
|
109
110
|
}, [
|
|
110
111
|
D(K(V), {
|
|
111
|
-
class: "bbt-close-icon uikit-box-border
|
|
112
|
-
width: 30,
|
|
113
|
-
height: 30
|
|
114
|
-
})
|
|
112
|
+
class: s(["bbt-close-icon uikit-box-border", e.closeIcon?.classes]),
|
|
113
|
+
width: e.closeIcon?.size || 30,
|
|
114
|
+
height: e.closeIcon?.size || 30
|
|
115
|
+
}, null, 8, ["class", "width", "height"])
|
|
115
116
|
], 2)) : w("", !0),
|
|
116
117
|
d(t.$slots, "header", { closeModal: o }, () => [
|
|
117
118
|
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", "update:modelValue", "change"],
|
|
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-flex uikit-items-center uikit-gap-[12px]
|
|
34
|
+
class: "uikit-checkbox-btn uikit-flex uikit-items-center uikit-gap-[12px]",
|
|
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(["
|
|
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 data-[state='unchecked']:uikit-border-w-lightgray", [
|
|
44
44
|
{
|
|
45
45
|
"uikit-bg-white": !e.modelValue,
|
|
46
46
|
"uikit-bg-w-primary": e.modelValue
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { stringToHyphened as
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { defineComponent as p, ref as v, computed as h, watch as D, renderSlot as b, createElementVNode as E, normalizeClass as $, createElementBlock as B, createCommentVNode as A, openBlock as g, Fragment as I, renderList as R, createBlock as K, unref as V } from "vue";
|
|
2
|
+
import { stringToHyphened as L, isArrNullOrEmpty as G } from "@wikicasa-dev/utilities";
|
|
3
|
+
import N from "./CheckboxBtn.vue.js";
|
|
4
|
+
import '../../../../../assets/CheckboxBtn.css';/* empty css */
|
|
5
|
+
const T = ["id", "data-cy"], j = /* @__PURE__ */ p({
|
|
5
6
|
inheritAttrs: !1,
|
|
6
7
|
__name: "CheckboxGroup",
|
|
7
8
|
props: {
|
|
@@ -14,36 +15,38 @@ const N = ["id", "data-cy"], O = /* @__PURE__ */ x({
|
|
|
14
15
|
autoCheckResetAll: { type: Boolean, default: !1 },
|
|
15
16
|
autoCheckResetEmpty: { type: Boolean, default: !1 },
|
|
16
17
|
manualToggleResetButton: { type: Boolean, default: !1 },
|
|
17
|
-
getKey: { type: Function, default: (
|
|
18
|
+
getKey: { type: Function, default: (a) => typeof a == "string" || typeof a == "number" ? `${a}` : `${a.id}` },
|
|
18
19
|
groupId: { default: "" },
|
|
19
20
|
dataCy: { default: "" }
|
|
20
21
|
},
|
|
21
22
|
emits: ["resetted", "update:modelValue", "checkedGroup"],
|
|
22
|
-
setup(
|
|
23
|
-
const o =
|
|
23
|
+
setup(a, { emit: C }) {
|
|
24
|
+
const o = a, s = C, l = v(
|
|
25
|
+
/* @__PURE__ */ new Map()
|
|
26
|
+
), r = h(() => {
|
|
24
27
|
for (const e of o.checkboxData)
|
|
25
28
|
if (e.reset) return e;
|
|
26
29
|
return null;
|
|
27
30
|
}), y = h(() => o.checkboxData.length), f = h(() => {
|
|
28
31
|
let e = 0;
|
|
29
|
-
return l.value.forEach((
|
|
30
|
-
|
|
32
|
+
return l.value.forEach((t) => {
|
|
33
|
+
t.checked && e++;
|
|
31
34
|
}), e;
|
|
32
35
|
});
|
|
33
36
|
(() => {
|
|
34
37
|
const e = [];
|
|
35
|
-
for (const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
),
|
|
38
|
+
for (const t of o.checkboxData)
|
|
39
|
+
l.value.set(`${t.id}`, {
|
|
40
|
+
...t,
|
|
41
|
+
checked: !!t.checked
|
|
42
|
+
}), t.checked && e.push(t);
|
|
40
43
|
s("update:modelValue", e);
|
|
41
44
|
})();
|
|
42
|
-
const u = (e,
|
|
45
|
+
const u = (e, t) => {
|
|
43
46
|
const c = l.value.get(e);
|
|
44
47
|
if (c) {
|
|
45
|
-
if (
|
|
46
|
-
l.value.set(e, { ...c, ...
|
|
48
|
+
if (t) {
|
|
49
|
+
l.value.set(e, { ...c, ...t });
|
|
47
50
|
return;
|
|
48
51
|
}
|
|
49
52
|
l.value.set(e, { ...c, checked: !c.checked });
|
|
@@ -55,55 +58,55 @@ const N = ["id", "data-cy"], O = /* @__PURE__ */ x({
|
|
|
55
58
|
}, m = () => {
|
|
56
59
|
k(), s("update:modelValue", []), s("resetted");
|
|
57
60
|
}, d = (e) => l.value.get(o.getKey(e))?.checked ?? !1, i = (e) => {
|
|
58
|
-
if (
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
+
if (G(o.checkboxData)) return;
|
|
62
|
+
const t = l.value.get(e.id);
|
|
63
|
+
t?.reset && e.checked ? k() : r.value && !t?.reset && u(o.getKey(r.value), { checked: !1 }), u(`${e.id}`), o.autoCheckResetAll && r.value && f.value === y.value - 1 && l.value.forEach((n) => {
|
|
61
64
|
n.checked = !!n.reset;
|
|
62
|
-
}), o.autoCheckResetEmpty && r.value && !f.value && (!o.manualToggleResetButton || !
|
|
65
|
+
}), o.autoCheckResetEmpty && r.value && !f.value && (!o.manualToggleResetButton || !t?.reset) && u(o.getKey(r.value), { checked: !0 });
|
|
63
66
|
const c = [];
|
|
64
67
|
l.value.forEach((n) => {
|
|
65
68
|
n.checked && c.push(n);
|
|
66
69
|
}), s("update:modelValue", c), s("checkedGroup", o.groupId);
|
|
67
70
|
};
|
|
68
|
-
return
|
|
71
|
+
return D(
|
|
69
72
|
() => o.reset,
|
|
70
73
|
(e) => {
|
|
71
74
|
e && m();
|
|
72
75
|
}
|
|
73
|
-
), (e,
|
|
76
|
+
), (e, t) => b(e.$slots, "default", {
|
|
74
77
|
isActive: d,
|
|
75
78
|
handleChange: i,
|
|
76
|
-
checkboxesData:
|
|
79
|
+
checkboxesData: a.checkboxData
|
|
77
80
|
}, () => [
|
|
78
|
-
|
|
79
|
-
id:
|
|
80
|
-
class:
|
|
81
|
-
"data-cy":
|
|
81
|
+
E("div", {
|
|
82
|
+
id: a.groupId,
|
|
83
|
+
class: $(["checkbox-group-container", e.$attrs.class || ""]),
|
|
84
|
+
"data-cy": a.dataCy
|
|
82
85
|
}, [
|
|
83
86
|
b(e.$slots, "checkbox_elements", {
|
|
84
87
|
isActive: d,
|
|
85
88
|
handleChange: i,
|
|
86
|
-
checkboxesData:
|
|
89
|
+
checkboxesData: a.checkboxData,
|
|
87
90
|
reset: m
|
|
88
91
|
}, () => [
|
|
89
|
-
|
|
90
|
-
id:
|
|
92
|
+
a.checkboxData ? (g(!0), B(I, { key: 0 }, R(a.checkboxData, (c, n) => (g(), K(N, {
|
|
93
|
+
id: a.getKey(c),
|
|
91
94
|
key: n,
|
|
92
|
-
"data-cy": c.dataCy ?? `checkbox_${
|
|
95
|
+
"data-cy": c.dataCy ?? `checkbox_${V(L)(`${c.label}`)}`,
|
|
93
96
|
label: c.label,
|
|
94
|
-
inline:
|
|
97
|
+
inline: a.formCheckInline,
|
|
95
98
|
"model-value": d(c),
|
|
96
99
|
"container-class": [
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
a.formCheckInline ? "uikit-mr-10px" : "uikit-mb-10px",
|
|
101
|
+
a.checkboxContainerClasses
|
|
99
102
|
],
|
|
100
|
-
onChange: i
|
|
101
|
-
}, null, 8, ["id", "data-cy", "label", "inline", "model-value", "container-class"]))), 128)) :
|
|
103
|
+
onChange: t[0] || (t[0] = (x) => i(x))
|
|
104
|
+
}, null, 8, ["id", "data-cy", "label", "inline", "model-value", "container-class"]))), 128)) : A("", !0)
|
|
102
105
|
])
|
|
103
|
-
], 10,
|
|
106
|
+
], 10, T)
|
|
104
107
|
]);
|
|
105
108
|
}
|
|
106
109
|
});
|
|
107
110
|
export {
|
|
108
|
-
|
|
111
|
+
j as default
|
|
109
112
|
};
|