vue-composable-ui 1.2.0 → 1.3.0

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 (39) hide show
  1. package/dist/combobox.vue_vue_type_script_setup_true_lang-CFyb8irG.js +144 -0
  2. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-DZuDsRZX.js +21 -0
  3. package/dist/composable-ui.js +27 -27
  4. package/dist/composable-ui11.js +1 -1
  5. package/dist/composable-ui12.js +1 -1
  6. package/dist/composable-ui13.js +1 -1
  7. package/dist/composable-ui15.js +1 -1
  8. package/dist/composable-ui18.js +1 -1
  9. package/dist/composable-ui2.js +1 -1
  10. package/dist/composable-ui20.js +17 -18
  11. package/dist/composable-ui22.js +117 -105
  12. package/dist/composable-ui23.js +65 -89
  13. package/dist/composable-ui24.js +7 -4
  14. package/dist/composable-ui6.js +1 -1
  15. package/dist/composable-ui9.js +1 -1
  16. package/dist/menu.vue_vue_type_script_setup_true_lang-CXMH_Siw.js +82 -0
  17. package/dist/{menuItems.vue_vue_type_script_setup_true_lang-DQV-lU_A.js → menuItems.vue_vue_type_script_setup_true_lang-C7feROa2.js} +10 -9
  18. package/dist/popover.vue_vue_type_script_setup_true_lang-2uGxM2x-.js +64 -0
  19. package/dist/{popoverDialog.vue_vue_type_script_setup_true_lang-BbR_2G3W.js → popoverDialog.vue_vue_type_script_setup_true_lang-C_cJy27S.js} +5 -4
  20. package/dist/tabContainer.vue_vue_type_script_setup_true_lang-B65gXNdp.js +42 -0
  21. package/dist/tooltip.vue_vue_type_script_setup_true_lang-DX78jdaW.js +81 -0
  22. package/dist/types/components/combobox/combobox.vue.d.ts +9 -1
  23. package/dist/types/components/injectionKeys.d.ts +19 -1
  24. package/dist/types/components/menu/menu.vue.d.ts +2 -0
  25. package/dist/types/components/popover/popover.vue.d.ts +4 -2
  26. package/dist/types/components/tooltip.vue.d.ts +2 -0
  27. package/dist/types/composables/formControl.d.ts +3 -4
  28. package/dist/types/composables/list.d.ts +8 -4
  29. package/dist/types/composables/listOption.d.ts +3 -4
  30. package/dist/types/composables/popover.d.ts +4 -5
  31. package/dist/types/main.d.ts +1 -1
  32. package/dist/types/utils/element.d.ts +10 -3
  33. package/package.json +1 -1
  34. package/dist/combobox.vue_vue_type_script_setup_true_lang-sMngTuXu.js +0 -139
  35. package/dist/comboboxOptions.vue_vue_type_script_setup_true_lang-DN0tz5dv.js +0 -20
  36. package/dist/menu.vue_vue_type_script_setup_true_lang-B0Jm9v_v.js +0 -82
  37. package/dist/popover.vue_vue_type_script_setup_true_lang-BEMQwnTq.js +0 -64
  38. package/dist/tabContainer.vue_vue_type_script_setup_true_lang-yqy32Zx5.js +0 -40
  39. package/dist/tooltip.vue_vue_type_script_setup_true_lang-BSjMpNzD.js +0 -78
@@ -1,120 +1,96 @@
1
- import { ref as D, watch as K, nextTick as P, onBeforeMount as U, onMounted as V, onBeforeUnmount as j, toValue as z } from "vue";
2
- import { useHTMLElement as A } from "./composable-ui24.js";
3
- function I(H, L, {
4
- direction: c = "down",
1
+ import { ref as A, computed as B, watch as C, onBeforeMount as K, onMounted as U, onBeforeUnmount as j, nextTick as q } from "vue";
2
+ import { toElement as z } from "./composable-ui24.js";
3
+ function J(F, O, {
4
+ direction: r = "down",
5
5
  align: u = "left",
6
- position: k = "fixed",
7
- closeOnOutsideClick: F = !0,
8
- closeOnInsideClick: M = !1
6
+ position: L = "fixed",
7
+ closeOnOutsideClick: R = !0,
8
+ closeOnInsideClick: _ = !1
9
9
  } = {}) {
10
- const s = D(!1);
11
- function h() {
12
- const e = A(H);
13
- if (!e.value)
14
- throw new Error(
15
- "Activator element is undefined: " + z(H)
16
- );
17
- return e.value;
10
+ const f = A(!1), h = B(() => z(F)), c = B(() => z(O));
11
+ function k({ focus: e = !0 } = {}) {
12
+ f.value = !0, e && q(() => c.value?.focus());
18
13
  }
19
- function g() {
20
- const e = A(L);
21
- if (!e.value)
22
- throw new Error("Popover element is undefined: " + z(L));
23
- return e.value;
14
+ function D() {
15
+ return !!c.value?.contains(document.activeElement);
24
16
  }
25
- function B({ focus: e = !0 } = {}) {
26
- s.value = !0, e && P(() => {
27
- g().focus();
28
- });
17
+ function g({ focus: e } = {}) {
18
+ const t = e ?? D();
19
+ f.value = !1, t && h.value?.focus();
29
20
  }
30
- function O() {
31
- try {
32
- return g().contains(document.activeElement);
33
- } catch {
34
- return !1;
35
- }
21
+ function M(e) {
22
+ f.value ? g(e) : k(e);
36
23
  }
37
- function w({ focus: e } = {}) {
38
- const i = e ?? O();
39
- s.value = !1, i && h().focus();
40
- }
41
- function R(e) {
42
- s.value ? w(e) : B(e);
43
- }
44
- function m() {
45
- if (!s.value) return;
46
- const e = h(), i = g();
47
- i.style.position = k;
24
+ function w() {
25
+ const e = h.value, t = c.value;
26
+ if (!f.value || !e || !t) return;
27
+ t.style.position = L;
48
28
  const {
49
- top: f,
50
- right: l,
51
- bottom: x,
29
+ top: l,
30
+ right: x,
31
+ bottom: b,
52
32
  left: p,
53
- width: b,
54
- height: y
55
- } = e.getBoundingClientRect(), d = i.offsetHeight, v = i.offsetWidth, $ = document.documentElement.clientHeight, E = document.documentElement.clientWidth;
56
- let n = c;
57
- c == "up" ? f - d < 0 && (n = "down") : c == "down" ? x + d > $ && (n = "up") : c == "right" ? l + v > E && (n = "left") : c == "left" && p - v < 0 && (n = "right");
58
- let o = u;
59
- u == "left" ? p + v > E && (o = "right") : u == "right" ? l - v < 0 && (o = "left") : u == "top" ? f + d > $ && (o = "bottom") : u == "bottom" && x - d < 0 && (o = "top");
60
- const t = {
33
+ width: $,
34
+ height: H
35
+ } = e.getBoundingClientRect(), d = t.offsetHeight, v = t.offsetWidth, E = document.documentElement.clientHeight, W = document.documentElement.clientWidth;
36
+ let n = r;
37
+ r == "up" ? l - d < 0 && (n = "down") : r == "down" ? b + d > E && (n = "up") : r == "right" ? x + v > W && (n = "left") : r == "left" && p - v < 0 && (n = "right");
38
+ let i = u;
39
+ u == "left" ? p + v > W && (i = "right") : u == "right" ? x - v < 0 && (i = "left") : u == "top" ? l + d > E && (i = "bottom") : u == "bottom" && b - d < 0 && (i = "top");
40
+ const o = {
61
41
  top: "auto",
62
42
  bottom: "auto",
63
43
  left: "auto",
64
44
  right: "auto",
65
45
  width: "auto"
66
- }, r = k === "fixed";
67
- n == "up" ? t.bottom = `${y + (r ? $ - x : 0)}px` : n == "down" ? t.top = `${y + (r ? f : 0)}px` : n == "right" ? t.left = `${b + (r ? p : 0)}px` : n == "left" && (t.right = `${b + (r ? E - l : 0)}px`), ["up", "down"].includes(n) ? o == "right" ? t.right = `${r ? E - l : 0}px` : o == "left" || o == "stretch" ? t.left = `${r ? p : 0}px` : o == "center" && (t.left = `${(r ? p : 0) - (v - b) / 2}px`) : o == "bottom" ? t.bottom = `${r ? $ - x : 0}px` : o == "top" ? t.top = `${r ? f : 0}px` : o == "center" && (t.top = `${(r ? f : 0) - (d - y) / 2}px`), ["up", "down"].includes(n) && o === "stretch" && (t.width = b + "px");
68
- for (const C in t)
69
- i.style[C] = t[C];
46
+ }, s = L === "fixed";
47
+ n == "up" ? o.bottom = `${H + (s ? E - b : 0)}px` : n == "down" ? o.top = `${H + (s ? l : 0)}px` : n == "right" ? o.left = `${$ + (s ? p : 0)}px` : n == "left" && (o.right = `${$ + (s ? W - x : 0)}px`), ["up", "down"].includes(n) ? i == "right" ? o.right = `${s ? W - x : 0}px` : i == "left" || i == "stretch" ? o.left = `${s ? p : 0}px` : i == "center" && (o.left = `${(s ? p : 0) - (v - $) / 2}px`) : i == "bottom" ? o.bottom = `${s ? E - b : 0}px` : i == "top" ? o.top = `${s ? l : 0}px` : i == "center" && (o.top = `${(s ? l : 0) - (d - H) / 2}px`), ["up", "down"].includes(n) && i === "stretch" && (o.width = $ + "px");
48
+ for (const y in o)
49
+ t.style[y] = o[y];
70
50
  }
71
- K(
72
- s,
73
- (e) => {
74
- e && P(() => {
75
- m();
76
- });
77
- },
78
- { flush: "pre" }
79
- );
80
- function T(e) {
81
- const i = e.target;
82
- if (!h().contains(i))
83
- try {
84
- g().contains(i) ? M && w() : F && (s.value = !1);
85
- } catch {
86
- }
51
+ C([f, c], () => w(), { flush: "post" });
52
+ function P(e) {
53
+ const t = e.target;
54
+ if (h.value?.contains(t)) return;
55
+ const l = c.value;
56
+ l && (l.contains(t) ? _ && g() : R && (f.value = !1));
87
57
  }
88
- function _(e) {
89
- !s.value || e.code !== "Escape" || (w(), e.preventDefault());
58
+ function T(e) {
59
+ !f.value || e.code !== "Escape" || (g(), e.preventDefault());
90
60
  }
91
- let W;
61
+ let m;
92
62
  const a = new AbortController();
93
- return U(() => {
94
- W = new ResizeObserver(m);
95
- }), V(() => {
96
- window.addEventListener("resize", m, {
63
+ return K(() => {
64
+ m = new ResizeObserver(w);
65
+ }), U(() => {
66
+ window.addEventListener("resize", w, {
97
67
  passive: !0,
98
68
  signal: a.signal
99
- }), window.addEventListener("scroll", m, {
69
+ }), window.addEventListener("scroll", w, {
100
70
  passive: !0,
101
71
  //capture: true,
102
72
  signal: a.signal
103
- }), window.addEventListener("click", T, {
73
+ }), window.addEventListener("click", P, {
104
74
  passive: !0,
105
75
  signal: a.signal
106
- }), window.addEventListener("keydown", _, {
76
+ }), window.addEventListener("keydown", T, {
107
77
  signal: a.signal
108
- }), W.observe(h());
78
+ }), C(
79
+ h,
80
+ (e, t) => {
81
+ t && m.unobserve(t), e && m.observe(e);
82
+ },
83
+ { immediate: !0 }
84
+ );
109
85
  }), j(() => {
110
- a.abort(), W.disconnect();
86
+ a.abort(), m.disconnect();
111
87
  }), {
112
- isOpen: s,
113
- open: B,
114
- close: w,
115
- toggle: R
88
+ isOpen: f,
89
+ open: k,
90
+ close: g,
91
+ toggle: M
116
92
  };
117
93
  }
118
94
  export {
119
- I as usePopover
95
+ J as usePopover
120
96
  };
@@ -1,7 +1,10 @@
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;
1
+ function l(t) {
2
+ const n = t.value;
3
+ if (!n) return null;
4
+ if (n instanceof HTMLElement) return n;
5
+ const e = n.$el;
6
+ return e instanceof HTMLElement ? e : null;
4
7
  }
5
8
  export {
6
- n as useHTMLElement
9
+ l as toElement
7
10
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-DN0tz5dv.js";
1
+ import { _ as f } from "./comboboxOptions.vue_vue_type_script_setup_true_lang-DZuDsRZX.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -1,4 +1,4 @@
1
- import { _ as f } from "./menu.vue_vue_type_script_setup_true_lang-B0Jm9v_v.js";
1
+ import { _ as f } from "./menu.vue_vue_type_script_setup_true_lang-CXMH_Siw.js";
2
2
  export {
3
3
  f as default
4
4
  };
@@ -0,0 +1,82 @@
1
+ import { defineComponent as O, useId as p, useModel as h, shallowRef as A, ref as _, computed as f, provide as C, renderSlot as D, unref as V, mergeModels as y, nextTick as i } from "vue";
2
+ import { usePopover as E } from "./composable-ui23.js";
3
+ import { useList as L } from "./composable-ui22.js";
4
+ import { injectMenu as P } from "./composable-ui19.js";
5
+ const N = /* @__PURE__ */ O({
6
+ __name: "menu",
7
+ props: /* @__PURE__ */ y({
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(n) {
19
+ const e = n, r = e.id ?? p(), s = e.activatorId ?? p(), v = h(n, "modelValue"), {
20
+ isMultiselectable: I,
21
+ activeItem: k,
22
+ activateFirstItem: a,
23
+ activateLastItem: c,
24
+ activateNextItem: w,
25
+ activatePrevItem: g
26
+ } = L(v), l = A(
27
+ null
28
+ ), d = _(null), { isOpen: t, toggle: u, open: m, close: x } = E(l, d, {
29
+ direction: e.direction,
30
+ align: e.align,
31
+ position: e.position,
32
+ closeOnOutsideClick: !0,
33
+ closeOnInsideClick: !1
34
+ });
35
+ function b(o) {
36
+ switch (o.code) {
37
+ case "Space":
38
+ case "Enter":
39
+ u(), t.value && i(a);
40
+ break;
41
+ case "ArrowUp":
42
+ m(), i(c);
43
+ break;
44
+ case "ArrowDown":
45
+ m(), i(a);
46
+ break;
47
+ default:
48
+ return;
49
+ }
50
+ o.preventDefault();
51
+ }
52
+ const M = f(() => ({
53
+ ref: l,
54
+ id: s,
55
+ "aria-controls": t.value ? r : void 0,
56
+ "aria-haspopup": "menu",
57
+ "aria-expanded": t.value,
58
+ onclick: () => u(),
59
+ onkeydown: b,
60
+ tabindex: 0
61
+ }));
62
+ return C(P, {
63
+ menuId: r,
64
+ activatorId: s,
65
+ menuRef: d,
66
+ isOpen: t,
67
+ close: x,
68
+ isMultiselectable: I,
69
+ activeItemId: f(() => k.value?.element.value?.id),
70
+ activateFirstItem: a,
71
+ activateLastItem: c,
72
+ activateNextItem: w,
73
+ activatePrevItem: g
74
+ }), (o, R) => D(o.$slots, "default", {
75
+ attrs: M.value,
76
+ isOpen: V(t)
77
+ });
78
+ }
79
+ });
80
+ export {
81
+ N as _
82
+ };
@@ -1,4 +1,4 @@
1
- import { defineComponent as n, inject as o, unref as a, openBlock as c, createElementBlock as s, renderSlot as i, createCommentVNode as u } from "vue";
1
+ import { defineComponent as n, inject as o, unref as t, openBlock as c, createElementBlock as s, renderSlot as i, createCommentVNode as u } from "vue";
2
2
  import { injectMenu as l } from "./composable-ui19.js";
3
3
  const d = ["id", "aria-activedescendant", "aria-labelledby"], b = /* @__PURE__ */ n({
4
4
  __name: "menuItems",
@@ -6,8 +6,8 @@ const d = ["id", "aria-activedescendant", "aria-labelledby"], b = /* @__PURE__ *
6
6
  const e = o(l);
7
7
  if (!e)
8
8
  throw new Error("Menu injectable context is not provided");
9
- function r(t) {
10
- switch (t.code) {
9
+ function r(a) {
10
+ switch (a.code) {
11
11
  case "ArrowUp":
12
12
  e.activatePrevItem({ focus: !0, loop: !1 });
13
13
  break;
@@ -29,18 +29,19 @@ const d = ["id", "aria-activedescendant", "aria-labelledby"], b = /* @__PURE__ *
29
29
  default:
30
30
  return;
31
31
  }
32
- t.preventDefault();
32
+ a.preventDefault();
33
33
  }
34
- return (t, f) => a(e).isOpen.value ? (c(), s("div", {
34
+ return (a, f) => t(e).isOpen.value ? (c(), s("div", {
35
35
  key: 0,
36
36
  onKeydown: r,
37
- id: a(e).menuId,
38
- "aria-activedescendant": a(e).activeItemId.value,
39
- "aria-labelledby": a(e).activatorId,
37
+ ref: t(e).menuRef,
38
+ id: t(e).menuId,
39
+ "aria-activedescendant": t(e).activeItemId.value,
40
+ "aria-labelledby": t(e).activatorId,
40
41
  role: "menu",
41
42
  tabindex: "-1"
42
43
  }, [
43
- i(t.$slots, "default")
44
+ i(a.$slots, "default")
44
45
  ], 40, d)) : u("", !0);
45
46
  }
46
47
  });
@@ -0,0 +1,64 @@
1
+ import { defineComponent as O, useModel as g, useId as u, shallowRef as I, ref as C, watch as f, onMounted as k, computed as M, provide as h, renderSlot as _, unref as n, mergeModels as w } from "vue";
2
+ import { usePopover as x } from "./composable-ui23.js";
3
+ import { injectPopover as y } from "./composable-ui19.js";
4
+ const A = /* @__PURE__ */ O({
5
+ __name: "popover",
6
+ props: /* @__PURE__ */ w({
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
+ open: { type: Boolean },
17
+ openModifiers: {}
18
+ }),
19
+ emits: ["update:open"],
20
+ setup(a) {
21
+ const e = a, i = g(a, "open"), r = e.id ?? u(), d = e.activatorId ?? u(), c = I(
22
+ null
23
+ ), p = C(null), { isOpen: t, toggle: v, open: l, close: s } = x(c, p, {
24
+ direction: e.direction,
25
+ align: e.align,
26
+ position: e.position,
27
+ closeOnOutsideClick: e.closeOnOutsideClick,
28
+ closeOnInsideClick: e.closeOnInsideClick
29
+ });
30
+ f(t, (o) => {
31
+ i.value !== o && (i.value = o);
32
+ }), f(i, (o) => {
33
+ o === void 0 || o === t.value || (o ? l({ focus: !1 }) : s());
34
+ }), k(() => {
35
+ i.value && !t.value && l({ focus: !1 });
36
+ });
37
+ const m = M(() => ({
38
+ ref: c,
39
+ id: d,
40
+ "aria-controls": t.value ? r : void 0,
41
+ // A disclosure is a plain expandable region: aria-haspopup would promise
42
+ // assistive technology a widget that is not there.
43
+ "aria-haspopup": e.role === "none" ? void 0 : e.role,
44
+ "aria-expanded": t.value
45
+ }));
46
+ return h(y, {
47
+ popoverId: r,
48
+ activatorId: d,
49
+ popoverRef: p,
50
+ role: e.role,
51
+ isOpen: t,
52
+ close: s
53
+ }), (o, B) => _(o.$slots, "default", {
54
+ attrs: m.value,
55
+ isOpen: n(t),
56
+ toggle: n(v),
57
+ open: n(l),
58
+ close: n(s)
59
+ });
60
+ }
61
+ });
62
+ export {
63
+ A as _
64
+ };
@@ -1,4 +1,4 @@
1
- import { defineComponent as t, inject as n, unref as o, openBlock as i, createElementBlock as a, renderSlot as l, createCommentVNode as p } from "vue";
1
+ import { defineComponent as t, inject as n, unref as o, openBlock as i, createElementBlock as p, renderSlot as a, createCommentVNode as l } from "vue";
2
2
  import { injectPopover as d } from "./composable-ui19.js";
3
3
  const c = ["id", "role", "aria-labelledby"], f = /* @__PURE__ */ t({
4
4
  __name: "popoverDialog",
@@ -6,15 +6,16 @@ const c = ["id", "role", "aria-labelledby"], f = /* @__PURE__ */ t({
6
6
  const e = n(d);
7
7
  if (!e)
8
8
  throw new Error("Popover injectable context is not provided");
9
- return (r, m) => o(e).isOpen.value ? (i(), a("div", {
9
+ return (r, v) => o(e).isOpen.value ? (i(), p("div", {
10
10
  key: 0,
11
+ ref: o(e).popoverRef,
11
12
  id: o(e).popoverId,
12
13
  role: o(e).role === "none" ? void 0 : o(e).role,
13
14
  "aria-labelledby": o(e).activatorId,
14
15
  tabindex: "-1"
15
16
  }, [
16
- l(r.$slots, "default")
17
- ], 8, c)) : p("", !0);
17
+ a(r.$slots, "default")
18
+ ], 8, c)) : l("", !0);
18
19
  }
19
20
  });
20
21
  export {
@@ -0,0 +1,42 @@
1
+ import { defineComponent as v, useModel as p, provide as I, computed as l, openBlock as f, createElementBlock as _, renderSlot as b } from "vue";
2
+ import { useList as g } from "./composable-ui22.js";
3
+ import { injectTabs as A } from "./composable-ui19.js";
4
+ const B = /* @__PURE__ */ v({
5
+ __name: "tabContainer",
6
+ props: {
7
+ modelValue: {},
8
+ modelModifiers: {}
9
+ },
10
+ emits: ["update:modelValue"],
11
+ setup(o) {
12
+ const a = p(o, "modelValue"), {
13
+ items: m,
14
+ selectedItem: i,
15
+ selectActiveItem: n,
16
+ activateFirstItem: r,
17
+ activateLastItem: s,
18
+ activateNextItem: d,
19
+ activatePrevItem: u
20
+ } = g(a);
21
+ return I(A, {
22
+ getIds: (e) => l(() => {
23
+ const t = m.value.find((c) => c.value === e);
24
+ return {
25
+ tabId: t?.element.value?.getAttribute("id") || void 0,
26
+ panelId: t?.element.value?.getAttribute("aria-controls") || void 0
27
+ };
28
+ }),
29
+ selectedItemEl: l(() => i.value?.element.value ?? null),
30
+ selectActiveItem: n,
31
+ activateFirstItem: r,
32
+ activateLastItem: s,
33
+ activateNextItem: d,
34
+ activatePrevItem: u
35
+ }), (e, t) => (f(), _("div", null, [
36
+ b(e.$slots, "default")
37
+ ]));
38
+ }
39
+ });
40
+ export {
41
+ B as _
42
+ };
@@ -0,0 +1,81 @@
1
+ import { defineComponent as b, useSlots as E, shallowRef as p, useId as h, onMounted as k, onBeforeUnmount as T, openBlock as i, createElementBlock as f, Fragment as _, renderSlot as m, createBlock as $, Teleport as w, unref as v, mergeProps as B, createTextVNode as L, toDisplayString as S, createCommentVNode as A } from "vue";
2
+ import { usePopover as C } from "./composable-ui23.js";
3
+ const I = ["id"], V = /* @__PURE__ */ b({
4
+ inheritAttrs: !1,
5
+ __name: "tooltip",
6
+ props: {
7
+ id: {},
8
+ text: {},
9
+ delay: {},
10
+ direction: { default: "up" }
11
+ },
12
+ setup(u) {
13
+ const t = u, g = E(), c = p(null), l = p(
14
+ null
15
+ );
16
+ let d;
17
+ const n = t.id ?? h(), { isOpen: a } = C(l, c, {
18
+ direction: t.direction,
19
+ align: "center"
20
+ });
21
+ function r() {
22
+ d = setTimeout(
23
+ () => {
24
+ a.value = !0;
25
+ },
26
+ typeof t.delay == "string" ? parseInt(t.delay) : t.delay
27
+ );
28
+ }
29
+ function s() {
30
+ a.value = !1, clearTimeout(d);
31
+ }
32
+ const y = {
33
+ ref: l,
34
+ "aria-describedby": n,
35
+ onmouseenter: r,
36
+ onmouseleave: s,
37
+ onfocus: r,
38
+ onblur: s
39
+ }, o = new AbortController();
40
+ return k(() => {
41
+ if (g.default) return;
42
+ const e = document.querySelector(
43
+ `[aria-describedby=${n}]`
44
+ );
45
+ if (!e)
46
+ throw new Error(`Tooltip activator not found: ${n}`);
47
+ l.value = e, e.addEventListener("mouseenter", r, {
48
+ signal: o.signal,
49
+ passive: !0
50
+ }), e.addEventListener("mouseleave", s, {
51
+ signal: o.signal,
52
+ passive: !0
53
+ }), e.addEventListener("focus", r, {
54
+ signal: o.signal,
55
+ passive: !0
56
+ }), e.addEventListener("blur", s, {
57
+ signal: o.signal,
58
+ passive: !0
59
+ });
60
+ }), T(() => {
61
+ o.abort();
62
+ }), (e, x) => (i(), f(_, null, [
63
+ m(e.$slots, "default", { attrs: y }),
64
+ (i(), $(w, { to: "body" }, [
65
+ v(a) ? (i(), f("div", B({
66
+ key: 0,
67
+ ref_key: "popupEl",
68
+ ref: c,
69
+ id: v(n)
70
+ }, e.$attrs, { role: "tooltip" }), [
71
+ m(e.$slots, "content", {}, () => [
72
+ L(S(u.text), 1)
73
+ ])
74
+ ], 16, I)) : A("", !0)
75
+ ]))
76
+ ], 64));
77
+ }
78
+ });
79
+ export {
80
+ V as _
81
+ };
@@ -1,7 +1,14 @@
1
+ import { type ComponentPublicInstance } from "vue";
1
2
  type __VLS_Props = {
2
3
  displayValue?: (value: any) => string;
3
4
  id?: string;
4
- activatorId?: string;
5
+ /**
6
+ * The element the options panel is anchored to and closes away from.
7
+ * Defaults to whatever carries `activatorAttrs`; pass an element to widen
8
+ * that — a tag field wants the panel to span the whole box of chips, not
9
+ * just the text input sitting in it.
10
+ */
11
+ activator?: HTMLElement | null;
5
12
  name?: string;
6
13
  formValue?: (item: any) => Record<string, string> | string;
7
14
  };
@@ -15,6 +22,7 @@ declare var __VLS_11: {
15
22
  toggle: () => void;
16
23
  displayValue: string;
17
24
  attrs: {
25
+ ref: import("vue").ShallowRef<HTMLElement | ComponentPublicInstance | null, HTMLElement | ComponentPublicInstance | null>;
18
26
  id: string;
19
27
  "aria-controls": string | undefined;
20
28
  "aria-expanded": boolean;
@@ -1,4 +1,4 @@
1
- import type { ComputedRef, InjectionKey } from "vue";
1
+ import type { ComputedRef, InjectionKey, Ref } from "vue";
2
2
  import type { UseListReturn } from "../composables/list";
3
3
  import type { UsePopoverReturn } from "../composables/popover";
4
4
  export declare const injectTabs: InjectionKey<{
@@ -6,6 +6,8 @@ export declare const injectTabs: InjectionKey<{
6
6
  tabId: string | undefined;
7
7
  panelId: string | undefined;
8
8
  }>;
9
+ /** The selected tab's element, for anything that has to measure it. */
10
+ selectedItemEl: ComputedRef<HTMLElement | null>;
9
11
  selectActiveItem: UseListReturn["selectActiveItem"];
10
12
  activateFirstItem: UseListReturn["activateFirstItem"];
11
13
  activateLastItem: UseListReturn["activateLastItem"];
@@ -15,6 +17,11 @@ export declare const injectTabs: InjectionKey<{
15
17
  export declare const injectPopover: InjectionKey<{
16
18
  popoverId: string;
17
19
  activatorId: string;
20
+ /**
21
+ * Bind to the popover element with `:ref`. The popover is positioned off
22
+ * this, so the element that carries it is the one that gets placed.
23
+ */
24
+ popoverRef: Ref<HTMLElement | null>;
18
25
  role: "dialog" | "listbox" | "menu" | "tree" | "grid" | "none";
19
26
  isOpen: UsePopoverReturn["isOpen"];
20
27
  close: UsePopoverReturn["close"];
@@ -22,6 +29,8 @@ export declare const injectPopover: InjectionKey<{
22
29
  export declare const injectMenu: InjectionKey<{
23
30
  menuId: string;
24
31
  activatorId: string;
32
+ /** Bind to the menu element with `:ref`. See {@link injectPopover}. */
33
+ menuRef: Ref<HTMLElement | null>;
25
34
  isOpen: UsePopoverReturn["isOpen"];
26
35
  close: UsePopoverReturn["close"];
27
36
  activeItemId: ComputedRef<string | undefined>;
@@ -34,6 +43,15 @@ export declare const injectMenu: InjectionKey<{
34
43
  export declare const injectCombobox: InjectionKey<{
35
44
  displayValue: ComputedRef<string | undefined>;
36
45
  popoverId: string;
46
+ /** Bind to the options element with `:ref`. See {@link injectPopover}. */
47
+ popoverRef: Ref<HTMLElement | null>;
48
+ /**
49
+ * The active option's element — the one `aria-activedescendant` names, handed
50
+ * over directly so nothing has to find it by that id.
51
+ */
52
+ activeItemEl: ComputedRef<HTMLElement | null>;
53
+ /** The first selected option's element. */
54
+ selectedItemEl: ComputedRef<HTMLElement | null>;
37
55
  isOpen: UsePopoverReturn["isOpen"];
38
56
  open: UsePopoverReturn["open"];
39
57
  close: UsePopoverReturn["close"];
@@ -1,3 +1,4 @@
1
+ import { type ComponentPublicInstance } from "vue";
1
2
  type __VLS_Props = {
2
3
  id?: string;
3
4
  activatorId?: string;
@@ -12,6 +13,7 @@ type __VLS_ModelProps = {
12
13
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
13
14
  declare var __VLS_1: {
14
15
  attrs: {
16
+ ref: import("vue").ShallowRef<HTMLElement | ComponentPublicInstance | null, HTMLElement | ComponentPublicInstance | null>;
15
17
  id: string;
16
18
  "aria-controls": string | undefined;
17
19
  "aria-haspopup": "menu";