vue-composable-ui 1.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.
- package/dist/combobox.vue_vue_type_script_setup_true_lang-BhVMcx67.js +140 -0
- package/dist/comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js +29 -0
- package/dist/comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js +33 -0
- package/dist/comboboxOption.vue_vue_type_script_setup_true_lang-OyJxB4Jk.js +42 -0
- package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-Doy6MfEQ.js +20 -0
- package/dist/composable-ui.js +47 -1112
- package/dist/composable-ui10.js +4 -0
- package/dist/composable-ui11.js +4 -0
- package/dist/composable-ui12.js +4 -0
- package/dist/composable-ui13.js +4 -0
- package/dist/composable-ui14.js +4 -0
- package/dist/composable-ui15.js +4 -0
- package/dist/composable-ui16.js +4 -0
- package/dist/composable-ui17.js +31 -0
- package/dist/composable-ui18.js +4 -0
- package/dist/composable-ui19.js +4 -0
- package/dist/composable-ui2.js +55 -0
- package/dist/composable-ui20.js +4 -0
- package/dist/composable-ui21.js +100 -0
- package/dist/composable-ui22.js +144 -0
- package/dist/composable-ui23.js +7 -0
- package/dist/composable-ui24.js +7 -0
- package/dist/composable-ui3.js +4 -0
- package/dist/composable-ui4.js +4 -0
- package/dist/composable-ui5.js +4 -0
- package/dist/composable-ui6.js +4 -0
- package/dist/composable-ui7.js +4 -0
- package/dist/composable-ui8.js +4 -0
- package/dist/composable-ui9.js +4 -0
- package/dist/listbox.vue_vue_type_script_setup_true_lang-Bj1ZXiBX.js +69 -0
- package/dist/listboxOption.vue_vue_type_script_setup_true_lang-B_yRptJm.js +37 -0
- package/dist/menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js +82 -0
- package/dist/menuItem.vue_vue_type_script_setup_true_lang-mXtMa4gO.js +63 -0
- package/dist/menuItems.vue_vue_type_script_setup_true_lang-p9vftREy.js +49 -0
- package/dist/popover.vue_vue_type_script_setup_true_lang-DhKF7_nY.js +50 -0
- package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-CDXUO7wZ.js +33 -0
- package/dist/tab.vue_vue_type_script_setup_true_lang-Y5OFGqMB.js +29 -0
- package/dist/tabContainer.vue_vue_type_script_setup_true_lang-fPpLno2Z.js +40 -0
- package/dist/tabList.vue_vue_type_script_setup_true_lang-CZyqGCuj.js +48 -0
- package/dist/tabPanel.vue_vue_type_script_setup_true_lang-CGhP6SHR.js +31 -0
- package/dist/tooltip.vue_vue_type_script_setup_true_lang-DVKYJyfL.js +85 -0
- package/dist/types/components/combobox/combobox.vue.d.ts +45 -0
- package/dist/types/components/combobox/comboboxHiddenInput.vue.d.ts +3 -5
- package/dist/types/components/combobox/comboboxInput.vue.d.ts +3 -3
- package/dist/types/components/combobox/comboboxOption.vue.d.ts +12 -14
- package/dist/types/components/combobox/comboboxOptions.vue.d.ts +6 -5
- package/dist/types/components/listbox/listbox.vue.d.ts +11 -11
- package/dist/types/components/listbox/listboxOption.vue.d.ts +12 -14
- package/dist/types/components/menu/menu.vue.d.ts +42 -0
- package/dist/types/components/menu/menuItem.vue.d.ts +13 -15
- package/dist/types/components/menu/menuItems.vue.d.ts +6 -5
- package/dist/types/components/popover/popover.vue.d.ts +40 -0
- package/dist/types/components/popover/popoverDialog.vue.d.ts +6 -5
- package/dist/types/components/tabs/tab.vue.d.ts +9 -11
- package/dist/types/components/tabs/tabContainer.vue.d.ts +8 -7
- package/dist/types/components/tabs/tabList.vue.d.ts +9 -9
- package/dist/types/components/tabs/tabPanel.vue.d.ts +9 -9
- package/dist/types/components/tooltip.vue.d.ts +23 -25
- package/dist/types/composables/list.d.ts +5 -1
- package/dist/types/composables/listOption.d.ts +4 -0
- package/dist/types/main.d.ts +21 -23
- package/dist/types/utils/element.d.ts +2 -2
- package/package.json +11 -8
- package/dist/composable-ui.umd.cjs +0 -1
- package/dist/types/utils/id.d.ts +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { defineComponent as _, mergeModels as B, computed as p, useModel as H, useId as T, watch as j, provide as N, createElementBlock as v, openBlock as l, Fragment as b, createCommentVNode as P, renderSlot as U, createBlock as h, unref as k, renderList as K, nextTick as $ } from "vue";
|
|
2
|
+
import { useHTMLElement as q } from "./composable-ui23.js";
|
|
3
|
+
import { usePopover as z } from "./composable-ui21.js";
|
|
4
|
+
import { useList as G } from "./composable-ui22.js";
|
|
5
|
+
import { _ as x } from "./comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js";
|
|
6
|
+
import { injectCombobox as J } from "./composable-ui24.js";
|
|
7
|
+
const ae = /* @__PURE__ */ _({
|
|
8
|
+
inheritAttrs: !1,
|
|
9
|
+
__name: "combobox",
|
|
10
|
+
props: /* @__PURE__ */ B({
|
|
11
|
+
displayValue: { type: Function, default: (a) => Array.isArray(a) ? a.map((o) => o.toString()).join(", ") : a.toString() },
|
|
12
|
+
id: {},
|
|
13
|
+
activatorId: {},
|
|
14
|
+
name: {},
|
|
15
|
+
formValue: { type: Function, default: (a) => a }
|
|
16
|
+
}, {
|
|
17
|
+
modelValue: {},
|
|
18
|
+
modelModifiers: {}
|
|
19
|
+
}),
|
|
20
|
+
emits: ["update:modelValue"],
|
|
21
|
+
setup(a) {
|
|
22
|
+
const o = a, I = p(() => u.value ? c.value.map((e) => o.formValue(e)) : o.formValue(c.value)), c = H(a, "modelValue"), i = o.id ?? T(), y = o.activatorId ?? i, n = `${i}-popover`, { isOpen: t, toggle: E, open: s, close: r } = z(
|
|
23
|
+
`#${y}`,
|
|
24
|
+
`#${n}`,
|
|
25
|
+
{
|
|
26
|
+
direction: "down",
|
|
27
|
+
align: "stretch",
|
|
28
|
+
position: "fixed",
|
|
29
|
+
closeOnOutsideClick: !0,
|
|
30
|
+
closeOnInsideClick: !1
|
|
31
|
+
}
|
|
32
|
+
), {
|
|
33
|
+
items: w,
|
|
34
|
+
activeItem: f,
|
|
35
|
+
isMultiselectable: u,
|
|
36
|
+
selectActiveItem: m,
|
|
37
|
+
activateSelectedItem: S,
|
|
38
|
+
activateFirstItem: d,
|
|
39
|
+
activateLastItem: V,
|
|
40
|
+
activateNextItem: C,
|
|
41
|
+
activatePrevItem: M
|
|
42
|
+
} = G(c), g = p(() => o.displayValue(c.value));
|
|
43
|
+
j(w, () => {
|
|
44
|
+
!f.value && w.value.length && (S({ focus: !1 }), f.value || d({ focus: !1 }));
|
|
45
|
+
});
|
|
46
|
+
function O() {
|
|
47
|
+
q(`#${y}`).value?.focus();
|
|
48
|
+
}
|
|
49
|
+
function D(e) {
|
|
50
|
+
if (t.value)
|
|
51
|
+
switch (e.code) {
|
|
52
|
+
case "Space":
|
|
53
|
+
m(), u.value || r({ focus: !0 });
|
|
54
|
+
break;
|
|
55
|
+
case "Enter":
|
|
56
|
+
m(), r({ focus: !0 });
|
|
57
|
+
break;
|
|
58
|
+
case "Tab":
|
|
59
|
+
m(), r({ focus: !0 });
|
|
60
|
+
return;
|
|
61
|
+
case "ArrowUp":
|
|
62
|
+
M({ focus: !1, loop: !1 });
|
|
63
|
+
break;
|
|
64
|
+
case "ArrowDown":
|
|
65
|
+
C({ focus: !1, loop: !1 });
|
|
66
|
+
break;
|
|
67
|
+
case "Home":
|
|
68
|
+
d({ focus: !1 });
|
|
69
|
+
break;
|
|
70
|
+
case "End":
|
|
71
|
+
V({ focus: !1 });
|
|
72
|
+
break;
|
|
73
|
+
case "Escape":
|
|
74
|
+
r({ focus: !0 });
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
else
|
|
80
|
+
switch (e.code) {
|
|
81
|
+
case "Space":
|
|
82
|
+
case "Enter":
|
|
83
|
+
s({ focus: !1 });
|
|
84
|
+
break;
|
|
85
|
+
case "End":
|
|
86
|
+
case "ArrowUp":
|
|
87
|
+
s({ focus: !1 }), $(() => V({ focus: !1 }));
|
|
88
|
+
break;
|
|
89
|
+
case "Home":
|
|
90
|
+
case "ArrowDown":
|
|
91
|
+
s({ focus: !1 }), $(() => d({ focus: !1 }));
|
|
92
|
+
break;
|
|
93
|
+
default:
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
e.preventDefault();
|
|
97
|
+
}
|
|
98
|
+
const A = p(() => ({
|
|
99
|
+
onkeydown: D,
|
|
100
|
+
onclick: () => s({ focus: !1 }),
|
|
101
|
+
id: i,
|
|
102
|
+
"aria-controls": t.value ? n : void 0,
|
|
103
|
+
"aria-expanded": t.value,
|
|
104
|
+
"aria-activedescendant": f.value?.element.value?.id,
|
|
105
|
+
"aria-haspopup": "listbox",
|
|
106
|
+
role: "combobox"
|
|
107
|
+
}));
|
|
108
|
+
return N(J, {
|
|
109
|
+
displayValue: g,
|
|
110
|
+
popoverId: n,
|
|
111
|
+
isOpen: t,
|
|
112
|
+
open: s,
|
|
113
|
+
close: r,
|
|
114
|
+
focus: O,
|
|
115
|
+
isMultiselectable: u,
|
|
116
|
+
activatorAttrs: A
|
|
117
|
+
}), (e, Q) => (l(), v(b, null, [
|
|
118
|
+
e.name ? (l(), v(b, { key: 0 }, [
|
|
119
|
+
k(u) ? (l(!0), v(b, { key: 0 }, K(I.value, (F, L) => (l(), h(x, {
|
|
120
|
+
name: `${e.name}[${L}]`,
|
|
121
|
+
value: F
|
|
122
|
+
}, null, 8, ["name", "value"]))), 256)) : (l(), h(x, {
|
|
123
|
+
key: 1,
|
|
124
|
+
name: e.name,
|
|
125
|
+
value: I.value
|
|
126
|
+
}, null, 8, ["name", "value"]))
|
|
127
|
+
], 64)) : P("", !0),
|
|
128
|
+
U(e.$slots, "default", {
|
|
129
|
+
popoverId: n,
|
|
130
|
+
isOpen: k(t),
|
|
131
|
+
toggle: () => k(E)(),
|
|
132
|
+
displayValue: g.value,
|
|
133
|
+
attrs: A.value
|
|
134
|
+
})
|
|
135
|
+
], 64));
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
export {
|
|
139
|
+
ae as _
|
|
140
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { defineComponent as l, computed as p, createElementBlock as r, openBlock as u, Fragment as m, renderList as i } from "vue";
|
|
2
|
+
const d = ["name", "value"], f = /* @__PURE__ */ l({
|
|
3
|
+
__name: "comboboxHiddenInput",
|
|
4
|
+
props: {
|
|
5
|
+
name: {},
|
|
6
|
+
value: {}
|
|
7
|
+
},
|
|
8
|
+
setup(a) {
|
|
9
|
+
const e = a, c = p(() => {
|
|
10
|
+
if (typeof e.value == "object") {
|
|
11
|
+
const n = {};
|
|
12
|
+
for (const [o, t] of Object.entries(e.value))
|
|
13
|
+
n[`${e.name}[${o}]`] = t;
|
|
14
|
+
return n;
|
|
15
|
+
} else
|
|
16
|
+
return {
|
|
17
|
+
[e.name]: e.value
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
return (n, o) => (u(!0), r(m, null, i(c.value, (t, s) => (u(), r("input", {
|
|
21
|
+
name: s,
|
|
22
|
+
value: t,
|
|
23
|
+
type: "hidden"
|
|
24
|
+
}, null, 8, d))), 256));
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
export {
|
|
28
|
+
f as _
|
|
29
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineComponent as i, inject as m, useModel as r, watch as c, computed as p, withDirectives as d, createElementBlock as s, openBlock as f, mergeProps as v, vModelDynamic as b } from "vue";
|
|
2
|
+
import { injectCombobox as x } from "./composable-ui24.js";
|
|
3
|
+
const h = /* @__PURE__ */ i({
|
|
4
|
+
__name: "comboboxInput",
|
|
5
|
+
props: {
|
|
6
|
+
modelValue: {},
|
|
7
|
+
modelModifiers: {}
|
|
8
|
+
},
|
|
9
|
+
emits: ["update:modelValue"],
|
|
10
|
+
setup(l) {
|
|
11
|
+
const e = m(x);
|
|
12
|
+
if (!e)
|
|
13
|
+
throw new Error("Combobox injectable context is not provided");
|
|
14
|
+
const o = r(l, "modelValue");
|
|
15
|
+
function t() {
|
|
16
|
+
o.value = e.displayValue.value;
|
|
17
|
+
}
|
|
18
|
+
c(e.displayValue, t, { immediate: !0 });
|
|
19
|
+
const u = p(() => ({
|
|
20
|
+
oninput: () => e.open({ focus: !0 }),
|
|
21
|
+
onchange: t,
|
|
22
|
+
...e.activatorAttrs.value
|
|
23
|
+
}));
|
|
24
|
+
return (V, n) => d((f(), s("input", v({
|
|
25
|
+
"onUpdate:modelValue": n[0] || (n[0] = (a) => o.value = a)
|
|
26
|
+
}, u.value, { autocomplete: "off" }), null, 16)), [
|
|
27
|
+
[b, o.value]
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export {
|
|
32
|
+
h as _
|
|
33
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineComponent as n, inject as r, createElementBlock as i, createCommentVNode as c, unref as e, openBlock as m, renderSlot as s } from "vue";
|
|
2
|
+
import { injectCombobox as p } from "./composable-ui24.js";
|
|
3
|
+
const d = ["id"], f = /* @__PURE__ */ n({
|
|
4
|
+
__name: "comboboxOptions",
|
|
5
|
+
setup(b) {
|
|
6
|
+
const o = r(p);
|
|
7
|
+
if (!o)
|
|
8
|
+
throw new Error("Combobox injectable context is not provided");
|
|
9
|
+
return (t, l) => e(o).isOpen.value ? (m(), i("div", {
|
|
10
|
+
key: 0,
|
|
11
|
+
id: e(o).popoverId,
|
|
12
|
+
role: "listbox"
|
|
13
|
+
}, [
|
|
14
|
+
s(t.$slots, "default")
|
|
15
|
+
], 8, d)) : c("", !0);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
export {
|
|
19
|
+
f as _
|
|
20
|
+
};
|