@v1nt1248/3nclient-lib 0.4.0 → 0.4.1

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/README.md CHANGED
@@ -56,12 +56,14 @@ You can run the project as `pnpm dev` or `npm run dev`.
56
56
  - notifications
57
57
  - vue-bus
58
58
  - theme
59
+ - tooltips
59
60
 
60
61
  ### Store plugins [`@v1nt1248/3nclient-lib/plugins`]
61
62
  - store-dialogs
62
63
  - store-notifications
63
64
  - store-vue-bus
64
65
  - store-theme
66
+ - store-tooltips
65
67
 
66
68
  ### Constants
67
69
  - emoticons
@@ -4468,6 +4468,6 @@ function Q(e) {
4468
4468
  }
4469
4469
  //#endregion
4470
4470
  //#region src/constants/plugins-keys.ts
4471
- var Ot = Symbol.for("ui3n-dialogs-plugin"), kt = Symbol.for("ui3n-notifications-plugin"), At = Symbol.for("ui3n-vuebus-plugin"), jt = Symbol.for("ui3n-theme-plugin");
4471
+ var Ot = Symbol.for("ui3n-dialogs-plugin"), kt = Symbol.for("ui3n-notifications-plugin"), At = Symbol.for("ui3n-vuebus-plugin"), jt = Symbol.for("ui3n-theme-plugin"), Mt = Symbol.for("ui3n-tooltips-plugin");
4472
4472
  //#endregion
4473
- export { L as $, Pe as A, Te as B, Be as C, Ie as D, Le as E, G as F, ge as G, ye as H, Oe as I, fe as J, H as K, K as L, je as M, Ae as N, Ne as O, ke as P, de as Q, De as R, He as S, Re as T, ve as U, U as V, _e as W, B as X, pe as Y, z as Z, Ze as _, m as _t, St as a, re as at, We as b, ut as c, M as ct, st as d, O as dt, I as et, ot as f, x as ft, et as g, f as gt, rt as h, g as ht, At as i, ie as it, Me as j, Fe as k, lt as l, A as lt, it as m, _ as mt, kt as n, oe as nt, dt as o, te as ot, at as p, b as pt, me as q, jt as r, ae as rt, X as s, N as st, Ot as t, F as tt, ct as u, k as ut, Je as v, ze as w, Ue as x, Ge as y, W as z };
4473
+ export { de as $, Fe as A, W as B, He as C, Le as D, Re as E, ke as F, _e as G, U as H, G as I, me as J, ge as K, Oe as L, Me as M, je as N, Ie as O, Ae as P, z as Q, K as R, Ue as S, ze as T, ye as U, Te as V, ve as W, pe as X, fe as Y, B as Z, et as _, f as _t, At as a, ie as at, Ge as b, X as c, N as ct, ct as d, k as dt, L as et, st as f, O as ft, rt as g, g as gt, it as h, _ as ht, Mt as i, ae as it, Pe as j, Ne as k, ut as l, M as lt, at as m, b as mt, kt as n, F as nt, St as o, re as ot, ot as p, x as pt, H as q, jt as r, oe as rt, dt as s, te as st, Ot as t, I as tt, lt as u, A as ut, Ze as v, m as vt, Be as w, We as x, Je as y, De as z };
@@ -0,0 +1,409 @@
1
+ import { D as e, x as t } from "./plugins-keys-CjKqZeyH.js";
2
+ import { Fragment as n, Teleport as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, mergeProps as d, normalizeClass as f, normalizeStyle as p, onBeforeUnmount as m, onMounted as h, openBlock as g, ref as _, renderSlot as v, toDisplayString as y, unref as b, useCssModule as x, useSlots as S, watch as C, withDirectives as w, withKeys as T } from "vue";
3
+ import { arrow as E, autoUpdate as D, offset as O, useFloating as k } from "@floating-ui/vue";
4
+ //#region src/directives/ui3n-ripple.ts
5
+ var A = /* @__PURE__ */ new WeakMap();
6
+ function j(e, t, n) {
7
+ let r = document.createElement("div"), i = Math.max(e.clientWidth, e.clientHeight), a = i / 2;
8
+ r.style.width = r.style.height = `${i}px`, r.style.left = `${Math.round(e.clientWidth / 2 - a)}px`, r.style.top = `${Math.round(e.clientHeight / 2 - a)}px`, r.classList.add("ui3n-ripple"), t && r.style.setProperty("--ui3n-ripple-bg-color", t), n && r.style.setProperty("--ui3n-ripple-duration", `${n}ms`);
9
+ let o = e.getElementsByClassName("ui3n-ripple")[0];
10
+ o && o.remove(), e.appendChild(r);
11
+ }
12
+ function M(e, t) {
13
+ A.get(e)?.controller.abort();
14
+ let { color: n, duration: r, eventsTriggers: i = [], disabled: a = !1 } = t.value || {};
15
+ if (a) {
16
+ A.delete(e);
17
+ return;
18
+ }
19
+ let o = new AbortController(), s = { signal: o.signal };
20
+ (!i.length || i.includes("click")) && e.addEventListener("click", () => j(e, n, r), s), i.length && i.includes("enter") && e.addEventListener("keydown", (t) => {
21
+ t.key === "Enter" && j(e, n, r);
22
+ }, s), A.set(e, { controller: o });
23
+ }
24
+ var N = {
25
+ mounted(e, t) {
26
+ M(e, t);
27
+ },
28
+ updated(e, t) {
29
+ M(e, t);
30
+ },
31
+ beforeUnmount(e) {
32
+ A.get(e)?.controller.abort(), A.delete(e);
33
+ }
34
+ }, P = ["id", "title"], F = /* @__PURE__ */ u({
35
+ __name: "ui3n-icon",
36
+ props: {
37
+ id: {},
38
+ icon: {},
39
+ title: { default: "" },
40
+ size: {},
41
+ width: {},
42
+ height: {},
43
+ color: {},
44
+ horizontalFlip: { type: Boolean },
45
+ verticalFlip: { type: Boolean },
46
+ rotate: { default: 0 }
47
+ },
48
+ emits: ["click"],
49
+ setup(e, { emit: t }) {
50
+ let n = e, r = t, a = i(() => n.size || n.width), o = i(() => n.size || n.height), c = i(() => {
51
+ let e = {};
52
+ a.value !== void 0 && (e["--ui3n-icon-width"] = l(a.value)), o.value !== void 0 && (e["--ui3n-icon-height"] = l(o.value)), n.color && (e["--ui3n-icon-color"] = n.color);
53
+ let t = [];
54
+ return n.horizontalFlip && t.push("rotateY(180deg)"), n.verticalFlip && t.push("rotateX(180deg)"), n.rotate && t.push(`rotate(${n.rotate}deg)`), t.length && (e.transform = t.join(" ")), e;
55
+ });
56
+ function l(e) {
57
+ return isNaN(Number(e)) ? String(e) : `${e}px`;
58
+ }
59
+ return (t, n) => (g(), s("div", d({
60
+ id: e.id,
61
+ "data-ui3n": "icon",
62
+ class: t.$style.ui3nIcon,
63
+ title: e.title,
64
+ style: c.value
65
+ }, { "data-icon": e.icon }, { onClick: n[0] ||= (e) => r("click", e) }), null, 16, P));
66
+ }
67
+ }), I = { ui3nIcon: "_ui3nIcon_pfn1q_1" }, L = (e, t) => {
68
+ let n = e.__vccOpts || e;
69
+ for (let [e, r] of t) n[e] = r;
70
+ return n;
71
+ }, R = /* @__PURE__ */ L(F, [["__cssModules", { $style: I }]]), z = {
72
+ small: 12,
73
+ regular: 16,
74
+ large: 24
75
+ }, B = ["id", "disabled"], V = /* @__PURE__ */ L(/* @__PURE__ */ u({
76
+ __name: "ui3n-button",
77
+ props: {
78
+ id: {},
79
+ type: { default: "primary" },
80
+ size: { default: "regular" },
81
+ square: { type: Boolean },
82
+ block: { type: Boolean },
83
+ textColor: {},
84
+ color: {},
85
+ elevation: { type: Boolean },
86
+ icon: {},
87
+ iconSize: {},
88
+ iconColor: {},
89
+ iconPosition: { default: "right" },
90
+ disabled: {
91
+ type: Boolean,
92
+ default: !1
93
+ }
94
+ },
95
+ emits: [
96
+ "init",
97
+ "click",
98
+ "enter",
99
+ "focus",
100
+ "blur"
101
+ ],
102
+ setup(e, { emit: t }) {
103
+ let n = N, r = e, c = t, l = x(), u = _(null), d = i(() => {
104
+ let e = [
105
+ l.ui3nButton,
106
+ l[r.size],
107
+ l[r.type]
108
+ ];
109
+ return r.block && r.type !== "icon" && e.push(l.block), r.square && e.push(l.square), r.icon && e.push(l[`withIcon-${r.iconPosition}`]), r.elevation && e.push(l.elevation), e;
110
+ }), p = i(() => r.iconSize ? r.iconSize : z[r.size]), m = i(() => r.iconColor ? r.iconColor : "inherit");
111
+ async function y(e, t) {
112
+ ["init", "enter"].includes(e) ? c(e, u.value) : c(e, t);
113
+ }
114
+ return C([() => r.color, () => r.textColor], (e, t) => {
115
+ if (!u.value) return;
116
+ let [n, i] = t, [a, o] = e;
117
+ (r.type === "custom" || r.type === "icon") && a !== n && u.value.style.setProperty("--ui3n-button-bg-color", a ?? "var(--color-bg-button-primary-default)"), (r.type === "custom" || r.type === "icon") && o !== i && u.value.style.setProperty("--ui3n-button-text-color", o ?? "var(--color-text-button-primary-default)");
118
+ }), h(() => {
119
+ u.value && ((r.type === "custom" || r.type === "icon") && r.color && u.value.style.setProperty("--ui3n-button-bg-color", r.color), r.type === "custom" && r.textColor && u.value.style.setProperty("--ui3n-button-text-color", r.textColor), y("init"));
120
+ }), (t, r) => w((g(), s("button", {
121
+ ref_key: "buttonEl",
122
+ ref: u,
123
+ id: e.id,
124
+ "data-ui3n": "button",
125
+ class: f(d.value),
126
+ type: "button",
127
+ disabled: e.disabled,
128
+ onClick: r[0] ||= (e) => y("click", e),
129
+ onFocusin: r[1] ||= (e) => y("focus", e),
130
+ onFocusout: r[2] ||= (e) => y("blur", e),
131
+ onKeydown: r[3] ||= T((e) => y("enter"), ["enter"])
132
+ }, [e.icon ? (g(), a(R, {
133
+ key: 0,
134
+ class: f(t.$style.buttonIcon),
135
+ icon: e.icon,
136
+ size: p.value,
137
+ color: m.value
138
+ }, null, 8, [
139
+ "class",
140
+ "icon",
141
+ "size",
142
+ "color"
143
+ ])) : o("", !0), e.type === "icon" ? o("", !0) : (g(), s("span", {
144
+ key: 1,
145
+ class: f(t.$style.text)
146
+ }, [v(t.$slots, "default")], 2))], 42, B)), [[b(n)]]);
147
+ }
148
+ }), [["__cssModules", { $style: {
149
+ ui3nButton: "_ui3nButton_1y5ej_3",
150
+ "withIcon-left": "_withIcon-left_1y5ej_43",
151
+ "withIcon-right": "_withIcon-right_1y5ej_46",
152
+ square: "_square_1y5ej_49",
153
+ regular: "_regular_1y5ej_57",
154
+ small: "_small_1y5ej_67",
155
+ large: "_large_1y5ej_77",
156
+ block: "_block_1y5ej_87",
157
+ primary: "_primary_1y5ej_91",
158
+ elevation: "_elevation_1y5ej_117",
159
+ text: "_text_1y5ej_122",
160
+ secondary: "_secondary_1y5ej_160",
161
+ tertiary: "_tertiary_1y5ej_232",
162
+ outline: "_outline_1y5ej_302",
163
+ icon: "_icon_1y5ej_340",
164
+ custom: "_custom_1y5ej_360",
165
+ buttonIcon: "_buttonIcon_1y5ej_392"
166
+ } }]]), H = ["id"], U = /* @__PURE__ */ L(/* @__PURE__ */ u({
167
+ __name: "ui3n-notification",
168
+ props: {
169
+ id: {},
170
+ type: { default: "info" },
171
+ content: {},
172
+ position: { default: "center" },
173
+ duration: { default: 0 },
174
+ withIcon: {
175
+ type: Boolean,
176
+ default: !0
177
+ },
178
+ borderRadius: { default: 8 },
179
+ onOpen: {
180
+ type: Function,
181
+ default: () => {}
182
+ },
183
+ onClose: {
184
+ type: Function,
185
+ default: () => {}
186
+ }
187
+ },
188
+ setup(e) {
189
+ let n = e, r = null, u = x(), d = i(() => ({
190
+ success: {
191
+ icon: "round-check-circle",
192
+ iconColor: "var(--success-fill-default)",
193
+ iconRotate: 0
194
+ },
195
+ warning: {
196
+ icon: "round-warning",
197
+ iconColor: "var(--warning-fill-default)",
198
+ iconRotate: 0
199
+ },
200
+ info: {
201
+ icon: "round-info",
202
+ iconColor: "var(--info-fill-default)",
203
+ iconRotate: 180
204
+ },
205
+ error: {
206
+ icon: "round-info",
207
+ iconColor: "var(--error-fill-default)",
208
+ iconRotate: 180
209
+ }
210
+ })[n.type || "info"]), _ = i(() => {
211
+ let e = [
212
+ u.ui3nNotification,
213
+ u[`${n.type}Type`],
214
+ u[`${n.position}Position`]
215
+ ];
216
+ return n.withIcon && e.push(u.withIcon), e;
217
+ }), v = i(() => ({ "--ui3n-notification-border-radius": t(n.borderRadius, "8px") }));
218
+ function S() {
219
+ n.onClose && n.onClose();
220
+ }
221
+ return h(() => {
222
+ n.onOpen && n.onOpen(), n.duration > 0 && (r = setTimeout(() => {
223
+ S();
224
+ }, n.duration));
225
+ }), m(() => {
226
+ r && clearTimeout(r);
227
+ }), (t, n) => (g(), s("div", {
228
+ id: e.id,
229
+ "data-ui3n": "notification",
230
+ class: f(_.value),
231
+ style: p(v.value)
232
+ }, [
233
+ e.withIcon ? (g(), s("div", {
234
+ key: 0,
235
+ class: f(b(u).ui3nNotificationIcon)
236
+ }, [l(R, {
237
+ icon: d.value.icon,
238
+ size: "16",
239
+ rotate: d.value.iconRotate,
240
+ color: d.value.iconColor
241
+ }, null, 8, [
242
+ "icon",
243
+ "rotate",
244
+ "color"
245
+ ])], 2)) : o("", !0),
246
+ c("div", { class: f(b(u).ui3nNotificationContent) }, y(e.content), 3),
247
+ e.duration ? o("", !0) : (g(), a(V, {
248
+ key: 1,
249
+ type: "icon",
250
+ size: "small",
251
+ color: "transparent",
252
+ icon: "round-close",
253
+ "icon-size": "16",
254
+ class: f(b(u).closeBtn),
255
+ onClick: S
256
+ }, null, 8, ["class"]))
257
+ ], 14, H));
258
+ }
259
+ }), [["__cssModules", { $style: {
260
+ ui3nNotification: "_ui3nNotification_152ae_1",
261
+ withIcon: "_withIcon_152ae_24",
262
+ ui3nNotificationIcon: "_ui3nNotificationIcon_152ae_28",
263
+ ui3nNotificationContent: "_ui3nNotificationContent_152ae_41",
264
+ closeBtn: "_closeBtn_152ae_51",
265
+ infoType: "_infoType_152ae_59",
266
+ successType: "_successType_152ae_70",
267
+ warningType: "_warningType_152ae_81",
268
+ errorType: "_errorType_152ae_92",
269
+ leftPosition: "_leftPosition_152ae_103",
270
+ centerPosition: "_centerPosition_152ae_108",
271
+ rightPosition: "_rightPosition_152ae_113"
272
+ } }]]), W = 8, G = /* @__PURE__ */ L(/* @__PURE__ */ u({
273
+ __name: "ui3n-tooltip",
274
+ props: {
275
+ id: {},
276
+ modelValue: { type: Boolean },
277
+ content: {},
278
+ maxContentWidth: {},
279
+ color: {},
280
+ textColor: {},
281
+ placement: { default: "top" },
282
+ triggerElement: {},
283
+ positionStrategy: {},
284
+ offsetX: { default: 0 },
285
+ offsetY: { default: 0 },
286
+ trigger: { default: "hover" },
287
+ disabled: {
288
+ type: Boolean,
289
+ default: !1
290
+ }
291
+ },
292
+ emits: [
293
+ "open",
294
+ "opened",
295
+ "close",
296
+ "closed",
297
+ "update:modelValue"
298
+ ],
299
+ setup(l, { emit: u }) {
300
+ let d = Math.round(W / 2 * Math.SQRT2), x = l, w = u, T = S(), A = _(!1), j = _(null), M = _(null), N = _(null), P = _(!1), F = null, I = i(() => !x.triggerElement || e(T.default)), L = i(() => x.positionStrategy ? x.positionStrategy : x.triggerElement ? "fixed" : "absolute"), R = i(() => !!x.triggerElement || L.value === "fixed"), z = i(() => x.triggerElement || j.value), B = i(() => {
301
+ let e = z.value;
302
+ return e ? e instanceof HTMLElement ? e : "contextElement" in e && e.contextElement instanceof HTMLElement ? e.contextElement : null : null;
303
+ }), V = i(() => {
304
+ let [e] = x.placement.split("-");
305
+ return e;
306
+ }), H = i(() => {
307
+ let e = {
308
+ mainAxis: 0,
309
+ crossAxis: 0
310
+ };
311
+ switch (V.value) {
312
+ case "top":
313
+ e.mainAxis = -1 * Number(x.offsetY) + d, e.crossAxis = Number(x.offsetX);
314
+ break;
315
+ case "bottom":
316
+ e.mainAxis = Number(x.offsetY) + d, e.crossAxis = Number(x.offsetX);
317
+ break;
318
+ case "left":
319
+ e.mainAxis = -1 * Number(x.offsetX) + d, e.crossAxis = Number(x.offsetY);
320
+ break;
321
+ case "right":
322
+ e.mainAxis = Number(x.offsetX) + d, e.crossAxis = Number(x.offsetY);
323
+ break;
324
+ }
325
+ return e;
326
+ }), { floatingStyles: U, isPositioned: G, middlewareData: K, update: q } = k(z, M, {
327
+ open: A,
328
+ placement: () => x.placement,
329
+ strategy: L,
330
+ middleware: i(() => [O(H.value), E({
331
+ element: N,
332
+ padding: 8
333
+ })]),
334
+ whileElementsMounted: (e, t, n) => L.value === "fixed" || x.triggerElement ? D(e, t, n) : (n(), () => void 0)
335
+ }), J = i(() => {
336
+ let e = {
337
+ ...U.value,
338
+ "--ui3n-tooltip-arrow-size": `${W}px`
339
+ };
340
+ return x.color && (e["--ui3n-tooltip-bg-color"] = x.color), x.textColor && (e["--ui3n-tooltip-text-color"] = x.textColor), x.maxContentWidth !== void 0 && (e["--ui3n-tooltip-max-width"] = t(x.maxContentWidth)), e;
341
+ });
342
+ function Y() {
343
+ x.disabled || (A.value = !0, w("open"), w("update:modelValue", !0));
344
+ }
345
+ function X() {
346
+ x.disabled && !A.value || (A.value = !1, w("close"), w("update:modelValue", !1));
347
+ }
348
+ function Z() {
349
+ x.disabled && !A.value || (A.value ? X() : Y());
350
+ }
351
+ function Q() {
352
+ F &&= (F.removeEventListener("mouseenter", Y), F.removeEventListener("mouseleave", X), F.removeEventListener("click", Z), null);
353
+ }
354
+ function $() {
355
+ Q(), !(!B.value || x.disabled) && (F = B.value, x.trigger === "hover" ? (F.addEventListener("mouseenter", Y), F.addEventListener("mouseleave", X)) : x.trigger === "click" && F.addEventListener("click", Z));
356
+ }
357
+ return h(() => {
358
+ P.value = !0, $();
359
+ }), m(() => {
360
+ Q();
361
+ }), C([
362
+ () => x.trigger,
363
+ () => x.disabled,
364
+ B
365
+ ], () => {
366
+ P.value && $();
367
+ }), C(() => x.triggerElement, () => {
368
+ q();
369
+ }), C(() => x.modelValue, (e) => x.trigger === "manual" && (A.value = e), { immediate: !0 }), C(G, (e) => {
370
+ w(e ? "opened" : "closed");
371
+ }), (e, t) => (g(), s(n, null, [I.value ? (g(), s("div", {
372
+ key: 0,
373
+ ref_key: "referenceContainer",
374
+ ref: j,
375
+ "data-ui3n": "tooltip",
376
+ class: f(e.$style.container)
377
+ }, [v(e.$slots, "default")], 2)) : o("", !0), (g(), a(r, {
378
+ to: "body",
379
+ disabled: !P.value || !R.value
380
+ }, [A.value ? (g(), s("div", {
381
+ key: 0,
382
+ ref_key: "floatingEl",
383
+ ref: M,
384
+ "data-ui3n": "tooltip-content",
385
+ class: f([e.$style.floating, R.value && e.$style.floatingTeleported]),
386
+ style: p(J.value)
387
+ }, [v(e.$slots, "content", {}, () => [c("div", {
388
+ ref_key: "floatingArrowEl",
389
+ ref: N,
390
+ class: f([e.$style.arrow, e.$style[`arrow-${V.value}`]]),
391
+ style: p({
392
+ left: b(K).arrow?.x == null ? "" : `${b(K).arrow.x}px`,
393
+ top: b(K).arrow?.y == null ? "" : `${b(K).arrow.y}px`
394
+ })
395
+ }, null, 6), c("div", { class: f(e.$style.content) }, y(l.content), 3)])], 6)) : o("", !0)], 8, ["disabled"]))], 64));
396
+ }
397
+ }), [["__cssModules", { $style: {
398
+ container: "_container_1xxjj_1",
399
+ floating: "_floating_1xxjj_7",
400
+ floatingTeleported: "_floatingTeleported_1xxjj_16",
401
+ arrow: "_arrow_1xxjj_20",
402
+ "arrow-top": "_arrow-top_1xxjj_29",
403
+ "arrow-bottom": "_arrow-bottom_1xxjj_32",
404
+ "arrow-left": "_arrow-left_1xxjj_35",
405
+ "arrow-right": "_arrow-right_1xxjj_38",
406
+ content: "_content_1xxjj_42"
407
+ } }]]);
408
+ //#endregion
409
+ export { L as a, R as i, U as n, N as o, V as r, G as t };
@@ -1,4 +1,5 @@
1
1
  import { VNode } from 'vue';
2
+ import { Ui3nVirtualElement } from '../ui3n-menu/types';
2
3
  /**
3
4
  * Tooltip placement types
4
5
  */
@@ -35,9 +36,14 @@ export interface Ui3nTooltipProps {
35
36
  * Tooltip placement
36
37
  */
37
38
  placement?: Ui3nTooltipPlacement;
39
+ /**
40
+ * External element the tooltip is positioned against.
41
+ * When set, this node is the floating-ui reference and receives hover/click listeners.
42
+ */
43
+ triggerElement?: HTMLElement | Ui3nVirtualElement;
38
44
  /**
39
45
  * Position strategy
40
- * @default 'absolute'
46
+ * @default 'absolute' (or 'fixed' when triggerElement is set)
41
47
  */
42
48
  positionStrategy?: 'absolute' | 'fixed';
43
49
  /**
@@ -91,7 +97,7 @@ export interface Ui3nTooltipSlots {
91
97
  /**
92
98
  * Default slot
93
99
  */
94
- default: () => VNode;
100
+ default?: () => VNode;
95
101
  /**
96
102
  * Content slot
97
103
  */
@@ -0,0 +1,16 @@
1
+ import { TooltipInstance, Ui3nTooltipShowOptions } from '../../plugins/tooltips/types';
2
+ declare function add(item: TooltipInstance): void;
3
+ declare function remove(id: string): void;
4
+ declare function removeByKind(kind: 'show' | 'attach'): void;
5
+ declare function removeByTarget(target: HTMLElement): void;
6
+ declare function update(id: string, patch: Partial<Ui3nTooltipShowOptions>): void;
7
+ declare function clearAll(): void;
8
+ declare const _default: import('vue').DefineComponent<{}, {
9
+ add: typeof add;
10
+ remove: typeof remove;
11
+ removeByKind: typeof removeByKind;
12
+ removeByTarget: typeof removeByTarget;
13
+ update: typeof update;
14
+ clearAll: typeof clearAll;
15
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
16
+ export default _default;
@@ -26,9 +26,8 @@ declare const __VLS_component: import('vue').DefineComponent<Ui3nTooltipProps, {
26
26
  disabled: boolean;
27
27
  offsetX: string | number;
28
28
  offsetY: string | number;
29
- positionStrategy: "absolute" | "fixed";
30
- placement: import('./types').Ui3nTooltipPlacement;
31
29
  trigger: "click" | "hover" | "manual";
30
+ placement: import('./types').Ui3nTooltipPlacement;
32
31
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
33
32
  referenceContainer: HTMLDivElement;
34
33
  floatingEl: HTMLDivElement;
@@ -3,7 +3,9 @@ import { DialogsPlugin } from '../plugins/dialogs/types';
3
3
  import { NotificationsPlugin } from '../plugins/notifications/types';
4
4
  import { VueBusPlugin } from '../plugins/vue-bus/types';
5
5
  import { ThemePlugin } from '../plugins/theme/types';
6
+ import { TooltipsPlugin } from '../plugins/tooltips/types';
6
7
  export declare const DIALOGS_KEY: InjectionKey<DialogsPlugin>;
7
8
  export declare const NOTIFICATIONS_KEY: InjectionKey<NotificationsPlugin>;
8
9
  export declare const VUEBUS_KEY: InjectionKey<VueBusPlugin<any>>;
9
10
  export declare const THEME_KEY: InjectionKey<ThemePlugin>;
11
+ export declare const TOOLTIPS_KEY: InjectionKey<TooltipsPlugin>;
@@ -45,6 +45,7 @@ import { default as Ui3nLongPress } from './directives/ui3n-long-press';
45
45
  import { VueEventBus } from './plugins/vue-bus/types';
46
46
  import { ExtractComponentProps } from './types/components.types';
47
47
  import { DialogOptions } from './plugins/dialogs/types';
48
+ import { TooltipsPlugin } from './plugins/tooltips/types';
48
49
  export * from './constants';
49
50
  export * from './utils';
50
51
  export * from './plugins';
@@ -65,6 +66,7 @@ declare module 'vue' {
65
66
  dialogStack: Ref<DialogOptions<any>[]>;
66
67
  $createNotice: (params: Ui3nNotificationProps) => void;
67
68
  $emitter: VueEventBus<any>;
69
+ $tooltip: TooltipsPlugin;
68
70
  }
69
71
  interface GlobalComponents {
70
72
  Ui3nAutocomplete: typeof Ui3nAutocomplete;
@@ -128,5 +130,6 @@ declare module 'pinia' {
128
130
  };
129
131
  $createNotice: (params: Ui3nNotificationProps) => void;
130
132
  $emitter: VueEventBus<any>;
133
+ $tooltip: TooltipsPlugin;
131
134
  }
132
135
  }
@@ -10,4 +10,7 @@ import { storeDialogs } from './dialogs/store-dialog';
10
10
  import { theme } from './theme/theme';
11
11
  import { storeTheme } from './theme/store-theme';
12
12
  import { ThemePlugin, ThemePluginOptions, ThemeId } from './theme/types';
13
- export { notifications, NotificationsPlugin, vueBus, VueBusPlugin, dialogs, DialogsPlugin, DialogOptions, theme, ThemePlugin, ThemePluginOptions, ThemeId, storeNotifications, storeVueBus, storeDialogs, storeTheme, };
13
+ import { tooltips } from './tooltips/tooltips';
14
+ import { storeTooltips } from './tooltips/store-tooltips';
15
+ import { TooltipsPlugin, TooltipHandle, TooltipTarget, Ui3nTooltipShowOptions, Ui3nTooltipAttachOptions } from './tooltips/types';
16
+ export { notifications, NotificationsPlugin, vueBus, VueBusPlugin, dialogs, DialogsPlugin, DialogOptions, theme, ThemePlugin, ThemePluginOptions, ThemeId, tooltips, TooltipsPlugin, TooltipHandle, TooltipTarget, Ui3nTooltipShowOptions, Ui3nTooltipAttachOptions, storeNotifications, storeVueBus, storeDialogs, storeTheme, storeTooltips, };
@@ -0,0 +1,4 @@
1
+ import { TooltipsPlugin } from './types';
2
+ export declare function storeTooltips(context: any): {
3
+ $tooltip: TooltipsPlugin;
4
+ };
@@ -0,0 +1,8 @@
1
+ import { Plugin } from 'vue';
2
+ import { TooltipsPlugin } from './types';
3
+ export declare const tooltips: Plugin;
4
+ declare module '@vue/runtime-core' {
5
+ interface ComponentCustomProperties {
6
+ $tooltip: TooltipsPlugin;
7
+ }
8
+ }
@@ -0,0 +1,34 @@
1
+ import { Ui3nTooltipProps } from '../../components/ui3n-tooltip/types';
2
+ import { Ui3nVirtualElement } from '../../components/ui3n-menu/types';
3
+ export type TooltipTarget = HTMLElement | Ui3nVirtualElement;
4
+ export type Ui3nTooltipShowOptions = Omit<Ui3nTooltipProps, 'modelValue' | 'trigger' | 'id' | 'triggerElement'>;
5
+ export interface Ui3nTooltipAttachOptions extends Omit<Ui3nTooltipProps, 'modelValue' | 'id' | 'triggerElement'> {
6
+ trigger?: 'hover' | 'click';
7
+ }
8
+ export interface TooltipHandle {
9
+ id: string;
10
+ close: () => void;
11
+ update: (patch: Partial<Ui3nTooltipShowOptions>) => void;
12
+ }
13
+ export interface TooltipsPlugin {
14
+ show: (target: TooltipTarget, options: Ui3nTooltipShowOptions) => TooltipHandle;
15
+ attach: (target: TooltipTarget, options: Ui3nTooltipAttachOptions) => TooltipHandle;
16
+ hide: () => void;
17
+ detach: (targetOrId: HTMLElement | string) => void;
18
+ detachAll: () => void;
19
+ }
20
+ export interface TooltipInstance extends Ui3nTooltipShowOptions {
21
+ id: string;
22
+ kind: 'show' | 'attach';
23
+ target: TooltipTarget;
24
+ trigger: 'hover' | 'click' | 'manual';
25
+ modelValue?: boolean;
26
+ }
27
+ export interface TooltipContainerExpose {
28
+ add: (item: TooltipInstance) => void;
29
+ remove: (id: string) => void;
30
+ removeByKind: (kind: 'show' | 'attach') => void;
31
+ removeByTarget: (target: HTMLElement) => void;
32
+ update: (id: string, patch: Partial<Ui3nTooltipShowOptions>) => void;
33
+ clearAll: () => void;
34
+ }
@@ -2,9 +2,9 @@ import { Component, Ref } from 'vue';
2
2
  import { ExtractComponentProps } from './types';
3
3
  import { Ui3nNotificationProps } from './components/ui3n-notification/types';
4
4
  import { Ui3nDialogEvent } from './components/ui3n-dialog/types';
5
- import { notifications, storeNotifications, NotificationsPlugin, dialogs, storeDialogs, DialogOptions, DialogsPlugin, vueBus, storeVueBus, VueBusPlugin, theme, storeTheme, ThemePlugin, ThemePluginOptions, ThemeId } from './plugins';
5
+ import { notifications, storeNotifications, NotificationsPlugin, dialogs, storeDialogs, DialogOptions, DialogsPlugin, vueBus, storeVueBus, VueBusPlugin, theme, storeTheme, ThemePlugin, ThemePluginOptions, ThemeId, tooltips, storeTooltips, TooltipsPlugin, TooltipHandle, TooltipTarget, Ui3nTooltipShowOptions, Ui3nTooltipAttachOptions } from './plugins';
6
6
  import { CbFunction, VueEventBus } from './plugins/vue-bus/types';
7
- import { NOTIFICATIONS_KEY, DIALOGS_KEY, VUEBUS_KEY, THEME_KEY } from './constants';
7
+ import { NOTIFICATIONS_KEY, DIALOGS_KEY, VUEBUS_KEY, THEME_KEY, TOOLTIPS_KEY } from './constants';
8
8
  declare module 'vue' {
9
9
  interface ComponentCustomProperties {
10
10
  $openDialog: <V>(component: Component, props: ExtractComponentProps<Component>) => Promise<{
@@ -20,6 +20,7 @@ declare module 'vue' {
20
20
  $createNotice: (params: Ui3nNotificationProps) => void;
21
21
  $emitter: VueEventBus<any>;
22
22
  $theme: ThemePlugin;
23
+ $tooltip: TooltipsPlugin;
23
24
  }
24
25
  }
25
26
  declare module 'pinia' {
@@ -27,6 +28,7 @@ declare module 'pinia' {
27
28
  $createNotice: (params: Ui3nNotificationProps) => void;
28
29
  $emitter: VueEventBus<any>;
29
30
  $theme: ThemePlugin;
31
+ $tooltip: TooltipsPlugin;
30
32
  $dialogs: {
31
33
  open: <V>(component: Component, props: ExtractComponentProps<Component>) => Promise<{
32
34
  event: Ui3nDialogEvent;
@@ -41,4 +43,4 @@ declare module 'pinia' {
41
43
  };
42
44
  }
43
45
  }
44
- export { notifications, storeNotifications, NOTIFICATIONS_KEY, NotificationsPlugin, dialogs, storeDialogs, DIALOGS_KEY, DialogsPlugin, DialogOptions, vueBus, storeVueBus, VUEBUS_KEY, CbFunction, VueBusPlugin, VueEventBus, theme, storeTheme, ThemePlugin, ThemePluginOptions, ThemeId, THEME_KEY, };
46
+ export { notifications, storeNotifications, NOTIFICATIONS_KEY, NotificationsPlugin, dialogs, storeDialogs, DIALOGS_KEY, DialogsPlugin, DialogOptions, vueBus, storeVueBus, VUEBUS_KEY, CbFunction, VueBusPlugin, VueEventBus, theme, storeTheme, ThemePlugin, ThemePluginOptions, ThemeId, THEME_KEY, tooltips, storeTooltips, TOOLTIPS_KEY, TooltipsPlugin, TooltipHandle, TooltipTarget, Ui3nTooltipShowOptions, Ui3nTooltipAttachOptions, };