vue-composable-ui 1.0.2 → 1.0.3
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/{combobox.vue_vue_type_script_setup_true_lang-BhVMcx67.js → combobox.vue_vue_type_script_setup_true_lang-DpM6lN_3.js} +36 -36
- package/dist/comboboxOption.vue_vue_type_script_setup_true_lang-DPEArk3M.js +42 -0
- package/dist/composable-ui.js +6 -6
- package/dist/composable-ui11.js +1 -1
- package/dist/composable-ui13.js +1 -1
- package/dist/composable-ui14.js +1 -1
- package/dist/composable-ui16.js +1 -1
- package/dist/composable-ui20.js +1 -1
- package/dist/composable-ui3.js +1 -1
- package/dist/{listbox.vue_vue_type_script_setup_true_lang-Bj1ZXiBX.js → listbox.vue_vue_type_script_setup_true_lang-CP8lV3wp.js} +12 -12
- package/dist/{listboxOption.vue_vue_type_script_setup_true_lang-B_yRptJm.js → listboxOption.vue_vue_type_script_setup_true_lang-C1-Q-dSr.js} +16 -16
- package/dist/menuItem.vue_vue_type_script_setup_true_lang-ezPw3j-i.js +63 -0
- package/dist/{tooltip.vue_vue_type_script_setup_true_lang-DVKYJyfL.js → tooltip.vue_vue_type_script_setup_true_lang-D4uAZmQb.js} +21 -21
- package/dist/types/components/combobox/combobox.vue.d.ts +1 -1
- package/dist/types/components/combobox/comboboxHiddenInput.vue.d.ts +1 -1
- package/dist/types/components/combobox/comboboxInput.vue.d.ts +1 -1
- package/dist/types/components/combobox/comboboxOption.vue.d.ts +1 -1
- package/dist/types/components/combobox/comboboxOptions.vue.d.ts +1 -1
- package/dist/types/components/listbox/listbox.vue.d.ts +1 -1
- package/dist/types/components/listbox/listboxOption.vue.d.ts +1 -1
- package/dist/types/components/menu/menu.vue.d.ts +1 -1
- package/dist/types/components/menu/menuItem.vue.d.ts +1 -1
- package/dist/types/components/menu/menuItems.vue.d.ts +1 -1
- package/dist/types/components/popover/popover.vue.d.ts +1 -1
- package/dist/types/components/popover/popoverDialog.vue.d.ts +1 -1
- package/dist/types/components/tabs/tab.vue.d.ts +1 -1
- package/dist/types/components/tabs/tabContainer.vue.d.ts +1 -1
- package/dist/types/components/tabs/tabList.vue.d.ts +1 -1
- package/dist/types/components/tabs/tabPanel.vue.d.ts +1 -1
- package/dist/types/components/tooltip.vue.d.ts +1 -1
- package/package.json +2 -1
- package/dist/comboboxOption.vue_vue_type_script_setup_true_lang-OyJxB4Jk.js +0 -42
- package/dist/menuItem.vue_vue_type_script_setup_true_lang-mXtMa4gO.js +0 -63
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as B, mergeModels as H, computed as p, useModel as T, useId as j, watch as N, provide as P, createElementBlock as v, openBlock as r, Fragment as b, createCommentVNode as U, renderSlot as K, createBlock as A, unref as k, renderList as _, nextTick as h } from "vue";
|
|
2
2
|
import { useHTMLElement as q } from "./composable-ui23.js";
|
|
3
3
|
import { usePopover as z } from "./composable-ui21.js";
|
|
4
4
|
import { useList as G } from "./composable-ui22.js";
|
|
5
|
-
import { _ as
|
|
5
|
+
import { _ as $ } from "./comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js";
|
|
6
6
|
import { injectCombobox as J } from "./composable-ui24.js";
|
|
7
|
-
const ae = /* @__PURE__ */
|
|
7
|
+
const ae = /* @__PURE__ */ B({
|
|
8
8
|
inheritAttrs: !1,
|
|
9
9
|
__name: "combobox",
|
|
10
|
-
props: /* @__PURE__ */
|
|
11
|
-
displayValue: { type: Function, default: (
|
|
10
|
+
props: /* @__PURE__ */ H({
|
|
11
|
+
displayValue: { type: Function, default: (e) => Array.isArray(e) ? e.map((t) => t.toString()).join(", ") : e.toString() },
|
|
12
12
|
id: {},
|
|
13
13
|
activatorId: {},
|
|
14
14
|
name: {},
|
|
15
|
-
formValue: { type: Function, default: (
|
|
15
|
+
formValue: { type: Function, default: (e) => e }
|
|
16
16
|
}, {
|
|
17
17
|
modelValue: {},
|
|
18
18
|
modelModifiers: {}
|
|
19
19
|
}),
|
|
20
20
|
emits: ["update:modelValue"],
|
|
21
|
-
setup(
|
|
22
|
-
const
|
|
21
|
+
setup(e) {
|
|
22
|
+
const t = e, I = p(() => u.value ? l.value.map((a) => t.formValue(a)) : t.formValue(l.value)), l = T(e, "modelValue"), i = t.id ?? j(), y = t.activatorId ?? i, n = `${i}-popover`, { isOpen: o, toggle: E, open: s, close: c } = z(
|
|
23
23
|
`#${y}`,
|
|
24
24
|
`#${n}`,
|
|
25
25
|
{
|
|
@@ -39,24 +39,24 @@ const ae = /* @__PURE__ */ _({
|
|
|
39
39
|
activateLastItem: V,
|
|
40
40
|
activateNextItem: C,
|
|
41
41
|
activatePrevItem: M
|
|
42
|
-
} = G(
|
|
43
|
-
|
|
42
|
+
} = G(l), g = p(() => t.displayValue(l.value));
|
|
43
|
+
N(w, () => {
|
|
44
44
|
!f.value && w.value.length && (S({ focus: !1 }), f.value || d({ focus: !1 }));
|
|
45
45
|
});
|
|
46
46
|
function O() {
|
|
47
47
|
q(`#${y}`).value?.focus();
|
|
48
48
|
}
|
|
49
|
-
function D(
|
|
50
|
-
if (
|
|
51
|
-
switch (
|
|
49
|
+
function D(a) {
|
|
50
|
+
if (o.value)
|
|
51
|
+
switch (a.code) {
|
|
52
52
|
case "Space":
|
|
53
|
-
m(), u.value ||
|
|
53
|
+
m(), u.value || c({ focus: !0 });
|
|
54
54
|
break;
|
|
55
55
|
case "Enter":
|
|
56
|
-
m(),
|
|
56
|
+
m(), c({ focus: !0 });
|
|
57
57
|
break;
|
|
58
58
|
case "Tab":
|
|
59
|
-
m(),
|
|
59
|
+
m(), c({ focus: !0 });
|
|
60
60
|
return;
|
|
61
61
|
case "ArrowUp":
|
|
62
62
|
M({ focus: !1, loop: !1 });
|
|
@@ -71,66 +71,66 @@ const ae = /* @__PURE__ */ _({
|
|
|
71
71
|
V({ focus: !1 });
|
|
72
72
|
break;
|
|
73
73
|
case "Escape":
|
|
74
|
-
|
|
74
|
+
c({ focus: !0 });
|
|
75
75
|
break;
|
|
76
76
|
default:
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
79
|
else
|
|
80
|
-
switch (
|
|
80
|
+
switch (a.code) {
|
|
81
81
|
case "Space":
|
|
82
82
|
case "Enter":
|
|
83
83
|
s({ focus: !1 });
|
|
84
84
|
break;
|
|
85
85
|
case "End":
|
|
86
86
|
case "ArrowUp":
|
|
87
|
-
s({ focus: !1 }),
|
|
87
|
+
s({ focus: !1 }), h(() => V({ focus: !1 }));
|
|
88
88
|
break;
|
|
89
89
|
case "Home":
|
|
90
90
|
case "ArrowDown":
|
|
91
|
-
s({ focus: !1 }),
|
|
91
|
+
s({ focus: !1 }), h(() => d({ focus: !1 }));
|
|
92
92
|
break;
|
|
93
93
|
default:
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
a.preventDefault();
|
|
97
97
|
}
|
|
98
|
-
const
|
|
98
|
+
const x = p(() => ({
|
|
99
99
|
onkeydown: D,
|
|
100
100
|
onclick: () => s({ focus: !1 }),
|
|
101
101
|
id: i,
|
|
102
|
-
"aria-controls":
|
|
103
|
-
"aria-expanded":
|
|
102
|
+
"aria-controls": o.value ? n : void 0,
|
|
103
|
+
"aria-expanded": o.value,
|
|
104
104
|
"aria-activedescendant": f.value?.element.value?.id,
|
|
105
105
|
"aria-haspopup": "listbox",
|
|
106
106
|
role: "combobox"
|
|
107
107
|
}));
|
|
108
|
-
return
|
|
108
|
+
return P(J, {
|
|
109
109
|
displayValue: g,
|
|
110
110
|
popoverId: n,
|
|
111
|
-
isOpen:
|
|
111
|
+
isOpen: o,
|
|
112
112
|
open: s,
|
|
113
|
-
close:
|
|
113
|
+
close: c,
|
|
114
114
|
focus: O,
|
|
115
115
|
isMultiselectable: u,
|
|
116
|
-
activatorAttrs:
|
|
117
|
-
}), (
|
|
118
|
-
e.name ? (
|
|
119
|
-
k(u) ? (
|
|
116
|
+
activatorAttrs: x
|
|
117
|
+
}), (a, Q) => (r(), v(b, null, [
|
|
118
|
+
e.name ? (r(), v(b, { key: 0 }, [
|
|
119
|
+
k(u) ? (r(!0), v(b, { key: 0 }, _(I.value, (F, L) => (r(), A($, {
|
|
120
120
|
name: `${e.name}[${L}]`,
|
|
121
121
|
value: F
|
|
122
|
-
}, null, 8, ["name", "value"]))), 256)) : (
|
|
122
|
+
}, null, 8, ["name", "value"]))), 256)) : (r(), A($, {
|
|
123
123
|
key: 1,
|
|
124
124
|
name: e.name,
|
|
125
125
|
value: I.value
|
|
126
126
|
}, null, 8, ["name", "value"]))
|
|
127
|
-
], 64)) :
|
|
128
|
-
|
|
127
|
+
], 64)) : U("", !0),
|
|
128
|
+
K(a.$slots, "default", {
|
|
129
129
|
popoverId: n,
|
|
130
|
-
isOpen: k(
|
|
130
|
+
isOpen: k(o),
|
|
131
131
|
toggle: () => k(E)(),
|
|
132
132
|
displayValue: g.value,
|
|
133
|
-
attrs:
|
|
133
|
+
attrs: x.value
|
|
134
134
|
})
|
|
135
135
|
], 64));
|
|
136
136
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineComponent as f, useId as b, useTemplateRef as p, inject as v, createElementBlock as x, openBlock as E, unref as e, renderSlot as _ } from "vue";
|
|
2
|
+
import { useListOption as k } from "./composable-ui17.js";
|
|
3
|
+
import { injectCombobox as C } from "./composable-ui24.js";
|
|
4
|
+
const j = ["id", "data-active", "aria-selected", "aria-disabled"], A = /* @__PURE__ */ f({
|
|
5
|
+
__name: "comboboxOption",
|
|
6
|
+
props: {
|
|
7
|
+
id: {},
|
|
8
|
+
value: {},
|
|
9
|
+
disabled: { type: Boolean }
|
|
10
|
+
},
|
|
11
|
+
setup(i) {
|
|
12
|
+
const o = i, c = o.id ?? b(), s = p("itemEl"), { isSelected: n, isActive: a, activate: d, select: r } = k(
|
|
13
|
+
s,
|
|
14
|
+
o.value,
|
|
15
|
+
o.disabled
|
|
16
|
+
), t = v(C);
|
|
17
|
+
if (!t)
|
|
18
|
+
throw new Error("Combobox injectable context is not provided");
|
|
19
|
+
function m() {
|
|
20
|
+
r(), t.isMultiselectable.value ? t.focus() : t.close({ focus: !0 });
|
|
21
|
+
}
|
|
22
|
+
return (u, l) => (E(), x("div", {
|
|
23
|
+
ref_key: "itemEl",
|
|
24
|
+
ref: s,
|
|
25
|
+
id: e(c),
|
|
26
|
+
onClick: m,
|
|
27
|
+
onMouseenter: l[0] || (l[0] = (B) => e(d)({ focus: !1 })),
|
|
28
|
+
"data-active": e(a),
|
|
29
|
+
"aria-selected": e(n),
|
|
30
|
+
"aria-disabled": i.disabled || void 0,
|
|
31
|
+
role: "option"
|
|
32
|
+
}, [
|
|
33
|
+
_(u.$slots, "default", {
|
|
34
|
+
isSelected: e(n),
|
|
35
|
+
isActive: e(a)
|
|
36
|
+
})
|
|
37
|
+
], 40, j));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
export {
|
|
41
|
+
A as _
|
|
42
|
+
};
|
package/dist/composable-ui.js
CHANGED
|
@@ -4,22 +4,22 @@ import { useListOption as s } from "./composable-ui17.js";
|
|
|
4
4
|
import { useFormControl as a } from "./composable-ui2.js";
|
|
5
5
|
import { useHTMLElement as n } from "./composable-ui23.js";
|
|
6
6
|
import { injectCombobox as i, injectMenu as _, injectPopover as u, injectTabs as C } from "./composable-ui24.js";
|
|
7
|
-
import { _ as L } from "./listbox.vue_vue_type_script_setup_true_lang-
|
|
8
|
-
import { _ as M } from "./listboxOption.vue_vue_type_script_setup_true_lang-
|
|
7
|
+
import { _ as L } from "./listbox.vue_vue_type_script_setup_true_lang-CP8lV3wp.js";
|
|
8
|
+
import { _ as M } from "./listboxOption.vue_vue_type_script_setup_true_lang-C1-Q-dSr.js";
|
|
9
9
|
import { _ as c } from "./tabContainer.vue_vue_type_script_setup_true_lang-fPpLno2Z.js";
|
|
10
10
|
import { _ as v } from "./tabList.vue_vue_type_script_setup_true_lang-CZyqGCuj.js";
|
|
11
11
|
import { _ as I } from "./tab.vue_vue_type_script_setup_true_lang-Y5OFGqMB.js";
|
|
12
12
|
import { _ as D } from "./tabPanel.vue_vue_type_script_setup_true_lang-CGhP6SHR.js";
|
|
13
13
|
import { _ as F } from "./popover.vue_vue_type_script_setup_true_lang-DhKF7_nY.js";
|
|
14
14
|
import { _ as d } from "./popoverDialog.vue_vue_type_script_setup_true_lang-CDXUO7wZ.js";
|
|
15
|
-
import { _ as k } from "./tooltip.vue_vue_type_script_setup_true_lang-
|
|
15
|
+
import { _ as k } from "./tooltip.vue_vue_type_script_setup_true_lang-D4uAZmQb.js";
|
|
16
16
|
import { _ as w } from "./menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js";
|
|
17
17
|
import { _ as z } from "./menuItems.vue_vue_type_script_setup_true_lang-p9vftREy.js";
|
|
18
|
-
import { _ as B } from "./menuItem.vue_vue_type_script_setup_true_lang-
|
|
19
|
-
import { _ as J } from "./combobox.vue_vue_type_script_setup_true_lang-
|
|
18
|
+
import { _ as B } from "./menuItem.vue_vue_type_script_setup_true_lang-ezPw3j-i.js";
|
|
19
|
+
import { _ as J } from "./combobox.vue_vue_type_script_setup_true_lang-DpM6lN_3.js";
|
|
20
20
|
import { _ as N } from "./comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js";
|
|
21
21
|
import { _ as R } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-Doy6MfEQ.js";
|
|
22
|
-
import { _ as U } from "./comboboxOption.vue_vue_type_script_setup_true_lang-
|
|
22
|
+
import { _ as U } from "./comboboxOption.vue_vue_type_script_setup_true_lang-DPEArk3M.js";
|
|
23
23
|
export {
|
|
24
24
|
J as Combobox,
|
|
25
25
|
N as ComboboxInput,
|
package/dist/composable-ui11.js
CHANGED
package/dist/composable-ui13.js
CHANGED
package/dist/composable-ui14.js
CHANGED
package/dist/composable-ui16.js
CHANGED
package/dist/composable-ui20.js
CHANGED
package/dist/composable-ui3.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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
|
|
3
|
-
const
|
|
2
|
+
import { useList as x } from "./composable-ui22.js";
|
|
3
|
+
const A = ["aria-activedescendant", "aria-orientation", "aria-multiselectable"], B = /* @__PURE__ */ m({
|
|
4
4
|
__name: "listbox",
|
|
5
5
|
props: /* @__PURE__ */ p({
|
|
6
6
|
orientation: { default: "vertical" },
|
|
@@ -17,9 +17,9 @@ const _ = ["aria-activedescendant", "aria-orientation", "aria-multiselectable"],
|
|
|
17
17
|
selectActiveItem: o,
|
|
18
18
|
activateFirstItem: c,
|
|
19
19
|
activateLastItem: u,
|
|
20
|
-
activateNextItem:
|
|
21
|
-
activatePrevItem:
|
|
22
|
-
} =
|
|
20
|
+
activateNextItem: l,
|
|
21
|
+
activatePrevItem: r
|
|
22
|
+
} = x(n), f = b(() => s.value?.element.value?.id);
|
|
23
23
|
function d(a) {
|
|
24
24
|
switch (a.code) {
|
|
25
25
|
case "Space":
|
|
@@ -27,19 +27,19 @@ const _ = ["aria-activedescendant", "aria-orientation", "aria-multiselectable"],
|
|
|
27
27
|
break;
|
|
28
28
|
case "ArrowUp":
|
|
29
29
|
if (e.orientation === "horizontal") return;
|
|
30
|
-
|
|
30
|
+
r({ focus: !1, loop: e.loop }), t.value || o();
|
|
31
31
|
break;
|
|
32
32
|
case "ArrowDown":
|
|
33
33
|
if (e.orientation === "horizontal") return;
|
|
34
|
-
|
|
34
|
+
l({ focus: !1, loop: e.loop }), t.value || o();
|
|
35
35
|
break;
|
|
36
36
|
case "ArrowLeft":
|
|
37
37
|
if (e.orientation === "vertical") return;
|
|
38
|
-
|
|
38
|
+
r({ focus: !1, loop: e.loop }), t.value || o();
|
|
39
39
|
break;
|
|
40
40
|
case "ArrowRight":
|
|
41
41
|
if (e.orientation === "vertical") return;
|
|
42
|
-
|
|
42
|
+
l({ focus: !1, loop: e.loop }), t.value || o();
|
|
43
43
|
break;
|
|
44
44
|
case "Home":
|
|
45
45
|
c({ focus: !1 });
|
|
@@ -52,16 +52,16 @@ const _ = ["aria-activedescendant", "aria-orientation", "aria-multiselectable"],
|
|
|
52
52
|
}
|
|
53
53
|
a.preventDefault();
|
|
54
54
|
}
|
|
55
|
-
return (a,
|
|
55
|
+
return (a, M) => (w(), k("div", {
|
|
56
56
|
onKeydown: d,
|
|
57
57
|
"aria-activedescendant": f.value,
|
|
58
|
-
"aria-orientation":
|
|
58
|
+
"aria-orientation": i.orientation,
|
|
59
59
|
"aria-multiselectable": I(t),
|
|
60
60
|
role: "listbox",
|
|
61
61
|
tabindex: "0"
|
|
62
62
|
}, [
|
|
63
63
|
h(a.$slots, "default")
|
|
64
|
-
], 40,
|
|
64
|
+
], 40, A));
|
|
65
65
|
}
|
|
66
66
|
});
|
|
67
67
|
export {
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as m, useId as p, useTemplateRef as u, createElementBlock as f, openBlock as b, unref as e, renderSlot as v } from "vue";
|
|
2
2
|
import { useListOption as _ } from "./composable-ui17.js";
|
|
3
|
-
const k = ["id", "aria-disabled", "aria-selected", "data-active"],
|
|
3
|
+
const k = ["id", "aria-disabled", "aria-selected", "data-active"], B = /* @__PURE__ */ m({
|
|
4
4
|
__name: "listboxOption",
|
|
5
5
|
props: {
|
|
6
6
|
id: {},
|
|
7
7
|
value: {},
|
|
8
8
|
disabled: { type: Boolean }
|
|
9
9
|
},
|
|
10
|
-
setup(
|
|
11
|
-
const t =
|
|
12
|
-
|
|
10
|
+
setup(i) {
|
|
11
|
+
const t = i, n = t.id ?? p(), s = u("itemEl"), { isSelected: o, isActive: a, select: d } = _(
|
|
12
|
+
s,
|
|
13
13
|
t.value,
|
|
14
14
|
t.disabled
|
|
15
15
|
);
|
|
16
|
-
return (
|
|
16
|
+
return (r, l) => (b(), f("div", {
|
|
17
17
|
ref_key: "itemEl",
|
|
18
|
-
ref:
|
|
19
|
-
id: e(
|
|
18
|
+
ref: s,
|
|
19
|
+
id: e(n),
|
|
20
20
|
onClick: l[0] || (l[0] = //@ts-ignore
|
|
21
|
-
(...c) => e(
|
|
22
|
-
"aria-disabled":
|
|
23
|
-
"aria-selected": e(
|
|
24
|
-
"data-active": e(
|
|
21
|
+
(...c) => e(d) && e(d)(...c)),
|
|
22
|
+
"aria-disabled": i.disabled,
|
|
23
|
+
"aria-selected": e(o),
|
|
24
|
+
"data-active": e(a),
|
|
25
25
|
role: "option",
|
|
26
26
|
tabindex: "-1"
|
|
27
27
|
}, [
|
|
28
|
-
v(
|
|
29
|
-
isSelected: e(
|
|
30
|
-
isActive: e(
|
|
28
|
+
v(r.$slots, "default", {
|
|
29
|
+
isSelected: e(o),
|
|
30
|
+
isActive: e(a)
|
|
31
31
|
})
|
|
32
32
|
], 8, k));
|
|
33
33
|
}
|
|
34
34
|
});
|
|
35
35
|
export {
|
|
36
|
-
|
|
36
|
+
B as _
|
|
37
37
|
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { defineComponent as w, useId as x, useTemplateRef as y, inject as S, computed as h, createElementBlock as j, openBlock as A, unref as t, renderSlot as B } from "vue";
|
|
2
|
+
import { useListOption as I } from "./composable-ui17.js";
|
|
3
|
+
import { injectMenu as $ } from "./composable-ui24.js";
|
|
4
|
+
const C = ["id", "data-active", "role", "aria-checked", "aria-disabled"], O = /* @__PURE__ */ w({
|
|
5
|
+
__name: "menuItem",
|
|
6
|
+
props: {
|
|
7
|
+
id: {},
|
|
8
|
+
value: {},
|
|
9
|
+
disabled: { type: Boolean }
|
|
10
|
+
},
|
|
11
|
+
emits: ["select"],
|
|
12
|
+
setup(a, { emit: r }) {
|
|
13
|
+
const e = a, u = r, m = e.id ?? x(), s = y("itemEl"), { isSelected: c, isActive: d, select: v, activate: f, deactivate: p } = I(
|
|
14
|
+
s,
|
|
15
|
+
e.value,
|
|
16
|
+
e.disabled
|
|
17
|
+
), i = S($);
|
|
18
|
+
if (!i)
|
|
19
|
+
throw new Error("Menu injectable context is not provided");
|
|
20
|
+
const b = h(() => e.value !== void 0 ? i.isMultiselectable.value ? "menuitemcheckbox" : "menuitemradio" : "menuitem");
|
|
21
|
+
function l() {
|
|
22
|
+
v(), u("select", e.value);
|
|
23
|
+
}
|
|
24
|
+
function k() {
|
|
25
|
+
l(), (e.value === void 0 || !i?.isMultiselectable.value) && i.close();
|
|
26
|
+
}
|
|
27
|
+
function E(o) {
|
|
28
|
+
switch (o.code) {
|
|
29
|
+
case "Space":
|
|
30
|
+
l(), e.value === void 0 && i.close();
|
|
31
|
+
break;
|
|
32
|
+
case "Enter":
|
|
33
|
+
l(), i.close();
|
|
34
|
+
break;
|
|
35
|
+
default:
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
o.preventDefault();
|
|
39
|
+
}
|
|
40
|
+
return (o, n) => (A(), j("div", {
|
|
41
|
+
ref_key: "itemEl",
|
|
42
|
+
ref: s,
|
|
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(d),
|
|
49
|
+
role: b.value,
|
|
50
|
+
"aria-checked": a.value !== void 0 ? t(c) : void 0,
|
|
51
|
+
"aria-disabled": a.disabled || void 0,
|
|
52
|
+
tabindex: "-1"
|
|
53
|
+
}, [
|
|
54
|
+
B(o.$slots, "default", {
|
|
55
|
+
isSelected: t(c),
|
|
56
|
+
isActive: t(d)
|
|
57
|
+
})
|
|
58
|
+
], 40, C));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
export {
|
|
62
|
+
O as _
|
|
63
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { defineComponent as g, useSlots as b, ref as E, useId as k, onMounted as w, onBeforeUnmount as
|
|
1
|
+
import { defineComponent as g, useSlots as b, ref as E, useId as k, onMounted as w, onBeforeUnmount as $, createElementBlock as p, openBlock as a, Fragment as L, renderSlot as f, createBlock as T, Teleport as _, createCommentVNode as h, unref as m, mergeProps as B, createTextVNode as S, toDisplayString as A } from "vue";
|
|
2
2
|
import { usePopover as C } from "./composable-ui21.js";
|
|
3
|
-
const I = ["id"],
|
|
3
|
+
const I = ["id"], P = /* @__PURE__ */ g({
|
|
4
4
|
inheritAttrs: !1,
|
|
5
5
|
__name: "tooltip",
|
|
6
6
|
props: {
|
|
@@ -9,15 +9,15 @@ const I = ["id"], V = /* @__PURE__ */ g({
|
|
|
9
9
|
delay: {},
|
|
10
10
|
direction: { default: "up" }
|
|
11
11
|
},
|
|
12
|
-
setup(
|
|
13
|
-
const o =
|
|
14
|
-
let
|
|
15
|
-
const n = o.id ?? k(), { isOpen: i } = C(`[aria-describedby=${n}]`,
|
|
12
|
+
setup(l) {
|
|
13
|
+
const o = l, v = b(), d = E();
|
|
14
|
+
let u;
|
|
15
|
+
const n = o.id ?? k(), { isOpen: i } = C(`[aria-describedby=${n}]`, d, {
|
|
16
16
|
direction: o.direction,
|
|
17
17
|
align: "center"
|
|
18
18
|
});
|
|
19
19
|
function s() {
|
|
20
|
-
|
|
20
|
+
u = setTimeout(
|
|
21
21
|
() => {
|
|
22
22
|
i.value = !0;
|
|
23
23
|
},
|
|
@@ -25,9 +25,9 @@ const I = ["id"], V = /* @__PURE__ */ g({
|
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
function r() {
|
|
28
|
-
i.value = !1, clearTimeout(
|
|
28
|
+
i.value = !1, clearTimeout(u);
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function c(e) {
|
|
31
31
|
e.key === "Escape" && r();
|
|
32
32
|
}
|
|
33
33
|
const y = {
|
|
@@ -36,7 +36,7 @@ const I = ["id"], V = /* @__PURE__ */ g({
|
|
|
36
36
|
onmouseleave: r,
|
|
37
37
|
onfocus: s,
|
|
38
38
|
onblur: r,
|
|
39
|
-
onkeydown:
|
|
39
|
+
onkeydown: c
|
|
40
40
|
}, t = new AbortController();
|
|
41
41
|
return w(() => {
|
|
42
42
|
if (v.default) return;
|
|
@@ -57,23 +57,23 @@ const I = ["id"], V = /* @__PURE__ */ g({
|
|
|
57
57
|
}), e.addEventListener("blur", r, {
|
|
58
58
|
signal: t.signal,
|
|
59
59
|
passive: !0
|
|
60
|
-
}), e.addEventListener("keydown",
|
|
60
|
+
}), e.addEventListener("keydown", c, {
|
|
61
61
|
signal: t.signal,
|
|
62
62
|
passive: !0
|
|
63
63
|
});
|
|
64
|
-
}),
|
|
64
|
+
}), $(() => {
|
|
65
65
|
t.abort();
|
|
66
|
-
}), (e,
|
|
67
|
-
|
|
68
|
-
(a(),
|
|
69
|
-
|
|
66
|
+
}), (e, x) => (a(), p(L, null, [
|
|
67
|
+
f(e.$slots, "default", { attrs: y }),
|
|
68
|
+
(a(), T(_, { to: "body" }, [
|
|
69
|
+
m(i) ? (a(), p("div", B({
|
|
70
70
|
key: 0,
|
|
71
71
|
ref_key: "popupEl",
|
|
72
|
-
ref:
|
|
73
|
-
id:
|
|
72
|
+
ref: d,
|
|
73
|
+
id: m(n)
|
|
74
74
|
}, e.$attrs, { role: "tooltip" }), [
|
|
75
|
-
|
|
76
|
-
S(A(
|
|
75
|
+
f(e.$slots, "content", {}, () => [
|
|
76
|
+
S(A(l.text), 1)
|
|
77
77
|
])
|
|
78
78
|
], 16, I)) : h("", !0)
|
|
79
79
|
]))
|
|
@@ -81,5 +81,5 @@ const I = ["id"], V = /* @__PURE__ */ g({
|
|
|
81
81
|
}
|
|
82
82
|
});
|
|
83
83
|
export {
|
|
84
|
-
|
|
84
|
+
P as _
|
|
85
85
|
};
|
|
@@ -28,7 +28,7 @@ declare var __VLS_9: {
|
|
|
28
28
|
type __VLS_Slots = {} & {
|
|
29
29
|
default?: (props: typeof __VLS_9) => any;
|
|
30
30
|
};
|
|
31
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
|
|
31
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
32
32
|
"update:modelValue": (value: any) => any;
|
|
33
33
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
34
34
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
@@ -2,5 +2,5 @@ type __VLS_Props = {
|
|
|
2
2
|
name: string;
|
|
3
3
|
value: any;
|
|
4
4
|
};
|
|
5
|
-
declare const _default: import("vue").DefineComponent<__VLS_Props,
|
|
5
|
+
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
6
6
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type __VLS_PublicProps = {
|
|
2
2
|
modelValue?: string;
|
|
3
3
|
};
|
|
4
|
-
declare const _default: import("vue").DefineComponent<__VLS_PublicProps,
|
|
4
|
+
declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
5
5
|
"update:modelValue": (value: string | undefined) => any;
|
|
6
6
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
7
7
|
"onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
|
|
@@ -10,7 +10,7 @@ declare var __VLS_1: {
|
|
|
10
10
|
type __VLS_Slots = {} & {
|
|
11
11
|
default?: (props: typeof __VLS_1) => any;
|
|
12
12
|
};
|
|
13
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props,
|
|
13
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
14
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
15
15
|
export default _default;
|
|
16
16
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -2,7 +2,7 @@ declare var __VLS_1: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_1) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const __VLS_component: import("vue").DefineComponent<{},
|
|
5
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
6
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
7
7
|
export default _default;
|
|
8
8
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -9,7 +9,7 @@ declare var __VLS_1: {};
|
|
|
9
9
|
type __VLS_Slots = {} & {
|
|
10
10
|
default?: (props: typeof __VLS_1) => any;
|
|
11
11
|
};
|
|
12
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
|
|
12
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
13
|
"update:modelValue": (value: any) => any;
|
|
14
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
15
15
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
@@ -10,7 +10,7 @@ declare var __VLS_1: {
|
|
|
10
10
|
type __VLS_Slots = {} & {
|
|
11
11
|
default?: (props: typeof __VLS_1) => any;
|
|
12
12
|
};
|
|
13
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props,
|
|
13
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
14
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
15
15
|
export default _default;
|
|
16
16
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -24,7 +24,7 @@ declare var __VLS_1: {
|
|
|
24
24
|
type __VLS_Slots = {} & {
|
|
25
25
|
default?: (props: typeof __VLS_1) => any;
|
|
26
26
|
};
|
|
27
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
|
|
27
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
28
28
|
"update:modelValue": (value: any) => any;
|
|
29
29
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
30
30
|
"onUpdate:modelValue"?: ((value: any) => any) | undefined;
|
|
@@ -10,7 +10,7 @@ declare var __VLS_1: {
|
|
|
10
10
|
type __VLS_Slots = {} & {
|
|
11
11
|
default?: (props: typeof __VLS_1) => any;
|
|
12
12
|
};
|
|
13
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props,
|
|
13
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
14
|
select: (value: any) => any;
|
|
15
15
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
16
16
|
onSelect?: ((value: any) => any) | undefined;
|
|
@@ -2,7 +2,7 @@ declare var __VLS_1: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_1) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const __VLS_component: import("vue").DefineComponent<{},
|
|
5
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
6
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
7
7
|
export default _default;
|
|
8
8
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -23,7 +23,7 @@ declare var __VLS_1: {
|
|
|
23
23
|
type __VLS_Slots = {} & {
|
|
24
24
|
default?: (props: typeof __VLS_1) => any;
|
|
25
25
|
};
|
|
26
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props,
|
|
26
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
27
27
|
role: "dialog" | "listbox" | "menu" | "tree" | "grid";
|
|
28
28
|
direction: "up" | "down" | "left" | "right";
|
|
29
29
|
align: "top" | "bottom" | "left" | "right" | "center" | "stretch";
|
|
@@ -2,7 +2,7 @@ declare var __VLS_1: {};
|
|
|
2
2
|
type __VLS_Slots = {} & {
|
|
3
3
|
default?: (props: typeof __VLS_1) => any;
|
|
4
4
|
};
|
|
5
|
-
declare const __VLS_component: import("vue").DefineComponent<{},
|
|
5
|
+
declare const __VLS_component: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
6
6
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
7
7
|
export default _default;
|
|
8
8
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -7,7 +7,7 @@ declare var __VLS_1: {};
|
|
|
7
7
|
type __VLS_Slots = {} & {
|
|
8
8
|
default?: (props: typeof __VLS_1) => any;
|
|
9
9
|
};
|
|
10
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props,
|
|
10
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
11
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
12
12
|
export default _default;
|
|
13
13
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -5,7 +5,7 @@ declare var __VLS_1: {};
|
|
|
5
5
|
type __VLS_Slots = {} & {
|
|
6
6
|
default?: (props: typeof __VLS_1) => any;
|
|
7
7
|
};
|
|
8
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
|
|
8
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
9
9
|
"update:modelValue": (value: string | number | undefined) => any;
|
|
10
10
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
11
11
|
"onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
|
|
@@ -5,7 +5,7 @@ declare var __VLS_1: {};
|
|
|
5
5
|
type __VLS_Slots = {} & {
|
|
6
6
|
default?: (props: typeof __VLS_1) => any;
|
|
7
7
|
};
|
|
8
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props,
|
|
8
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
9
9
|
orientation: "horizontal" | "vertical";
|
|
10
10
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
11
11
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
@@ -5,7 +5,7 @@ declare var __VLS_1: {};
|
|
|
5
5
|
type __VLS_Slots = {} & {
|
|
6
6
|
default?: (props: typeof __VLS_1) => any;
|
|
7
7
|
};
|
|
8
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props,
|
|
8
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
9
9
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
|
10
10
|
export default _default;
|
|
11
11
|
type __VLS_WithSlots<T, S> = T & {
|
|
@@ -22,7 +22,7 @@ type __VLS_Slots = {} & {
|
|
|
22
22
|
} & {
|
|
23
23
|
content?: (props: typeof __VLS_8) => any;
|
|
24
24
|
};
|
|
25
|
-
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props,
|
|
25
|
+
declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
26
26
|
direction: "up" | "down" | "left" | "right";
|
|
27
27
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
28
|
declare const _default: __VLS_WithSlots<typeof __VLS_component, __VLS_Slots>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-composable-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"vue": "^3.5.12"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
+
"@release-it/conventional-changelog": "^10.0.1",
|
|
40
41
|
"@types/node": "^24.1.0",
|
|
41
42
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
42
43
|
"glob": "^11.0.2",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { defineComponent as f, useId as p, useTemplateRef as b, inject as v, createElementBlock as _, openBlock as x, unref as e, renderSlot as E } from "vue";
|
|
2
|
-
import { useListOption as k } from "./composable-ui17.js";
|
|
3
|
-
import { injectCombobox as C } from "./composable-ui24.js";
|
|
4
|
-
const j = ["id", "data-active", "aria-selected", "aria-disabled"], A = /* @__PURE__ */ f({
|
|
5
|
-
__name: "comboboxOption",
|
|
6
|
-
props: {
|
|
7
|
-
id: {},
|
|
8
|
-
value: {},
|
|
9
|
-
disabled: { type: Boolean }
|
|
10
|
-
},
|
|
11
|
-
setup(c) {
|
|
12
|
-
const t = c, r = t.id ?? p(), i = b("itemEl"), { isSelected: s, isActive: n, activate: d, select: m } = k(
|
|
13
|
-
i,
|
|
14
|
-
t.value,
|
|
15
|
-
t.disabled
|
|
16
|
-
), o = v(C);
|
|
17
|
-
if (!o)
|
|
18
|
-
throw new Error("Combobox injectable context is not provided");
|
|
19
|
-
function u() {
|
|
20
|
-
m(), o.isMultiselectable.value ? o.focus() : o.close({ focus: !0 });
|
|
21
|
-
}
|
|
22
|
-
return (a, l) => (x(), _("div", {
|
|
23
|
-
ref_key: "itemEl",
|
|
24
|
-
ref: i,
|
|
25
|
-
id: e(r),
|
|
26
|
-
onClick: u,
|
|
27
|
-
onMouseenter: l[0] || (l[0] = (B) => e(d)({ focus: !1 })),
|
|
28
|
-
"data-active": e(n),
|
|
29
|
-
"aria-selected": e(s),
|
|
30
|
-
"aria-disabled": a.disabled || void 0,
|
|
31
|
-
role: "option"
|
|
32
|
-
}, [
|
|
33
|
-
E(a.$slots, "default", {
|
|
34
|
-
isSelected: e(s),
|
|
35
|
-
isActive: e(n)
|
|
36
|
-
})
|
|
37
|
-
], 40, j));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
export {
|
|
41
|
-
A as _
|
|
42
|
-
};
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
};
|