@weni/unnnic-system 3.36.1-alpha.0 → 3.36.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/scss/tailwind.css +1 -1
- package/dist/components/MultiSelect/MultiSelectOption.css +1 -1
- package/dist/components/MultiSelect/MultiSelectOption.vue.mjs +2 -2
- package/dist/components/MultiSelect/MultiSelectOption.vue2.mjs +15 -41
- package/dist/components/MultiSelect/index.css +1 -1
- package/dist/components/MultiSelect/index.vue.mjs +2 -2
- package/dist/components/MultiSelect/index.vue2.mjs +114 -126
- package/dist/components/SelectTime/index.css +1 -1
- package/dist/components/SelectTime/index.vue.mjs +55 -42
- package/dist/composables/useSelectBase.mjs +39 -44
- package/dist/composables/useSelectKeyboard.mjs +35 -70
- package/dist/locales/en.json.mjs +5 -9
- package/dist/style.css +4 -6
- package/dist/unnnic.umd.js +19 -19
- package/package.json +2 -2
- package/src/components/MultiSelect/MultiSelectOption.vue +3 -66
- package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +0 -556
- package/src/components/MultiSelect/__tests__/MultiSelectOption.spec.js +1 -55
- package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +0 -5
- package/src/components/MultiSelect/index.vue +50 -57
- package/src/components/Select/_select-shared.scss +0 -8
- package/src/components/Select/types.ts +0 -1
- package/src/components/SelectTime/__tests__/SelectTime.spec.js +88 -0
- package/src/components/SelectTime/index.vue +31 -7
- package/src/composables/useSelectBase.ts +16 -40
- package/src/composables/useSelectKeyboard.ts +18 -92
- package/src/locales/en.json +1 -3
- package/src/stories/MultiSelect.stories.js +1 -62
- package/src/stories/SelectTime.stories.js +5 -1
- package/dist/components/MultiSelect/MultiSelectTreeOptions.css +0 -1
- package/dist/components/MultiSelect/MultiSelectTreeOptions.vue.mjs +0 -7
- package/dist/components/MultiSelect/MultiSelectTreeOptions.vue2.mjs +0 -50
- package/dist/composables/useMultiSelectRows.mjs +0 -74
- package/dist/composables/useMultiSelectSelection.mjs +0 -44
- package/dist/composables/useTreeExpansion.mjs +0 -24
- package/dist/lib/tree-selection.mjs +0 -66
- package/src/components/MultiSelect/MultiSelectTreeOptions.vue +0 -73
- package/src/composables/useMultiSelectRows.ts +0 -121
- package/src/composables/useMultiSelectSelection.ts +0 -97
- package/src/composables/useTreeExpansion.ts +0 -44
- package/src/lib/__tests__/tree-selection.spec.ts +0 -141
- package/src/lib/tree-selection.ts +0 -156
|
@@ -1,68 +1,63 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
import { useElementSize as
|
|
3
|
-
function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
() => r.value ? m(e.options, u) : e.options
|
|
16
|
-
);
|
|
17
|
-
function L(t) {
|
|
1
|
+
import { ref as b, computed as s } from "vue";
|
|
2
|
+
import { useElementSize as w } from "../node_modules/@vueuse/core/dist/index.mjs";
|
|
3
|
+
function V(n, g, c, d) {
|
|
4
|
+
const v = b(!1), { width: f } = w(c), m = s(() => `${f.value}px`), l = s(() => {
|
|
5
|
+
var t;
|
|
6
|
+
const e = n.options;
|
|
7
|
+
if (!n.enableSearch || !n.search) return e;
|
|
8
|
+
const o = ((t = n.search) == null ? void 0 : t.toLowerCase()) ?? "";
|
|
9
|
+
return e.filter((i) => {
|
|
10
|
+
const a = String(i[n.itemLabel] ?? "").toLowerCase().includes(o), r = String(i[n.itemValue] ?? "").toLowerCase().includes(o);
|
|
11
|
+
return a || r;
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
function L(e) {
|
|
18
15
|
const {
|
|
19
16
|
optionsLength: o,
|
|
20
|
-
optionsLines:
|
|
17
|
+
optionsLines: t,
|
|
21
18
|
enableSearch: i,
|
|
22
|
-
variant:
|
|
23
|
-
} =
|
|
19
|
+
variant: a
|
|
20
|
+
} = e;
|
|
24
21
|
if (o === 0) return "unset";
|
|
25
|
-
if (
|
|
26
|
-
const
|
|
27
|
-
return `${i ?
|
|
22
|
+
if (a === "single") {
|
|
23
|
+
const x = 37 * t, H = i ? 1 : 2, h = x + 32 + (4 * t - H);
|
|
24
|
+
return `${i ? h + 45 + 1 : h}px`;
|
|
28
25
|
}
|
|
29
|
-
const
|
|
30
|
-
return `${i ?
|
|
26
|
+
const r = i ? 16 : 0, u = 22 * t + (24 * t - 2);
|
|
27
|
+
return `${i ? u + 51 + r : u}px`;
|
|
31
28
|
}
|
|
32
29
|
const p = s(
|
|
33
30
|
() => {
|
|
34
|
-
var
|
|
31
|
+
var e;
|
|
35
32
|
return L({
|
|
36
|
-
optionsLength: ((
|
|
37
|
-
optionsLines:
|
|
38
|
-
enableSearch:
|
|
39
|
-
variant:
|
|
33
|
+
optionsLength: ((e = n.options) == null ? void 0 : e.length) ?? 0,
|
|
34
|
+
optionsLines: n.optionsLines,
|
|
35
|
+
enableSearch: n.enableSearch,
|
|
36
|
+
variant: g
|
|
40
37
|
});
|
|
41
38
|
}
|
|
42
|
-
),
|
|
43
|
-
var
|
|
44
|
-
const
|
|
39
|
+
), S = s(() => {
|
|
40
|
+
var t;
|
|
41
|
+
const e = ((t = l.value) == null ? void 0 : t.length) === 0, o = p.value;
|
|
45
42
|
return {
|
|
46
43
|
overflow: "auto",
|
|
47
44
|
display: "flex",
|
|
48
45
|
flexDirection: "column",
|
|
49
46
|
minHeight: o,
|
|
50
|
-
maxHeight:
|
|
51
|
-
height:
|
|
47
|
+
maxHeight: e ? "unset" : o,
|
|
48
|
+
height: e ? o : "unset"
|
|
52
49
|
};
|
|
53
50
|
});
|
|
54
51
|
return {
|
|
55
|
-
openPopover:
|
|
56
|
-
triggerRef:
|
|
57
|
-
contentRef:
|
|
58
|
-
inputWidthString:
|
|
52
|
+
openPopover: v,
|
|
53
|
+
triggerRef: c,
|
|
54
|
+
contentRef: d,
|
|
55
|
+
inputWidthString: m,
|
|
59
56
|
calculatedPopoverHeight: p,
|
|
60
|
-
popoverContentCustomStyles:
|
|
61
|
-
|
|
62
|
-
matchesSearch: u,
|
|
63
|
-
filteredOptions: h
|
|
57
|
+
popoverContentCustomStyles: S,
|
|
58
|
+
filteredOptions: l
|
|
64
59
|
};
|
|
65
60
|
}
|
|
66
61
|
export {
|
|
67
|
-
|
|
62
|
+
V as useSelectBase
|
|
68
63
|
};
|
|
@@ -1,88 +1,53 @@
|
|
|
1
|
-
import { ref as
|
|
2
|
-
const
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const {
|
|
9
|
-
closeOnSelect: D = !0,
|
|
10
|
-
closePopover: b,
|
|
11
|
-
openPopoverRef: a,
|
|
12
|
-
onArrowRight: k,
|
|
13
|
-
onArrowLeft: A,
|
|
14
|
-
toggleOnSpace: g = !1
|
|
15
|
-
} = m, n = E(-1);
|
|
16
|
-
function l(e, t = "smooth", f = "center") {
|
|
17
|
-
y(() => {
|
|
18
|
-
var r;
|
|
1
|
+
import { ref as K, watch as k, nextTick as f, onBeforeUnmount as A } from "vue";
|
|
2
|
+
const E = "data-option-index";
|
|
3
|
+
function b(a, w, y) {
|
|
4
|
+
const { closeOnSelect: v = !0, closePopover: m, openPopoverRef: u } = y, n = K(-1);
|
|
5
|
+
function r(e, s = "smooth", t = "center") {
|
|
6
|
+
f(() => {
|
|
7
|
+
var d;
|
|
19
8
|
const o = document.querySelector(
|
|
20
|
-
`[${
|
|
9
|
+
`[${E}="${e}"]`
|
|
21
10
|
);
|
|
22
|
-
(
|
|
11
|
+
(d = o == null ? void 0 : o.scrollIntoView) == null || d.call(o, { behavior: s, block: t });
|
|
23
12
|
});
|
|
24
13
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
function s(e) {
|
|
30
|
-
const t = u();
|
|
14
|
+
function i(e) {
|
|
15
|
+
if (!["ArrowUp", "ArrowDown", "Enter"].includes(e.key)) return;
|
|
16
|
+
e.preventDefault();
|
|
17
|
+
const t = a();
|
|
31
18
|
if (e.key === "ArrowUp") {
|
|
32
|
-
if (
|
|
33
|
-
n.value--,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
n.value++, l(n.value);
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (e.key === "Enter") {
|
|
42
|
-
e.preventDefault(), c();
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
const f = e.key === "ArrowRight" ? k : e.key === "ArrowLeft" ? A : void 0;
|
|
46
|
-
if (f) {
|
|
47
|
-
if (v(e)) return;
|
|
48
|
-
e.preventDefault();
|
|
19
|
+
if (n.value <= 0) return;
|
|
20
|
+
n.value--, r(n.value);
|
|
21
|
+
} else if (e.key === "ArrowDown") {
|
|
22
|
+
if (n.value >= t.length - 1) return;
|
|
23
|
+
n.value++, r(n.value);
|
|
24
|
+
} else if (e.key === "Enter" && n.value >= 0 && t[n.value]) {
|
|
49
25
|
const o = t[n.value];
|
|
50
|
-
if (
|
|
51
|
-
|
|
52
|
-
typeof r == "number" && r >= 0 && (n.value = r, l(r));
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (e.key === " " && T(g)) {
|
|
56
|
-
if (v(e)) return;
|
|
57
|
-
e.preventDefault(), c();
|
|
26
|
+
if (o != null && o.disabled) return;
|
|
27
|
+
w(o), v && m();
|
|
58
28
|
}
|
|
59
29
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
function h() {
|
|
64
|
-
document.addEventListener("keydown", d);
|
|
30
|
+
function c(e) {
|
|
31
|
+
u.value && i(e);
|
|
65
32
|
}
|
|
66
33
|
function p() {
|
|
67
|
-
document.
|
|
34
|
+
document.addEventListener("keydown", c);
|
|
35
|
+
}
|
|
36
|
+
function l() {
|
|
37
|
+
document.removeEventListener("keydown", c);
|
|
68
38
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
71
|
-
e ?
|
|
72
|
-
}),
|
|
73
|
-
() => u().length,
|
|
74
|
-
(e) => {
|
|
75
|
-
n.value >= e && (n.value = e - 1);
|
|
76
|
-
}
|
|
77
|
-
), K(p);
|
|
39
|
+
function D() {
|
|
40
|
+
k(u, (e) => {
|
|
41
|
+
e ? f(p) : l();
|
|
42
|
+
}), A(l);
|
|
78
43
|
}
|
|
79
44
|
return {
|
|
80
45
|
focusedOptionIndex: n,
|
|
81
|
-
scrollToOption:
|
|
82
|
-
handleKeyDown:
|
|
83
|
-
setupKeydownBinding:
|
|
46
|
+
scrollToOption: r,
|
|
47
|
+
handleKeyDown: i,
|
|
48
|
+
setupKeydownBinding: D
|
|
84
49
|
};
|
|
85
50
|
}
|
|
86
51
|
export {
|
|
87
|
-
|
|
52
|
+
b as useSelectKeyboard
|
|
88
53
|
};
|
package/dist/locales/en.json.mjs
CHANGED
|
@@ -40,7 +40,7 @@ const e = {
|
|
|
40
40
|
flags: "Flags",
|
|
41
41
|
custom: "Custom"
|
|
42
42
|
}
|
|
43
|
-
}, i = "
|
|
43
|
+
}, i = "Search", l = "No results found", u = {
|
|
44
44
|
upload_area: e,
|
|
45
45
|
import_card: t,
|
|
46
46
|
audio_recorder: o,
|
|
@@ -48,22 +48,18 @@ const e = {
|
|
|
48
48
|
chats_contact: a,
|
|
49
49
|
data_table: r,
|
|
50
50
|
emoji_picker: c,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
search: d,
|
|
54
|
-
without_results: n
|
|
51
|
+
search: i,
|
|
52
|
+
without_results: l
|
|
55
53
|
};
|
|
56
54
|
export {
|
|
57
55
|
o as audio_recorder,
|
|
58
56
|
s as chat_message,
|
|
59
57
|
a as chats_contact,
|
|
60
|
-
i as collapse,
|
|
61
58
|
r as data_table,
|
|
62
59
|
u as default,
|
|
63
60
|
c as emoji_picker,
|
|
64
|
-
l as expand,
|
|
65
61
|
t as import_card,
|
|
66
|
-
|
|
62
|
+
i as search,
|
|
67
63
|
e as upload_area,
|
|
68
|
-
|
|
64
|
+
l as without_results
|
|
69
65
|
};
|