vue-composable-ui 1.0.1 → 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.
Files changed (65) hide show
  1. package/dist/combobox.vue_vue_type_script_setup_true_lang-DpM6lN_3.js +140 -0
  2. package/dist/comboboxHiddenInput.vue_vue_type_script_setup_true_lang-Ba-UPd-M.js +29 -0
  3. package/dist/comboboxInput.vue_vue_type_script_setup_true_lang-DzRfJ5ke.js +33 -0
  4. package/dist/comboboxOption.vue_vue_type_script_setup_true_lang-DPEArk3M.js +42 -0
  5. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-Doy6MfEQ.js +20 -0
  6. package/dist/composable-ui.js +47 -1112
  7. package/dist/composable-ui10.js +4 -0
  8. package/dist/composable-ui11.js +4 -0
  9. package/dist/composable-ui12.js +4 -0
  10. package/dist/composable-ui13.js +4 -0
  11. package/dist/composable-ui14.js +4 -0
  12. package/dist/composable-ui15.js +4 -0
  13. package/dist/composable-ui16.js +4 -0
  14. package/dist/composable-ui17.js +31 -0
  15. package/dist/composable-ui18.js +4 -0
  16. package/dist/composable-ui19.js +4 -0
  17. package/dist/composable-ui2.js +55 -0
  18. package/dist/composable-ui20.js +4 -0
  19. package/dist/composable-ui21.js +100 -0
  20. package/dist/composable-ui22.js +144 -0
  21. package/dist/composable-ui23.js +7 -0
  22. package/dist/composable-ui24.js +7 -0
  23. package/dist/composable-ui3.js +4 -0
  24. package/dist/composable-ui4.js +4 -0
  25. package/dist/composable-ui5.js +4 -0
  26. package/dist/composable-ui6.js +4 -0
  27. package/dist/composable-ui7.js +4 -0
  28. package/dist/composable-ui8.js +4 -0
  29. package/dist/composable-ui9.js +4 -0
  30. package/dist/listbox.vue_vue_type_script_setup_true_lang-CP8lV3wp.js +69 -0
  31. package/dist/listboxOption.vue_vue_type_script_setup_true_lang-C1-Q-dSr.js +37 -0
  32. package/dist/menu.vue_vue_type_script_setup_true_lang-Ci7q2rOg.js +82 -0
  33. package/dist/menuItem.vue_vue_type_script_setup_true_lang-ezPw3j-i.js +63 -0
  34. package/dist/menuItems.vue_vue_type_script_setup_true_lang-p9vftREy.js +49 -0
  35. package/dist/popover.vue_vue_type_script_setup_true_lang-DhKF7_nY.js +50 -0
  36. package/dist/popoverDialog.vue_vue_type_script_setup_true_lang-CDXUO7wZ.js +33 -0
  37. package/dist/tab.vue_vue_type_script_setup_true_lang-Y5OFGqMB.js +29 -0
  38. package/dist/tabContainer.vue_vue_type_script_setup_true_lang-fPpLno2Z.js +40 -0
  39. package/dist/tabList.vue_vue_type_script_setup_true_lang-CZyqGCuj.js +48 -0
  40. package/dist/tabPanel.vue_vue_type_script_setup_true_lang-CGhP6SHR.js +31 -0
  41. package/dist/tooltip.vue_vue_type_script_setup_true_lang-D4uAZmQb.js +85 -0
  42. package/dist/types/components/combobox/combobox.vue.d.ts +45 -0
  43. package/dist/types/components/combobox/comboboxHiddenInput.vue.d.ts +3 -5
  44. package/dist/types/components/combobox/comboboxInput.vue.d.ts +2 -2
  45. package/dist/types/components/combobox/comboboxOption.vue.d.ts +12 -14
  46. package/dist/types/components/combobox/comboboxOptions.vue.d.ts +5 -4
  47. package/dist/types/components/listbox/listbox.vue.d.ts +10 -10
  48. package/dist/types/components/listbox/listboxOption.vue.d.ts +12 -14
  49. package/dist/types/components/menu/menu.vue.d.ts +42 -0
  50. package/dist/types/components/menu/menuItem.vue.d.ts +13 -15
  51. package/dist/types/components/menu/menuItems.vue.d.ts +5 -4
  52. package/dist/types/components/popover/popover.vue.d.ts +40 -0
  53. package/dist/types/components/popover/popoverDialog.vue.d.ts +5 -4
  54. package/dist/types/components/tabs/tab.vue.d.ts +9 -11
  55. package/dist/types/components/tabs/tabContainer.vue.d.ts +7 -6
  56. package/dist/types/components/tabs/tabList.vue.d.ts +9 -9
  57. package/dist/types/components/tabs/tabPanel.vue.d.ts +9 -9
  58. package/dist/types/components/tooltip.vue.d.ts +23 -25
  59. package/dist/types/composables/list.d.ts +5 -1
  60. package/dist/types/composables/listOption.d.ts +4 -0
  61. package/dist/types/main.d.ts +21 -23
  62. package/dist/types/utils/element.d.ts +2 -2
  63. package/package.json +12 -8
  64. package/dist/composable-ui.umd.cjs +0 -1
  65. package/dist/types/utils/id.d.ts +0 -1
@@ -0,0 +1,140 @@
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
+ 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 $ } 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__ */ B({
8
+ inheritAttrs: !1,
9
+ __name: "combobox",
10
+ props: /* @__PURE__ */ H({
11
+ displayValue: { type: Function, default: (e) => Array.isArray(e) ? e.map((t) => t.toString()).join(", ") : e.toString() },
12
+ id: {},
13
+ activatorId: {},
14
+ name: {},
15
+ formValue: { type: Function, default: (e) => e }
16
+ }, {
17
+ modelValue: {},
18
+ modelModifiers: {}
19
+ }),
20
+ emits: ["update:modelValue"],
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
+ `#${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(l), g = p(() => t.displayValue(l.value));
43
+ N(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(a) {
50
+ if (o.value)
51
+ switch (a.code) {
52
+ case "Space":
53
+ m(), u.value || c({ focus: !0 });
54
+ break;
55
+ case "Enter":
56
+ m(), c({ focus: !0 });
57
+ break;
58
+ case "Tab":
59
+ m(), c({ 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
+ c({ focus: !0 });
75
+ break;
76
+ default:
77
+ return;
78
+ }
79
+ else
80
+ switch (a.code) {
81
+ case "Space":
82
+ case "Enter":
83
+ s({ focus: !1 });
84
+ break;
85
+ case "End":
86
+ case "ArrowUp":
87
+ s({ focus: !1 }), h(() => V({ focus: !1 }));
88
+ break;
89
+ case "Home":
90
+ case "ArrowDown":
91
+ s({ focus: !1 }), h(() => d({ focus: !1 }));
92
+ break;
93
+ default:
94
+ return;
95
+ }
96
+ a.preventDefault();
97
+ }
98
+ const x = p(() => ({
99
+ onkeydown: D,
100
+ onclick: () => s({ focus: !1 }),
101
+ id: i,
102
+ "aria-controls": o.value ? n : void 0,
103
+ "aria-expanded": o.value,
104
+ "aria-activedescendant": f.value?.element.value?.id,
105
+ "aria-haspopup": "listbox",
106
+ role: "combobox"
107
+ }));
108
+ return P(J, {
109
+ displayValue: g,
110
+ popoverId: n,
111
+ isOpen: o,
112
+ open: s,
113
+ close: c,
114
+ focus: O,
115
+ isMultiselectable: 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
+ name: `${e.name}[${L}]`,
121
+ value: F
122
+ }, null, 8, ["name", "value"]))), 256)) : (r(), A($, {
123
+ key: 1,
124
+ name: e.name,
125
+ value: I.value
126
+ }, null, 8, ["name", "value"]))
127
+ ], 64)) : U("", !0),
128
+ K(a.$slots, "default", {
129
+ popoverId: n,
130
+ isOpen: k(o),
131
+ toggle: () => k(E)(),
132
+ displayValue: g.value,
133
+ attrs: x.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 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
+ };
@@ -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
+ };