vue-composable-ui 0.0.1 → 1.0.2

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 (123) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +5 -1
  3. package/dist/combobox.vue_vue_type_script_setup_true_lang-BhVMcx67.js +140 -0
  4. package/dist/comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js +29 -0
  5. package/dist/comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js +33 -0
  6. package/dist/comboboxOption.vue_vue_type_script_setup_true_lang-OyJxB4Jk.js +42 -0
  7. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-Doy6MfEQ.js +20 -0
  8. package/dist/composable-ui.js +49 -0
  9. package/dist/composable-ui10.js +4 -0
  10. package/dist/composable-ui11.js +4 -0
  11. package/dist/composable-ui12.js +4 -0
  12. package/dist/composable-ui13.js +4 -0
  13. package/dist/composable-ui14.js +4 -0
  14. package/dist/composable-ui15.js +4 -0
  15. package/dist/composable-ui16.js +4 -0
  16. package/dist/composable-ui17.js +31 -0
  17. package/dist/composable-ui18.js +4 -0
  18. package/dist/composable-ui19.js +4 -0
  19. package/dist/composable-ui2.js +55 -0
  20. package/dist/composable-ui20.js +4 -0
  21. package/dist/composable-ui21.js +100 -0
  22. package/dist/composable-ui22.js +144 -0
  23. package/dist/composable-ui23.js +7 -0
  24. package/dist/composable-ui24.js +7 -0
  25. package/dist/composable-ui3.js +4 -0
  26. package/dist/composable-ui4.js +4 -0
  27. package/dist/composable-ui5.js +4 -0
  28. package/dist/composable-ui6.js +4 -0
  29. package/dist/composable-ui7.js +4 -0
  30. package/dist/composable-ui8.js +4 -0
  31. package/dist/composable-ui9.js +4 -0
  32. package/dist/listbox.vue_vue_type_script_setup_true_lang-Bj1ZXiBX.js +69 -0
  33. package/dist/listboxOption.vue_vue_type_script_setup_true_lang-B_yRptJm.js +37 -0
  34. package/dist/menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js +82 -0
  35. package/dist/menuItem.vue_vue_type_script_setup_true_lang-mXtMa4gO.js +63 -0
  36. package/dist/menuItems.vue_vue_type_script_setup_true_lang-p9vftREy.js +49 -0
  37. package/dist/popover.vue_vue_type_script_setup_true_lang-DhKF7_nY.js +50 -0
  38. package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-CDXUO7wZ.js +33 -0
  39. package/dist/tab.vue_vue_type_script_setup_true_lang-Y5OFGqMB.js +29 -0
  40. package/dist/tabContainer.vue_vue_type_script_setup_true_lang-fPpLno2Z.js +40 -0
  41. package/dist/tabList.vue_vue_type_script_setup_true_lang-CZyqGCuj.js +48 -0
  42. package/dist/tabPanel.vue_vue_type_script_setup_true_lang-CGhP6SHR.js +31 -0
  43. package/dist/tooltip.vue_vue_type_script_setup_true_lang-DVKYJyfL.js +85 -0
  44. package/dist/types/components/combobox/combobox.vue.d.ts +45 -0
  45. package/dist/types/components/combobox/comboboxHiddenInput.vue.d.ts +6 -0
  46. package/dist/types/components/combobox/comboboxInput.vue.d.ts +9 -0
  47. package/dist/types/components/combobox/comboboxOption.vue.d.ts +20 -0
  48. package/dist/types/components/combobox/comboboxOptions.vue.d.ts +12 -0
  49. package/dist/types/components/injectionKeys.d.ts +43 -0
  50. package/dist/types/components/listbox/listbox.vue.d.ts +26 -0
  51. package/dist/types/components/listbox/listboxOption.vue.d.ts +20 -0
  52. package/dist/types/components/menu/menu.vue.d.ts +42 -0
  53. package/dist/types/components/menu/menuItem.vue.d.ts +24 -0
  54. package/dist/types/components/menu/menuItems.vue.d.ts +12 -0
  55. package/dist/types/components/popover/popover.vue.d.ts +40 -0
  56. package/dist/types/components/popover/popoverDialog.vue.d.ts +12 -0
  57. package/dist/types/components/tabs/tab.vue.d.ts +17 -0
  58. package/dist/types/components/tabs/tabContainer.vue.d.ts +19 -0
  59. package/dist/types/components/tabs/tabList.vue.d.ts +17 -0
  60. package/dist/types/components/tabs/tabPanel.vue.d.ts +15 -0
  61. package/dist/types/components/tooltip.vue.d.ts +34 -0
  62. package/dist/types/composables/formControl.d.ts +48 -0
  63. package/dist/types/composables/list.d.ts +107 -0
  64. package/dist/types/composables/listOption.d.ts +34 -0
  65. package/dist/types/composables/popover.d.ts +68 -0
  66. package/dist/types/main.d.ts +22 -0
  67. package/dist/types/utils/element.d.ts +3 -0
  68. package/package.json +28 -12
  69. package/.github/workflows/deploy.yml +0 -21
  70. package/.github/workflows/docs.yml +0 -62
  71. package/.vscode/extensions.json +0 -7
  72. package/docs/.vitepress/config.mts +0 -40
  73. package/docs/.vitepress/theme/index.js +0 -4
  74. package/docs/.vitepress/theme/style.scss +0 -155
  75. package/docs/components/combobox.md +0 -174
  76. package/docs/components/demos/combobox.vue +0 -142
  77. package/docs/components/demos/combobox_autocomplete.vue +0 -75
  78. package/docs/components/demos/combobox_tags.vue +0 -127
  79. package/docs/components/demos/input.vue +0 -35
  80. package/docs/components/demos/listbox.vue +0 -64
  81. package/docs/components/demos/menu.vue +0 -93
  82. package/docs/components/demos/popover.vue +0 -16
  83. package/docs/components/demos/tabs.vue +0 -59
  84. package/docs/components/demos/tooltip.vue +0 -27
  85. package/docs/components/listbox.md +0 -9
  86. package/docs/components/menu.md +0 -121
  87. package/docs/components/popover.md +0 -82
  88. package/docs/components/tabs.md +0 -9
  89. package/docs/components/tooltip.md +0 -78
  90. package/docs/composables/form-control.md +0 -130
  91. package/docs/composables/list-option.md +0 -47
  92. package/docs/composables/list.md +0 -192
  93. package/docs/composables/popover.md +0 -90
  94. package/docs/index.md +0 -24
  95. package/docs/intro.md +0 -0
  96. package/src/components/combobox/combobox.vue +0 -229
  97. package/src/components/combobox/comboboxFormInput.vue +0 -33
  98. package/src/components/combobox/comboboxOption.vue +0 -52
  99. package/src/components/combobox/comboboxOptions.vue +0 -17
  100. package/src/components/injectionKeys.ts +0 -50
  101. package/src/components/listbox/listbox.vue +0 -91
  102. package/src/components/listbox/listboxOption.vue +0 -37
  103. package/src/components/menu/menu.vue +0 -100
  104. package/src/components/menu/menuItem.vue +0 -86
  105. package/src/components/menu/menuItems.vue +0 -51
  106. package/src/components/popover/popover.vue +0 -68
  107. package/src/components/popover/popoverDialog.vue +0 -35
  108. package/src/components/tabs/tab.vue +0 -35
  109. package/src/components/tabs/tabContainer.vue +0 -50
  110. package/src/components/tabs/tabList.vue +0 -52
  111. package/src/components/tabs/tabPanel.vue +0 -36
  112. package/src/components/tooltip.vue +0 -115
  113. package/src/composables/formControl.ts +0 -144
  114. package/src/composables/list.ts +0 -326
  115. package/src/composables/listOption.ts +0 -80
  116. package/src/composables/popover.ts +0 -306
  117. package/src/main.ts +0 -65
  118. package/src/utils/element.ts +0 -19
  119. package/src/utils/id.ts +0 -5
  120. package/src/vite-env.d.ts +0 -1
  121. package/tsconfig.json +0 -27
  122. package/tsconfig.node.json +0 -10
  123. package/vite.config.ts +0 -28
@@ -0,0 +1,144 @@
1
+ import { shallowRef as N, ref as R, computed as g, provide as B, readonly as h, shallowReadonly as J, triggerRef as S, unref as s } from "vue";
2
+ import { useHTMLElement as _ } from "./composable-ui23.js";
3
+ const q = Symbol();
4
+ function d(r, c) {
5
+ const [n, l] = [s(r), s(c)];
6
+ return typeof n == "object" ? typeof l == "object" ? JSON.stringify(n) === JSON.stringify(l) : !1 : n === l;
7
+ }
8
+ function P(r) {
9
+ let c = 0;
10
+ const n = N([]), l = R(), v = g(() => Array.isArray(r.value));
11
+ function o(e) {
12
+ const t = n.value.find((i) => i.id === e);
13
+ if (!t) throw new Error(`Item not found: (${e})`);
14
+ return t;
15
+ }
16
+ function b(e) {
17
+ const t = s(e.element);
18
+ if (t)
19
+ return t.focus(), t;
20
+ }
21
+ function f(e, { focus: t = !1 } = {}) {
22
+ l.value = e?.id ?? void 0, e !== void 0 && t && b(e);
23
+ }
24
+ function O(e, { focus: t = !1 } = {}) {
25
+ const i = o(e);
26
+ return f(i, { focus: t });
27
+ }
28
+ function m(e) {
29
+ return l.value === e;
30
+ }
31
+ function w(e, t, i = !1) {
32
+ const a = _(e), u = c++;
33
+ return n.value.push({
34
+ id: u,
35
+ value: t,
36
+ element: a,
37
+ disabled: i
38
+ }), S(n), u;
39
+ }
40
+ function A(e) {
41
+ m(e) && f();
42
+ const t = o(e), i = n.value.indexOf(t);
43
+ n.value.splice(i, 1), S(n);
44
+ }
45
+ function I(e) {
46
+ const t = o(e);
47
+ if (s(t.disabled)) return;
48
+ const i = s(t.value);
49
+ if (i !== void 0) {
50
+ if (s(v)) {
51
+ const a = r.value.findIndex(
52
+ (u) => d(i, u)
53
+ );
54
+ a > -1 ? r.value.splice(a, 1) : r.value = [...r.value, i];
55
+ } else
56
+ r.value = i;
57
+ f(t);
58
+ }
59
+ }
60
+ function y(e) {
61
+ return s(v) ? !!r.value.find(
62
+ (t) => d(e.value, t)
63
+ ) : d(r, e.value);
64
+ }
65
+ function L(e) {
66
+ try {
67
+ const t = o(e);
68
+ return y(t);
69
+ } catch {
70
+ return !1;
71
+ }
72
+ }
73
+ function j({ focus: e = !1 } = {}) {
74
+ for (let t of n.value)
75
+ if (y(t))
76
+ return f(t, { focus: e });
77
+ }
78
+ function p({ focus: e = !1 } = {}) {
79
+ if (n.value.length)
80
+ return f(n.value[0], { focus: e });
81
+ }
82
+ function x({ focus: e = !1 } = {}) {
83
+ if (n.value.length)
84
+ return f(n.value[n.value.length - 1], { focus: e });
85
+ }
86
+ function E({
87
+ focus: e = !1,
88
+ loop: t = !1
89
+ } = {}) {
90
+ if (l.value === void 0) return p({ focus: e });
91
+ const i = o(l.value), a = n.value.indexOf(i);
92
+ let u;
93
+ if (a + 1 < n.value.length)
94
+ u = n.value[a + 1];
95
+ else if (t)
96
+ u = n.value[0];
97
+ else
98
+ return;
99
+ return f(u, { focus: e });
100
+ }
101
+ function M({
102
+ focus: e = !1,
103
+ loop: t = !1
104
+ } = {}) {
105
+ if (l.value === void 0) return x({ focus: e });
106
+ const i = o(l.value), a = n.value.indexOf(i);
107
+ let u;
108
+ if (a - 1 > -1)
109
+ u = n.value[a - 1];
110
+ else if (t)
111
+ u = n.value[n.value.length - 1];
112
+ else
113
+ return;
114
+ return f(u, { focus: e });
115
+ }
116
+ return B(q, {
117
+ value: h(r),
118
+ selectItem: I,
119
+ activateItem: O,
120
+ deactivateItem: () => f(),
121
+ isSelected: L,
122
+ isActive: m,
123
+ addItem: w,
124
+ removeItem: A
125
+ }), {
126
+ items: J(n),
127
+ isMultiselectable: h(v),
128
+ activeItem: g(
129
+ () => l.value !== void 0 ? o(l.value) : void 0
130
+ ),
131
+ selectActiveItem: () => {
132
+ l.value !== void 0 && I(l.value);
133
+ },
134
+ activateSelectedItem: j,
135
+ activateFirstItem: p,
136
+ activateLastItem: x,
137
+ activateNextItem: E,
138
+ activatePrevItem: M
139
+ };
140
+ }
141
+ export {
142
+ q as injectList,
143
+ P as useList
144
+ };
@@ -0,0 +1,7 @@
1
+ import { ref as r } from "vue";
2
+ function n(e) {
3
+ return typeof e == "string" ? r(document.querySelector(e)) : e instanceof HTMLElement ? r(e) : e;
4
+ }
5
+ export {
6
+ n as useHTMLElement
7
+ };
@@ -0,0 +1,7 @@
1
+ const o = Symbol(), n = Symbol(), t = Symbol(), c = Symbol();
2
+ export {
3
+ c as injectCombobox,
4
+ t as injectMenu,
5
+ n as injectPopover,
6
+ o as injectTabs
7
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./tooltip.vue_vue_type_script_setup_true_lang-DVKYJyfL.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./tabPanel.vue_vue_type_script_setup_true_lang-CGhP6SHR.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./tabList.vue_vue_type_script_setup_true_lang-CZyqGCuj.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./tabContainer.vue_vue_type_script_setup_true_lang-fPpLno2Z.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./tab.vue_vue_type_script_setup_true_lang-Y5OFGqMB.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./popoverDialog.vue_vue_type_script_setup_true_lang-CDXUO7wZ.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,4 @@
1
+ import { _ as f } from "./popover.vue_vue_type_script_setup_true_lang-DhKF7_nY.js";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,69 @@
1
+ import { defineComponent as m, mergeModels as p, useModel as v, computed as b, createElementBlock as k, openBlock as w, unref as I, renderSlot as h } from "vue";
2
+ import { useList as A } from "./composable-ui22.js";
3
+ const _ = ["aria-activedescendant", "aria-orientation", "aria-multiselectable"], B = /* @__PURE__ */ m({
4
+ __name: "listbox",
5
+ props: /* @__PURE__ */ p({
6
+ orientation: { default: "vertical" },
7
+ loop: { type: Boolean, default: !1 }
8
+ }, {
9
+ modelValue: {},
10
+ modelModifiers: {}
11
+ }),
12
+ emits: ["update:modelValue"],
13
+ setup(i) {
14
+ const e = i, n = v(i, "modelValue"), {
15
+ isMultiselectable: t,
16
+ activeItem: s,
17
+ selectActiveItem: o,
18
+ activateFirstItem: c,
19
+ activateLastItem: u,
20
+ activateNextItem: r,
21
+ activatePrevItem: l
22
+ } = A(n), f = b(() => s.value?.element.value?.id);
23
+ function d(a) {
24
+ switch (a.code) {
25
+ case "Space":
26
+ o();
27
+ break;
28
+ case "ArrowUp":
29
+ if (e.orientation === "horizontal") return;
30
+ l({ focus: !1, loop: e.loop }), t.value || o();
31
+ break;
32
+ case "ArrowDown":
33
+ if (e.orientation === "horizontal") return;
34
+ r({ focus: !1, loop: e.loop }), t.value || o();
35
+ break;
36
+ case "ArrowLeft":
37
+ if (e.orientation === "vertical") return;
38
+ l({ focus: !1, loop: e.loop }), t.value || o();
39
+ break;
40
+ case "ArrowRight":
41
+ if (e.orientation === "vertical") return;
42
+ r({ focus: !1, loop: e.loop }), t.value || o();
43
+ break;
44
+ case "Home":
45
+ c({ focus: !1 });
46
+ break;
47
+ case "End":
48
+ u({ focus: !1 });
49
+ break;
50
+ default:
51
+ return;
52
+ }
53
+ a.preventDefault();
54
+ }
55
+ return (a, x) => (w(), k("div", {
56
+ onKeydown: d,
57
+ "aria-activedescendant": f.value,
58
+ "aria-orientation": a.orientation,
59
+ "aria-multiselectable": I(t),
60
+ role: "listbox",
61
+ tabindex: "0"
62
+ }, [
63
+ h(a.$slots, "default")
64
+ ], 40, _));
65
+ }
66
+ });
67
+ export {
68
+ B as _
69
+ };
@@ -0,0 +1,37 @@
1
+ import { defineComponent as p, useId as m, useTemplateRef as u, createElementBlock as f, openBlock as b, unref as e, renderSlot as v } from "vue";
2
+ import { useListOption as _ } from "./composable-ui17.js";
3
+ const k = ["id", "aria-disabled", "aria-selected", "data-active"], S = /* @__PURE__ */ p({
4
+ __name: "listboxOption",
5
+ props: {
6
+ id: {},
7
+ value: {},
8
+ disabled: { type: Boolean }
9
+ },
10
+ setup(n) {
11
+ const t = n, r = t.id ?? m(), i = u("itemEl"), { isSelected: s, isActive: o, select: a } = _(
12
+ i,
13
+ t.value,
14
+ t.disabled
15
+ );
16
+ return (d, l) => (b(), f("div", {
17
+ ref_key: "itemEl",
18
+ ref: i,
19
+ id: e(r),
20
+ onClick: l[0] || (l[0] = //@ts-ignore
21
+ (...c) => e(a) && e(a)(...c)),
22
+ "aria-disabled": d.disabled,
23
+ "aria-selected": e(s),
24
+ "data-active": e(o),
25
+ role: "option",
26
+ tabindex: "-1"
27
+ }, [
28
+ v(d.$slots, "default", {
29
+ isSelected: e(s),
30
+ isActive: e(o)
31
+ })
32
+ ], 8, k));
33
+ }
34
+ });
35
+ export {
36
+ S as _
37
+ };
@@ -0,0 +1,82 @@
1
+ import { defineComponent as b, mergeModels as M, useId as u, useModel as O, computed as m, provide as A, renderSlot as _, unref as h, nextTick as r } from "vue";
2
+ import { usePopover as C } from "./composable-ui21.js";
3
+ import { useList as D } from "./composable-ui22.js";
4
+ import { injectMenu as V } from "./composable-ui24.js";
5
+ const j = /* @__PURE__ */ b({
6
+ __name: "menu",
7
+ props: /* @__PURE__ */ M({
8
+ id: {},
9
+ activatorId: {},
10
+ direction: { default: "down" },
11
+ align: { default: "left" },
12
+ position: { default: "fixed" }
13
+ }, {
14
+ modelValue: {},
15
+ modelModifiers: {}
16
+ }),
17
+ emits: ["update:modelValue"],
18
+ setup(s) {
19
+ const e = s, a = e.id ?? u(), i = e.activatorId ?? u(), p = O(s, "modelValue"), {
20
+ isMultiselectable: v,
21
+ activeItem: f,
22
+ activateFirstItem: n,
23
+ activateLastItem: c,
24
+ activateNextItem: I,
25
+ activatePrevItem: k
26
+ } = D(p), { isOpen: t, toggle: d, open: l, close: w } = C(
27
+ `#${i}`,
28
+ `#${a}`,
29
+ {
30
+ direction: e.direction,
31
+ align: e.align,
32
+ position: e.position,
33
+ closeOnOutsideClick: !0,
34
+ closeOnInsideClick: !1
35
+ }
36
+ );
37
+ function g(o) {
38
+ switch (o.code) {
39
+ case "Space":
40
+ case "Enter":
41
+ d(), t.value && r(n);
42
+ break;
43
+ case "ArrowUp":
44
+ l(), r(c);
45
+ break;
46
+ case "ArrowDown":
47
+ l(), r(n);
48
+ break;
49
+ default:
50
+ return;
51
+ }
52
+ o.preventDefault();
53
+ }
54
+ const x = m(() => ({
55
+ id: i,
56
+ "aria-controls": t.value ? a : void 0,
57
+ "aria-haspopup": "menu",
58
+ "aria-expanded": t.value,
59
+ onclick: () => d(),
60
+ onkeydown: g,
61
+ tabindex: 0
62
+ }));
63
+ return A(V, {
64
+ menuId: a,
65
+ activatorId: i,
66
+ isOpen: t,
67
+ close: w,
68
+ isMultiselectable: v,
69
+ activeItemId: m(() => f.value?.element.value?.id),
70
+ activateFirstItem: n,
71
+ activateLastItem: c,
72
+ activateNextItem: I,
73
+ activatePrevItem: k
74
+ }), (o, $) => _(o.$slots, "default", {
75
+ attrs: x.value,
76
+ isOpen: h(t)
77
+ });
78
+ }
79
+ });
80
+ export {
81
+ j as _
82
+ };
@@ -0,0 +1,63 @@
1
+ import { defineComponent as w, useId as y, useTemplateRef as S, inject as h, computed as j, createElementBlock as A, openBlock as B, unref as t, renderSlot as I } from "vue";
2
+ import { useListOption as _ } from "./composable-ui17.js";
3
+ import { injectMenu as $ } from "./composable-ui24.js";
4
+ const x = ["id", "data-active", "role", "aria-checked", "aria-disabled"], L = /* @__PURE__ */ w({
5
+ __name: "menuItem",
6
+ props: {
7
+ id: {},
8
+ value: {},
9
+ disabled: { type: Boolean }
10
+ },
11
+ emits: ["select"],
12
+ setup(d, { emit: r }) {
13
+ const e = d, u = r, m = e.id ?? y(), l = S("itemEl"), { isSelected: s, isActive: c, select: v, activate: f, deactivate: p } = _(
14
+ l,
15
+ e.value,
16
+ e.disabled
17
+ ), i = h($);
18
+ if (!i)
19
+ throw new Error("Menu injectable context is not provided");
20
+ const b = j(() => e.value !== void 0 ? i.isMultiselectable.value ? "menuitemcheckbox" : "menuitemradio" : "menuitem");
21
+ function a() {
22
+ v(), u("select", e.value);
23
+ }
24
+ function k() {
25
+ a(), (e.value === void 0 || !i?.isMultiselectable.value) && i.close();
26
+ }
27
+ function E(o) {
28
+ switch (o.code) {
29
+ case "Space":
30
+ a(), e.value === void 0 && i.close();
31
+ break;
32
+ case "Enter":
33
+ a(), i.close();
34
+ break;
35
+ default:
36
+ return;
37
+ }
38
+ o.preventDefault();
39
+ }
40
+ return (o, n) => (B(), A("div", {
41
+ ref_key: "itemEl",
42
+ ref: l,
43
+ id: t(m),
44
+ onClick: k,
45
+ onKeydown: E,
46
+ onMouseenter: n[0] || (n[0] = (M) => t(f)({ focus: !1 })),
47
+ onMouseleave: n[1] || (n[1] = (M) => t(p)()),
48
+ "data-active": t(c),
49
+ role: b.value,
50
+ "aria-checked": o.value !== void 0 ? t(s) : void 0,
51
+ "aria-disabled": o.disabled || void 0,
52
+ tabindex: "-1"
53
+ }, [
54
+ I(o.$slots, "default", {
55
+ isSelected: t(s),
56
+ isActive: t(c)
57
+ })
58
+ ], 40, x));
59
+ }
60
+ });
61
+ export {
62
+ L as _
63
+ };
@@ -0,0 +1,49 @@
1
+ import { defineComponent as n, inject as o, createElementBlock as c, createCommentVNode as s, unref as a, openBlock as i, renderSlot as u } from "vue";
2
+ import { injectMenu as l } from "./composable-ui24.js";
3
+ const d = ["id", "aria-activedescendant", "aria-labelledby"], b = /* @__PURE__ */ n({
4
+ __name: "menuItems",
5
+ setup(m) {
6
+ const e = o(l);
7
+ if (!e)
8
+ throw new Error("Menu injectable context is not provided");
9
+ function r(t) {
10
+ switch (t.code) {
11
+ case "ArrowUp":
12
+ e.activatePrevItem({ focus: !0, loop: !1 });
13
+ break;
14
+ case "ArrowDown":
15
+ e.activateNextItem({ focus: !0, loop: !1 });
16
+ break;
17
+ case "Home":
18
+ e.activateFirstItem({ focus: !0 });
19
+ break;
20
+ case "End":
21
+ e.activateLastItem({ focus: !0 });
22
+ break;
23
+ case "Escape":
24
+ e.close();
25
+ break;
26
+ case "Tab":
27
+ e.isOpen.value = !1;
28
+ return;
29
+ default:
30
+ return;
31
+ }
32
+ t.preventDefault();
33
+ }
34
+ return (t, f) => a(e).isOpen.value ? (i(), c("div", {
35
+ key: 0,
36
+ onKeydown: r,
37
+ id: a(e).menuId,
38
+ "aria-activedescendant": a(e).activeItemId.value,
39
+ "aria-labelledby": a(e).activatorId,
40
+ role: "menu",
41
+ tabindex: "-1"
42
+ }, [
43
+ u(t.$slots, "default")
44
+ ], 40, d)) : s("", !0);
45
+ }
46
+ });
47
+ export {
48
+ b as _
49
+ };
@@ -0,0 +1,50 @@
1
+ import { defineComponent as u, useId as r, computed as f, provide as v, renderSlot as O, unref as t } from "vue";
2
+ import { usePopover as m } from "./composable-ui21.js";
3
+ import { injectPopover as g } from "./composable-ui24.js";
4
+ const x = /* @__PURE__ */ u({
5
+ __name: "popover",
6
+ props: {
7
+ id: {},
8
+ activatorId: {},
9
+ direction: { default: "down" },
10
+ align: { default: "left" },
11
+ position: { default: "fixed" },
12
+ closeOnOutsideClick: { type: Boolean, default: !0 },
13
+ closeOnInsideClick: { type: Boolean, default: !1 },
14
+ role: { default: "dialog" }
15
+ },
16
+ setup(s) {
17
+ const e = s, n = e.id ?? r(), i = e.activatorId ?? r(), { isOpen: o, toggle: a, open: d, close: l } = m(
18
+ `#${i}`,
19
+ `#${n}`,
20
+ {
21
+ direction: e.direction,
22
+ align: e.align,
23
+ position: e.position,
24
+ closeOnOutsideClick: e.closeOnOutsideClick,
25
+ closeOnInsideClick: e.closeOnInsideClick
26
+ }
27
+ ), c = f(() => ({
28
+ id: i,
29
+ "aria-controls": o.value ? e.id : void 0,
30
+ "aria-haspopup": e.role,
31
+ "aria-expanded": o.value
32
+ }));
33
+ return v(g, {
34
+ popoverId: n,
35
+ activatorId: i,
36
+ role: e.role,
37
+ isOpen: o,
38
+ close: l
39
+ }), (p, I) => O(p.$slots, "default", {
40
+ attrs: c.value,
41
+ isOpen: t(o),
42
+ toggle: () => t(a)(),
43
+ open: () => t(d)(),
44
+ close: () => t(l)()
45
+ });
46
+ }
47
+ });
48
+ export {
49
+ x as _
50
+ };
@@ -0,0 +1,33 @@
1
+ import { defineComponent as n, inject as a, createElementBlock as i, createCommentVNode as c, unref as r, openBlock as l, renderSlot as p } from "vue";
2
+ import { injectPopover as d } from "./composable-ui24.js";
3
+ const s = ["id", "role", "aria-labelledby"], v = /* @__PURE__ */ n({
4
+ __name: "popoverDialog",
5
+ setup(u) {
6
+ const e = a(d);
7
+ if (!e)
8
+ throw new Error("Popover injectable context is not provided");
9
+ function t(o) {
10
+ switch (o.code) {
11
+ case "Escape":
12
+ e.close();
13
+ break;
14
+ default:
15
+ return;
16
+ }
17
+ o.preventDefault();
18
+ }
19
+ return (o, f) => r(e).isOpen.value ? (l(), i("div", {
20
+ key: 0,
21
+ onKeydown: t,
22
+ id: r(e).popoverId,
23
+ role: r(e).role,
24
+ "aria-labelledby": r(e).activatorId,
25
+ tabindex: "-1"
26
+ }, [
27
+ p(o.$slots, "default")
28
+ ], 40, s)) : c("", !0);
29
+ }
30
+ });
31
+ export {
32
+ v as _
33
+ };
@@ -0,0 +1,29 @@
1
+ import { defineComponent as u, useTemplateRef as b, useId as s, createElementBlock as f, openBlock as m, unref as e, renderSlot as _ } from "vue";
2
+ import { useListOption as k } from "./composable-ui17.js";
3
+ const C = ["id", "aria-selected", "aria-controls", "tabindex"], v = /* @__PURE__ */ u({
4
+ __name: "tab",
5
+ props: {
6
+ id: {},
7
+ ariaControls: {},
8
+ value: {}
9
+ },
10
+ setup(i) {
11
+ const t = i, o = b("tab"), { isSelected: a, select: n } = k(o, t.value), l = t.id ?? s(), c = t.ariaControls ?? s();
12
+ return (d, r) => (m(), f("button", {
13
+ ref_key: "tab",
14
+ ref: o,
15
+ onClick: r[0] || (r[0] = //@ts-ignore
16
+ (...p) => e(n) && e(n)(...p)),
17
+ id: e(l),
18
+ "aria-selected": e(a),
19
+ "aria-controls": e(c),
20
+ tabindex: e(a) ? 0 : -1,
21
+ role: "tab"
22
+ }, [
23
+ _(d.$slots, "default")
24
+ ], 8, C));
25
+ }
26
+ });
27
+ export {
28
+ v as _
29
+ };
@@ -0,0 +1,40 @@
1
+ import { defineComponent as c, useModel as u, provide as v, computed as p, createElementBlock as f, openBlock as I, renderSlot as _ } from "vue";
2
+ import { useList as b } from "./composable-ui22.js";
3
+ import { injectTabs as g } from "./composable-ui24.js";
4
+ const x = /* @__PURE__ */ c({
5
+ __name: "tabContainer",
6
+ props: {
7
+ modelValue: {},
8
+ modelModifiers: {}
9
+ },
10
+ emits: ["update:modelValue"],
11
+ setup(o) {
12
+ const a = u(o, "modelValue"), {
13
+ items: i,
14
+ selectActiveItem: l,
15
+ activateFirstItem: m,
16
+ activateLastItem: r,
17
+ activateNextItem: n,
18
+ activatePrevItem: s
19
+ } = b(a);
20
+ return v(g, {
21
+ getIds: (e) => p(() => {
22
+ const t = i.value.find((d) => d.value === e);
23
+ return {
24
+ tabId: t?.element.value?.getAttribute("id") || void 0,
25
+ panelId: t?.element.value?.getAttribute("aria-controls") || void 0
26
+ };
27
+ }),
28
+ selectActiveItem: l,
29
+ activateFirstItem: m,
30
+ activateLastItem: r,
31
+ activateNextItem: n,
32
+ activatePrevItem: s
33
+ }), (e, t) => (I(), f("div", null, [
34
+ _(e.$slots, "default")
35
+ ]));
36
+ }
37
+ });
38
+ export {
39
+ x as _
40
+ };