@gearbox-protocol/permissionless-ui 1.4.4 → 1.6.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.
- package/dist/cjs/components/auth/siwe-provider.js +0 -1
- package/dist/cjs/components/buttons/button.js +1 -1
- package/dist/cjs/components/cards/card.js +13 -10
- package/dist/cjs/components/detailed-page-title.js +11 -3
- package/dist/cjs/components/graph/graph-view.js +2 -2
- package/dist/cjs/components/graph/graph.js +6 -2
- package/dist/cjs/components/layout/footer.js +2 -2
- package/dist/cjs/components/layout/header.js +25 -7
- package/dist/cjs/components/layout/layout.js +12 -1
- package/dist/cjs/components/layout/page-layout.js +5 -2
- package/dist/cjs/components/navitem.js +5 -5
- package/dist/cjs/components/table/table-sm.js +2 -2
- package/dist/cjs/components/tabs.js +1 -1
- package/dist/esm/components/auth/siwe-provider.js +0 -1
- package/dist/esm/components/buttons/button.js +1 -1
- package/dist/esm/components/cards/card.js +13 -10
- package/dist/esm/components/detailed-page-title.js +11 -3
- package/dist/esm/components/graph/graph-view.js +2 -2
- package/dist/esm/components/graph/graph.js +6 -2
- package/dist/esm/components/layout/footer.js +2 -2
- package/dist/esm/components/layout/header.js +23 -6
- package/dist/esm/components/layout/layout.js +12 -1
- package/dist/esm/components/layout/page-layout.js +5 -2
- package/dist/esm/components/navitem.js +5 -5
- package/dist/esm/components/table/table-sm.js +2 -2
- package/dist/esm/components/tabs.js +1 -1
- package/dist/globals.css +5 -1
- package/dist/types/components/detailed-page-title.d.ts +2 -3
- package/dist/types/components/layout/header.d.ts +22 -0
- package/dist/types/components/layout/page-layout.d.ts +3 -1
- package/package.json +7 -3
|
@@ -38,7 +38,7 @@ var import_class_variance_authority = require("class-variance-authority");
|
|
|
38
38
|
var React = __toESM(require("react"));
|
|
39
39
|
var import_utils = __toESM(require('../../utils/index.js'));
|
|
40
40
|
const buttonVariants = (0, import_class_variance_authority.cva)(
|
|
41
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border border-transparent",
|
|
41
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border border-transparent outline-none focus-visible:outline-none",
|
|
42
42
|
{
|
|
43
43
|
variants: {
|
|
44
44
|
variant: {
|
|
@@ -40,18 +40,21 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
40
40
|
var import_class_variance_authority = require("class-variance-authority");
|
|
41
41
|
var React = __toESM(require("react"));
|
|
42
42
|
var import_utils = __toESM(require('../../utils/index.js'));
|
|
43
|
-
const cardVariants = (0, import_class_variance_authority.cva)(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
const cardVariants = (0, import_class_variance_authority.cva)(
|
|
44
|
+
"rounded-xl border border-border bg-card text-card-foreground",
|
|
45
|
+
{
|
|
46
|
+
variants: {
|
|
47
|
+
variant: {
|
|
48
|
+
default: "",
|
|
49
|
+
interactive: "hover:bg-secondary transition-colors cursor-pointer",
|
|
50
|
+
transparent: "bg-card/0"
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
variant: "default"
|
|
49
55
|
}
|
|
50
|
-
},
|
|
51
|
-
defaultVariants: {
|
|
52
|
-
variant: "default"
|
|
53
56
|
}
|
|
54
|
-
|
|
57
|
+
);
|
|
55
58
|
const Card = React.forwardRef(
|
|
56
59
|
({ className, variant, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
57
60
|
"div",
|
|
@@ -33,24 +33,28 @@ __export(detailed_page_title_exports, {
|
|
|
33
33
|
module.exports = __toCommonJS(detailed_page_title_exports);
|
|
34
34
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
35
|
var import_lucide_react = require("lucide-react");
|
|
36
|
+
var React = __toESM(require("react"));
|
|
36
37
|
var import_utils = __toESM(require('../utils/index.js'));
|
|
37
38
|
var import_copy = require('../utils/copy.js');
|
|
38
39
|
var import_button = require('./buttons/button.js');
|
|
39
40
|
var import_dropdown_menu = require('./dropdown-menu/index.js');
|
|
40
41
|
var import_page_title = require('./page-title.js');
|
|
41
42
|
var import_token_icon = require('./token-icon.js');
|
|
43
|
+
var import_typed_intl = require('./typed-intl/index.js');
|
|
42
44
|
function DetailedPageTitle({
|
|
43
45
|
title,
|
|
44
46
|
token,
|
|
45
47
|
toCopy,
|
|
46
48
|
explorerLinks,
|
|
47
|
-
className
|
|
48
|
-
onCopySuccess
|
|
49
|
+
className
|
|
49
50
|
}) {
|
|
51
|
+
const intl = (0, import_typed_intl.useIntlTyped)();
|
|
52
|
+
const [isPressed, setIsPressed] = React.useState(false);
|
|
50
53
|
const handleCopy = () => {
|
|
51
54
|
if (toCopy) {
|
|
52
55
|
(0, import_copy.copyToClipboard)({ text: toCopy });
|
|
53
|
-
|
|
56
|
+
setIsPressed(true);
|
|
57
|
+
setTimeout(() => setIsPressed(false), 150);
|
|
54
58
|
}
|
|
55
59
|
};
|
|
56
60
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
@@ -65,6 +69,10 @@ function DetailedPageTitle({
|
|
|
65
69
|
size: "icon",
|
|
66
70
|
onClick: handleCopy,
|
|
67
71
|
title: "Copy address",
|
|
72
|
+
className: (0, import_utils.default)(
|
|
73
|
+
"transition-all",
|
|
74
|
+
isPressed ? "scale-75" : "scale-100"
|
|
75
|
+
),
|
|
68
76
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Copy, { className: "h-4 w-4" })
|
|
69
77
|
}
|
|
70
78
|
),
|
|
@@ -37,6 +37,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
37
37
|
var import_lightweight_charts = require("lightweight-charts");
|
|
38
38
|
var React = __toESM(require("react"));
|
|
39
39
|
var import_react = require("react");
|
|
40
|
+
var import_use_media_query = require('../../hooks/use-media-query.js');
|
|
40
41
|
var import_cn = require('../../utils/cn.js');
|
|
41
42
|
var import_colors = require('../../utils/colors.js');
|
|
42
43
|
var import_default_config = require('./default-config.js');
|
|
@@ -100,6 +101,7 @@ function Graph({
|
|
|
100
101
|
const chartRef = (0, import_react.useRef)(null);
|
|
101
102
|
const seriesRefs = (0, import_react.useRef)(/* @__PURE__ */ new Map());
|
|
102
103
|
const parentRef = (0, import_react.useRef)(null);
|
|
104
|
+
const isMobile = (0, import_use_media_query.useIsMobile)();
|
|
103
105
|
const allPoints = React.useMemo(() => {
|
|
104
106
|
return series.flatMap((s) => s.data);
|
|
105
107
|
}, [series]);
|
|
@@ -145,7 +147,7 @@ function Graph({
|
|
|
145
147
|
const hasZero = allPoints.some((p) => p.value === 0);
|
|
146
148
|
const shouldPreventNegativeAxis = !hasNegativeValues && hasZero;
|
|
147
149
|
const useMultiplePriceScales = series.length > 1;
|
|
148
|
-
const shouldHideScaleLabels = useMultiplePriceScales;
|
|
150
|
+
const shouldHideScaleLabels = useMultiplePriceScales || isMobile;
|
|
149
151
|
const defaultOptions = (0, import_default_config.getDefaultOptions)();
|
|
150
152
|
const chart = initChart(graphId, {
|
|
151
153
|
...defaultOptions,
|
|
@@ -166,6 +168,7 @@ function Graph({
|
|
|
166
168
|
},
|
|
167
169
|
rightPriceScale: {
|
|
168
170
|
...defaultOptions.rightPriceScale || {},
|
|
171
|
+
visible: !isMobile,
|
|
169
172
|
...shouldPreventNegativeAxis && {
|
|
170
173
|
scaleMargins: {
|
|
171
174
|
top: 0.3,
|
|
@@ -308,7 +311,8 @@ function Graph({
|
|
|
308
311
|
xMeasureUnit,
|
|
309
312
|
yMeasureUnit,
|
|
310
313
|
optionsOverrides,
|
|
311
|
-
subscribeLegendMove
|
|
314
|
+
subscribeLegendMove,
|
|
315
|
+
isMobile
|
|
312
316
|
]);
|
|
313
317
|
(0, import_react.useEffect)(() => {
|
|
314
318
|
const ch = chartRef.current;
|
|
@@ -58,7 +58,7 @@ const Footer = import_react.default.forwardRef(
|
|
|
58
58
|
{
|
|
59
59
|
ref,
|
|
60
60
|
className: (0, import_cn.cn)(
|
|
61
|
-
"relative w-full border-t bg-card border-border
|
|
61
|
+
"relative w-full border-t bg-card border-border flex items-center justify-center",
|
|
62
62
|
className
|
|
63
63
|
),
|
|
64
64
|
...props,
|
|
@@ -138,7 +138,7 @@ function GearboxFooter({
|
|
|
138
138
|
"footer",
|
|
139
139
|
{
|
|
140
140
|
className: (0, import_cn.cn)(
|
|
141
|
-
"relative w-full border-t bg-card border-border
|
|
141
|
+
"relative w-full border-t bg-card border-border flex items-center justify-center",
|
|
142
142
|
className
|
|
143
143
|
),
|
|
144
144
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 items-top py-6 w-full px-4 max-w-[1440px]", children: [
|
|
@@ -28,13 +28,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
var header_exports = {};
|
|
30
30
|
__export(header_exports, {
|
|
31
|
-
Header: () => Header
|
|
31
|
+
Header: () => Header,
|
|
32
|
+
useMobileMenu: () => useMobileMenu
|
|
32
33
|
});
|
|
33
34
|
module.exports = __toCommonJS(header_exports);
|
|
34
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
35
36
|
var import_lucide_react = require("lucide-react");
|
|
36
37
|
var import_react = __toESM(require("react"));
|
|
37
38
|
var import_cn = require('../../utils/cn.js');
|
|
39
|
+
const MobileMenuContext = import_react.default.createContext(
|
|
40
|
+
null
|
|
41
|
+
);
|
|
42
|
+
function useMobileMenu() {
|
|
43
|
+
const context = import_react.default.useContext(MobileMenuContext);
|
|
44
|
+
if (!context) {
|
|
45
|
+
throw new Error("useMobileMenu must be used within Header component");
|
|
46
|
+
}
|
|
47
|
+
return context;
|
|
48
|
+
}
|
|
38
49
|
const Header = import_react.default.forwardRef(
|
|
39
50
|
({
|
|
40
51
|
navigation,
|
|
@@ -54,7 +65,7 @@ const Header = import_react.default.forwardRef(
|
|
|
54
65
|
{
|
|
55
66
|
ref,
|
|
56
67
|
className: (0, import_cn.cn)(
|
|
57
|
-
"relative w-full bg-background h-18
|
|
68
|
+
"relative w-full bg-background h-18 border-b flex flex-nowrap items-center border-border",
|
|
58
69
|
fixed && "fixed top-0 left-0 right-0 z-50",
|
|
59
70
|
sticky && "sticky top-0 z-50",
|
|
60
71
|
className
|
|
@@ -87,10 +98,16 @@ const Header = import_react.default.forwardRef(
|
|
|
87
98
|
]
|
|
88
99
|
}
|
|
89
100
|
),
|
|
90
|
-
mobileMenuOpen && (navigation || mobileMenuContent) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
101
|
+
mobileMenuOpen && (navigation || mobileMenuContent) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
102
|
+
MobileMenuContext.Provider,
|
|
103
|
+
{
|
|
104
|
+
value: { closeMobileMenu: () => setMobileMenuOpen(false) },
|
|
105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute top-full left-0 right-0 bg-background border-b border-border md:hidden z-40 shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col px-4 py-4 space-y-2", children: [
|
|
106
|
+
mobileMenuContent || navigation,
|
|
107
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex flex-col gap-2 pt-4 border-t border-border mt-4", children: actions })
|
|
108
|
+
] }) })
|
|
109
|
+
}
|
|
110
|
+
)
|
|
94
111
|
]
|
|
95
112
|
}
|
|
96
113
|
);
|
|
@@ -99,5 +116,6 @@ const Header = import_react.default.forwardRef(
|
|
|
99
116
|
Header.displayName = "Header";
|
|
100
117
|
// Annotate the CommonJS export names for ESM import in node:
|
|
101
118
|
0 && (module.exports = {
|
|
102
|
-
Header
|
|
119
|
+
Header,
|
|
120
|
+
useMobileMenu
|
|
103
121
|
});
|
|
@@ -51,7 +51,18 @@ const Layout = import_react.default.forwardRef(
|
|
|
51
51
|
...props,
|
|
52
52
|
children: [
|
|
53
53
|
header && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { gridArea: "header" }, children: header }),
|
|
54
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
54
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
55
|
+
"main",
|
|
56
|
+
{
|
|
57
|
+
className: "overflow-x-hidden py-6",
|
|
58
|
+
style: {
|
|
59
|
+
gridArea: "main",
|
|
60
|
+
backgroundColor: "hsl(var(--main-background))",
|
|
61
|
+
color: "hsl(var(--main-foreground))"
|
|
62
|
+
},
|
|
63
|
+
children
|
|
64
|
+
}
|
|
65
|
+
),
|
|
55
66
|
footer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: { gridArea: "footer" }, children: footer })
|
|
56
67
|
]
|
|
57
68
|
}
|
|
@@ -23,15 +23,18 @@ __export(page_layout_exports, {
|
|
|
23
23
|
module.exports = __toCommonJS(page_layout_exports);
|
|
24
24
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
25
25
|
var import_back_button = require('../buttons/back-button.js');
|
|
26
|
+
var import_container = require('./container.js');
|
|
26
27
|
function PageLayout({
|
|
27
28
|
children,
|
|
28
29
|
title,
|
|
29
30
|
description,
|
|
30
31
|
icon,
|
|
31
32
|
backButton,
|
|
32
|
-
actionButton
|
|
33
|
+
actionButton,
|
|
34
|
+
maxContainerWidth = "xl",
|
|
35
|
+
containerClassName
|
|
33
36
|
}) {
|
|
34
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
37
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_container.Container, { maxWidth: maxContainerWidth, className: containerClassName, children: [
|
|
35
38
|
backButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
36
39
|
import_back_button.BackButton,
|
|
37
40
|
{
|
|
@@ -43,11 +43,11 @@ const navitemVariants = (0, import_class_variance_authority.cva)(
|
|
|
43
43
|
{
|
|
44
44
|
variants: {
|
|
45
45
|
variant: {
|
|
46
|
-
default: "text-decoration-none text-foreground hover:text-foreground hover:bg-secondary",
|
|
47
|
-
active: "text-foreground",
|
|
48
|
-
ghost: "text-decoration-none text-muted-foreground hover:text-foreground hover:bg-secondary",
|
|
49
|
-
link: "text-decoration-none text-muted-foreground hover:text-foreground underline-offset-4 hover:underline",
|
|
50
|
-
pill: "text-decoration-none text-muted-foreground hover:text-foreground hover:bg-accent rounded-full",
|
|
46
|
+
default: "text-decoration-none text-foreground hover:text-foreground hover:bg-secondary data-[active=true]:bg-secondary md:data-[active=true]:bg-transparent data-[active=true]:text-foreground",
|
|
47
|
+
active: "text-foreground bg-secondary",
|
|
48
|
+
ghost: "text-decoration-none text-muted-foreground hover:text-foreground hover:bg-secondary data-[active=true]:bg-secondary md:data-[active=true]:bg-transparent data-[active=true]:text-foreground",
|
|
49
|
+
link: "text-decoration-none text-muted-foreground hover:text-foreground underline-offset-4 hover:underline data-[active=true]:text-foreground data-[active=true]:underline",
|
|
50
|
+
pill: "text-decoration-none text-muted-foreground hover:text-foreground hover:bg-accent rounded-full data-[active=true]:bg-accent data-[active=true]:text-foreground",
|
|
51
51
|
tab: "text-decoration-none text-muted-foreground hover:text-foreground border-b-2 border-transparent hover:border-border data-[active=true]:border-primary data-[active=true]:text-foreground rounded-none"
|
|
52
52
|
},
|
|
53
53
|
size: {
|
|
@@ -63,7 +63,7 @@ function TableLineSm({
|
|
|
63
63
|
"div",
|
|
64
64
|
{
|
|
65
65
|
className: (0, import_utils.default)(
|
|
66
|
-
"flex flex-col gap-3
|
|
66
|
+
"flex flex-col gap-3 py-3 px-0 md:px-4 border-b border-border",
|
|
67
67
|
className
|
|
68
68
|
),
|
|
69
69
|
...props,
|
|
@@ -72,7 +72,7 @@ function TableLineSm({
|
|
|
72
72
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
73
73
|
"div",
|
|
74
74
|
{
|
|
75
|
-
className: "grid gap-4 table-sm-grid",
|
|
75
|
+
className: "grid gap-2 md:gap-4 table-sm-grid",
|
|
76
76
|
style: {
|
|
77
77
|
"--grid-cols-xs": colsXs,
|
|
78
78
|
"--grid-cols-sm": colsSm,
|
|
@@ -56,7 +56,7 @@ const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
56
56
|
{
|
|
57
57
|
ref,
|
|
58
58
|
className: (0, import_utils.default)(
|
|
59
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow rounded-none border-b-2 border-transparent px-2 py-2 text-gray-400 hover:text-white data-[state=active]:border-white data-[state=active]:bg-transparent data-[state=active]:text-white focus:outline-none",
|
|
59
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow rounded-none border-b-2 border-transparent px-2 py-2 text-gray-400 hover:text-white data-[state=active]:border-white data-[state=active]:bg-transparent data-[state=active]:text-white focus:outline-none cursor-pointer",
|
|
60
60
|
className
|
|
61
61
|
),
|
|
62
62
|
...props
|
|
@@ -4,7 +4,7 @@ import { cva } from "class-variance-authority";
|
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import cn from "../../utils/index.js";
|
|
6
6
|
const buttonVariants = cva(
|
|
7
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border border-transparent",
|
|
7
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors cursor-pointer disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border border-transparent outline-none focus-visible:outline-none",
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
@@ -2,18 +2,21 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { cva } from "class-variance-authority";
|
|
3
3
|
import * as React from "react";
|
|
4
4
|
import cn from "../../utils/index.js";
|
|
5
|
-
const cardVariants = cva(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
const cardVariants = cva(
|
|
6
|
+
"rounded-xl border border-border bg-card text-card-foreground",
|
|
7
|
+
{
|
|
8
|
+
variants: {
|
|
9
|
+
variant: {
|
|
10
|
+
default: "",
|
|
11
|
+
interactive: "hover:bg-secondary transition-colors cursor-pointer",
|
|
12
|
+
transparent: "bg-card/0"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
variant: "default"
|
|
11
17
|
}
|
|
12
|
-
},
|
|
13
|
-
defaultVariants: {
|
|
14
|
-
variant: "default"
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
);
|
|
17
20
|
const Card = React.forwardRef(
|
|
18
21
|
({ className, variant, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
19
22
|
"div",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Copy, ExternalLink } from "lucide-react";
|
|
3
|
+
import * as React from "react";
|
|
3
4
|
import cn from "../utils/index.js";
|
|
4
5
|
import { copyToClipboard } from "../utils/copy.js";
|
|
5
6
|
import { Button } from "./buttons/button.js";
|
|
@@ -11,18 +12,21 @@ import {
|
|
|
11
12
|
} from "./dropdown-menu/index.js";
|
|
12
13
|
import { PageTitle } from "./page-title.js";
|
|
13
14
|
import { TokenIcon } from "./token-icon.js";
|
|
15
|
+
import { useIntlTyped } from "./typed-intl/index.js";
|
|
14
16
|
function DetailedPageTitle({
|
|
15
17
|
title,
|
|
16
18
|
token,
|
|
17
19
|
toCopy,
|
|
18
20
|
explorerLinks,
|
|
19
|
-
className
|
|
20
|
-
onCopySuccess
|
|
21
|
+
className
|
|
21
22
|
}) {
|
|
23
|
+
const intl = useIntlTyped();
|
|
24
|
+
const [isPressed, setIsPressed] = React.useState(false);
|
|
22
25
|
const handleCopy = () => {
|
|
23
26
|
if (toCopy) {
|
|
24
27
|
copyToClipboard({ text: toCopy });
|
|
25
|
-
|
|
28
|
+
setIsPressed(true);
|
|
29
|
+
setTimeout(() => setIsPressed(false), 150);
|
|
26
30
|
}
|
|
27
31
|
};
|
|
28
32
|
return /* @__PURE__ */ jsx(
|
|
@@ -37,6 +41,10 @@ function DetailedPageTitle({
|
|
|
37
41
|
size: "icon",
|
|
38
42
|
onClick: handleCopy,
|
|
39
43
|
title: "Copy address",
|
|
44
|
+
className: cn(
|
|
45
|
+
"transition-all",
|
|
46
|
+
isPressed ? "scale-75" : "scale-100"
|
|
47
|
+
),
|
|
40
48
|
children: /* @__PURE__ */ jsx(Copy, { className: "h-4 w-4" })
|
|
41
49
|
}
|
|
42
50
|
),
|
|
@@ -3,6 +3,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { createChart } from "lightweight-charts";
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { useIsMobile } from "../../hooks/use-media-query.js";
|
|
6
7
|
import { cn } from "../../utils/cn.js";
|
|
7
8
|
import { generateColorsFromBase } from "../../utils/colors.js";
|
|
8
9
|
import {
|
|
@@ -70,6 +71,7 @@ function Graph({
|
|
|
70
71
|
const chartRef = useRef(null);
|
|
71
72
|
const seriesRefs = useRef(/* @__PURE__ */ new Map());
|
|
72
73
|
const parentRef = useRef(null);
|
|
74
|
+
const isMobile = useIsMobile();
|
|
73
75
|
const allPoints = React.useMemo(() => {
|
|
74
76
|
return series.flatMap((s) => s.data);
|
|
75
77
|
}, [series]);
|
|
@@ -115,7 +117,7 @@ function Graph({
|
|
|
115
117
|
const hasZero = allPoints.some((p) => p.value === 0);
|
|
116
118
|
const shouldPreventNegativeAxis = !hasNegativeValues && hasZero;
|
|
117
119
|
const useMultiplePriceScales = series.length > 1;
|
|
118
|
-
const shouldHideScaleLabels = useMultiplePriceScales;
|
|
120
|
+
const shouldHideScaleLabels = useMultiplePriceScales || isMobile;
|
|
119
121
|
const defaultOptions = getDefaultOptions();
|
|
120
122
|
const chart = initChart(graphId, {
|
|
121
123
|
...defaultOptions,
|
|
@@ -136,6 +138,7 @@ function Graph({
|
|
|
136
138
|
},
|
|
137
139
|
rightPriceScale: {
|
|
138
140
|
...defaultOptions.rightPriceScale || {},
|
|
141
|
+
visible: !isMobile,
|
|
139
142
|
...shouldPreventNegativeAxis && {
|
|
140
143
|
scaleMargins: {
|
|
141
144
|
top: 0.3,
|
|
@@ -278,7 +281,8 @@ function Graph({
|
|
|
278
281
|
xMeasureUnit,
|
|
279
282
|
yMeasureUnit,
|
|
280
283
|
optionsOverrides,
|
|
281
|
-
subscribeLegendMove
|
|
284
|
+
subscribeLegendMove,
|
|
285
|
+
isMobile
|
|
282
286
|
]);
|
|
283
287
|
useEffect(() => {
|
|
284
288
|
const ch = chartRef.current;
|
|
@@ -22,7 +22,7 @@ const Footer = React.forwardRef(
|
|
|
22
22
|
{
|
|
23
23
|
ref,
|
|
24
24
|
className: cn(
|
|
25
|
-
"relative w-full border-t bg-card border-border
|
|
25
|
+
"relative w-full border-t bg-card border-border flex items-center justify-center",
|
|
26
26
|
className
|
|
27
27
|
),
|
|
28
28
|
...props,
|
|
@@ -102,7 +102,7 @@ function GearboxFooter({
|
|
|
102
102
|
"footer",
|
|
103
103
|
{
|
|
104
104
|
className: cn(
|
|
105
|
-
"relative w-full border-t bg-card border-border
|
|
105
|
+
"relative w-full border-t bg-card border-border flex items-center justify-center",
|
|
106
106
|
className
|
|
107
107
|
),
|
|
108
108
|
children: /* @__PURE__ */ jsxs("div", { className: "grid grid-cols-1 md:grid-cols-2 gap-4 items-top py-6 w-full px-4 max-w-[1440px]", children: [
|
|
@@ -2,6 +2,16 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Menu, X } from "lucide-react";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { cn } from "../../utils/cn.js";
|
|
5
|
+
const MobileMenuContext = React.createContext(
|
|
6
|
+
null
|
|
7
|
+
);
|
|
8
|
+
function useMobileMenu() {
|
|
9
|
+
const context = React.useContext(MobileMenuContext);
|
|
10
|
+
if (!context) {
|
|
11
|
+
throw new Error("useMobileMenu must be used within Header component");
|
|
12
|
+
}
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
5
15
|
const Header = React.forwardRef(
|
|
6
16
|
({
|
|
7
17
|
navigation,
|
|
@@ -21,7 +31,7 @@ const Header = React.forwardRef(
|
|
|
21
31
|
{
|
|
22
32
|
ref,
|
|
23
33
|
className: cn(
|
|
24
|
-
"relative w-full bg-background h-18
|
|
34
|
+
"relative w-full bg-background h-18 border-b flex flex-nowrap items-center border-border",
|
|
25
35
|
fixed && "fixed top-0 left-0 right-0 z-50",
|
|
26
36
|
sticky && "sticky top-0 z-50",
|
|
27
37
|
className
|
|
@@ -54,10 +64,16 @@ const Header = React.forwardRef(
|
|
|
54
64
|
]
|
|
55
65
|
}
|
|
56
66
|
),
|
|
57
|
-
mobileMenuOpen && (navigation || mobileMenuContent) && /* @__PURE__ */ jsx(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
67
|
+
mobileMenuOpen && (navigation || mobileMenuContent) && /* @__PURE__ */ jsx(
|
|
68
|
+
MobileMenuContext.Provider,
|
|
69
|
+
{
|
|
70
|
+
value: { closeMobileMenu: () => setMobileMenuOpen(false) },
|
|
71
|
+
children: /* @__PURE__ */ jsx("div", { className: "absolute top-full left-0 right-0 bg-background border-b border-border md:hidden z-40 shadow-lg", children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col px-4 py-4 space-y-2", children: [
|
|
72
|
+
mobileMenuContent || navigation,
|
|
73
|
+
actions && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2 pt-4 border-t border-border mt-4", children: actions })
|
|
74
|
+
] }) })
|
|
75
|
+
}
|
|
76
|
+
)
|
|
61
77
|
]
|
|
62
78
|
}
|
|
63
79
|
);
|
|
@@ -65,5 +81,6 @@ const Header = React.forwardRef(
|
|
|
65
81
|
);
|
|
66
82
|
Header.displayName = "Header";
|
|
67
83
|
export {
|
|
68
|
-
Header
|
|
84
|
+
Header,
|
|
85
|
+
useMobileMenu
|
|
69
86
|
};
|
|
@@ -18,7 +18,18 @@ const Layout = React.forwardRef(
|
|
|
18
18
|
...props,
|
|
19
19
|
children: [
|
|
20
20
|
header && /* @__PURE__ */ jsx("div", { style: { gridArea: "header" }, children: header }),
|
|
21
|
-
/* @__PURE__ */ jsx(
|
|
21
|
+
/* @__PURE__ */ jsx(
|
|
22
|
+
"main",
|
|
23
|
+
{
|
|
24
|
+
className: "overflow-x-hidden py-6",
|
|
25
|
+
style: {
|
|
26
|
+
gridArea: "main",
|
|
27
|
+
backgroundColor: "hsl(var(--main-background))",
|
|
28
|
+
color: "hsl(var(--main-foreground))"
|
|
29
|
+
},
|
|
30
|
+
children
|
|
31
|
+
}
|
|
32
|
+
),
|
|
22
33
|
footer && /* @__PURE__ */ jsx("div", { style: { gridArea: "footer" }, children: footer })
|
|
23
34
|
]
|
|
24
35
|
}
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { BackButton } from "../buttons/back-button.js";
|
|
3
|
+
import { Container } from "./container.js";
|
|
3
4
|
function PageLayout({
|
|
4
5
|
children,
|
|
5
6
|
title,
|
|
6
7
|
description,
|
|
7
8
|
icon,
|
|
8
9
|
backButton,
|
|
9
|
-
actionButton
|
|
10
|
+
actionButton,
|
|
11
|
+
maxContainerWidth = "xl",
|
|
12
|
+
containerClassName
|
|
10
13
|
}) {
|
|
11
|
-
return /* @__PURE__ */ jsxs(
|
|
14
|
+
return /* @__PURE__ */ jsxs(Container, { maxWidth: maxContainerWidth, className: containerClassName, children: [
|
|
12
15
|
backButton && /* @__PURE__ */ jsx(
|
|
13
16
|
BackButton,
|
|
14
17
|
{
|
|
@@ -9,11 +9,11 @@ const navitemVariants = cva(
|
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
|
-
default: "text-decoration-none text-foreground hover:text-foreground hover:bg-secondary",
|
|
13
|
-
active: "text-foreground",
|
|
14
|
-
ghost: "text-decoration-none text-muted-foreground hover:text-foreground hover:bg-secondary",
|
|
15
|
-
link: "text-decoration-none text-muted-foreground hover:text-foreground underline-offset-4 hover:underline",
|
|
16
|
-
pill: "text-decoration-none text-muted-foreground hover:text-foreground hover:bg-accent rounded-full",
|
|
12
|
+
default: "text-decoration-none text-foreground hover:text-foreground hover:bg-secondary data-[active=true]:bg-secondary md:data-[active=true]:bg-transparent data-[active=true]:text-foreground",
|
|
13
|
+
active: "text-foreground bg-secondary",
|
|
14
|
+
ghost: "text-decoration-none text-muted-foreground hover:text-foreground hover:bg-secondary data-[active=true]:bg-secondary md:data-[active=true]:bg-transparent data-[active=true]:text-foreground",
|
|
15
|
+
link: "text-decoration-none text-muted-foreground hover:text-foreground underline-offset-4 hover:underline data-[active=true]:text-foreground data-[active=true]:underline",
|
|
16
|
+
pill: "text-decoration-none text-muted-foreground hover:text-foreground hover:bg-accent rounded-full data-[active=true]:bg-accent data-[active=true]:text-foreground",
|
|
17
17
|
tab: "text-decoration-none text-muted-foreground hover:text-foreground border-b-2 border-transparent hover:border-border data-[active=true]:border-primary data-[active=true]:text-foreground rounded-none"
|
|
18
18
|
},
|
|
19
19
|
size: {
|
|
@@ -29,7 +29,7 @@ function TableLineSm({
|
|
|
29
29
|
"div",
|
|
30
30
|
{
|
|
31
31
|
className: cn(
|
|
32
|
-
"flex flex-col gap-3
|
|
32
|
+
"flex flex-col gap-3 py-3 px-0 md:px-4 border-b border-border",
|
|
33
33
|
className
|
|
34
34
|
),
|
|
35
35
|
...props,
|
|
@@ -38,7 +38,7 @@ function TableLineSm({
|
|
|
38
38
|
/* @__PURE__ */ jsx(
|
|
39
39
|
"div",
|
|
40
40
|
{
|
|
41
|
-
className: "grid gap-4 table-sm-grid",
|
|
41
|
+
className: "grid gap-2 md:gap-4 table-sm-grid",
|
|
42
42
|
style: {
|
|
43
43
|
"--grid-cols-xs": colsXs,
|
|
44
44
|
"--grid-cols-sm": colsSm,
|
|
@@ -20,7 +20,7 @@ const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PUR
|
|
|
20
20
|
{
|
|
21
21
|
ref,
|
|
22
22
|
className: cn(
|
|
23
|
-
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow rounded-none border-b-2 border-transparent px-2 py-2 text-gray-400 hover:text-white data-[state=active]:border-white data-[state=active]:bg-transparent data-[state=active]:text-white focus:outline-none",
|
|
23
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow rounded-none border-b-2 border-transparent px-2 py-2 text-gray-400 hover:text-white data-[state=active]:border-white data-[state=active]:bg-transparent data-[state=active]:text-white focus:outline-none cursor-pointer",
|
|
24
24
|
className
|
|
25
25
|
),
|
|
26
26
|
...props
|
package/dist/globals.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
@import "tailwindcss";
|
|
2
1
|
@import url("https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700&display=swap");
|
|
2
|
+
@import "tailwindcss";
|
|
3
3
|
@import "./grid-safelist.css";
|
|
4
4
|
|
|
5
5
|
@layer base {
|
|
@@ -32,6 +32,8 @@
|
|
|
32
32
|
--white: 0 0% 100%;
|
|
33
33
|
--black: 0 0% 0%;
|
|
34
34
|
--border: 0 0% 89.8%;
|
|
35
|
+
--main-background: 240 10% 3.9%;
|
|
36
|
+
--main-foreground: 0 0% 98%;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
.dark {
|
|
@@ -74,6 +76,8 @@
|
|
|
74
76
|
--white: 0 0% 100%;
|
|
75
77
|
--black: 0 0% 0%;
|
|
76
78
|
--border: 225 7% 22%;
|
|
79
|
+
--main-background: 240 10% 3.9%;
|
|
80
|
+
--main-foreground: 0 0% 98%;
|
|
77
81
|
}
|
|
78
82
|
}
|
|
79
83
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TokenData } from "@gearbox-protocol/sdk";
|
|
2
|
-
import
|
|
2
|
+
import * as React from "react";
|
|
3
3
|
export interface ExplorerLink {
|
|
4
4
|
link: string;
|
|
5
5
|
label: string;
|
|
@@ -10,7 +10,6 @@ export interface DetailedPageTitleProps {
|
|
|
10
10
|
toCopy?: string;
|
|
11
11
|
explorerLinks?: Array<ExplorerLink>;
|
|
12
12
|
className?: string;
|
|
13
|
-
onCopySuccess?: () => void;
|
|
14
13
|
}
|
|
15
14
|
/**
|
|
16
15
|
* DetailedPageTitle - page title with token icon, copy functionality, and explorer links
|
|
@@ -28,4 +27,4 @@ export interface DetailedPageTitleProps {
|
|
|
28
27
|
* />
|
|
29
28
|
* ```
|
|
30
29
|
*/
|
|
31
|
-
export declare function DetailedPageTitle({ title, token, toCopy, explorerLinks, className,
|
|
30
|
+
export declare function DetailedPageTitle({ title, token, toCopy, explorerLinks, className, }: DetailedPageTitleProps): React.ReactElement;
|
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
interface MobileMenuContextValue {
|
|
3
|
+
closeMobileMenu: () => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Hook to access mobile menu control functions
|
|
7
|
+
* Use this hook inside mobileMenuContent to close the menu on navigation
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* function MobileNav() {
|
|
12
|
+
* const { closeMobileMenu } = useMobileMenu();
|
|
13
|
+
*
|
|
14
|
+
* return (
|
|
15
|
+
* <nav>
|
|
16
|
+
* <a href="/" onClick={closeMobileMenu}>Home</a>
|
|
17
|
+
* </nav>
|
|
18
|
+
* );
|
|
19
|
+
* }
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare function useMobileMenu(): MobileMenuContextValue;
|
|
2
23
|
export interface HeaderProps extends React.HTMLAttributes<HTMLElement> {
|
|
3
24
|
/**
|
|
4
25
|
* Navigation content (shown on desktop, hidden on mobile unless specified)
|
|
@@ -79,3 +100,4 @@ export interface HeaderProps extends React.HTMLAttributes<HTMLElement> {
|
|
|
79
100
|
* ```
|
|
80
101
|
*/
|
|
81
102
|
export declare const Header: React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<HTMLElement>>;
|
|
103
|
+
export {};
|
|
@@ -9,6 +9,8 @@ interface PageLayoutProps {
|
|
|
9
9
|
onClick?: () => void;
|
|
10
10
|
};
|
|
11
11
|
actionButton?: JSX.Element;
|
|
12
|
+
maxContainerWidth?: "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
13
|
+
containerClassName?: string;
|
|
12
14
|
}
|
|
13
15
|
/**
|
|
14
16
|
* PageLayout — main layout component for application pages.
|
|
@@ -35,5 +37,5 @@ interface PageLayoutProps {
|
|
|
35
37
|
* - for modal dialogs or overlays (use Dialog component instead).
|
|
36
38
|
* - for nested page sections (use Card or other container components).
|
|
37
39
|
*/
|
|
38
|
-
export declare function PageLayout({ children, title, description, icon, backButton, actionButton, }: PageLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare function PageLayout({ children, title, description, icon, backButton, actionButton, maxContainerWidth, containerClassName, }: PageLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
39
41
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gearbox-protocol/permissionless-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Internal UI components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/cjs/index.js",
|
|
@@ -66,13 +66,13 @@
|
|
|
66
66
|
"react-markdown": "^9.0.3",
|
|
67
67
|
"react-markdown-math": "^1.0.2",
|
|
68
68
|
"remark-gfm": "^4.0.0",
|
|
69
|
-
"sonner": "^
|
|
69
|
+
"sonner": "^2.0.7",
|
|
70
70
|
"tailwind-merge": "^2.6.0",
|
|
71
71
|
"tailwindcss-animate": "^1.0.7"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"@gearbox-protocol/sdk": "*",
|
|
75
|
-
"@tanstack/react-query": "^5.
|
|
75
|
+
"@tanstack/react-query": "^5.64.1",
|
|
76
76
|
"@types/react": "^18 || ^19",
|
|
77
77
|
"@types/react-dom": "^18 || ^19",
|
|
78
78
|
"connectkit": "^1.8.0",
|
|
@@ -82,6 +82,7 @@
|
|
|
82
82
|
"react-intl": "^6.0.0 || ^7.0.0",
|
|
83
83
|
"react-router-dom": "^6.0.0 || ^7.0.0",
|
|
84
84
|
"reactochart": "^6.1.1",
|
|
85
|
+
"sonner": "^2.0.0",
|
|
85
86
|
"viem": "^2.0.0",
|
|
86
87
|
"wagmi": "^2.0.0"
|
|
87
88
|
},
|
|
@@ -94,6 +95,9 @@
|
|
|
94
95
|
},
|
|
95
96
|
"react-router-dom": {
|
|
96
97
|
"optional": true
|
|
98
|
+
},
|
|
99
|
+
"sonner": {
|
|
100
|
+
"optional": true
|
|
97
101
|
}
|
|
98
102
|
},
|
|
99
103
|
"devDependencies": {
|