@gearbox-protocol/ui-kit 4.0.0-next.62 → 4.0.0-next.63
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
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),g=require("class-variance-authority"),S=require("react"),k=require("../base-link/base-link.cjs"),_=require("../layout/col/col.cjs"),A=require("../layout/grid/grid.cjs"),s=require("../../utils/cn.cjs");function K(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const d=K(S),L=g.cva("w-full",{variants:{size:{sm:"text-xs",default:"text-sm",lg:"text-base"}},defaultVariants:{size:"default"}}),w=d.forwardRef(({className:e,size:t,cols:r=12,gap:a=0,wrapperClassName:n,...c},f)=>o.jsx("div",{className:s.cn("relative w-full overflow-auto",n),children:o.jsx(A.Grid,{ref:f,cols:r,gap:a,className:s.cn(L({size:t,className:e})),...c})}));w.displayName="GridTable";const z=d.forwardRef(({className:e,...t},r)=>o.jsx("div",{ref:r,className:s.cn("contents","[&>*>*]:after:absolute [&>*>*]:after:bottom-0 [&>*>*]:after:inset-x-0 [&>*>*]:after:h-px [&>*>*]:after:bg-border","hover:[&>*>*]:before:opacity-0!",e),...t}));z.displayName="GridTableHeader";const B=d.forwardRef(({className:e,...t},r)=>o.jsx("div",{ref:r,className:s.cn("contents [&>*:last-child>*]:after:hidden",e),...t}));B.displayName="GridTableBody";function N(e){const t=e.target.closest("a, button, input, select, textarea, [role='button']");return t!==null&&t!==e.currentTarget}const q=d.forwardRef(({className:e,cols:t,gap:r=0,last:a,height:n,hideValue:c,noHover:f,noRound:x,onRowClick:l,href:u,target:V,rel:C,style:D,children:b,...p},m)=>{const j=typeof n=="number"?`${n}px`:n,T=d.useCallback(i=>{l&&(N(i)||l(i))},[l]),v=d.useCallback(i=>{if(l&&!(i.key!=="Enter"&&i.key!==" ")&&!N(i)){if(u){if(i.key!=="Enter")return}else i.preventDefault();l(i)}},[l,u]),G=s.cn("[&>*]:relative [&>*]:transition-colors data-[state=selected]:[&>*]:bg-muted","[&>*]:after:absolute [&>*]:after:bottom-0 [&>*]:after:inset-x-0 [&>*]:after:h-px [&>*]:after:bg-border",!x&&["[&>*:first-child]:after:left-3","[&>*:last-child]:after:right-3"],!f&&["[&>*]:z-0","[&>*]:before:absolute [&>*]:before:inset-x-0 [&>*]:before:top-0 [&>*]:before:bottom-px [&>*]:before:-z-10 [&>*]:before:bg-muted/50 [&>*]:before:opacity-0 [&>*]:before:transition-opacity","hover:[&>*]:before:opacity-100",!x&&"[&>*:first-child]:before:rounded-l-lg [&>*:last-child]:before:rounded-r-lg"],a&&"[&>*]:after:hidden",c&&"[&>*]:opacity-0"),h=s.cn("grid grid-cols-subgrid col-span-full",G,"cursor-pointer",e),y={...D,...j?{height:j}:{}};return u?o.jsx(k.BaseLink,{ref:m,href:u,target:V,rel:C,size:"unset",variant:"unset",className:s.cn("no-underline text-foreground!",h),style:y,onClick:l?T:void 0,onKeyDown:l?v:void 0,...p,children:b}):l?o.jsx("div",{ref:m,role:"row",tabIndex:0,className:h,style:y,onClick:T,onKeyDown:v,...p,children:b}):o.jsx("div",{ref:m,className:s.cn("grid grid-cols-subgrid col-span-full",G,e),style:y,...p,children:b})});q.displayName="GridTableRow";const P=g.cva("flex items-center justify-start text-left align-middle font-medium text-muted-foreground !bg-transparent",{variants:{size:{sm:"min-h-8 px-1 py-2 text-sm",default:"min-h-10 px-2 py-2.5",lg:"min-h-12 px-4 py-3"},justify:{start:"justify-start",center:"justify-center",end:"justify-end"},gapBefore:{sm:"pl-5",md:"pl-10",none:""}},defaultVariants:{size:"default",justify:"start",gapBefore:"none"}}),H=d.forwardRef(({className:e,size:t,span:r=1,justify:a="start",gapBefore:n,...c},f)=>o.jsx(_.Col,{ref:f,span:r,className:s.cn(P({size:t,justify:a,gapBefore:n,className:e})),...c}));H.displayName="GridTableHead";const R=g.cva("flex items-center align-middle",{variants:{size:{sm:"px-1 py-2",default:"p-4",lg:"p-6"},textAlign:{left:"text-left justify-start",center:"text-center justify-center",right:"text-right justify-end"},gapBefore:{sm:"pl-5",md:"pl-10",none:""}},defaultVariants:{size:"default",textAlign:"left",gapBefore:"none"}}),O=d.forwardRef(({className:e,size:t,span:r=1,textAlign:a,gapBefore:n,...c},f)=>o.jsx(_.Col,{ref:f,span:r,className:s.cn(R({size:t,textAlign:a,gapBefore:n,className:e})),...c}));O.displayName="GridTableCell";exports.GridTable=w;exports.GridTableBody=B;exports.GridTableCell=O;exports.GridTableHead=H;exports.GridTableHeader=z;exports.GridTableRow=q;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
2
|
import { cva as g } from "class-variance-authority";
|
|
3
3
|
import * as n from "react";
|
|
4
4
|
import { BaseLink as H } from "../base-link/base-link.js";
|
|
5
|
-
import { Col as
|
|
6
|
-
import { Grid as
|
|
7
|
-
import { cn as
|
|
5
|
+
import { Col as z } from "../layout/col/col.js";
|
|
6
|
+
import { Grid as C } from "../layout/grid/grid.js";
|
|
7
|
+
import { cn as a } from "../../utils/cn.js";
|
|
8
8
|
const D = g("w-full", {
|
|
9
9
|
variants: {
|
|
10
10
|
size: {
|
|
@@ -16,24 +16,24 @@ const D = g("w-full", {
|
|
|
16
16
|
defaultVariants: {
|
|
17
17
|
size: "default"
|
|
18
18
|
}
|
|
19
|
-
}),
|
|
20
|
-
({ className: e, size: t, cols:
|
|
21
|
-
|
|
19
|
+
}), K = n.forwardRef(
|
|
20
|
+
({ className: e, size: t, cols: r = 12, gap: d = 0, wrapperClassName: s, ...f }, u) => /* @__PURE__ */ o("div", { className: a("relative w-full overflow-auto", s), children: /* @__PURE__ */ o(
|
|
21
|
+
C,
|
|
22
22
|
{
|
|
23
|
-
ref:
|
|
24
|
-
cols:
|
|
23
|
+
ref: u,
|
|
24
|
+
cols: r,
|
|
25
25
|
gap: d,
|
|
26
|
-
className:
|
|
26
|
+
className: a(D({ size: t, className: e })),
|
|
27
27
|
...f
|
|
28
28
|
}
|
|
29
29
|
) })
|
|
30
30
|
);
|
|
31
|
-
|
|
32
|
-
const
|
|
31
|
+
K.displayName = "GridTable";
|
|
32
|
+
const A = n.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ o(
|
|
33
33
|
"div",
|
|
34
34
|
{
|
|
35
|
-
ref:
|
|
36
|
-
className:
|
|
35
|
+
ref: r,
|
|
36
|
+
className: a(
|
|
37
37
|
"contents",
|
|
38
38
|
// Full-width border for header (no insets)
|
|
39
39
|
"[&>*>*]:after:absolute [&>*>*]:after:bottom-0 [&>*>*]:after:inset-x-0 [&>*>*]:after:h-px [&>*>*]:after:bg-border",
|
|
@@ -44,126 +44,130 @@ const K = n.forwardRef(({ className: e, ...t }, a) => /* @__PURE__ */ i(
|
|
|
44
44
|
...t
|
|
45
45
|
}
|
|
46
46
|
));
|
|
47
|
-
|
|
48
|
-
const
|
|
47
|
+
A.displayName = "GridTableHeader";
|
|
48
|
+
const E = n.forwardRef(({ className: e, ...t }, r) => /* @__PURE__ */ o(
|
|
49
49
|
"div",
|
|
50
50
|
{
|
|
51
|
-
ref:
|
|
52
|
-
className:
|
|
51
|
+
ref: r,
|
|
52
|
+
className: a("contents [&>*:last-child>*]:after:hidden", e),
|
|
53
53
|
...t
|
|
54
54
|
}
|
|
55
55
|
));
|
|
56
|
-
|
|
56
|
+
E.displayName = "GridTableBody";
|
|
57
|
+
function j(e) {
|
|
58
|
+
const t = e.target.closest(
|
|
59
|
+
"a, button, input, select, textarea, [role='button']"
|
|
60
|
+
);
|
|
61
|
+
return t !== null && t !== e.currentTarget;
|
|
62
|
+
}
|
|
57
63
|
const S = n.forwardRef(
|
|
58
64
|
({
|
|
59
65
|
className: e,
|
|
60
66
|
cols: t,
|
|
61
|
-
gap:
|
|
67
|
+
gap: r = 0,
|
|
62
68
|
last: d,
|
|
63
69
|
height: s,
|
|
64
70
|
hideValue: f,
|
|
65
|
-
noHover:
|
|
66
|
-
noRound:
|
|
71
|
+
noHover: u,
|
|
72
|
+
noRound: x,
|
|
67
73
|
onRowClick: l,
|
|
68
|
-
href:
|
|
69
|
-
target:
|
|
70
|
-
rel:
|
|
71
|
-
style:
|
|
72
|
-
children:
|
|
73
|
-
...
|
|
74
|
-
},
|
|
75
|
-
const
|
|
76
|
-
(
|
|
77
|
-
|
|
78
|
-
"a, button, input, select, textarea, [role='button']"
|
|
79
|
-
) || l(o);
|
|
74
|
+
href: c,
|
|
75
|
+
target: w,
|
|
76
|
+
rel: B,
|
|
77
|
+
style: V,
|
|
78
|
+
children: m,
|
|
79
|
+
...b
|
|
80
|
+
}, p) => {
|
|
81
|
+
const v = typeof s == "number" ? `${s}px` : s, T = n.useCallback(
|
|
82
|
+
(i) => {
|
|
83
|
+
l && (j(i) || l(i));
|
|
80
84
|
},
|
|
81
85
|
[l]
|
|
82
86
|
), h = n.useCallback(
|
|
83
|
-
(
|
|
84
|
-
if (l && (
|
|
85
|
-
if (
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
l(
|
|
87
|
+
(i) => {
|
|
88
|
+
if (l && !(i.key !== "Enter" && i.key !== " ") && !j(i)) {
|
|
89
|
+
if (c) {
|
|
90
|
+
if (i.key !== "Enter") return;
|
|
91
|
+
} else
|
|
92
|
+
i.preventDefault();
|
|
93
|
+
l(i);
|
|
90
94
|
}
|
|
91
95
|
},
|
|
92
|
-
[l]
|
|
93
|
-
), N =
|
|
96
|
+
[l, c]
|
|
97
|
+
), N = a(
|
|
94
98
|
"[&>*]:relative [&>*]:transition-colors data-[state=selected]:[&>*]:bg-muted",
|
|
95
99
|
"[&>*]:after:absolute [&>*]:after:bottom-0 [&>*]:after:inset-x-0 [&>*]:after:h-px [&>*]:after:bg-border",
|
|
96
|
-
!
|
|
100
|
+
!x && [
|
|
97
101
|
"[&>*:first-child]:after:left-3",
|
|
98
102
|
"[&>*:last-child]:after:right-3"
|
|
99
103
|
],
|
|
100
|
-
!
|
|
104
|
+
!u && [
|
|
101
105
|
"[&>*]:z-0",
|
|
102
106
|
"[&>*]:before:absolute [&>*]:before:inset-x-0 [&>*]:before:top-0 [&>*]:before:bottom-px [&>*]:before:-z-10 [&>*]:before:bg-muted/50 [&>*]:before:opacity-0 [&>*]:before:transition-opacity",
|
|
103
107
|
"hover:[&>*]:before:opacity-100",
|
|
104
|
-
!
|
|
108
|
+
!x && "[&>*:first-child]:before:rounded-l-lg [&>*:last-child]:before:rounded-r-lg"
|
|
105
109
|
],
|
|
106
110
|
d && "[&>*]:after:hidden",
|
|
107
111
|
f && "[&>*]:opacity-0"
|
|
108
|
-
), G =
|
|
112
|
+
), G = a(
|
|
109
113
|
"grid grid-cols-subgrid col-span-full",
|
|
110
114
|
N,
|
|
111
115
|
"cursor-pointer",
|
|
112
116
|
e
|
|
113
|
-
),
|
|
114
|
-
...
|
|
115
|
-
...
|
|
117
|
+
), y = {
|
|
118
|
+
...V,
|
|
119
|
+
...v ? { height: v } : {}
|
|
116
120
|
};
|
|
117
|
-
return
|
|
121
|
+
return c ? /* @__PURE__ */ o(
|
|
118
122
|
H,
|
|
119
123
|
{
|
|
120
|
-
ref:
|
|
121
|
-
href:
|
|
122
|
-
target:
|
|
123
|
-
rel:
|
|
124
|
+
ref: p,
|
|
125
|
+
href: c,
|
|
126
|
+
target: w,
|
|
127
|
+
rel: B,
|
|
124
128
|
size: "unset",
|
|
125
129
|
variant: "unset",
|
|
126
|
-
className:
|
|
127
|
-
style:
|
|
128
|
-
onClick: l ?
|
|
130
|
+
className: a("no-underline text-foreground!", G),
|
|
131
|
+
style: y,
|
|
132
|
+
onClick: l ? T : void 0,
|
|
129
133
|
onKeyDown: l ? h : void 0,
|
|
130
|
-
...
|
|
131
|
-
children:
|
|
134
|
+
...b,
|
|
135
|
+
children: m
|
|
132
136
|
}
|
|
133
137
|
) : l ? (
|
|
134
138
|
// biome-ignore lint/a11y/useSemanticElements: Using div with subgrid layout, not a semantic table
|
|
135
|
-
/* @__PURE__ */
|
|
139
|
+
/* @__PURE__ */ o(
|
|
136
140
|
"div",
|
|
137
141
|
{
|
|
138
|
-
ref:
|
|
142
|
+
ref: p,
|
|
139
143
|
role: "row",
|
|
140
144
|
tabIndex: 0,
|
|
141
145
|
className: G,
|
|
142
|
-
style:
|
|
143
|
-
onClick:
|
|
146
|
+
style: y,
|
|
147
|
+
onClick: T,
|
|
144
148
|
onKeyDown: h,
|
|
145
|
-
...
|
|
146
|
-
children:
|
|
149
|
+
...b,
|
|
150
|
+
children: m
|
|
147
151
|
}
|
|
148
152
|
)
|
|
149
|
-
) : /* @__PURE__ */
|
|
153
|
+
) : /* @__PURE__ */ o(
|
|
150
154
|
"div",
|
|
151
155
|
{
|
|
152
|
-
ref:
|
|
153
|
-
className:
|
|
156
|
+
ref: p,
|
|
157
|
+
className: a(
|
|
154
158
|
"grid grid-cols-subgrid col-span-full",
|
|
155
159
|
N,
|
|
156
160
|
e
|
|
157
161
|
),
|
|
158
|
-
style:
|
|
159
|
-
...
|
|
160
|
-
children:
|
|
162
|
+
style: y,
|
|
163
|
+
...b,
|
|
164
|
+
children: m
|
|
161
165
|
}
|
|
162
166
|
);
|
|
163
167
|
}
|
|
164
168
|
);
|
|
165
169
|
S.displayName = "GridTableRow";
|
|
166
|
-
const
|
|
170
|
+
const k = g(
|
|
167
171
|
"flex items-center justify-start text-left align-middle font-medium text-muted-foreground !bg-transparent",
|
|
168
172
|
{
|
|
169
173
|
variants: {
|
|
@@ -190,13 +194,13 @@ const E = g(
|
|
|
190
194
|
}
|
|
191
195
|
}
|
|
192
196
|
), I = n.forwardRef(
|
|
193
|
-
({ className: e, size: t, span:
|
|
194
|
-
|
|
197
|
+
({ className: e, size: t, span: r = 1, justify: d = "start", gapBefore: s, ...f }, u) => /* @__PURE__ */ o(
|
|
198
|
+
z,
|
|
195
199
|
{
|
|
196
|
-
ref:
|
|
197
|
-
span:
|
|
198
|
-
className:
|
|
199
|
-
|
|
200
|
+
ref: u,
|
|
201
|
+
span: r,
|
|
202
|
+
className: a(
|
|
203
|
+
k({ size: t, justify: d, gapBefore: s, className: e })
|
|
200
204
|
),
|
|
201
205
|
...f
|
|
202
206
|
}
|
|
@@ -226,25 +230,25 @@ const L = g("flex items-center align-middle", {
|
|
|
226
230
|
textAlign: "left",
|
|
227
231
|
gapBefore: "none"
|
|
228
232
|
}
|
|
229
|
-
}),
|
|
230
|
-
({ className: e, size: t, span:
|
|
231
|
-
|
|
233
|
+
}), O = n.forwardRef(
|
|
234
|
+
({ className: e, size: t, span: r = 1, textAlign: d, gapBefore: s, ...f }, u) => /* @__PURE__ */ o(
|
|
235
|
+
z,
|
|
232
236
|
{
|
|
233
|
-
ref:
|
|
234
|
-
span:
|
|
235
|
-
className:
|
|
237
|
+
ref: u,
|
|
238
|
+
span: r,
|
|
239
|
+
className: a(
|
|
236
240
|
L({ size: t, textAlign: d, gapBefore: s, className: e })
|
|
237
241
|
),
|
|
238
242
|
...f
|
|
239
243
|
}
|
|
240
244
|
)
|
|
241
245
|
);
|
|
242
|
-
|
|
246
|
+
O.displayName = "GridTableCell";
|
|
243
247
|
export {
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
248
|
+
K as GridTable,
|
|
249
|
+
E as GridTableBody,
|
|
250
|
+
O as GridTableCell,
|
|
247
251
|
I as GridTableHead,
|
|
248
|
-
|
|
252
|
+
A as GridTableHeader,
|
|
249
253
|
S as GridTableRow
|
|
250
254
|
};
|
|
@@ -128,58 +128,6 @@ interface GridTableRowProps extends GridProps {
|
|
|
128
128
|
*/
|
|
129
129
|
rel?: string;
|
|
130
130
|
}
|
|
131
|
-
/**
|
|
132
|
-
* GridTableRow — row component of a GridTable.
|
|
133
|
-
*
|
|
134
|
-
* @usage
|
|
135
|
-
* Use GridTableRow to create table rows in grid tables:
|
|
136
|
-
* data rows, table entries with hover effects and borders.
|
|
137
|
-
*
|
|
138
|
-
* Props:
|
|
139
|
-
* - `cols` — number of columns or custom grid template.
|
|
140
|
-
* - `gap` — gap between cells (defaults to 0).
|
|
141
|
-
* - `last` — whether this is the last row (removes bottom border).
|
|
142
|
-
* - `height` — custom height for the row (string or number in pixels).
|
|
143
|
-
* - `hideValue` — whether to hide value cells (for loading states).
|
|
144
|
-
* - `onRowClick` — click handler for the row (makes entire row clickable).
|
|
145
|
-
* - `href` — URL for the row link (renders as `<a>`, supports native link behavior).
|
|
146
|
-
* - `target` — link target (e.g., "_blank"). Only used with `href`.
|
|
147
|
-
* - `rel` — link rel attribute. Only used with `href`.
|
|
148
|
-
*
|
|
149
|
-
* Note: Automatically applies bottom border, hover effects, and selected state styling to all child elements.
|
|
150
|
-
*
|
|
151
|
-
* @example
|
|
152
|
-
* ```tsx
|
|
153
|
-
* <GridTableRow>
|
|
154
|
-
* <GridTableCell>Data</GridTableCell>
|
|
155
|
-
* </GridTableRow>
|
|
156
|
-
*
|
|
157
|
-
* // Last row (no bottom border)
|
|
158
|
-
* <GridTableRow last>
|
|
159
|
-
* <GridTableCell>Last row</GridTableCell>
|
|
160
|
-
* </GridTableRow>
|
|
161
|
-
*
|
|
162
|
-
* // Custom height
|
|
163
|
-
* <GridTableRow height="50px">
|
|
164
|
-
* <GridTableCell>Tall row</GridTableCell>
|
|
165
|
-
* </GridTableRow>
|
|
166
|
-
*
|
|
167
|
-
* // Clickable row
|
|
168
|
-
* <GridTableRow onRowClick={() => navigate('/details/123')}>
|
|
169
|
-
* <GridTableCell>Clickable row</GridTableCell>
|
|
170
|
-
* </GridTableRow>
|
|
171
|
-
*
|
|
172
|
-
* // Link row (native <a> element)
|
|
173
|
-
* <GridTableRow href="/pools/0x1234">
|
|
174
|
-
* <GridTableCell>Linked row</GridTableCell>
|
|
175
|
-
* </GridTableRow>
|
|
176
|
-
*
|
|
177
|
-
* // External link row
|
|
178
|
-
* <GridTableRow href="https://etherscan.io" target="_blank">
|
|
179
|
-
* <GridTableCell>External link row</GridTableCell>
|
|
180
|
-
* </GridTableRow>
|
|
181
|
-
* ```
|
|
182
|
-
*/
|
|
183
131
|
declare const GridTableRow: React.ForwardRefExoticComponent<GridTableRowProps & React.RefAttributes<HTMLDivElement | HTMLAnchorElement>>;
|
|
184
132
|
declare const gridTableHeadVariants: (props?: ({
|
|
185
133
|
size?: "default" | "sm" | "lg" | null | undefined;
|