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.
- package/LICENSE +1 -1
- package/README.md +5 -1
- 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 +49 -0
- 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 +6 -0
- package/dist/types/components/combobox/comboboxInput.vue.d.ts +9 -0
- package/dist/types/components/combobox/comboboxOption.vue.d.ts +20 -0
- package/dist/types/components/combobox/comboboxOptions.vue.d.ts +12 -0
- package/dist/types/components/injectionKeys.d.ts +43 -0
- package/dist/types/components/listbox/listbox.vue.d.ts +26 -0
- package/dist/types/components/listbox/listboxOption.vue.d.ts +20 -0
- package/dist/types/components/menu/menu.vue.d.ts +42 -0
- package/dist/types/components/menu/menuItem.vue.d.ts +24 -0
- package/dist/types/components/menu/menuItems.vue.d.ts +12 -0
- package/dist/types/components/popover/popover.vue.d.ts +40 -0
- package/dist/types/components/popover/popoverDialog.vue.d.ts +12 -0
- package/dist/types/components/tabs/tab.vue.d.ts +17 -0
- package/dist/types/components/tabs/tabContainer.vue.d.ts +19 -0
- package/dist/types/components/tabs/tabList.vue.d.ts +17 -0
- package/dist/types/components/tabs/tabPanel.vue.d.ts +15 -0
- package/dist/types/components/tooltip.vue.d.ts +34 -0
- package/dist/types/composables/formControl.d.ts +48 -0
- package/dist/types/composables/list.d.ts +107 -0
- package/dist/types/composables/listOption.d.ts +34 -0
- package/dist/types/composables/popover.d.ts +68 -0
- package/dist/types/main.d.ts +22 -0
- package/dist/types/utils/element.d.ts +3 -0
- package/package.json +28 -12
- package/.github/workflows/deploy.yml +0 -21
- package/.github/workflows/docs.yml +0 -62
- package/.vscode/extensions.json +0 -7
- package/docs/.vitepress/config.mts +0 -40
- package/docs/.vitepress/theme/index.js +0 -4
- package/docs/.vitepress/theme/style.scss +0 -155
- package/docs/components/combobox.md +0 -174
- package/docs/components/demos/combobox.vue +0 -142
- package/docs/components/demos/combobox_autocomplete.vue +0 -75
- package/docs/components/demos/combobox_tags.vue +0 -127
- package/docs/components/demos/input.vue +0 -35
- package/docs/components/demos/listbox.vue +0 -64
- package/docs/components/demos/menu.vue +0 -93
- package/docs/components/demos/popover.vue +0 -16
- package/docs/components/demos/tabs.vue +0 -59
- package/docs/components/demos/tooltip.vue +0 -27
- package/docs/components/listbox.md +0 -9
- package/docs/components/menu.md +0 -121
- package/docs/components/popover.md +0 -82
- package/docs/components/tabs.md +0 -9
- package/docs/components/tooltip.md +0 -78
- package/docs/composables/form-control.md +0 -130
- package/docs/composables/list-option.md +0 -47
- package/docs/composables/list.md +0 -192
- package/docs/composables/popover.md +0 -90
- package/docs/index.md +0 -24
- package/docs/intro.md +0 -0
- package/src/components/combobox/combobox.vue +0 -229
- package/src/components/combobox/comboboxFormInput.vue +0 -33
- package/src/components/combobox/comboboxOption.vue +0 -52
- package/src/components/combobox/comboboxOptions.vue +0 -17
- package/src/components/injectionKeys.ts +0 -50
- package/src/components/listbox/listbox.vue +0 -91
- package/src/components/listbox/listboxOption.vue +0 -37
- package/src/components/menu/menu.vue +0 -100
- package/src/components/menu/menuItem.vue +0 -86
- package/src/components/menu/menuItems.vue +0 -51
- package/src/components/popover/popover.vue +0 -68
- package/src/components/popover/popoverDialog.vue +0 -35
- package/src/components/tabs/tab.vue +0 -35
- package/src/components/tabs/tabContainer.vue +0 -50
- package/src/components/tabs/tabList.vue +0 -52
- package/src/components/tabs/tabPanel.vue +0 -36
- package/src/components/tooltip.vue +0 -115
- package/src/composables/formControl.ts +0 -144
- package/src/composables/list.ts +0 -326
- package/src/composables/listOption.ts +0 -80
- package/src/composables/popover.ts +0 -306
- package/src/main.ts +0 -65
- package/src/utils/element.ts +0 -19
- package/src/utils/id.ts +0 -5
- package/src/vite-env.d.ts +0 -1
- package/tsconfig.json +0 -27
- package/tsconfig.node.json +0 -10
- package/vite.config.ts +0 -28
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
# Vue Composable UI (WIP)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Headless or not, there is just no way to create a one-size-fits-all UI framework. With any framework you always end up one component short, always have to reinvent the wheel at some point and always have to compromise.
|
|
4
|
+
|
|
5
|
+
The idea of Vue Composable UI is to abstract functionality, not components. This way you do not have to adopt any kind of opinionated UI paradigm and do not have to recreate basic UI functionaly for application-specific components that are not present in frameworks.
|
|
6
|
+
|
|
7
|
+
[Docs](https://dzapletin.github.io/vue-composable-ui/)
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { usePopover as e } from "./composable-ui21.js";
|
|
2
|
+
import { useList as p } from "./composable-ui22.js";
|
|
3
|
+
import { useListOption as s } from "./composable-ui17.js";
|
|
4
|
+
import { useFormControl as a } from "./composable-ui2.js";
|
|
5
|
+
import { useHTMLElement as n } from "./composable-ui23.js";
|
|
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-Bj1ZXiBX.js";
|
|
8
|
+
import { _ as M } from "./listboxOption.vue_vue_type_script_setup_true_lang-B_yRptJm.js";
|
|
9
|
+
import { _ as c } from "./tabContainer.vue_vue_type_script_setup_true_lang-fPpLno2Z.js";
|
|
10
|
+
import { _ as v } from "./tabList.vue_vue_type_script_setup_true_lang-CZyqGCuj.js";
|
|
11
|
+
import { _ as I } from "./tab.vue_vue_type_script_setup_true_lang-Y5OFGqMB.js";
|
|
12
|
+
import { _ as D } from "./tabPanel.vue_vue_type_script_setup_true_lang-CGhP6SHR.js";
|
|
13
|
+
import { _ as F } from "./popover.vue_vue_type_script_setup_true_lang-DhKF7_nY.js";
|
|
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-DVKYJyfL.js";
|
|
16
|
+
import { _ as w } from "./menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js";
|
|
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-mXtMa4gO.js";
|
|
19
|
+
import { _ as J } from "./combobox.vue_vue_type_script_setup_true_lang-BhVMcx67.js";
|
|
20
|
+
import { _ as N } from "./comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js";
|
|
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-OyJxB4Jk.js";
|
|
23
|
+
export {
|
|
24
|
+
J as Combobox,
|
|
25
|
+
N as ComboboxInput,
|
|
26
|
+
U as ComboboxOption,
|
|
27
|
+
R as ComboboxOptions,
|
|
28
|
+
L as Listbox,
|
|
29
|
+
M as ListboxOption,
|
|
30
|
+
w as Menu,
|
|
31
|
+
B as MenuItem,
|
|
32
|
+
z as MenuItems,
|
|
33
|
+
F as Popover,
|
|
34
|
+
d as PopoverDialog,
|
|
35
|
+
I as Tab,
|
|
36
|
+
c as TabContainer,
|
|
37
|
+
v as TabList,
|
|
38
|
+
D as TabPanel,
|
|
39
|
+
k as Tooltip,
|
|
40
|
+
i as injectCombobox,
|
|
41
|
+
_ as injectMenu,
|
|
42
|
+
u as injectPopover,
|
|
43
|
+
C as injectTabs,
|
|
44
|
+
a as useFormControl,
|
|
45
|
+
n as useHTMLElement,
|
|
46
|
+
p as useList,
|
|
47
|
+
s as useListOption,
|
|
48
|
+
e as usePopover
|
|
49
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { inject as l, ref as d, computed as n, onMounted as f, onUnmounted as p, unref as I } from "vue";
|
|
2
|
+
import { injectList as j } from "./composable-ui22.js";
|
|
3
|
+
function S(c, o, i) {
|
|
4
|
+
const e = l(j);
|
|
5
|
+
if (!e)
|
|
6
|
+
throw new Error("List injectable context is not provided");
|
|
7
|
+
const t = d(-1), r = n(() => e.isSelected(t.value)), u = n(() => e.isActive(t.value));
|
|
8
|
+
function s() {
|
|
9
|
+
e.selectItem(t.value);
|
|
10
|
+
}
|
|
11
|
+
function a({ focus: m = !0 } = {}) {
|
|
12
|
+
I(i) || e.activateItem(t.value, { focus: m });
|
|
13
|
+
}
|
|
14
|
+
function v() {
|
|
15
|
+
e.deactivateItem();
|
|
16
|
+
}
|
|
17
|
+
return f(() => {
|
|
18
|
+
t.value = e.addItem(c, o, i);
|
|
19
|
+
}), p(() => {
|
|
20
|
+
e.removeItem(t.value);
|
|
21
|
+
}), {
|
|
22
|
+
isSelected: r,
|
|
23
|
+
isActive: u,
|
|
24
|
+
select: s,
|
|
25
|
+
activate: a,
|
|
26
|
+
deactivate: v
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
S as useListOption
|
|
31
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { ref as t, onMounted as V, onBeforeUnmount as M, readonly as m, unref as g } from "vue";
|
|
2
|
+
import { useHTMLElement as b } from "./composable-ui23.js";
|
|
3
|
+
function k(y, h = [], w = !0) {
|
|
4
|
+
const a = t(!1), n = t(!0), l = t(), r = t("");
|
|
5
|
+
let e, u;
|
|
6
|
+
function s() {
|
|
7
|
+
e?.focus();
|
|
8
|
+
}
|
|
9
|
+
function d() {
|
|
10
|
+
n.value = e.validity.valid, l.value = e.validity, r.value = e.validationMessage;
|
|
11
|
+
}
|
|
12
|
+
function f() {
|
|
13
|
+
if (!e) throw new Error("Form element is undefined");
|
|
14
|
+
const o = e.value;
|
|
15
|
+
for (const p of g(h)) {
|
|
16
|
+
const c = p(o);
|
|
17
|
+
if (c !== !0) {
|
|
18
|
+
e.setCustomValidity(c);
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function v() {
|
|
24
|
+
if (!e) throw new Error("Form element is undefined");
|
|
25
|
+
return e.setCustomValidity(""), e.validity.valid && f(), d(), n.value;
|
|
26
|
+
}
|
|
27
|
+
function C(o) {
|
|
28
|
+
d(), g(w) || o.preventDefault();
|
|
29
|
+
}
|
|
30
|
+
function E() {
|
|
31
|
+
v(), a.value = u !== e.value;
|
|
32
|
+
}
|
|
33
|
+
let i = new AbortController();
|
|
34
|
+
return V(() => {
|
|
35
|
+
if (e = b(y).value, !e) throw new Error("Form element is undefined");
|
|
36
|
+
f(), u = e.value, e.addEventListener("change", E, {
|
|
37
|
+
signal: i.signal,
|
|
38
|
+
passive: !0
|
|
39
|
+
}), e.addEventListener("invalid", C, {
|
|
40
|
+
signal: i.signal
|
|
41
|
+
}), e?.autofocus && s();
|
|
42
|
+
}), M(() => {
|
|
43
|
+
i.abort();
|
|
44
|
+
}), {
|
|
45
|
+
focus: s,
|
|
46
|
+
validate: v,
|
|
47
|
+
isValid: n,
|
|
48
|
+
validity: m(l),
|
|
49
|
+
validationMessage: m(r),
|
|
50
|
+
isChanged: a
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
k as useFormControl
|
|
55
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ref as _, watch as M, nextTick as k, onMounted as F, onBeforeUnmount as U } from "vue";
|
|
2
|
+
import { useHTMLElement as y } from "./composable-ui23.js";
|
|
3
|
+
function D(z, A, {
|
|
4
|
+
direction: c = "down",
|
|
5
|
+
align: p = "left",
|
|
6
|
+
position: W = "fixed",
|
|
7
|
+
closeOnOutsideClick: B = !0,
|
|
8
|
+
closeOnInsideClick: O = !1
|
|
9
|
+
} = {}) {
|
|
10
|
+
const s = _(!1);
|
|
11
|
+
function v() {
|
|
12
|
+
const t = y(z);
|
|
13
|
+
if (!t.value) throw new Error("Activator element is undefined");
|
|
14
|
+
return t.value;
|
|
15
|
+
}
|
|
16
|
+
function $() {
|
|
17
|
+
const t = y(A);
|
|
18
|
+
if (!t.value) throw new Error("Popover element is undefined");
|
|
19
|
+
return t.value;
|
|
20
|
+
}
|
|
21
|
+
function L({ focus: t = !0 } = {}) {
|
|
22
|
+
s.value = !0, t && k(() => {
|
|
23
|
+
$().focus();
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function E({ focus: t = !0 } = {}) {
|
|
27
|
+
s.value = !1, t && v().focus();
|
|
28
|
+
}
|
|
29
|
+
function R(t) {
|
|
30
|
+
s.value ? E(t) : L(t);
|
|
31
|
+
}
|
|
32
|
+
function h() {
|
|
33
|
+
if (!s.value) return;
|
|
34
|
+
const t = v(), r = $();
|
|
35
|
+
r.style.position = W;
|
|
36
|
+
const {
|
|
37
|
+
top: f,
|
|
38
|
+
right: l,
|
|
39
|
+
bottom: w,
|
|
40
|
+
left: u,
|
|
41
|
+
width: m,
|
|
42
|
+
height: H
|
|
43
|
+
} = t.getBoundingClientRect(), a = r.offsetHeight, d = r.offsetWidth, x = document.documentElement.clientHeight, b = document.documentElement.clientWidth;
|
|
44
|
+
let i = c;
|
|
45
|
+
c == "up" ? f - a < 0 && (i = "down") : c == "down" ? w + a > x && (i = "up") : c == "right" ? l + d > b && (i = "left") : c == "left" && u - d < 0 && (i = "right");
|
|
46
|
+
let o = p;
|
|
47
|
+
p == "left" ? u + d > b && (o = "right") : p == "right" ? l - d < 0 && (o = "left") : p == "top" ? f + a > x && (o = "bottom") : p == "bottom" && w - a < 0 && (o = "top");
|
|
48
|
+
const e = {
|
|
49
|
+
top: "auto",
|
|
50
|
+
bottom: "auto",
|
|
51
|
+
left: "auto",
|
|
52
|
+
right: "auto",
|
|
53
|
+
width: "auto"
|
|
54
|
+
}, n = W === "fixed";
|
|
55
|
+
i == "up" ? e.bottom = `${H + (n ? x - w : 0)}px` : i == "down" ? e.top = `${H + (n ? f : 0)}px` : i == "right" ? e.left = `${m + (n ? u : 0)}px` : i == "left" && (e.right = `${m + (n ? b - l : 0)}px`), ["up", "down"].includes(i) ? o == "right" ? e.right = `${n ? b - l : 0}px` : o == "left" || o == "stretch" ? e.left = `${n ? u : 0}px` : o == "center" && (e.left = `${(n ? u : 0) - (d - m) / 2}px`) : o == "bottom" ? e.bottom = `${n ? x - w : 0}px` : o == "top" ? e.top = `${n ? f : 0}px` : o == "center" && (e.top = `${(n ? f : 0) - (a - H) / 2}px`), ["up", "down"].includes(i) && o === "stretch" && (e.width = m + "px");
|
|
56
|
+
for (const P in e)
|
|
57
|
+
r.style[P] = e[P];
|
|
58
|
+
}
|
|
59
|
+
M(
|
|
60
|
+
s,
|
|
61
|
+
(t) => {
|
|
62
|
+
t && k(() => {
|
|
63
|
+
h();
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
{ flush: "pre" }
|
|
67
|
+
);
|
|
68
|
+
function T(t) {
|
|
69
|
+
const r = t.target;
|
|
70
|
+
if (!v().contains(r))
|
|
71
|
+
try {
|
|
72
|
+
$().contains(r) ? O && E() : B && (s.value = !1);
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const C = new ResizeObserver(h), g = new AbortController();
|
|
77
|
+
return F(() => {
|
|
78
|
+
window.addEventListener("resize", h, {
|
|
79
|
+
passive: !0,
|
|
80
|
+
signal: g.signal
|
|
81
|
+
}), window.addEventListener("scroll", h, {
|
|
82
|
+
passive: !0,
|
|
83
|
+
//capture: true,
|
|
84
|
+
signal: g.signal
|
|
85
|
+
}), window.addEventListener("click", T, {
|
|
86
|
+
passive: !0,
|
|
87
|
+
signal: g.signal
|
|
88
|
+
}), C.observe(v());
|
|
89
|
+
}), U(() => {
|
|
90
|
+
g.abort(), C.disconnect();
|
|
91
|
+
}), {
|
|
92
|
+
isOpen: s,
|
|
93
|
+
open: L,
|
|
94
|
+
close: E,
|
|
95
|
+
toggle: R
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
export {
|
|
99
|
+
D as usePopover
|
|
100
|
+
};
|