@dv.net/ui-kit 7.7.21 → 7.7.22

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.
@@ -1,8 +1,7 @@
1
1
  import { SelectListItemSize as e } from "../components/UiSelect/types.js";
2
2
  import { computed as t, createElementBlock as n, defineComponent as r, normalizeClass as i, openBlock as a, renderSlot as o, useCssVars as s } from "vue";
3
- //#endregion
4
- //#region src/lib/components/UiSelect/components/SelectListItem.vue
5
- var c = /* @__PURE__ */ r({
3
+ //#region src/lib/components/UiSelect/components/SelectListItem.vue?vue&type=script&setup=true&lang.ts
4
+ var c = ["data-highlighted"], l = /* @__PURE__ */ r({
6
5
  __name: "SelectListItem",
7
6
  props: {
8
7
  isDisabled: { type: Boolean },
@@ -12,15 +11,18 @@ var c = /* @__PURE__ */ r({
12
11
  },
13
12
  emits: ["check", "mouseOver"],
14
13
  setup(r) {
15
- s((e) => ({ a2ec6fc8: l.value }));
16
- let c = r, l = t(() => e[c.size] + "px");
17
- return (e, t) => (a(), n("button", { class: i(["ui-select__option", [
18
- { "is-checked": r.isChecked },
19
- { "is-navigated": r.isNavigated },
20
- { "is-disabled": r.isDisabled },
21
- `size-${l.value}`
22
- ]]) }, [o(e.$slots, "default")], 2));
14
+ s((e) => ({ v0546e42a: u.value }));
15
+ let l = r, u = t(() => e[l.size] + "px");
16
+ return (e, t) => (a(), n("button", {
17
+ class: i(["ui-select__option", [
18
+ { "is-checked": r.isChecked },
19
+ { "is-navigated": r.isNavigated },
20
+ { "is-disabled": r.isDisabled },
21
+ `size-${u.value}`
22
+ ]]),
23
+ "data-highlighted": r.isNavigated ? "true" : void 0
24
+ }, [o(e.$slots, "default")], 10, c));
23
25
  }
24
26
  });
25
27
  //#endregion
26
- export { c as t };
28
+ export { l as t };
@@ -1066,15 +1066,19 @@ var je = {
1066
1066
  isLoading: { type: Boolean }
1067
1067
  },
1068
1068
  emits: ["changeInfinityScroll"],
1069
- setup(n) {
1070
- let a = n, o = r(() => a.options.map((e, t) => ({
1069
+ setup(n, { expose: a }) {
1070
+ let o = n, c = r(() => o.options.map((e, t) => ({
1071
1071
  index: t,
1072
1072
  option: e
1073
- }))), c = r(() => t[a.size]);
1074
- return (t, r) => (_(), i(T(Pe), {
1073
+ }))), l = r(() => t[o.size]), u = v(null);
1074
+ return a({ scrollToItem(e) {
1075
+ u.value?.scrollToItem(e);
1076
+ } }), (t, r) => (_(), i(T(Pe), {
1077
+ ref_key: "scroller",
1078
+ ref: u,
1075
1079
  onScrollEnd: r[0] ||= () => t.$emit("changeInfinityScroll"),
1076
- items: o.value,
1077
- "item-size": c.value,
1080
+ items: c.value,
1081
+ "item-size": l.value,
1078
1082
  "key-field": "index",
1079
1083
  class: "ui-select__options-list-wrapper"
1080
1084
  }, {
@@ -2,7 +2,7 @@ import { r as e } from "./UiChatAttachments.CAFeMyCV.js";
2
2
  import { useBreakpoints as t } from "../composables/useBreakpoints.js";
3
3
  import { config as n } from "../config/index.js";
4
4
  import { t as r } from "./UiChatFooter.UPkQfa4c.js";
5
- import { t as i } from "./UiChatHeader.CXBBEiuH.js";
5
+ import { t as i } from "./UiChatHeader.tNXu72JW.js";
6
6
  import { t as a } from "./UiChatManagerAlert.CiAaxS9L.js";
7
7
  import { formatUiChatDate as o, getUiChatDatetimeTimestamp as s, getUiChatNowIso as c, parseUiChatDatetime as l } from "../components/UiChat/uiChatDate.js";
8
8
  import { t as u } from "./UiChatMessage.BgjgEgkc.js";
@@ -1,7 +1,7 @@
1
1
  import { t as e } from "./UiIcon.iHypdpWu.js";
2
2
  import { useBreakpoints as t } from "../composables/useBreakpoints.js";
3
3
  import { config as n } from "../config/index.js";
4
- import { t as r } from "./UiSelect.CBOQXkNp.js";
4
+ import { t as r } from "./UiSelect.DBnwUWeq.js";
5
5
  import { t as i } from "./UiSkeleton.Gw5aX0E-.js";
6
6
  import { Fragment as a, computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, normalizeClass as p, normalizeStyle as m, openBlock as h, ref as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
7
7
  //#region src/lib/components/UiChat/UiChatHeader.vue?vue&type=script&setup=true&lang.ts
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./UiIcon.iHypdpWu.js";
2
2
  import { config as t } from "../config/index.js";
3
- import { t as n } from "./UiSelect.CBOQXkNp.js";
3
+ import { t as n } from "./UiSelect.DBnwUWeq.js";
4
4
  import r from "../components/UiPagination/components/IconArrow.js";
5
5
  import { Fragment as i, computed as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeModels as f, openBlock as p, toDisplayString as m, unref as h, useModel as g } from "vue";
6
6
  //#region src/lib/components/UiPagination/UiPagination.vue?vue&type=script&setup=true&lang.ts
@@ -0,0 +1,349 @@
1
+ import { t as e } from "./UiIcon.iHypdpWu.js";
2
+ import { t } from "./UiLoading.C1fW2N3T.js";
3
+ import { config as n } from "../config/index.js";
4
+ import { t as r } from "./SelectList.DfsXkDPU.js";
5
+ import { t as i } from "./SelectListItem.C3KlnrwK.js";
6
+ import { t as ee } from "./SelectSearch.D39QhMF3.js";
7
+ import { t as te } from "./SelectTrigger.CoKjmQFU.js";
8
+ import { t as ne } from "./SelectVirtualList.BKZFHrk3.js";
9
+ import { t as re } from "./UiDropdown.Dg0XSpN8.js";
10
+ import { useKeyboard as a } from "../components/UiSelect/composables/useKeyboard.js";
11
+ import { useMultiple as o } from "../components/UiSelect/composables/useMultiple.js";
12
+ import { Fragment as ie, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, mergeModels as h, nextTick as g, normalizeClass as _, openBlock as v, ref as y, renderList as ae, renderSlot as b, toDisplayString as x, unref as S, useModel as C, watch as w, withCtx as T, withKeys as oe, withModifiers as E } from "vue";
13
+ //#region src/lib/components/UiSelect/UiSelect.vue?vue&type=script&setup=true&lang.ts
14
+ var se = ["disabled", "id"], ce = ["title"], le = {
15
+ key: 0,
16
+ class: "ui-select__header"
17
+ }, ue = {
18
+ key: 3,
19
+ class: "ui-select__no-data-block"
20
+ }, de = {
21
+ key: 6,
22
+ class: "ui-select__footer"
23
+ }, D = /* @__PURE__ */ m({
24
+ __name: "UiSelect",
25
+ props: /*@__PURE__*/ h({
26
+ options: { default: () => [] },
27
+ valueKey: { default: "value" },
28
+ labelKey: { default: "label" },
29
+ asObject: { type: Boolean },
30
+ type: { default: "outside" },
31
+ size: { default: "md" },
32
+ error: { type: Boolean },
33
+ filled: { type: Boolean },
34
+ disabled: { type: Boolean },
35
+ placeholder: {},
36
+ withSearch: { type: Boolean },
37
+ clearable: { type: Boolean },
38
+ loading: {
39
+ type: Boolean,
40
+ default: !1
41
+ },
42
+ id: {},
43
+ multiple: { type: Boolean },
44
+ itemSize: { default: "sm" },
45
+ popperClass: {},
46
+ fitContentWidth: {
47
+ type: Boolean,
48
+ default: !0
49
+ },
50
+ offset: {
51
+ type: [
52
+ Number,
53
+ Object,
54
+ Function
55
+ ],
56
+ default: 1
57
+ },
58
+ placement: { default: "bottom" },
59
+ readonly: { type: Boolean },
60
+ teleport: {
61
+ type: [String, Boolean],
62
+ default: "body"
63
+ },
64
+ isVirtualList: {
65
+ type: Boolean,
66
+ default: !1
67
+ },
68
+ customSearch: {
69
+ type: Boolean,
70
+ default: !1
71
+ },
72
+ chevronName: { default: "keyboard-arrow-down" },
73
+ chevronColor: { default: "intherit" },
74
+ chevronSize: { default: "md" },
75
+ optionClass: {},
76
+ searchFn: {}
77
+ }, {
78
+ modelValue: { default: null },
79
+ modelModifiers: {},
80
+ isOpen: {
81
+ type: Boolean,
82
+ default: !1
83
+ },
84
+ isOpenModifiers: {}
85
+ }),
86
+ emits: /*@__PURE__*/ h([
87
+ "change",
88
+ "clear",
89
+ "changeInfinityScroll",
90
+ "search",
91
+ "onClose"
92
+ ], ["update:modelValue", "update:isOpen"]),
93
+ setup(m, { emit: h }) {
94
+ let D = h, O = m, k = C(m, "modelValue"), A = C(m, "isOpen"), j = y(!1), M = y(""), N = y(), P = y(), F = y(null), I = y(null), L = s(() => O.disabled || O.readonly), R = s(() => O.options.length && typeof O.options[0] != "object"), fe = s(() => n.uiSelect.translations.notFound && !V.value.length), z = s(() => Array.isArray(k.value) ? !!k.value.length : !!k.value), B = s(() => {
95
+ if (O.multiple && Array.isArray(k.value) && k.value.length) return `${n.uiSelect.translations.multipleSelectedText} ${k.value.length}`;
96
+ let e = Y(k.value);
97
+ return R.value ? e : e?.[O.labelKey];
98
+ }), V = s(() => O.customSearch || !M.value ? O.options : O.searchFn ? O.searchFn(M.value) : O.options.filter((e) => {
99
+ let t = R.value ? e : e?.[O.labelKey];
100
+ return String(t).toLowerCase().includes(M.value.toLowerCase());
101
+ })), { onKeydown: H, navigatedIndex: U, firstSelectableIndex: W, lastSelectableIndex: pe } = a({
102
+ isOpen: A,
103
+ isDisabled: L,
104
+ checkOption: G,
105
+ filteredOptions: V,
106
+ isOptionDisabled: q,
107
+ open: ve
108
+ }), { setModelValueItem: me } = o(k);
109
+ function G(e) {
110
+ e.disabled || (O.multiple && Array.isArray(k.value) ? me(J(e)) : (k.value = J(e), Q(), N.value.close()), D("change"));
111
+ }
112
+ function K(e) {
113
+ return O.multiple && Array.isArray(k.value) ? k.value.includes(J(e)) : k.value === J(e);
114
+ }
115
+ function q(e) {
116
+ return e.disabled;
117
+ }
118
+ function J(e) {
119
+ return R.value || O.asObject ? e : e?.[O.valueKey];
120
+ }
121
+ function Y(e) {
122
+ return e ? O.options.find((t) => R.value ? t === e : O.asObject ? t?.[O.valueKey] === e?.[O.valueKey] : t?.[O.valueKey] === e) : null;
123
+ }
124
+ function X(e) {
125
+ U.value = e;
126
+ }
127
+ function Z() {
128
+ U.value = null;
129
+ }
130
+ function he() {
131
+ k.value = O.multiple ? [] : null, D("clear");
132
+ }
133
+ function ge() {
134
+ L.value || ($(), N.value.open());
135
+ }
136
+ function _e() {
137
+ Q(), N.value.close(), P.value?.blur();
138
+ }
139
+ function ve(e = !1) {
140
+ L.value || ($(e), N.value.open());
141
+ }
142
+ function Q() {
143
+ M.value = "", D("search", M.value), D("onClose"), U.value = null, j.value = !1;
144
+ }
145
+ function $(e = !1) {
146
+ if (e) U.value = pe();
147
+ else {
148
+ let e = V.value.findIndex((e) => K(e) && !q(e));
149
+ U.value = e === -1 ? W() : e;
150
+ }
151
+ P.value?.focus(), j.value = !0, ye();
152
+ }
153
+ async function ye() {
154
+ await g(), O.isVirtualList && U.value !== null && (I.value?.scrollToItem(U.value), await g());
155
+ let e = F.value?.querySelector("[data-highlighted='true']"), t = e?.closest(".ui-select__options-list-wrapper");
156
+ if (!(t instanceof HTMLElement) || !e) return;
157
+ let n = t.getBoundingClientRect(), r = e.getBoundingClientRect();
158
+ r.top < n.top ? t.scrollTop -= n.top - r.top : r.bottom > n.bottom && (t.scrollTop += r.bottom - n.bottom);
159
+ }
160
+ return w(U, () => {
161
+ A.value && U.value !== null && ye();
162
+ }), w(M, () => {
163
+ A.value && j.value && (U.value = W());
164
+ }), (a, o) => (v(), u("div", {
165
+ class: _(["ui-select__wrapper", [{ "is-disabled": O.disabled }]]),
166
+ onKeydown: [o[7] ||= (...e) => S(H) && S(H)(...e), oe(_e, ["tab"])]
167
+ }, [d("input", {
168
+ inputmode: "none",
169
+ ref_key: "inputRef",
170
+ ref: P,
171
+ disabled: m.disabled,
172
+ id: m.id,
173
+ class: "ui-select__input",
174
+ onFocus: ge
175
+ }, null, 40, se), p(re, {
176
+ modelValue: A.value,
177
+ "onUpdate:modelValue": o[5] ||= (e) => A.value = e,
178
+ offset: m.offset,
179
+ ref_key: "dropdownRef",
180
+ ref: N,
181
+ onClose: Q,
182
+ onOpen: o[6] ||= () => $(),
183
+ "popper-class": [m.popperClass ?? "", "ui-select__popper"],
184
+ "fit-content-width": m.fitContentWidth,
185
+ disabled: L.value,
186
+ placement: m.placement,
187
+ teleport: m.teleport
188
+ }, {
189
+ reference: T(() => [d("div", { class: _(["ui-select", [
190
+ m.size,
191
+ { "is-focus": j.value },
192
+ { "is-error": O.error },
193
+ { "is-filled": O.filled },
194
+ { "is-has-value": z.value },
195
+ `type-${m.type}`
196
+ ]]) }, [p(te, {
197
+ clearable: !!m.clearable,
198
+ isFocus: j.value,
199
+ "is-has-value": z.value,
200
+ "is-active": z.value,
201
+ type: m.type,
202
+ placeholder: m.placeholder,
203
+ "chevron-color": m.chevronColor,
204
+ "chevron-name": m.chevronName,
205
+ "chevron-size": m.chevronSize,
206
+ onClear: he
207
+ }, {
208
+ default: T(() => [b(a.$slots, "selected", { option: m.multiple ? k.value : Y(k.value) }, () => [B.value ? (v(), u("span", {
209
+ key: 0,
210
+ title: B.value
211
+ }, x(B.value), 9, ce)) : l("", !0)])]),
212
+ _: 3
213
+ }, 8, [
214
+ "clearable",
215
+ "isFocus",
216
+ "is-has-value",
217
+ "is-active",
218
+ "type",
219
+ "placeholder",
220
+ "chevron-color",
221
+ "chevron-name",
222
+ "chevron-size"
223
+ ])], 2)]),
224
+ default: T(() => [d("div", {
225
+ ref_key: "contentRef",
226
+ ref: F,
227
+ class: "ui-select__content",
228
+ onKeydown: o[4] ||= (...e) => S(H) && S(H)(...e)
229
+ }, [
230
+ a.$slots.header ? (v(), u("div", le, [b(a.$slots, "header")])) : l("", !0),
231
+ m.loading && !m.options.length && !M.value ? (v(), c(t, {
232
+ key: 1,
233
+ "icon-size": "xl",
234
+ class: "ui-select__loading-inner",
235
+ "is-show": ""
236
+ })) : l("", !0),
237
+ O.withSearch ? (v(), c(ee, {
238
+ key: 2,
239
+ "onUpdate:modelValue": [o[0] ||= (e) => a.$emit("search", e ?? ""), o[1] ||= (e) => M.value = e],
240
+ modelValue: M.value
241
+ }, null, 8, ["modelValue"])) : l("", !0),
242
+ fe.value ? (v(), u("div", ue, [d("p", null, x(S(n).uiSelect.translations.notFound), 1)])) : l("", !0),
243
+ m.isVirtualList ? (v(), c(ne, {
244
+ key: 4,
245
+ ref_key: "virtualListRef",
246
+ ref: I,
247
+ onChangeInfinityScroll: o[2] ||= (e) => a.$emit("changeInfinityScroll"),
248
+ size: m.itemSize,
249
+ options: V.value,
250
+ "is-loading": m.loading
251
+ }, {
252
+ default: T(({ item: t }) => [(v(), c(i, {
253
+ class: _(m.optionClass && m.optionClass(t.option, t.index)),
254
+ key: t.index,
255
+ size: m.itemSize,
256
+ "is-navigated": S(U) === t.index,
257
+ "is-checked": K(t.option),
258
+ "is-disabled": q(t.option),
259
+ onClick: E((e) => G(t.option), ["prevent"]),
260
+ onMouseenter: (e) => X(t.index),
261
+ onMouseleave: Z,
262
+ title: R.value ? t.option : t.option[m.labelKey]
263
+ }, {
264
+ default: T(() => [d("span", null, [b(a.$slots, "default", {
265
+ option: t.option,
266
+ checked: K(t.option)
267
+ }, () => [f(x(R.value ? t.option : t.option[m.labelKey]), 1)])]), K(t.option) ? (v(), c(e, {
268
+ key: 0,
269
+ color: "var(--color-icon-accent)",
270
+ type: "400",
271
+ name: "done"
272
+ })) : l("", !0)]),
273
+ _: 2
274
+ }, 1032, [
275
+ "class",
276
+ "size",
277
+ "is-navigated",
278
+ "is-checked",
279
+ "is-disabled",
280
+ "onClick",
281
+ "onMouseenter",
282
+ "title"
283
+ ]))]),
284
+ _: 3
285
+ }, 8, [
286
+ "size",
287
+ "options",
288
+ "is-loading"
289
+ ])) : (v(), c(r, {
290
+ key: 5,
291
+ onChangeInfinityScroll: o[3] ||= (e) => a.$emit("changeInfinityScroll"),
292
+ search: M.value,
293
+ size: m.itemSize,
294
+ options: V.value
295
+ }, {
296
+ default: T(({ options: t }) => [(v(!0), u(ie, null, ae(t, ({ index: t, data: n }) => (v(), c(i, {
297
+ class: _(m.optionClass && m.optionClass(n, t)),
298
+ key: t,
299
+ size: m.itemSize,
300
+ "is-navigated": S(U) === t,
301
+ "is-checked": K(n),
302
+ "is-disabled": q(n),
303
+ onClick: E((e) => G(n), ["prevent"]),
304
+ onMouseenter: (e) => X(t),
305
+ onMouseleave: Z,
306
+ title: R.value ? n : n[m.labelKey]
307
+ }, {
308
+ default: T(() => [d("span", null, [b(a.$slots, "default", {
309
+ option: n,
310
+ checked: K(n)
311
+ }, () => [f(x(R.value ? n : n[m.labelKey]), 1)])]), K(n) ? (v(), c(e, {
312
+ key: 0,
313
+ color: "var(--color-icon-accent)",
314
+ type: "400",
315
+ name: "done"
316
+ })) : l("", !0)]),
317
+ _: 2
318
+ }, 1032, [
319
+ "class",
320
+ "size",
321
+ "is-navigated",
322
+ "is-checked",
323
+ "is-disabled",
324
+ "onClick",
325
+ "onMouseenter",
326
+ "title"
327
+ ]))), 128))]),
328
+ _: 3
329
+ }, 8, [
330
+ "search",
331
+ "size",
332
+ "options"
333
+ ])),
334
+ a.$slots.footer ? (v(), u("div", de, [b(a.$slots, "footer")])) : l("", !0)
335
+ ], 544)]),
336
+ _: 3
337
+ }, 8, [
338
+ "modelValue",
339
+ "offset",
340
+ "popper-class",
341
+ "fit-content-width",
342
+ "disabled",
343
+ "placement",
344
+ "teleport"
345
+ ])], 34));
346
+ }
347
+ });
348
+ //#endregion
349
+ export { D as t };
@@ -3,7 +3,7 @@ import { config as t } from "../config/index.js";
3
3
  import { t as n } from "./UiSkeleton.Gw5aX0E-.js";
4
4
  import { t as r } from "./UiCheckbox.DcHqX1WC.js";
5
5
  import { t as i } from "./dist.l1zr5gfb.js";
6
- import { t as a } from "./UiPagination.2XvUpFoX.js";
6
+ import { t as a } from "./UiPagination.DpV3wFEW.js";
7
7
  import { t as ee } from "./TableEmptyState.DmZaFgND.js";
8
8
  import { t as te } from "./TableSort.CKgp16-1.js";
9
9
  import { getValueByHeaderName as ne } from "../components/UiTable/helpers/getValueByHeaderName.js";
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../assets/UiChat.C8yIOFl6.js";
1
+ import { t as e } from "../../assets/UiChat.BTOPlRp-.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../assets/UiChatHeader.CXBBEiuH.js";
1
+ import { t as e } from "../../assets/UiChatHeader.tNXu72JW.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../assets/UiPagination.2XvUpFoX.js";
1
+ import { t as e } from "../../assets/UiPagination.DpV3wFEW.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../assets/UiSelect.CBOQXkNp.js";
1
+ import { t as e } from "../../assets/UiSelect.DBnwUWeq.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../assets/SelectListItem.CjXmHYbp.js";
1
+ import { t as e } from "../../../assets/SelectListItem.C3KlnrwK.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../../assets/SelectVirtualList.C8ZTNnx8.js";
1
+ import { t as e } from "../../../assets/SelectVirtualList.BKZFHrk3.js";
2
2
  export { e as default };
@@ -9,7 +9,9 @@ declare const __VLS_export: <Options>(__VLS_props: NonNullable<Awaited<typeof __
9
9
  }> & (typeof globalThis extends {
10
10
  __VLS_PROPS_FALLBACK: infer P;
11
11
  } ? P : {});
12
- expose: (exposed: {}) => void;
12
+ expose: (exposed: import('vue').ShallowUnwrapRef<{
13
+ scrollToItem(index: number): void;
14
+ }>) => void;
13
15
  attrs: any;
14
16
  slots: {
15
17
  default?: (props: {
@@ -1,11 +1,14 @@
1
1
  import { ComputedRef, Ref } from 'vue';
2
- export declare function useKeyboard<Options>({ isFocus, checkOption, filteredOptions }: {
3
- isFocus: Ref<boolean>;
2
+ export declare function useKeyboard<Options>({ isOpen, isDisabled, checkOption, filteredOptions, isOptionDisabled, open }: {
3
+ isOpen: Ref<boolean>;
4
+ isDisabled: ComputedRef<boolean>;
4
5
  checkOption: (value: unknown) => void;
5
6
  filteredOptions: ComputedRef<Options[]>;
7
+ isOptionDisabled: (option: unknown) => boolean;
8
+ open: (preferEnd?: boolean) => void;
6
9
  }): {
7
- onKeydownEnter: () => void;
8
- onKeydownDown: () => void;
9
- onKeydownUp: () => void;
10
+ onKeydown: (event: KeyboardEvent) => void;
10
11
  navigatedIndex: Ref<number | null, number | null>;
12
+ firstSelectableIndex: () => number | null;
13
+ lastSelectableIndex: () => number | null;
11
14
  };
@@ -1,21 +1,52 @@
1
1
  import { ref as e } from "vue";
2
2
  //#region src/lib/components/UiSelect/composables/useKeyboard.ts
3
- function t({ isFocus: t, checkOption: n, filteredOptions: r }) {
4
- let i = e(null);
5
- function a() {
6
- i.value !== null && n(r.value?.[i.value]);
3
+ function t({ isOpen: t, isDisabled: n, checkOption: r, filteredOptions: i, isOptionDisabled: a, open: o }) {
4
+ let s = e(null);
5
+ function c(e) {
6
+ let t = i.value[e];
7
+ return t !== void 0 && !a(t);
7
8
  }
8
- function o() {
9
- t.value && (i.value === null || i.value === r.value.length - 1 ? i.value = 0 : i.value++);
9
+ function l() {
10
+ let e = i.value.findIndex((e, t) => c(t));
11
+ return e === -1 ? null : e;
10
12
  }
11
- function s() {
12
- t.value && (i.value === null || i.value === 0 ? i.value = r.value.length - 1 : i.value--);
13
+ function u() {
14
+ let e = i.value;
15
+ for (let t = e.length - 1; t >= 0; t--) if (c(t)) return t;
16
+ return null;
17
+ }
18
+ function d(e) {
19
+ let t = [];
20
+ if (i.value.forEach((e, n) => {
21
+ c(n) && t.push(n);
22
+ }), !t.length) return;
23
+ let n = t.indexOf(s.value ?? -1);
24
+ if (n === -1) {
25
+ s.value = e > 0 ? t[0] : t[t.length - 1];
26
+ return;
27
+ }
28
+ let r = n + e;
29
+ r < 0 || r >= t.length || (s.value = t[r]);
30
+ }
31
+ function f() {
32
+ if (s.value === null) return;
33
+ let e = i.value[s.value];
34
+ e === void 0 || a(e) || r(e);
35
+ }
36
+ function p(e) {
37
+ if (!(e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) && !n.value && (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Enter")) {
38
+ if (!t.value) {
39
+ (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), o(e.key === "ArrowUp"));
40
+ return;
41
+ }
42
+ e.preventDefault(), e.stopPropagation(), e.key === "ArrowDown" ? d(1) : e.key === "ArrowUp" ? d(-1) : f();
43
+ }
13
44
  }
14
45
  return {
15
- onKeydownEnter: a,
16
- onKeydownDown: o,
17
- onKeydownUp: s,
18
- navigatedIndex: i
46
+ onKeydown: p,
47
+ navigatedIndex: s,
48
+ firstSelectableIndex: l,
49
+ lastSelectableIndex: u
19
50
  };
20
51
  }
21
52
  //#endregion
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../assets/UiTable.B0Yoq7JZ.js";
1
+ import { t as e } from "../../assets/UiTable.BVVe4xAf.js";
2
2
  export { e as default };
package/dist/index.js CHANGED
@@ -15,10 +15,10 @@ import { t as p } from "./assets/UiTooltip.1p87Beod.js";
15
15
  import { config as m } from "./config/index.js";
16
16
  import { t as h } from "./assets/UiInput.BEFJx5jn.js";
17
17
  import { t as g } from "./assets/UiDropdown.Dg0XSpN8.js";
18
- import { t as _ } from "./assets/UiSelect.CBOQXkNp.js";
18
+ import { t as _ } from "./assets/UiSelect.DBnwUWeq.js";
19
19
  import { t as v } from "./assets/UiSkeleton.Gw5aX0E-.js";
20
20
  import { t as y } from "./assets/dayjs.min.DNJva77w.js";
21
- import { t as b } from "./assets/UiChat.C8yIOFl6.js";
21
+ import { t as b } from "./assets/UiChat.BTOPlRp-.js";
22
22
  import { t as x } from "./assets/UiCheckbox.DcHqX1WC.js";
23
23
  import { t as S } from "./assets/UiCheckboxGroup.BAyBw4d4.js";
24
24
  import { t as C } from "./assets/UiCollapse.wtAndcyP.js";
@@ -39,12 +39,12 @@ import L from "./components/UiLayoutAuth/UiLayoutAuth.js";
39
39
  import { t as R } from "./assets/UiLayoutMenuItem.BtzmDM7n.js";
40
40
  import { t as z } from "./assets/UiLayoutMenu.DQFLq1ZP.js";
41
41
  import { t as B } from "./assets/UiMobileMenu.BWQo-ly6.js";
42
- import { t as V } from "./assets/UiPagination.2XvUpFoX.js";
42
+ import { t as V } from "./assets/UiPagination.DpV3wFEW.js";
43
43
  import { t as H } from "./assets/UiProfileMenu.DabRebk0.js";
44
44
  import { t as U } from "./assets/UiRadio.B9S8onxL.js";
45
45
  import { t as W } from "./assets/UiRadioGroup.BYchviiF.js";
46
46
  import { t as G } from "./assets/UiSwitch.CiUXziwX.js";
47
- import { t as K } from "./assets/UiTable.B0Yoq7JZ.js";
47
+ import { t as K } from "./assets/UiTable.BVVe4xAf.js";
48
48
  import { t as q } from "./assets/UiTag.BXBfn77t.js";
49
49
  import J from "./composables/useNotification/useNotification.js";
50
50
  //#endregion