@gearbox-protocol/permissionless-ui 1.22.0-next.81 → 1.22.0-next.82
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 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),I=require("@radix-ui/react-tooltip"),K=require("react");require("@gearbox-protocol/sdk");const m=require("../../utils/cn.cjs");require("sonner");require("luxon");function T(s){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const c in s)if(c!=="default"){const e=Object.getOwnPropertyDescriptor(s,c);Object.defineProperty(a,c,e.get?e:{enumerable:!0,get:()=>s[c]})}}return a.default=s,Object.freeze(a)}const l=T(I),i=T(K),O=7,M=12;function D({children:s,title:a,placement:c="top",trigger:e="hover",triangle:R=!0,delayShow:k=5,maxWidth:C="200px",minWidth:P,type:E="tooltip",open:b,onOpenChange:h,className:_,triggerClassName:y,useTitleAsTrigger:q=!1}){const[S,N]=i.useState(!1),d=i.useRef(null),u=i.useRef(null),p=b!==void 0,r=p?b:S,t=i.useCallback(n=>{p?h?.(n):N(n)},[p,h]),g=i.useCallback(n=>{e!=="click"&&t(n)},[e,t]),A=i.useCallback(n=>{e==="click"&&(n.stopPropagation(),t(!r))},[e,r,t]),L=i.useCallback(n=>{e==="click"&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),n.stopPropagation(),t(!r))},[e,r,t]);i.useEffect(()=>{if(e!=="click"||!r)return;const n=f=>{const w=f.target;d.current&&!d.current.contains(w)&&u.current&&!u.current.contains(w)&&t(!1)},v=f=>{f.key==="Escape"&&t(!1)};return document.addEventListener("pointerdown",n),document.addEventListener("keydown",v),()=>{document.removeEventListener("pointerdown",n),document.removeEventListener("keydown",v)}},[e,r,t]);const x=E==="modal-tooltip",j=R&&!x,H=m.cn("z-50 pointer-events-auto","animate-in fade-in-0 duration-100","data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:duration-75",x?"bg-transparent p-0":"rounded bg-black/85 px-2 py-1 text-[0.85rem] leading-[1.5] font-normal text-center text-white/85 antialiased",_);return o.jsx(l.Provider,{delayDuration:e==="click"?0:k,skipDelayDuration:0,children:o.jsxs(l.Root,{open:r,onOpenChange:g,delayDuration:e==="click"?0:k,children:[o.jsx(l.Trigger,{asChild:!0,children:q?a:e==="click"?o.jsx("button",{ref:u,type:"button",onClick:A,onKeyDown:L,className:m.cn("inline-flex appearance-none border-0 bg-transparent p-0 text-inherit font-inherit cursor-pointer",y),children:a}):o.jsx("span",{ref:u,className:m.cn("inline-flex",y),children:a})}),o.jsx(l.Portal,{children:o.jsxs(l.Content,{ref:d,side:c,sideOffset:j?O-4:8,className:H,style:{maxWidth:C,minWidth:P},children:[s,j&&o.jsx(l.Arrow,{width:M,height:O,className:"fill-black/85"})]})})]})})}D.displayName="SimpleTooltip";exports.SimpleTooltip=D;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as i, jsxs as x } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as s from "@radix-ui/react-tooltip";
|
|
3
3
|
import * as o from "react";
|
|
4
4
|
import "@gearbox-protocol/sdk";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as u } from "../../utils/cn.js";
|
|
6
6
|
import "sonner";
|
|
7
7
|
import "luxon";
|
|
8
|
-
const C = 7,
|
|
9
|
-
function
|
|
8
|
+
const C = 7, S = 12;
|
|
9
|
+
function _({
|
|
10
10
|
children: D,
|
|
11
|
-
title:
|
|
11
|
+
title: c,
|
|
12
12
|
placement: R = "top",
|
|
13
13
|
trigger: n = "hover",
|
|
14
14
|
triangle: T = !0,
|
|
@@ -19,24 +19,25 @@ function S({
|
|
|
19
19
|
open: m,
|
|
20
20
|
onOpenChange: k,
|
|
21
21
|
className: A,
|
|
22
|
-
triggerClassName: h
|
|
22
|
+
triggerClassName: h,
|
|
23
|
+
useTitleAsTrigger: L = !1
|
|
23
24
|
}) {
|
|
24
|
-
const [
|
|
25
|
+
const [N, H] = o.useState(!1), l = o.useRef(null), r = o.useRef(null), p = m !== void 0, a = p ? m : N, t = o.useCallback(
|
|
25
26
|
(e) => {
|
|
26
|
-
|
|
27
|
+
p ? k?.(e) : H(e);
|
|
27
28
|
},
|
|
28
|
-
[
|
|
29
|
-
),
|
|
29
|
+
[p, k]
|
|
30
|
+
), I = o.useCallback(
|
|
30
31
|
(e) => {
|
|
31
32
|
n !== "click" && t(e);
|
|
32
33
|
},
|
|
33
34
|
[n, t]
|
|
34
|
-
),
|
|
35
|
+
), K = o.useCallback(
|
|
35
36
|
(e) => {
|
|
36
37
|
n === "click" && (e.stopPropagation(), t(!a));
|
|
37
38
|
},
|
|
38
39
|
[n, a, t]
|
|
39
|
-
),
|
|
40
|
+
), W = o.useCallback(
|
|
40
41
|
(e) => {
|
|
41
42
|
n === "click" && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), e.stopPropagation(), t(!a));
|
|
42
43
|
},
|
|
@@ -44,17 +45,17 @@ function S({
|
|
|
44
45
|
);
|
|
45
46
|
o.useEffect(() => {
|
|
46
47
|
if (n !== "click" || !a) return;
|
|
47
|
-
const e = (
|
|
48
|
-
const v =
|
|
49
|
-
|
|
50
|
-
}, w = (
|
|
51
|
-
|
|
48
|
+
const e = (d) => {
|
|
49
|
+
const v = d.target;
|
|
50
|
+
l.current && !l.current.contains(v) && r.current && !r.current.contains(v) && t(!1);
|
|
51
|
+
}, w = (d) => {
|
|
52
|
+
d.key === "Escape" && t(!1);
|
|
52
53
|
};
|
|
53
54
|
return document.addEventListener("pointerdown", e), document.addEventListener("keydown", w), () => {
|
|
54
55
|
document.removeEventListener("pointerdown", e), document.removeEventListener("keydown", w);
|
|
55
56
|
};
|
|
56
57
|
}, [n, a, t]);
|
|
57
|
-
const y = P === "modal-tooltip", b = T && !y,
|
|
58
|
+
const y = P === "modal-tooltip", b = T && !y, j = u(
|
|
58
59
|
// Base
|
|
59
60
|
"z-50 pointer-events-auto",
|
|
60
61
|
"animate-in fade-in-0 duration-100",
|
|
@@ -64,52 +65,52 @@ function S({
|
|
|
64
65
|
A
|
|
65
66
|
);
|
|
66
67
|
return /* @__PURE__ */ i(
|
|
67
|
-
|
|
68
|
+
s.Provider,
|
|
68
69
|
{
|
|
69
70
|
delayDuration: n === "click" ? 0 : f,
|
|
70
71
|
skipDelayDuration: 0,
|
|
71
72
|
children: /* @__PURE__ */ x(
|
|
72
|
-
|
|
73
|
+
s.Root,
|
|
73
74
|
{
|
|
74
75
|
open: a,
|
|
75
|
-
onOpenChange:
|
|
76
|
+
onOpenChange: I,
|
|
76
77
|
delayDuration: n === "click" ? 0 : f,
|
|
77
78
|
children: [
|
|
78
|
-
/* @__PURE__ */ i(
|
|
79
|
+
/* @__PURE__ */ i(s.Trigger, { asChild: !0, children: L ? c : n === "click" ? /* @__PURE__ */ i(
|
|
79
80
|
"button",
|
|
80
81
|
{
|
|
81
|
-
ref:
|
|
82
|
+
ref: r,
|
|
82
83
|
type: "button",
|
|
83
|
-
onClick:
|
|
84
|
-
onKeyDown:
|
|
85
|
-
className:
|
|
84
|
+
onClick: K,
|
|
85
|
+
onKeyDown: W,
|
|
86
|
+
className: u(
|
|
86
87
|
"inline-flex appearance-none border-0 bg-transparent p-0 text-inherit font-inherit cursor-pointer",
|
|
87
88
|
h
|
|
88
89
|
),
|
|
89
|
-
children:
|
|
90
|
+
children: c
|
|
90
91
|
}
|
|
91
92
|
) : /* @__PURE__ */ i(
|
|
92
93
|
"span",
|
|
93
94
|
{
|
|
94
|
-
ref:
|
|
95
|
-
className:
|
|
96
|
-
children:
|
|
95
|
+
ref: r,
|
|
96
|
+
className: u("inline-flex", h),
|
|
97
|
+
children: c
|
|
97
98
|
}
|
|
98
99
|
) }),
|
|
99
|
-
/* @__PURE__ */ i(
|
|
100
|
-
|
|
100
|
+
/* @__PURE__ */ i(s.Portal, { children: /* @__PURE__ */ x(
|
|
101
|
+
s.Content,
|
|
101
102
|
{
|
|
102
|
-
ref:
|
|
103
|
+
ref: l,
|
|
103
104
|
side: R,
|
|
104
105
|
sideOffset: b ? C - 4 : 8,
|
|
105
|
-
className:
|
|
106
|
+
className: j,
|
|
106
107
|
style: { maxWidth: E, minWidth: O },
|
|
107
108
|
children: [
|
|
108
109
|
D,
|
|
109
110
|
b && /* @__PURE__ */ i(
|
|
110
|
-
|
|
111
|
+
s.Arrow,
|
|
111
112
|
{
|
|
112
|
-
width:
|
|
113
|
+
width: S,
|
|
113
114
|
height: C,
|
|
114
115
|
className: "fill-black/85"
|
|
115
116
|
}
|
|
@@ -123,7 +124,7 @@ function S({
|
|
|
123
124
|
}
|
|
124
125
|
);
|
|
125
126
|
}
|
|
126
|
-
|
|
127
|
+
_.displayName = "SimpleTooltip";
|
|
127
128
|
export {
|
|
128
|
-
|
|
129
|
+
_ as SimpleTooltip
|
|
129
130
|
};
|
|
@@ -42,6 +42,8 @@ export interface SimpleTooltipProps {
|
|
|
42
42
|
className?: string;
|
|
43
43
|
/** Extra className applied to the trigger wrapper `<span>`. */
|
|
44
44
|
triggerClassName?: string;
|
|
45
|
+
/** Whether to use the title as the trigger element. */
|
|
46
|
+
useTitleAsTrigger?: boolean;
|
|
45
47
|
}
|
|
46
48
|
/**
|
|
47
49
|
* `SimpleTooltip` — a drop-in replacement for the legacy
|
|
@@ -78,7 +80,7 @@ export interface SimpleTooltipProps {
|
|
|
78
80
|
* </SimpleTooltip>
|
|
79
81
|
* ```
|
|
80
82
|
*/
|
|
81
|
-
export declare function SimpleTooltip({ children, title, placement, trigger, triangle, delayShow, maxWidth, minWidth, type, open: controlledOpen, onOpenChange: controlledOnOpenChange, className, triggerClassName, }: SimpleTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
83
|
+
export declare function SimpleTooltip({ children, title, placement, trigger, triangle, delayShow, maxWidth, minWidth, type, open: controlledOpen, onOpenChange: controlledOnOpenChange, className, triggerClassName, useTitleAsTrigger, }: SimpleTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
82
84
|
export declare namespace SimpleTooltip {
|
|
83
85
|
var displayName: string;
|
|
84
86
|
}
|