@wikicasa-dev/components 2.2.9-alpha.3 → 2.2.9-alpha.32
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/UIKit/AccessibleSelect.d.ts +4 -4
- package/dist/UIKit/AccessibleSelect.js +3 -2
- package/dist/UIKit/Autocomplete/ClearableAutocomplete.d.ts +9 -3
- package/dist/UIKit/BaseAutocomplete.d.ts +2 -2
- package/dist/UIKit/BaseButton.d.ts +14 -8
- package/dist/UIKit/BaseDropDown.d.ts +15 -11
- package/dist/UIKit/BaseInput.d.ts +2 -2
- package/dist/UIKit/BaseTextarea.d.ts +2 -2
- package/dist/assets/AccessibleSelect.css +1 -0
- package/dist/assets/BaseDropDown.css +1 -1
- 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.js +84 -83
- package/dist/packages/components/lib/UIKit/AccessibleSelect.vue.js +151 -158
- package/dist/packages/components/lib/UIKit/Autocomplete/ClearableAutocomplete.vue.js +116 -100
- package/dist/packages/components/lib/UIKit/BaseAutocomplete.vue.js +5 -5
- package/dist/packages/components/lib/UIKit/BaseButton.vue.js +28 -24
- package/dist/packages/components/lib/UIKit/BaseDropDown.vue.js +99 -104
- package/dist/packages/components/lib/UIKit/BaseModal.vue.js +44 -38
- package/dist/packages/components/lib/UIKit/BaseSelect/SelectItem.vue.js +18 -17
- package/dist/packages/components/lib/UIKit/Checkbox/CheckboxBtn.vue.js +24 -26
- package/dist/packages/components/lib/UIKit/Checkbox/CheckboxGroup.vue.js +14 -14
- package/package.json +5 -5
|
@@ -1,171 +1,187 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as P, mergeModels as O, useModel as B, useId as X, useTemplateRef as d, shallowRef as c, onBeforeMount as j, watch as T, nextTick as q, createBlock as V, openBlock as g, withCtx as S, createElementBlock as G, Fragment as J, renderList as Q, renderSlot as C, createElementVNode as s, normalizeClass as f, withDirectives as W, unref as Y, vModelText as Z, toDisplayString as _, withModifiers as ee, normalizeStyle as te, createTextVNode as le, vShow as ne } from "vue";
|
|
2
|
+
import oe from "../BaseDropDown.vue.js";
|
|
3
3
|
import '../../../../../assets/BaseDropDown.css';/* empty css */
|
|
4
|
-
import
|
|
5
|
-
import { debounce as
|
|
6
|
-
const
|
|
4
|
+
import ae from "../BaseSelect/SelectItem.vue.js";
|
|
5
|
+
import { debounce as ie } from "@wikicasa-dev/utilities";
|
|
6
|
+
const ue = ["id", "data-cy", "placeholder"], se = ["innerHTML"], ke = /* @__PURE__ */ P({
|
|
7
7
|
__name: "ClearableAutocomplete",
|
|
8
|
-
props: /* @__PURE__ */
|
|
8
|
+
props: /* @__PURE__ */ O({
|
|
9
9
|
dataCy: {},
|
|
10
10
|
placeholder: {},
|
|
11
11
|
enableKeyboardController: { type: Boolean, default: !0 },
|
|
12
12
|
triggerWrapperClasses: {},
|
|
13
13
|
inputWrapperClasses: {},
|
|
14
14
|
inputClasses: {},
|
|
15
|
+
hiddenTextClasses: {},
|
|
15
16
|
dropdownClasses: {},
|
|
16
17
|
clearButton: {},
|
|
17
18
|
keepState: {},
|
|
19
|
+
disableCb: { type: Boolean, default: !1 },
|
|
18
20
|
onInputChangeCb: { type: Function },
|
|
19
21
|
onOptionSelectedCb: { type: [Function, null] }
|
|
20
22
|
}, {
|
|
21
23
|
open: { type: Boolean, default: !1 },
|
|
22
24
|
openModifiers: {},
|
|
23
25
|
modelValue: { default: null },
|
|
24
|
-
modelModifiers: {}
|
|
26
|
+
modelModifiers: {},
|
|
27
|
+
inputValue: {
|
|
28
|
+
default: ""
|
|
29
|
+
},
|
|
30
|
+
inputValueModifiers: {}
|
|
25
31
|
}),
|
|
26
|
-
emits: /* @__PURE__ */
|
|
27
|
-
setup(
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
emits: /* @__PURE__ */ O(["input", "click", "inputClick", "keydown"], ["update:open", "update:modelValue", "update:inputValue"]),
|
|
33
|
+
setup(t, { expose: U, emit: E }) {
|
|
34
|
+
const r = B(t, "open"), u = B(t, "modelValue"), o = B(t, "inputValue");
|
|
35
|
+
o.value = o.value ?? u.value?.label ?? "";
|
|
36
|
+
const p = E, I = X(), b = d("inputRef"), v = c(0), y = c(!1), k = c(!!u.value?.label), x = c(null), a = c([]), M = d("dropdownRef"), F = d("hiddenSpan"), L = d("inputWrapperRef"), z = d("clearButtonRef"), D = () => {
|
|
37
|
+
o.value = "", u.value = null, k.value = !1;
|
|
38
|
+
}, K = async (l) => {
|
|
39
|
+
if (!l) {
|
|
40
|
+
a.value = [], r.value = !1;
|
|
33
41
|
return;
|
|
34
42
|
}
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
const e =
|
|
38
|
-
!e || e.id ===
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
+
t.disableCb || (a.value = await x.value?.(l) || [], y.value = !0, r.value = !!a.value.length);
|
|
44
|
+
}, R = (l = -1) => {
|
|
45
|
+
const e = a.value[l];
|
|
46
|
+
!e || e.id === u.value?.id || (t.onOptionSelectedCb?.(e), o.value = e.label, r.value = !1, u.value = e, k.value = !0, a.value = []);
|
|
47
|
+
}, N = () => {
|
|
48
|
+
b.value?.select();
|
|
49
|
+
}, A = () => {
|
|
50
|
+
b.value?.focus();
|
|
43
51
|
};
|
|
44
|
-
return
|
|
45
|
-
|
|
46
|
-
}),
|
|
47
|
-
[
|
|
48
|
-
([
|
|
49
|
-
e
|
|
50
|
-
if (!e) return;
|
|
51
|
-
const l = e.offsetWidth;
|
|
52
|
-
|
|
53
|
-
curInputValue: t
|
|
54
|
-
}), c.value = l);
|
|
52
|
+
return j(() => {
|
|
53
|
+
x.value = ie({ delay: 300 }, t.onInputChangeCb);
|
|
54
|
+
}), T(
|
|
55
|
+
[o, F, L, z],
|
|
56
|
+
([, l, e, n]) => {
|
|
57
|
+
!l || !e || q(() => {
|
|
58
|
+
if (!l || !e) return;
|
|
59
|
+
const h = l.offsetWidth, m = e.offsetWidth, i = t.clearButton?.offset || 0, w = t.clearButton?.width || n?.offsetWidth || 0, H = m - i - w, $ = Math.min(h, H);
|
|
60
|
+
$ !== v.value && (v.value = $);
|
|
55
61
|
});
|
|
56
62
|
},
|
|
57
63
|
{ immediate: !0 }
|
|
58
|
-
),
|
|
59
|
-
() =>
|
|
60
|
-
(
|
|
61
|
-
const e =
|
|
62
|
-
e !== -1 &&
|
|
64
|
+
), T(
|
|
65
|
+
() => M.value?.selectedIdx,
|
|
66
|
+
(l) => {
|
|
67
|
+
const e = l ?? -1;
|
|
68
|
+
e !== -1 && R(e);
|
|
63
69
|
}
|
|
64
|
-
),
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
|
|
70
|
+
), T(
|
|
71
|
+
u,
|
|
72
|
+
(l, e) => {
|
|
73
|
+
l === e || l?.label === o.value || (o.value = l?.label || "");
|
|
68
74
|
},
|
|
69
75
|
{ immediate: !0 }
|
|
70
|
-
),
|
|
71
|
-
getRootElement: () =>
|
|
72
|
-
select:
|
|
73
|
-
focus:
|
|
74
|
-
}), (
|
|
76
|
+
), U({
|
|
77
|
+
getRootElement: () => M.value?.getRootElement(),
|
|
78
|
+
select: N,
|
|
79
|
+
focus: A
|
|
80
|
+
}), (l, e) => (g(), V(oe, {
|
|
75
81
|
ref: "dropdownRef",
|
|
76
82
|
class: "uikit-clearable-autocomplete",
|
|
77
|
-
"data-cy":
|
|
83
|
+
"data-cy": t.dataCy,
|
|
78
84
|
"dropdown-element": "ul",
|
|
79
|
-
"dropdown-classes": ["uikit-z-30",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
|
|
85
|
-
"onUpdate:
|
|
85
|
+
"dropdown-classes": ["uikit-z-30", t.dropdownClasses],
|
|
86
|
+
"keep-state": !a.value.length || t.keepState === "closed" ? "closed" : "opened",
|
|
87
|
+
"activate-keyboard-controller": t.enableKeyboardController,
|
|
88
|
+
"reset-keyboard-controller": y.value,
|
|
89
|
+
"onUpdate:resetKeyboardController": e[5] || (e[5] = (n) => y.value = n),
|
|
90
|
+
open: r.value,
|
|
91
|
+
"onUpdate:open": e[6] || (e[6] = (n) => r.value = n)
|
|
86
92
|
}, {
|
|
87
|
-
btn_slot:
|
|
88
|
-
|
|
89
|
-
class:
|
|
90
|
-
onClick: e[
|
|
93
|
+
btn_slot: S(() => [
|
|
94
|
+
s("div", {
|
|
95
|
+
class: f(["uikit-text-16", t.triggerWrapperClasses]),
|
|
96
|
+
onClick: e[4] || (e[4] = (n) => p("click", n))
|
|
91
97
|
}, [
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
98
|
+
C(l.$slots, "left-icon"),
|
|
99
|
+
s("div", {
|
|
100
|
+
ref: "inputWrapperRef",
|
|
101
|
+
class: f(["uikit-relative", t.inputWrapperClasses])
|
|
95
102
|
}, [
|
|
96
|
-
|
|
103
|
+
W(s("input", {
|
|
97
104
|
ref: "inputRef",
|
|
98
105
|
"onUpdate:modelValue": [
|
|
99
|
-
e[0] || (e[0] = (
|
|
100
|
-
|
|
106
|
+
e[0] || (e[0] = (n) => o.value = n),
|
|
107
|
+
K
|
|
101
108
|
],
|
|
102
|
-
|
|
109
|
+
id: Y(I),
|
|
110
|
+
"data-cy": t.dataCy ? `ac_input_${t.dataCy}` : "",
|
|
103
111
|
type: "text",
|
|
104
112
|
autocomplete: "off",
|
|
105
|
-
class:
|
|
113
|
+
class: f(["uikit-w-full uikit-border-none focus-visible:uikit-outline-none", t.inputClasses]),
|
|
106
114
|
style: {
|
|
107
115
|
font: "inherit",
|
|
108
116
|
fontSize: "inherit"
|
|
109
117
|
},
|
|
110
|
-
placeholder:
|
|
111
|
-
onKeydown: e[1] || (e[1] = (
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
118
|
+
placeholder: t.placeholder,
|
|
119
|
+
onKeydown: e[1] || (e[1] = (n) => p("keydown", n)),
|
|
120
|
+
onInput: e[2] || (e[2] = (n) => {
|
|
121
|
+
p("input", n), k.value = !1;
|
|
122
|
+
}),
|
|
123
|
+
onClick: e[3] || (e[3] = (n) => {
|
|
124
|
+
p("inputClick", n), b.value?.select();
|
|
125
|
+
})
|
|
126
|
+
}, null, 42, ue), [
|
|
127
|
+
[Z, o.value]
|
|
115
128
|
]),
|
|
116
|
-
|
|
129
|
+
s("span", {
|
|
117
130
|
ref_key: "hiddenSpan",
|
|
118
|
-
ref:
|
|
119
|
-
class: "uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre",
|
|
131
|
+
ref: F,
|
|
132
|
+
class: f(["uikit-invisible uikit-absolute uikit-left-0 uikit-top-0 uikit-whitespace-pre", t.hiddenTextClasses]),
|
|
120
133
|
style: {
|
|
121
134
|
font: "inherit",
|
|
122
135
|
fontSize: "inherit"
|
|
123
136
|
}
|
|
124
|
-
},
|
|
125
|
-
|
|
137
|
+
}, _(o.value), 3),
|
|
138
|
+
W(s("button", {
|
|
139
|
+
ref: "clearButtonRef",
|
|
126
140
|
type: "button",
|
|
127
|
-
class:
|
|
141
|
+
class: f(["uikit-clear-btn uikit-absolute uikit-top-1/2 -uikit-translate-y-1/2 uikit-appearance-none", t.clearButton?.classes]),
|
|
128
142
|
"aria-label": "Clear input",
|
|
129
|
-
style:
|
|
130
|
-
left: `${
|
|
143
|
+
style: te({
|
|
144
|
+
left: `${v.value + (t.clearButton?.offset || 0)}px`,
|
|
145
|
+
width: t.clearButton?.width ? `${t.clearButton.width}px` : "auto",
|
|
146
|
+
height: t.clearButton?.height ? `${t.clearButton.height}px` : "auto"
|
|
131
147
|
}),
|
|
132
|
-
onClick:
|
|
148
|
+
onClick: ee(D, ["stop"])
|
|
133
149
|
}, [
|
|
134
|
-
|
|
135
|
-
e[
|
|
150
|
+
C(l.$slots, "clear-icon", {}, () => [
|
|
151
|
+
e[7] || (e[7] = le("X", -1))
|
|
136
152
|
])
|
|
137
153
|
], 6), [
|
|
138
|
-
[
|
|
154
|
+
[ne, k.value && v.value]
|
|
139
155
|
])
|
|
140
156
|
], 2),
|
|
141
|
-
|
|
157
|
+
C(l.$slots, "right-icon")
|
|
142
158
|
], 2)
|
|
143
159
|
]),
|
|
144
|
-
default:
|
|
145
|
-
(
|
|
146
|
-
key:
|
|
147
|
-
active:
|
|
160
|
+
default: S(({ activeIdx: n, setActiveIdx: h }) => [
|
|
161
|
+
(g(!0), G(J, null, Q(a.value, (m, i) => (g(), V(ae, {
|
|
162
|
+
key: i,
|
|
163
|
+
active: n === i,
|
|
148
164
|
class: "uikit-m-1 uikit-rounded-[5px] uikit-px-5 uikit-py-10px hover:uikit-cursor-pointer",
|
|
149
|
-
onClick: (
|
|
150
|
-
onMouseover: (
|
|
165
|
+
onClick: (w) => R(i),
|
|
166
|
+
onMouseover: (w) => h(i)
|
|
151
167
|
}, {
|
|
152
|
-
default:
|
|
153
|
-
|
|
154
|
-
option:
|
|
155
|
-
idx:
|
|
168
|
+
default: S(() => [
|
|
169
|
+
C(l.$slots, "option-content", {
|
|
170
|
+
option: m,
|
|
171
|
+
idx: i
|
|
156
172
|
}, () => [
|
|
157
|
-
|
|
158
|
-
innerHTML:
|
|
159
|
-
}, null, 8,
|
|
173
|
+
s("span", {
|
|
174
|
+
innerHTML: m.label
|
|
175
|
+
}, null, 8, se)
|
|
160
176
|
])
|
|
161
177
|
]),
|
|
162
178
|
_: 2
|
|
163
179
|
}, 1032, ["active", "onClick", "onMouseover"]))), 128))
|
|
164
180
|
]),
|
|
165
181
|
_: 3
|
|
166
|
-
}, 8, ["data-cy", "dropdown-classes", "
|
|
182
|
+
}, 8, ["data-cy", "dropdown-classes", "keep-state", "activate-keyboard-controller", "reset-keyboard-controller", "open"]));
|
|
167
183
|
}
|
|
168
184
|
});
|
|
169
185
|
export {
|
|
170
|
-
|
|
186
|
+
ke as default
|
|
171
187
|
};
|
|
@@ -30,13 +30,13 @@ const Q = ["innerHTML"], ne = /* @__PURE__ */ x({
|
|
|
30
30
|
modelModifiers: {}
|
|
31
31
|
}),
|
|
32
32
|
emits: /* @__PURE__ */ $(["update:dropdownState", "changedValue", "click", "keydown", "keydownEnterPressed"], ["update:modelValue"]),
|
|
33
|
-
setup(t, { expose:
|
|
34
|
-
const u = F(t, "modelValue"), r =
|
|
33
|
+
setup(t, { expose: V, emit: B }) {
|
|
34
|
+
const u = F(t, "modelValue"), r = B, i = d(""), a = d([]), v = d(null), b = d(!1), n = d(!1), C = d(null), S = k(() => a.value.length);
|
|
35
35
|
L(() => {
|
|
36
36
|
v.value = q({ delay: 300 }, t.onInputChangeCb);
|
|
37
37
|
});
|
|
38
38
|
const { activeIdx: m, selectedIdx: h } = J({
|
|
39
|
-
optionsLength:
|
|
39
|
+
optionsLength: S,
|
|
40
40
|
isDropdownOpen: n,
|
|
41
41
|
disableSpaceHandler: !0
|
|
42
42
|
}), O = k(() => {
|
|
@@ -103,7 +103,7 @@ const Q = ["innerHTML"], ne = /* @__PURE__ */ x({
|
|
|
103
103
|
}
|
|
104
104
|
), f(n, (e) => {
|
|
105
105
|
r("update:dropdownState", e);
|
|
106
|
-
}),
|
|
106
|
+
}), V({
|
|
107
107
|
select: () => {
|
|
108
108
|
C.value?.select();
|
|
109
109
|
}
|
|
@@ -126,7 +126,7 @@ const Q = ["innerHTML"], ne = /* @__PURE__ */ x({
|
|
|
126
126
|
"keep-state": !a.value.length || t.keepState === "closed" ? "closed" : "opened",
|
|
127
127
|
"close-when-clicked-outside": t.closeDropdownOnBodyPressed,
|
|
128
128
|
"activate-keyboard-controller": !1,
|
|
129
|
-
"onUpdate:
|
|
129
|
+
"onUpdate:open": l[3] || (l[3] = (o) => n.value = o),
|
|
130
130
|
onClick: l[4] || (l[4] = (o) => {
|
|
131
131
|
r("click"), E();
|
|
132
132
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as c,
|
|
2
|
-
import
|
|
3
|
-
const
|
|
1
|
+
import { defineComponent as v, useTemplateRef as c, shallowRef as B, computed as l, createElementBlock as C, openBlock as w, withModifiers as s, normalizeStyle as M, normalizeClass as z, renderSlot as u, createVNode as L } from "vue";
|
|
2
|
+
import g from "../../../../UIKit/StaticSpinner.js";
|
|
3
|
+
const S = ["id", "data-cy", "type", "data-active", "disabled", "aria-label", "title"], A = /* @__PURE__ */ v({
|
|
4
4
|
__name: "BaseButton",
|
|
5
5
|
props: {
|
|
6
6
|
btnClass: { default: "uikit-btn-w-primary" },
|
|
@@ -15,18 +15,21 @@ const L = ["id", "data-cy", "type", "data-active", "disabled", "aria-label", "ti
|
|
|
15
15
|
dataCy: {},
|
|
16
16
|
type: {}
|
|
17
17
|
},
|
|
18
|
-
emits: ["mouseover", "mouseout", "click"],
|
|
19
|
-
setup(e, {
|
|
20
|
-
const o =
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
18
|
+
emits: ["mouseover", "mouseout", "click", "keydown"],
|
|
19
|
+
setup(e, { expose: d, emit: r }) {
|
|
20
|
+
const o = r, m = c("buttonEl"), a = B(!1), y = l(() => e.size ? `uikit-btn-${e.size}` : ""), k = l(() => e.outlined ? "uikit-btn-outline" : ""), b = () => {
|
|
21
|
+
a.value = !0;
|
|
22
|
+
}, f = () => {
|
|
23
|
+
a.value = !1;
|
|
24
24
|
};
|
|
25
|
-
return (
|
|
26
|
-
|
|
25
|
+
return d({
|
|
26
|
+
getRootElement: () => m.value
|
|
27
|
+
}), (n, t) => (w(), C("button", {
|
|
28
|
+
ref: "buttonEl",
|
|
29
|
+
id: n.$attrs.id,
|
|
27
30
|
"data-cy": e.dataCy,
|
|
28
31
|
type: e.type,
|
|
29
|
-
class:
|
|
32
|
+
class: z([
|
|
30
33
|
"uikit-btn",
|
|
31
34
|
{
|
|
32
35
|
"uikit-btn-empty": !e.withMinWidth,
|
|
@@ -34,33 +37,34 @@ const L = ["id", "data-cy", "type", "data-active", "disabled", "aria-label", "ti
|
|
|
34
37
|
"uikit-flex uikit-items-center uikit-justify-center": e.isLoading
|
|
35
38
|
},
|
|
36
39
|
e.btnClass,
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
y.value,
|
|
41
|
+
k.value
|
|
39
42
|
]),
|
|
40
|
-
style:
|
|
43
|
+
style: M(n.$attrs.style),
|
|
41
44
|
"data-active": e.keepActive,
|
|
42
45
|
disabled: e.isLoading || e.disabled,
|
|
43
46
|
"aria-label": e.ariaLabel,
|
|
44
47
|
title: e.title,
|
|
45
48
|
onMouseover: t[0] || (t[0] = s((i) => {
|
|
46
|
-
|
|
49
|
+
b(), o("mouseover", i);
|
|
47
50
|
}, ["stop"])),
|
|
48
51
|
onMouseout: t[1] || (t[1] = s((i) => {
|
|
49
|
-
|
|
52
|
+
f(), o("mouseout", i);
|
|
50
53
|
}, ["stop"])),
|
|
51
|
-
onClick: t[2] || (t[2] = (i) => o("click", i))
|
|
54
|
+
onClick: t[2] || (t[2] = (i) => o("click", i)),
|
|
55
|
+
onKeydown: t[3] || (t[3] = (i) => o("keydown", i))
|
|
52
56
|
}, [
|
|
53
|
-
e.isLoading ? u(
|
|
54
|
-
|
|
57
|
+
e.isLoading ? u(n.$slots, "spinner", { key: 1 }, () => [
|
|
58
|
+
L(g, {
|
|
55
59
|
"stroke-color": e.outlined ? "#ACB4C3" : "#fff"
|
|
56
60
|
}, null, 8, ["stroke-color"])
|
|
57
|
-
]) : u(
|
|
61
|
+
]) : u(n.$slots, "default", {
|
|
58
62
|
key: 0,
|
|
59
|
-
hover:
|
|
63
|
+
hover: a.value
|
|
60
64
|
})
|
|
61
|
-
], 46,
|
|
65
|
+
], 46, S));
|
|
62
66
|
}
|
|
63
67
|
});
|
|
64
68
|
export {
|
|
65
|
-
|
|
69
|
+
A as default
|
|
66
70
|
};
|