@indielayer/ui 1.15.2 → 1.15.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.
@@ -1,6 +1,6 @@
1
- import { defineComponent as M, ref as n, useSlots as W, computed as r, openBlock as p, createElementBlock as w, Fragment as F, createBlock as y, resolveDynamicComponent as O, normalizeClass as f, unref as k, withCtx as C, renderSlot as T, Teleport as X, createVNode as j, Transition as q, normalizeStyle as A, createTextVNode as G, toDisplayString as I, createElementVNode as R, createCommentVNode as S } from "vue";
2
- import { useTheme as J } from "../../composables/useTheme.js";
3
- const K = {
1
+ import { defineComponent as H, ref as r, useSlots as M, computed as c, openBlock as v, createBlock as w, resolveDynamicComponent as W, normalizeClass as u, unref as y, withCtx as k, renderSlot as C, Teleport as O, createVNode as X, Transition as j, createElementBlock as q, normalizeStyle as A, createTextVNode as F, toDisplayString as G, createElementVNode as T, createCommentVNode as R } from "vue";
2
+ import { useTheme as I } from "../../composables/useTheme.js";
3
+ const J = {
4
4
  tag: {
5
5
  type: String,
6
6
  default: "div"
@@ -11,112 +11,110 @@ const K = {
11
11
  type: String,
12
12
  default: "bottom"
13
13
  }
14
- }, L = { name: "XTooltip" }, Y = /* @__PURE__ */ M({
15
- ...L,
16
- props: K,
17
- setup(_) {
18
- const a = _, u = n(null), h = n(null), g = n(!1), b = n({}), c = n(a.position), B = W(), N = r(() => a.tooltip || B.tooltip), d = r(() => a.disabled || !N.value), V = r(() => ({
14
+ }, K = { name: "XTooltip" }, U = /* @__PURE__ */ H({
15
+ ...K,
16
+ props: J,
17
+ setup(S) {
18
+ const n = S, f = r(null), h = r(null), g = r(!1), b = r({}), p = r(n.position), _ = M(), B = c(() => n.tooltip || _.tooltip), a = c(() => n.disabled || !B.value), N = c(() => a.value ? "" : {
19
19
  top: "-bottom-2.5 left-1/2 -translate-x-1/2 w-3.5",
20
20
  bottom: "-top-2.5 left-1/2 -translate-x-1/2 w-3.5",
21
21
  left: "-right-2.5 top-1/2 -translate-y-1/2 h-3.5",
22
22
  right: "-left-2.5 top-1/2 -translate-y-1/2 h-3.5"
23
- })[c.value]), $ = r(() => ({
23
+ }[p.value]), V = c(() => a.value ? "" : {
24
24
  top: "-rotate-45 origin-top-left",
25
25
  bottom: "rotate-45 origin-bottom-left",
26
26
  left: "rotate-45 origin-top-left",
27
27
  right: "-rotate-45 origin-top-right"
28
- })[c.value]), x = r(() => ({
28
+ }[p.value]), $ = c(() => a.value ? "" : {
29
29
  top: "origin-bottom",
30
30
  bottom: "origin-top",
31
31
  left: "origin-right",
32
32
  right: "origin-left"
33
- })[c.value]), z = () => {
34
- if (!u.value || !h.value)
33
+ }[p.value]), x = () => {
34
+ if (!f.value || !h.value)
35
35
  return;
36
- const t = u.value.getBoundingClientRect(), e = h.value.getBoundingClientRect(), l = 8, m = window.innerWidth, v = window.innerHeight;
37
- let s = a.position, o = 0, i = 0;
36
+ const t = f.value.getBoundingClientRect(), e = h.value.getBoundingClientRect(), l = 8, d = window.innerWidth, m = window.innerHeight;
37
+ let s = n.position, o = 0, i = 0;
38
38
  switch (s) {
39
39
  case "top":
40
40
  o = t.top - e.height - l, i = t.left + t.width / 2 - e.width / 2, o < 0 && (s = "bottom", o = t.bottom + l);
41
41
  break;
42
42
  case "bottom":
43
- o = t.bottom + l, i = t.left + t.width / 2 - e.width / 2, o + e.height > v && (s = "top", o = t.top - e.height - l);
43
+ o = t.bottom + l, i = t.left + t.width / 2 - e.width / 2, o + e.height > m && (s = "top", o = t.top - e.height - l);
44
44
  break;
45
45
  case "left":
46
46
  o = t.top + t.height / 2 - e.height / 2, i = t.left - e.width - l, i < 0 && (s = "right", i = t.right + l);
47
47
  break;
48
48
  case "right":
49
- o = t.top + t.height / 2 - e.height / 2, i = t.right + l, i + e.width > m && (s = "left", i = t.left - e.width - l);
49
+ o = t.top + t.height / 2 - e.height / 2, i = t.right + l, i + e.width > d && (s = "left", i = t.left - e.width - l);
50
50
  break;
51
51
  }
52
- (s === "top" || s === "bottom") && (i < 0 && (i = l), i + e.width > m && (i = m - e.width - l)), (s === "left" || s === "right") && (o < 0 && (o = l), o + e.height > v && (o = v - e.height - l)), c.value = s, b.value = {
52
+ (s === "top" || s === "bottom") && (i < 0 && (i = l), i + e.width > d && (i = d - e.width - l)), (s === "left" || s === "right") && (o < 0 && (o = l), o + e.height > m && (o = m - e.height - l)), p.value = s, b.value = {
53
53
  top: `${o}px`,
54
54
  left: `${i}px`
55
55
  };
56
+ }, z = () => {
57
+ a.value || (g.value = !0, setTimeout(x, 0));
56
58
  }, P = () => {
57
- d.value || (g.value = !0, setTimeout(z, 0));
58
- }, D = () => {
59
- d.value || (g.value = !1);
60
- }, { classes: E, className: H } = J("Tooltip", {}, a);
61
- return (t, e) => (p(), w(F, null, [
62
- (p(), y(O(t.tag), {
63
- ref_key: "triggerRef",
64
- ref: u,
65
- class: f([
66
- k(H),
67
- {
68
- "inline-block": !t.$attrs.class
69
- }
70
- ]),
71
- onMouseenter: P,
72
- onMouseleave: D
73
- }, {
74
- default: C(() => [
75
- T(t.$slots, "default")
76
- ]),
77
- _: 3
78
- }, 40, ["class"])),
79
- d.value ? S("", !0) : (p(), y(X, {
80
- key: 0,
81
- to: "body"
82
- }, [
83
- j(q, {
84
- "enter-active-class": "transition-opacity duration-150 ease-out",
85
- "leave-active-class": "transition-opacity duration-150 ease-in",
86
- "enter-from-class": "opacity-0",
87
- "enter-to-class": "opacity-100",
88
- "leave-from-class": "opacity-100",
89
- "leave-to-class": "opacity-0"
90
- }, {
91
- default: C(() => [
92
- g.value ? (p(), w("div", {
93
- key: 0,
94
- ref_key: "tooltipRef",
95
- ref: h,
96
- style: A(b.value),
97
- class: f(["fixed z-[9999] pointer-events-none", [
98
- k(E).tooltip,
99
- x.value
100
- ]])
101
- }, [
102
- T(t.$slots, "tooltip", {}, () => [
103
- G(I(t.tooltip), 1)
104
- ]),
105
- R("div", {
106
- class: f(["absolute overflow-hidden shadow-lg z-10", V.value])
59
+ a.value || (g.value = !1);
60
+ }, { classes: D, className: E } = I("Tooltip", {}, n);
61
+ return (t, e) => (v(), w(W(t.tag), {
62
+ ref_key: "triggerRef",
63
+ ref: f,
64
+ class: u([
65
+ y(E),
66
+ {
67
+ "inline-block": !t.$attrs.class
68
+ }
69
+ ]),
70
+ onMouseenter: z,
71
+ onMouseleave: P
72
+ }, {
73
+ default: k(() => [
74
+ C(t.$slots, "default"),
75
+ a.value ? R("", !0) : (v(), w(O, {
76
+ key: 0,
77
+ to: "body"
78
+ }, [
79
+ X(j, {
80
+ "enter-active-class": "transition-opacity duration-150 ease-out",
81
+ "leave-active-class": "transition-opacity duration-150 ease-in",
82
+ "enter-from-class": "opacity-0",
83
+ "enter-to-class": "opacity-100",
84
+ "leave-from-class": "opacity-100",
85
+ "leave-to-class": "opacity-0"
86
+ }, {
87
+ default: k(() => [
88
+ g.value ? (v(), q("div", {
89
+ key: 0,
90
+ ref_key: "tooltipRef",
91
+ ref: h,
92
+ style: A(b.value),
93
+ class: u(["fixed z-[10001] pointer-events-none", [
94
+ y(D).tooltip,
95
+ $.value
96
+ ]])
107
97
  }, [
108
- R("div", {
109
- class: f(["h-2.5 w-2.5 bg-secondary-700 transform border border-secondary-800", $.value])
110
- }, null, 2)
111
- ], 2)
112
- ], 6)) : S("", !0)
113
- ]),
114
- _: 3
115
- })
116
- ]))
117
- ], 64));
98
+ C(t.$slots, "tooltip", {}, () => [
99
+ F(G(t.tooltip), 1)
100
+ ]),
101
+ T("div", {
102
+ class: u(["absolute overflow-hidden shadow-lg z-10", N.value])
103
+ }, [
104
+ T("div", {
105
+ class: u(["h-2.5 w-2.5 bg-secondary-700 transform border border-secondary-800", V.value])
106
+ }, null, 2)
107
+ ], 2)
108
+ ], 6)) : R("", !0)
109
+ ]),
110
+ _: 3
111
+ })
112
+ ]))
113
+ ]),
114
+ _: 3
115
+ }, 40, ["class"]));
118
116
  }
119
117
  });
120
118
  export {
121
- Y as default
119
+ U as default
122
120
  };
@@ -1,4 +1,4 @@
1
1
  export { default as XTooltip } from './Tooltip.vue';
2
- export type { TooltipProps, TooltipTheme } from './Tooltip.vue';
2
+ export type { TooltipProps, TooltipPosition, TooltipTheme } from './Tooltip.vue';
3
3
  export { default as XToggleTip } from './ToggleTip.vue';
4
4
  export type { ToggleTipProps } from './ToggleTip.vue';