@dv.net/ui-kit 7.7.21 → 7.7.23

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 (30) hide show
  1. package/dist/assets/{SelectListItem.CjXmHYbp.js → SelectListItem.C3KlnrwK.js} +14 -12
  2. package/dist/assets/{SelectVirtualList.C8ZTNnx8.js → SelectVirtualList.BKZFHrk3.js} +10 -6
  3. package/dist/assets/{UiChat.C8yIOFl6.js → UiChat.Bzq1rIIj.js} +1 -1
  4. package/dist/assets/{UiChatHeader.CXBBEiuH.js → UiChatHeader.DPDnVuml.js} +1 -1
  5. package/dist/assets/UiDropdown.dordvCUy.js +142 -0
  6. package/dist/assets/{UiPagination.2XvUpFoX.js → UiPagination.7HNbPhvg.js} +1 -1
  7. package/dist/assets/{UiProfileMenu.DabRebk0.js → UiProfileMenu.Daxkis6-.js} +1 -1
  8. package/dist/assets/UiSelect.CF7NEAzH.js +350 -0
  9. package/dist/assets/{UiTable.B0Yoq7JZ.js → UiTable.pKt1Al8E.js} +1 -1
  10. package/dist/components/UiChat/UiChat.js +1 -1
  11. package/dist/components/UiChat/UiChatHeader.js +1 -1
  12. package/dist/components/UiDropdown/UiDropdown.js +1 -1
  13. package/dist/components/UiDropdown/UiDropdown.vue.d.ts +1 -0
  14. package/dist/components/UiDropdown/composables/useKeyboard.d.ts +12 -0
  15. package/dist/components/UiDropdown/composables/useKeyboard.js +73 -0
  16. package/dist/components/UiDropdown/types.d.ts +1 -0
  17. package/dist/components/UiPagination/UiPagination.js +1 -1
  18. package/dist/components/UiProfileMenu/UiProfileMenu.js +1 -1
  19. package/dist/components/UiSelect/UiSelect.js +1 -1
  20. package/dist/components/UiSelect/components/SelectListItem.js +1 -1
  21. package/dist/components/UiSelect/components/SelectVirtualList.js +1 -1
  22. package/dist/components/UiSelect/components/SelectVirtualList.vue.d.ts +3 -1
  23. package/dist/components/UiSelect/composables/useKeyboard.d.ts +8 -5
  24. package/dist/components/UiSelect/composables/useKeyboard.js +43 -12
  25. package/dist/components/UiTable/UiTable.js +1 -1
  26. package/dist/index.js +6 -6
  27. package/dist/style.css +1 -1
  28. package/package.json +1 -1
  29. package/dist/assets/UiDropdown.Dg0XSpN8.js +0 -122
  30. package/dist/assets/UiSelect.CBOQXkNp.js +0 -326
@@ -0,0 +1,73 @@
1
+ import { nextTick as e, ref as t } from "vue";
2
+ //#region src/lib/components/UiDropdown/composables/useKeyboard.ts
3
+ var n = [
4
+ "button:not(:disabled)",
5
+ "a[href]",
6
+ "[role=\"menuitem\"]:not([aria-disabled=\"true\"])",
7
+ "[data-dropdown-item]"
8
+ ].join(", ");
9
+ function r({ isOpen: r, isDisabled: i, open: a, getRoot: o }) {
10
+ let s = t(null);
11
+ function c() {
12
+ let e = o();
13
+ return e ? Array.from(e.querySelectorAll(n)).filter((e) => !e.hasAttribute("disabled") && e.getAttribute("aria-disabled") !== "true") : [];
14
+ }
15
+ function l() {
16
+ return c().length ? 0 : null;
17
+ }
18
+ function u() {
19
+ let e = c().length;
20
+ return e ? e - 1 : null;
21
+ }
22
+ function d() {
23
+ c().forEach((e, t) => {
24
+ t === s.value ? (e.setAttribute("data-highlighted", "true"), e.classList.add("is-navigated")) : (e.removeAttribute("data-highlighted"), e.classList.remove("is-navigated"));
25
+ });
26
+ }
27
+ function f() {
28
+ c().forEach((e) => {
29
+ e.removeAttribute("data-highlighted"), e.classList.remove("is-navigated");
30
+ }), s.value = null;
31
+ }
32
+ async function p() {
33
+ await e(), d();
34
+ let t = o()?.querySelector("[data-highlighted='true']"), n = t?.closest(".ui-dropdown__content");
35
+ if (!(n instanceof HTMLElement) || !t) return;
36
+ let r = n.getBoundingClientRect(), i = t.getBoundingClientRect();
37
+ i.top < r.top ? n.scrollTop -= r.top - i.top : i.bottom > r.bottom && (n.scrollTop += i.bottom - r.bottom);
38
+ }
39
+ function m(e) {
40
+ let t = c();
41
+ if (!t.length) return;
42
+ let n = s.value ?? -1;
43
+ if (n === -1) {
44
+ s.value = e > 0 ? 0 : t.length - 1, p();
45
+ return;
46
+ }
47
+ let r = n + e;
48
+ r < 0 || r >= t.length || (s.value = r, p());
49
+ }
50
+ function h() {
51
+ s.value !== null && c()[s.value]?.click();
52
+ }
53
+ function g(e = !1) {
54
+ s.value = e ? u() : l(), p();
55
+ }
56
+ function _(e) {
57
+ if (!(e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) && !i.value && (e.key === "ArrowDown" || e.key === "ArrowUp" || e.key === "Enter")) {
58
+ if (!r.value) {
59
+ e.key === "ArrowDown" || e.key === "ArrowUp" ? (e.preventDefault(), a(e.key === "ArrowUp")) : e.key === "Enter" && (e.preventDefault(), a());
60
+ return;
61
+ }
62
+ e.preventDefault(), e.stopPropagation(), e.key === "ArrowDown" ? m(1) : e.key === "ArrowUp" ? m(-1) : h();
63
+ }
64
+ }
65
+ return {
66
+ onKeydown: _,
67
+ navigatedIndex: s,
68
+ clearHighlight: f,
69
+ setInitialHighlight: g
70
+ };
71
+ }
72
+ //#endregion
73
+ export { r as useKeyboard };
@@ -11,4 +11,5 @@ export interface UiDropdownProps {
11
11
  placement?: UiPlacementType;
12
12
  teleport?: string | boolean;
13
13
  mode?: UiDropdownMode;
14
+ tabindex?: number;
14
15
  }
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../assets/UiPagination.2XvUpFoX.js";
1
+ import { t as e } from "../../assets/UiPagination.7HNbPhvg.js";
2
2
  export { e as default };
@@ -1,2 +1,2 @@
1
- import { t as e } from "../../assets/UiProfileMenu.DabRebk0.js";
1
+ import { t as e } from "../../assets/UiProfileMenu.Daxkis6-.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.CF7NEAzH.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.pKt1Al8E.js";
2
2
  export { e as default };
package/dist/index.js CHANGED
@@ -14,11 +14,11 @@ import { t as f } from "./assets/UiTextarea.BeZntaVW.js";
14
14
  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
- import { t as g } from "./assets/UiDropdown.Dg0XSpN8.js";
18
- import { t as _ } from "./assets/UiSelect.CBOQXkNp.js";
17
+ import { t as g } from "./assets/UiDropdown.dordvCUy.js";
18
+ import { t as _ } from "./assets/UiSelect.CF7NEAzH.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.Bzq1rIIj.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";
43
- import { t as H } from "./assets/UiProfileMenu.DabRebk0.js";
42
+ import { t as V } from "./assets/UiPagination.7HNbPhvg.js";
43
+ import { t as H } from "./assets/UiProfileMenu.Daxkis6-.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.pKt1Al8E.js";
48
48
  import { t as q } from "./assets/UiTag.BXBfn77t.js";
49
49
  import J from "./composables/useNotification/useNotification.js";
50
50
  //#endregion