@weni/unnnic-system 3.36.1-alpha.1 → 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.
Files changed (36) hide show
  1. package/dist/components/MultiSelect/MultiSelectOption.css +1 -1
  2. package/dist/components/MultiSelect/MultiSelectOption.vue.mjs +2 -2
  3. package/dist/components/MultiSelect/MultiSelectOption.vue2.mjs +15 -41
  4. package/dist/components/MultiSelect/index.css +1 -1
  5. package/dist/components/MultiSelect/index.vue.mjs +2 -2
  6. package/dist/components/MultiSelect/index.vue2.mjs +114 -126
  7. package/dist/composables/useSelectBase.mjs +39 -44
  8. package/dist/composables/useSelectKeyboard.mjs +35 -70
  9. package/dist/locales/en.json.mjs +5 -9
  10. package/dist/style.css +2 -4
  11. package/dist/unnnic.umd.js +19 -19
  12. package/package.json +2 -2
  13. package/src/components/MultiSelect/MultiSelectOption.vue +3 -66
  14. package/src/components/MultiSelect/__tests__/MultiSelect.spec.js +0 -556
  15. package/src/components/MultiSelect/__tests__/MultiSelectOption.spec.js +1 -55
  16. package/src/components/MultiSelect/__tests__/__snapshots__/MultiSelectOption.spec.js.snap +0 -5
  17. package/src/components/MultiSelect/index.vue +50 -57
  18. package/src/components/Select/_select-shared.scss +0 -8
  19. package/src/components/Select/types.ts +0 -1
  20. package/src/composables/useSelectBase.ts +16 -40
  21. package/src/composables/useSelectKeyboard.ts +18 -92
  22. package/src/locales/en.json +1 -3
  23. package/src/stories/MultiSelect.stories.js +1 -62
  24. package/dist/components/MultiSelect/MultiSelectTreeOptions.css +0 -1
  25. package/dist/components/MultiSelect/MultiSelectTreeOptions.vue.mjs +0 -7
  26. package/dist/components/MultiSelect/MultiSelectTreeOptions.vue2.mjs +0 -50
  27. package/dist/composables/useMultiSelectRows.mjs +0 -74
  28. package/dist/composables/useMultiSelectSelection.mjs +0 -44
  29. package/dist/composables/useTreeExpansion.mjs +0 -24
  30. package/dist/lib/tree-selection.mjs +0 -66
  31. package/src/components/MultiSelect/MultiSelectTreeOptions.vue +0 -73
  32. package/src/composables/useMultiSelectRows.ts +0 -121
  33. package/src/composables/useMultiSelectSelection.ts +0 -97
  34. package/src/composables/useTreeExpansion.ts +0 -44
  35. package/src/lib/__tests__/tree-selection.spec.ts +0 -141
  36. package/src/lib/tree-selection.ts +0 -156
@@ -1,28 +1,21 @@
1
- import { defineComponent as Q, useTemplateRef as P, computed as R, ref as X, watch as Y, nextTick as S, openBlock as n, createElementBlock as r, createVNode as s, unref as o, withCtx as v, normalizeStyle as Z, createElementVNode as ee, createBlock as g, createCommentVNode as C, toDisplayString as te, Fragment as w, renderList as oe } from "vue";
2
- import { useInfiniteScroll as le } from "../../node_modules/@vueuse/core/dist/index.mjs";
3
- import B from "../Input/Input.vue.mjs";
4
- import ne from "../IconLoading/IconLoading.vue.mjs";
5
- import ie from "./MultiSelectOption.vue.mjs";
6
- import ae from "./MultiSelectTreeOptions.vue.mjs";
7
- import { useSelectBase as re } from "../../composables/useSelectBase.mjs";
8
- import { useSelectKeyboard as se } from "../../composables/useSelectKeyboard.mjs";
9
- import { useMultiSelectSelection as ce } from "../../composables/useMultiSelectSelection.mjs";
10
- import { useMultiSelectRows as ue } from "../../composables/useMultiSelectRows.mjs";
11
- import { filterTreeOptions as de } from "../../lib/tree-selection.mjs";
12
- import pe from "../ui/popover/Popover.vue.mjs";
13
- import fe from "../ui/popover/PopoverTrigger.vue.mjs";
14
- import me from "../ui/popover/PopoverContent.vue.mjs";
1
+ import { defineComponent as K, useTemplateRef as w, computed as b, ref as W, watch as A, nextTick as V, openBlock as r, createElementBlock as c, createVNode as d, unref as n, withCtx as g, normalizeStyle as q, createElementVNode as C, createBlock as L, createCommentVNode as B, toDisplayString as G, Fragment as R, renderList as J } from "vue";
2
+ import { useInfiniteScroll as Q } from "../../node_modules/@vueuse/core/dist/index.mjs";
3
+ import x from "../Input/Input.vue.mjs";
4
+ import X from "../IconLoading/IconLoading.vue.mjs";
5
+ import Y from "./MultiSelectOption.vue.mjs";
6
+ import { useSelectBase as Z } from "../../composables/useSelectBase.mjs";
7
+ import { useSelectKeyboard as ee } from "../../composables/useSelectKeyboard.mjs";
8
+ import te from "../ui/popover/Popover.vue.mjs";
9
+ import le from "../ui/popover/PopoverTrigger.vue.mjs";
10
+ import ne from "../ui/popover/PopoverContent.vue.mjs";
15
11
  import '../ui/popover/PopoverContent.css';/* empty css */
16
- const he = { class: "unnnic-multi-select" }, Se = {
12
+ const oe = { class: "unnnic-multi-select" }, ae = {
17
13
  key: 1,
18
14
  class: "unnnic-multi-select__content-no-results"
19
- }, ve = {
20
- key: 1,
21
- class: "unnnic-multi-select__options"
22
- }, ge = {
23
- key: 2,
15
+ }, ie = { class: "unnnic-multi-select__options" }, re = {
16
+ key: 0,
24
17
  class: "unnnic-multi-select__infinite-loading"
25
- }, Ee = /* @__PURE__ */ Q({
18
+ }, be = /* @__PURE__ */ K({
26
19
  name: "UnnnicMultiSelect",
27
20
  __name: "index",
28
21
  props: {
@@ -48,167 +41,162 @@ const he = { class: "unnnic-multi-select" }, Se = {
48
41
  returnObject: { type: Boolean, default: !1 }
49
42
  },
50
43
  emits: ["update:modelValue", "update:search", "scroll-end"],
51
- setup(M, { expose: E, emit: U }) {
52
- const e = M, c = U, _ = P("multiSelectInputRef"), u = P("contentRef"), l = re(e, "multi", _, u, {
53
- filterOptions: de
54
- }), d = l.openPopover, z = l.popoverContentCustomStyles, A = l.inputWidthString, b = l.filteredOptions, {
55
- isTreeMode: y,
56
- getCheckState: T,
57
- toggleOption: V,
58
- toggle: $,
59
- displayItems: p
60
- } = ce(e, c), {
61
- optionGroups: H,
62
- visibleRows: k,
63
- toggleExpanded: j,
64
- resetExpanded: D,
65
- handleArrowRight: F,
66
- handleArrowLeft: N
67
- } = ue(e, {
68
- filteredOptions: l.filteredOptions,
69
- isSearchActive: l.isSearchActive,
70
- matchesSearch: l.matchesSearch,
71
- getCheckState: T
72
- });
73
- function f(t) {
44
+ setup(j, { expose: z, emit: M }) {
45
+ const e = j, u = M, y = w("multiSelectInputRef"), f = w("contentRef"), l = Z(e, "multi", y, f), p = l.openPopover, U = l.popoverContentCustomStyles, $ = l.inputWidthString, m = l.filteredOptions;
46
+ function v(t) {
74
47
  l.openPopover.value = t;
75
48
  }
76
- const x = R(
77
- () => p.value.map((t) => t[e.itemLabel]).join(", ")
49
+ const h = b(() => {
50
+ if (e.returnObject) return e.modelValue;
51
+ const t = e.modelValue.slice();
52
+ return e.options.filter(
53
+ (o) => t.includes(o[e.itemValue])
54
+ );
55
+ }), O = b(
56
+ () => h.value.map((t) => t[e.itemLabel]).join(", ")
78
57
  );
79
- function L(t) {
80
- c("update:search", t);
58
+ function k(t) {
59
+ u("update:search", t);
60
+ }
61
+ function P(t) {
62
+ return e.returnObject ? e.modelValue.some(
63
+ (o) => o[e.itemValue] === t[e.itemValue]
64
+ ) : e.modelValue.includes(t[e.itemValue]);
81
65
  }
82
- const m = se(
83
- () => k.value.map((t) => t.option),
84
- $,
66
+ function I(t, o) {
67
+ if (o) {
68
+ const a = e.returnObject ? [...e.modelValue, t] : [...e.modelValue, t[e.itemValue]];
69
+ u("update:modelValue", a);
70
+ } else {
71
+ const a = e.returnObject ? e.modelValue.filter(
72
+ (s) => s[e.itemValue] !== t[e.itemValue]
73
+ ) : e.modelValue.filter((s) => s !== t[e.itemValue]);
74
+ u("update:modelValue", a);
75
+ }
76
+ }
77
+ const S = ee(
78
+ () => l.filteredOptions.value,
79
+ (t) => {
80
+ if (t.disabled) return;
81
+ const o = P(t);
82
+ I(t, !o);
83
+ },
85
84
  {
86
85
  closeOnSelect: !1,
87
- closePopover: () => f(!1),
88
- openPopoverRef: l.openPopover,
89
- toggleOnSpace: y,
90
- onArrowRight: F,
91
- onArrowLeft: N
86
+ closePopover: () => v(!1),
87
+ openPopoverRef: l.openPopover
92
88
  }
93
89
  );
94
- m.setupKeydownBinding();
95
- const O = m.focusedOptionIndex, i = X(!1);
96
- function K(t) {
90
+ S.setupKeydownBinding();
91
+ const H = S.focusedOptionIndex, i = W(!1);
92
+ function D(t) {
97
93
  return !e.infiniteScroll || !l.openPopover.value || i.value || !e.infiniteScrollCanLoadMore() || !t || typeof t != "object" || !("clientHeight" in t) ? !1 : t.clientHeight > 0;
98
94
  }
99
- const W = R(
95
+ const E = b(
100
96
  () => {
101
97
  var t;
102
- return ((t = u.value) == null ? void 0 : t.closest(".unnnic-popover")) ?? u.value;
98
+ return ((t = f.value) == null ? void 0 : t.closest(".unnnic-popover")) ?? f.value;
103
99
  }
104
- ), { reset: h } = le(
105
- W,
100
+ ), { reset: _ } = Q(
101
+ E,
106
102
  () => {
107
- i.value || (i.value = !0, c("scroll-end"));
103
+ i.value || (i.value = !0, u("scroll-end"));
108
104
  },
109
105
  {
110
106
  distance: e.infiniteScrollDistance,
111
- canLoadMore: K
107
+ canLoadMore: D
112
108
  }
113
109
  );
114
- Y(l.openPopover, (t) => {
110
+ A(l.openPopover, (t) => {
115
111
  if (!t) {
116
- L(""), i.value = !1, D();
112
+ k(""), i.value = !1;
117
113
  return;
118
114
  }
119
- m.focusedOptionIndex.value = -1, e.infiniteScroll && S(() => h());
115
+ S.focusedOptionIndex.value = -1, e.infiniteScroll && V(() => _());
120
116
  });
121
- function G() {
122
- i.value = !1, l.openPopover.value && e.infiniteScroll && S(() => h());
117
+ function F() {
118
+ i.value = !1, l.openPopover.value && e.infiniteScroll && V(() => _());
123
119
  }
124
- function q() {
125
- i.value = !1, S(() => h());
120
+ function N() {
121
+ i.value = !1, V(() => _());
126
122
  }
127
- return E({
128
- openPopover: d,
129
- setOpenPopover: f,
130
- filteredOptions: b,
123
+ return z({
124
+ openPopover: p,
125
+ setOpenPopover: v,
126
+ filteredOptions: m,
131
127
  calculatedPopoverHeight: l.calculatedPopoverHeight,
132
- selectedItems: p,
133
- inputValue: x,
128
+ selectedItems: h,
129
+ inputValue: O,
134
130
  infiniteScrollLoading: i,
135
- finishInfiniteScroll: G,
136
- resetInfiniteScroll: q
137
- }), (t, I) => (n(), r("div", he, [
138
- s(o(pe), {
139
- open: o(d),
140
- "onUpdate:open": f
131
+ finishInfiniteScroll: F,
132
+ resetInfiniteScroll: N
133
+ }), (t, o) => (r(), c("div", oe, [
134
+ d(n(te), {
135
+ open: n(p),
136
+ "onUpdate:open": v
141
137
  }, {
142
- default: v(() => [
143
- s(o(fe), { class: "w-full" }, {
144
- default: v(() => [
145
- s(B, {
138
+ default: g(() => [
139
+ d(n(le), { class: "w-full" }, {
140
+ default: g(() => [
141
+ d(x, {
146
142
  ref_key: "multiSelectInputRef",
147
- ref: _,
148
- modelValue: x.value,
143
+ ref: y,
144
+ modelValue: O.value,
149
145
  class: "unnnic-multi-select__input",
150
146
  readonly: "",
151
147
  useFocusProp: "",
152
- focus: o(d),
148
+ focus: n(p),
153
149
  size: e.size,
154
150
  placeholder: e.placeholder,
155
151
  label: e.label,
156
152
  errors: e.errors,
157
153
  message: e.message,
158
- iconRight: o(d) ? "keyboard_arrow_up" : "keyboard_arrow_down",
154
+ iconRight: n(p) ? "keyboard_arrow_up" : "keyboard_arrow_down",
159
155
  disabled: e.disabled,
160
- showClear: !!o(p).length && e.clearable,
161
- onClear: I[0] || (I[0] = (a) => c("update:modelValue", []))
156
+ showClear: !!h.value.length && e.clearable,
157
+ onClear: o[0] || (o[0] = (a) => u("update:modelValue", []))
162
158
  }, null, 8, ["modelValue", "focus", "size", "placeholder", "label", "errors", "message", "iconRight", "disabled", "showClear"])
163
159
  ]),
164
160
  _: 1
165
161
  }),
166
- s(o(me), {
162
+ d(n(ne), {
167
163
  align: "start",
168
164
  class: "h-full",
169
- style: Z(o(z)),
170
- width: o(A)
165
+ style: q(n(U)),
166
+ width: n($)
171
167
  }, {
172
- default: v(() => [
173
- ee("div", {
168
+ default: g(() => [
169
+ C("div", {
174
170
  ref_key: "contentRef",
175
- ref: u,
171
+ ref: f,
176
172
  class: "unnnic-multi-select__content"
177
173
  }, [
178
- e.enableSearch ? (n(), g(B, {
174
+ e.enableSearch ? (r(), L(x, {
179
175
  key: 0,
180
176
  class: "unnnic-multi-select__input-search",
181
177
  modelValue: e.search,
182
178
  placeholder: t.$t("search"),
183
179
  iconLeft: "search",
184
- "onUpdate:modelValue": L
185
- }, null, 8, ["modelValue", "placeholder"])) : C("", !0),
186
- o(b).length === 0 ? (n(), r("p", Se, te(t.$t("without_results")), 1)) : (n(), r(w, { key: 2 }, [
187
- o(y) ? (n(), g(ae, {
188
- key: 0,
189
- groups: o(H),
190
- itemLabel: e.itemLabel,
191
- itemValue: e.itemValue,
192
- focusedIndex: o(O),
193
- onSelect: o(V),
194
- onExpand: o(j)
195
- }, null, 8, ["groups", "itemLabel", "itemValue", "focusedIndex", "onSelect", "onExpand"])) : (n(), r("div", ve, [
196
- (n(!0), r(w, null, oe(o(k), (a) => (n(), g(ie, {
197
- key: String(a.option[e.itemValue]),
198
- "data-option-index": a.index,
199
- label: String(a.option[e.itemLabel] ?? ""),
200
- active: a.checkState,
201
- focused: o(O) === a.index,
202
- disabled: a.option.disabled,
203
- "onUpdate:modelValue": (J) => o(V)(a.option, J)
180
+ "onUpdate:modelValue": k
181
+ }, null, 8, ["modelValue", "placeholder"])) : B("", !0),
182
+ n(m).length === 0 ? (r(), c("p", ae, G(t.$t("without_results")), 1)) : (r(), c(R, { key: 2 }, [
183
+ C("div", ie, [
184
+ (r(!0), c(R, null, J(n(m), (a, s) => (r(), L(Y, {
185
+ key: String(a[e.itemValue]),
186
+ "data-option-index": s,
187
+ label: String(a[e.itemLabel] ?? ""),
188
+ active: P(a),
189
+ focused: n(H) === s,
190
+ disabled: a.disabled,
191
+ "onUpdate:modelValue": (T) => I(a, T)
204
192
  }, null, 8, ["data-option-index", "label", "active", "focused", "disabled", "onUpdate:modelValue"]))), 128))
205
- ])),
206
- e.infiniteScroll && i.value ? (n(), r("div", ge, [
207
- s(ne, {
193
+ ]),
194
+ e.infiniteScroll && i.value ? (r(), c("div", re, [
195
+ d(X, {
208
196
  scheme: "fg-base",
209
197
  size: "sm"
210
198
  })
211
- ])) : C("", !0)
199
+ ])) : B("", !0)
212
200
  ], 64))
213
201
  ], 512)
214
202
  ]),
@@ -221,5 +209,5 @@ const he = { class: "unnnic-multi-select" }, Se = {
221
209
  }
222
210
  });
223
211
  export {
224
- Ee as default
212
+ be as default
225
213
  };
@@ -1,68 +1,63 @@
1
- import { ref as G, computed as s } from "vue";
2
- import { useElementSize as P } from "../node_modules/@vueuse/core/dist/index.mjs";
3
- function A(e, d, l, f, {
4
- filterOptions: m = (a, c) => a.filter(c)
5
- } = {}) {
6
- const a = G(!1), { width: c } = P(l), S = s(() => `${c.value}px`), r = s(
7
- () => e.enableSearch && !!e.search
8
- );
9
- function u(t) {
10
- if (!r.value) return !0;
11
- const o = e.search.toLowerCase(), n = String(t[e.itemLabel] ?? "").toLowerCase().includes(o), i = String(t[e.itemValue] ?? "").toLowerCase().includes(o);
12
- return n || i;
13
- }
14
- const h = s(
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: n,
17
+ optionsLines: t,
21
18
  enableSearch: i,
22
- variant: H
23
- } = t;
19
+ variant: a
20
+ } = e;
24
21
  if (o === 0) return "unset";
25
- if (H === "single") {
26
- const w = 37 * n, C = i ? 1 : 2, g = w + 32 + (4 * n - C);
27
- return `${i ? g + 45 + 1 : g}px`;
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 b = i ? 16 : 0, v = 22 * n + (24 * n - 2);
30
- return `${i ? v + 51 + b : v}px`;
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 t;
31
+ var e;
35
32
  return L({
36
- optionsLength: ((t = e.options) == null ? void 0 : t.length) ?? 0,
37
- optionsLines: e.optionsLines,
38
- enableSearch: e.enableSearch,
39
- variant: d
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
- ), x = s(() => {
43
- var n;
44
- const t = ((n = h.value) == null ? void 0 : n.length) === 0, o = p.value;
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: t ? "unset" : o,
51
- height: t ? o : "unset"
47
+ maxHeight: e ? "unset" : o,
48
+ height: e ? o : "unset"
52
49
  };
53
50
  });
54
51
  return {
55
- openPopover: a,
56
- triggerRef: l,
57
- contentRef: f,
58
- inputWidthString: S,
52
+ openPopover: v,
53
+ triggerRef: c,
54
+ contentRef: d,
55
+ inputWidthString: m,
59
56
  calculatedPopoverHeight: p,
60
- popoverContentCustomStyles: x,
61
- isSearchActive: r,
62
- matchesSearch: u,
63
- filteredOptions: h
57
+ popoverContentCustomStyles: S,
58
+ filteredOptions: l
64
59
  };
65
60
  }
66
61
  export {
67
- A as useSelectBase
62
+ V as useSelectBase
68
63
  };
@@ -1,88 +1,53 @@
1
- import { ref as E, watch as w, nextTick as y, onBeforeUnmount as K, toValue as T } from "vue";
2
- const I = "data-option-index";
3
- function v(u) {
4
- const i = u.target;
5
- return i instanceof HTMLElement ? i.closest('input, textarea, button, [contenteditable="true"]') ? !0 : i.isContentEditable : !1;
6
- }
7
- function O(u, i, m) {
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
- `[${I}="${e}"]`
9
+ `[${E}="${e}"]`
21
10
  );
22
- (r = o == null ? void 0 : o.scrollIntoView) == null || r.call(o, { behavior: t, block: f });
11
+ (d = o == null ? void 0 : o.scrollIntoView) == null || d.call(o, { behavior: s, block: t });
23
12
  });
24
13
  }
25
- function c() {
26
- const t = u()[n.value];
27
- n.value < 0 || !t || t.disabled || (i(t), D && b());
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 (e.preventDefault(), n.value <= 0) return;
33
- n.value--, l(n.value);
34
- return;
35
- }
36
- if (e.key === "ArrowDown") {
37
- if (e.preventDefault(), n.value >= t.length - 1) return;
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 (!o) return;
51
- const r = f(n.value, o);
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 d(e) {
61
- a.value && s(e);
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.removeEventListener("keydown", d);
34
+ document.addEventListener("keydown", c);
35
+ }
36
+ function l() {
37
+ document.removeEventListener("keydown", c);
68
38
  }
69
- function x() {
70
- w(a, (e) => {
71
- e ? y(h) : p();
72
- }), w(
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: l,
82
- handleKeyDown: s,
83
- setupKeydownBinding: x
46
+ scrollToOption: r,
47
+ handleKeyDown: i,
48
+ setupKeydownBinding: D
84
49
  };
85
50
  }
86
51
  export {
87
- O as useSelectKeyboard
52
+ b as useSelectKeyboard
88
53
  };
@@ -40,7 +40,7 @@ const e = {
40
40
  flags: "Flags",
41
41
  custom: "Custom"
42
42
  }
43
- }, i = "Collapse", l = "Expand", d = "Search", n = "No results found", u = {
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
- collapse: i,
52
- expand: l,
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
- d as search,
62
+ i as search,
67
63
  e as upload_area,
68
- n as without_results
64
+ l as without_results
69
65
  };