@turtleclub/ui 0.7.0-beta.0 → 0.7.0-beta.2
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/.turbo/turbo-build.log +54 -56
- package/CHANGELOG.md +10 -0
- package/dist/index.cjs +17 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5222 -5320
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/features/data-table/data-table.d.ts.map +1 -1
- package/dist/types/components/molecules/index.d.ts +1 -1
- package/dist/types/components/molecules/index.d.ts.map +1 -1
- package/dist/types/components/molecules/opportunity/index.d.ts +0 -1
- package/dist/types/components/molecules/opportunity/index.d.ts.map +1 -1
- package/dist/types/components/molecules/route-details.d.ts +1 -1
- package/dist/types/components/molecules/route-details.d.ts.map +1 -1
- package/dist/types/components/molecules/swap-input.d.ts.map +1 -1
- package/dist/types/components/molecules/token-selector.d.ts +3 -2
- package/dist/types/components/molecules/token-selector.d.ts.map +1 -1
- package/dist/types/components/molecules/widget/base-selector.d.ts +9 -3
- package/dist/types/components/molecules/widget/base-selector.d.ts.map +1 -1
- package/dist/types/components/ui/combobox.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/features/data-table/data-table.tsx +134 -82
- package/src/components/molecules/index.ts +1 -1
- package/src/components/molecules/opportunity/index.ts +0 -1
- package/src/components/molecules/route-details.tsx +6 -4
- package/src/components/molecules/swap-input.tsx +2 -8
- package/src/components/molecules/token-selector.tsx +15 -4
- package/src/components/molecules/widget/base-selector.tsx +23 -6
- package/src/components/ui/combobox.tsx +67 -34
- package/src/components/ui/tooltip.tsx +1 -1
- package/dist/types/components/molecules/opportunity/opportunity-list/hooks/index.d.ts +0 -3
- package/dist/types/components/molecules/opportunity/opportunity-list/hooks/index.d.ts.map +0 -1
- package/dist/types/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-filtering.d.ts +0 -11
- package/dist/types/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-filtering.d.ts.map +0 -1
- package/dist/types/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-grouping.d.ts +0 -9
- package/dist/types/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-grouping.d.ts.map +0 -1
- package/dist/types/components/molecules/opportunity/opportunity-list/index.d.ts +0 -2
- package/dist/types/components/molecules/opportunity/opportunity-list/index.d.ts.map +0 -1
- package/dist/types/components/molecules/opportunity/opportunity-list/opportunity-list.d.ts +0 -22
- package/dist/types/components/molecules/opportunity/opportunity-list/opportunity-list.d.ts.map +0 -1
- package/src/components/molecules/opportunity/opportunity-list/hooks/index.ts +0 -2
- package/src/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-filtering.ts +0 -45
- package/src/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-grouping.ts +0 -85
- package/src/components/molecules/opportunity/opportunity-list/index.ts +0 -1
- package/src/components/molecules/opportunity/opportunity-list/opportunity-list.tsx +0 -142
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export * from "./tx-status";
|
|
2
2
|
export * from "./swap-input";
|
|
3
3
|
export * from "./swap-details";
|
|
4
|
-
export * from "./route-details";
|
|
5
4
|
export * from "./token-selector";
|
|
6
5
|
export * from "./slippage-selector";
|
|
7
6
|
export * from "./tabs";
|
|
8
7
|
export * from "./widget";
|
|
9
8
|
export * from "./opportunity";
|
|
9
|
+
export * from "./route-details";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -4,7 +4,6 @@ export * from "./opportunity-section";
|
|
|
4
4
|
export * from "./opportunity-disclaimer";
|
|
5
5
|
export * from "./opportunity-type";
|
|
6
6
|
export * from "./opportunity-selector";
|
|
7
|
-
export * from "./opportunity-list";
|
|
8
7
|
export { OpportunityItem } from "../widget/opportunity-item";
|
|
9
8
|
export type { OpportunityItemProps } from "../widget/opportunity-item";
|
|
10
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/opportunity/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/opportunity/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,0BAA0B,CAAC;AACzC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AAGvC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-details.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/route-details.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"route-details.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/route-details.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,WAAW,CAAC;IAChB,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,UAAU,iBAAiB;IACzB,KAAK,EAAE;QACL,KAAK,EAAE,SAAS,EAAE,CAAC;KACpB,CAAC;IACF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,YAAY,GAAI,sBAAsB,iBAAiB,4CAmFnE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"swap-input.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/swap-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,EAAiB,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG7D,UAAU,cACR,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC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C;IACjC,iBAAiB,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IACjC,0BAA0B,CAAC,EAAE,MAAM,IAAI,CAAC;CACzC;AAED,QAAA,MAAM,SAAS,uFA0Id,CAAC;AAIF,OAAO,EAAE,SAAS,EAAE,CAAC;AACrB,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-selector.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/token-selector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,UAAU,KAAK;IACb,
|
|
1
|
+
{"version":3,"file":"token-selector.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/token-selector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B,UAAU,KAAK;IACb,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,kBAAkB;IAC1B,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACjC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,QAAA,MAAM,aAAa,GAAI,iGAUpB,kBAAkB,4CA8HpB,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,KAAK,KAAK,EAAE,CAAC"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { ReactNode } from "react";
|
|
3
|
+
interface TokenLike {
|
|
4
|
+
symbol: string;
|
|
5
|
+
logoUrl?: string;
|
|
6
|
+
}
|
|
3
7
|
interface BaseSelectorProps {
|
|
4
8
|
icon?: React.ReactNode;
|
|
5
9
|
text: string;
|
|
@@ -9,9 +13,11 @@ interface BaseSelectorProps {
|
|
|
9
13
|
size?: "xs" | "sm" | "default";
|
|
10
14
|
placeholder?: string;
|
|
11
15
|
showIcon?: boolean;
|
|
16
|
+
token?: TokenLike;
|
|
12
17
|
}
|
|
13
18
|
declare const iconUrlToImg: (iconUrl?: string, alt?: string) => ReactNode;
|
|
14
|
-
declare const
|
|
15
|
-
|
|
16
|
-
export
|
|
19
|
+
declare const getTokenIcon: (token: TokenLike) => ReactNode;
|
|
20
|
+
declare const BaseSelector: ({ icon, text, onClick, className, variant, size, placeholder, showIcon, token, }: BaseSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export { BaseSelector, iconUrlToImg, getTokenIcon };
|
|
22
|
+
export type { BaseSelectorProps, TokenLike };
|
|
17
23
|
//# sourceMappingURL=base-selector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-selector.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/widget/base-selector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"base-selector.d.ts","sourceRoot":"","sources":["../../../../../src/components/molecules/widget/base-selector.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,UAAU,SAAS;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,UAAU,iBAAiB;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IACjC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAGD,QAAA,MAAM,YAAY,GAAI,UAAU,MAAM,EAAE,MAAK,MAAW,KAAG,SAQ1D,CAAC;AAGF,QAAA,MAAM,YAAY,GAAI,OAAO,SAAS,KAAG,SAExC,CAAC;AAEF,QAAA,MAAM,YAAY,GAAI,kFAUnB,iBAAiB,4CAmEnB,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC;AACpD,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../../src/components/ui/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAoB/B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,UAAU,cAAc,CAAC,CAAC,GAAG,MAAM;IACjC,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,KAAK,EAAE,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UI components library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@radix-ui/react-tooltip": "^1.2.7",
|
|
58
58
|
"@tanstack/match-sorter-utils": "^8.19.4",
|
|
59
59
|
"@tanstack/react-table": "^8.21.3",
|
|
60
|
-
"@turtleclub/utils": "0.
|
|
60
|
+
"@turtleclub/utils": "0.4.0-beta.0",
|
|
61
61
|
"class-variance-authority": "^0.7.1",
|
|
62
62
|
"clsx": "^2.1.1",
|
|
63
63
|
"cmdk": "^1.1.1",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"vite": "^7.1.6",
|
|
85
85
|
"vite-plugin-dts": "^4.5.4"
|
|
86
86
|
},
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "f7b8bd4f1b705bddc75960c371c87537598f9b13"
|
|
88
88
|
}
|
|
@@ -132,17 +132,22 @@ export function DataTable<TData, TValue>({
|
|
|
132
132
|
pagination: controlledPagination,
|
|
133
133
|
onPaginationChange: onControlledPaginationChange,
|
|
134
134
|
}: DataTableProps<TData, TValue>) {
|
|
135
|
-
const [columnVisibility, setColumnVisibility] = React.useState(
|
|
135
|
+
const [columnVisibility, setColumnVisibility] = React.useState(
|
|
136
|
+
initialColumnVisibility ?? {},
|
|
137
|
+
);
|
|
136
138
|
const [rowSelection, setRowSelection] = React.useState<RowSelectionState>({});
|
|
137
139
|
const [expanded, setExpanded] = React.useState<ExpandedState>({});
|
|
138
140
|
|
|
139
141
|
// Internal state (used when not controlled from outside)
|
|
140
|
-
const [internalGlobalFilter, setInternalGlobalFilter] =
|
|
141
|
-
|
|
142
|
-
const [
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
142
|
+
const [internalGlobalFilter, setInternalGlobalFilter] =
|
|
143
|
+
React.useState<string>("");
|
|
144
|
+
const [internalSorting, setInternalSorting] =
|
|
145
|
+
React.useState<SortingState>(initialSorting);
|
|
146
|
+
const [internalPagination, setInternalPagination] =
|
|
147
|
+
React.useState<PaginationState>({
|
|
148
|
+
pageIndex: 0,
|
|
149
|
+
pageSize: 10,
|
|
150
|
+
});
|
|
146
151
|
|
|
147
152
|
// Use controlled state if provided, otherwise use internal state
|
|
148
153
|
const globalFilter = controlledGlobalFilter ?? internalGlobalFilter;
|
|
@@ -157,9 +162,13 @@ export function DataTable<TData, TValue>({
|
|
|
157
162
|
}
|
|
158
163
|
};
|
|
159
164
|
|
|
160
|
-
const setSorting = (
|
|
165
|
+
const setSorting = (
|
|
166
|
+
updaterOrValue: SortingState | ((old: SortingState) => SortingState),
|
|
167
|
+
) => {
|
|
161
168
|
const newSorting =
|
|
162
|
-
typeof updaterOrValue === "function"
|
|
169
|
+
typeof updaterOrValue === "function"
|
|
170
|
+
? updaterOrValue(sorting)
|
|
171
|
+
: updaterOrValue;
|
|
163
172
|
|
|
164
173
|
if (onControlledSortingChange) {
|
|
165
174
|
onControlledSortingChange(newSorting);
|
|
@@ -169,10 +178,14 @@ export function DataTable<TData, TValue>({
|
|
|
169
178
|
};
|
|
170
179
|
|
|
171
180
|
const setPagination = (
|
|
172
|
-
updaterOrValue:
|
|
181
|
+
updaterOrValue:
|
|
182
|
+
| PaginationState
|
|
183
|
+
| ((old: PaginationState) => PaginationState),
|
|
173
184
|
) => {
|
|
174
185
|
const newPagination =
|
|
175
|
-
typeof updaterOrValue === "function"
|
|
186
|
+
typeof updaterOrValue === "function"
|
|
187
|
+
? updaterOrValue(pagination)
|
|
188
|
+
: updaterOrValue;
|
|
176
189
|
|
|
177
190
|
if (onControlledPaginationChange) {
|
|
178
191
|
onControlledPaginationChange(newPagination);
|
|
@@ -218,7 +231,9 @@ export function DataTable<TData, TValue>({
|
|
|
218
231
|
getFilteredRowModel: !manualFiltering ? getFilteredRowModel() : undefined,
|
|
219
232
|
getSortedRowModel: !manualSorting ? getSortedRowModel() : undefined,
|
|
220
233
|
getPaginationRowModel:
|
|
221
|
-
enablePagination && !manualPagination
|
|
234
|
+
enablePagination && !manualPagination
|
|
235
|
+
? getPaginationRowModel()
|
|
236
|
+
: undefined,
|
|
222
237
|
getExpandedRowModel: getExpandedRowModel(),
|
|
223
238
|
|
|
224
239
|
// debugTable: true,
|
|
@@ -232,7 +247,7 @@ export function DataTable<TData, TValue>({
|
|
|
232
247
|
.getHeaderGroups()
|
|
233
248
|
.map((headerGroup) => headerGroup.headers)
|
|
234
249
|
.flat(),
|
|
235
|
-
[table]
|
|
250
|
+
[table],
|
|
236
251
|
);
|
|
237
252
|
|
|
238
253
|
return (
|
|
@@ -261,7 +276,10 @@ export function DataTable<TData, TValue>({
|
|
|
261
276
|
)}
|
|
262
277
|
</div>
|
|
263
278
|
) : undefined}
|
|
264
|
-
<ScrollArea
|
|
279
|
+
<ScrollArea
|
|
280
|
+
style={{ height: getScrollAreaHeight(size) }}
|
|
281
|
+
className={className}
|
|
282
|
+
>
|
|
265
283
|
{table.getRowModel().rows?.length || isLoading ? (
|
|
266
284
|
grid?.displayAsGrid ? (
|
|
267
285
|
isLoading ? (
|
|
@@ -269,15 +287,15 @@ export function DataTable<TData, TValue>({
|
|
|
269
287
|
className={cn(
|
|
270
288
|
"grid gap-1 pr-1.5",
|
|
271
289
|
"grid-cols-1 md:grid-cols-2 xl:grid-cols-3",
|
|
272
|
-
grid.className
|
|
290
|
+
grid.className,
|
|
273
291
|
)}
|
|
274
292
|
/>
|
|
275
293
|
) : (
|
|
276
294
|
<div
|
|
277
295
|
className={cn(
|
|
278
296
|
"grid gap-1 pr-1.5",
|
|
279
|
-
"grid-cols-1 md:grid-cols-2 xl:grid-cols-3",
|
|
280
|
-
grid.className
|
|
297
|
+
// "grid-cols-1 md:grid-cols-2 xl:grid-cols-3",
|
|
298
|
+
grid.className,
|
|
281
299
|
)}
|
|
282
300
|
>
|
|
283
301
|
{table.getRowModel().rows.map((row) => (
|
|
@@ -285,7 +303,9 @@ export function DataTable<TData, TValue>({
|
|
|
285
303
|
<Card
|
|
286
304
|
className={cn(
|
|
287
305
|
"max-w-none",
|
|
288
|
-
onRowClick
|
|
306
|
+
onRowClick
|
|
307
|
+
? "hover:bg-neutral-alpha-5 cursor-pointer"
|
|
308
|
+
: "",
|
|
289
309
|
)}
|
|
290
310
|
data-state={row.getIsSelected() && "selected"}
|
|
291
311
|
variant="border"
|
|
@@ -295,10 +315,15 @@ export function DataTable<TData, TValue>({
|
|
|
295
315
|
<CardTitle className="line-clamp-1 grow text-base">
|
|
296
316
|
{row
|
|
297
317
|
.getVisibleCells()
|
|
298
|
-
.filter(
|
|
318
|
+
.filter(
|
|
319
|
+
(cell) => cell.column.id === grid.headerSlot,
|
|
320
|
+
)
|
|
299
321
|
?.map((cell) => (
|
|
300
322
|
<Fragment key={cell.id}>
|
|
301
|
-
{flexRender(
|
|
323
|
+
{flexRender(
|
|
324
|
+
cell.column.columnDef.cell,
|
|
325
|
+
cell.getContext(),
|
|
326
|
+
)}
|
|
302
327
|
</Fragment>
|
|
303
328
|
))}
|
|
304
329
|
</CardTitle>
|
|
@@ -308,7 +333,10 @@ export function DataTable<TData, TValue>({
|
|
|
308
333
|
.filter((cell) => cell.column.id === grid?.rightSlot)
|
|
309
334
|
?.map((cell) => (
|
|
310
335
|
<div key={cell.id} className="text-lg">
|
|
311
|
-
{flexRender(
|
|
336
|
+
{flexRender(
|
|
337
|
+
cell.column.columnDef.cell,
|
|
338
|
+
cell.getContext(),
|
|
339
|
+
)}
|
|
312
340
|
</div>
|
|
313
341
|
))}
|
|
314
342
|
</CardHeader>
|
|
@@ -320,7 +348,7 @@ export function DataTable<TData, TValue>({
|
|
|
320
348
|
cell.column.id !== grid.headerSlot &&
|
|
321
349
|
cell.column.id !== grid.rightSlot &&
|
|
322
350
|
// @ts-expect-error I know that column id by defintion is keyof TData
|
|
323
|
-
!grid.excludeColumns?.includes(cell.column.id)
|
|
351
|
+
!grid.excludeColumns?.includes(cell.column.id),
|
|
324
352
|
)
|
|
325
353
|
.map((cell) => {
|
|
326
354
|
return (
|
|
@@ -329,10 +357,15 @@ export function DataTable<TData, TValue>({
|
|
|
329
357
|
title={flexRender(
|
|
330
358
|
cell.column.columnDef.header,
|
|
331
359
|
headers
|
|
332
|
-
.find(
|
|
333
|
-
|
|
360
|
+
.find(
|
|
361
|
+
(header) => header.id === cell.column.id,
|
|
362
|
+
)
|
|
363
|
+
?.getContext(),
|
|
364
|
+
)}
|
|
365
|
+
value={flexRender(
|
|
366
|
+
cell.column.columnDef.cell,
|
|
367
|
+
cell.getContext(),
|
|
334
368
|
)}
|
|
335
|
-
value={flexRender(cell.column.columnDef.cell, cell.getContext())}
|
|
336
369
|
className="justify-between gap-3 *:text-xs"
|
|
337
370
|
/>
|
|
338
371
|
);
|
|
@@ -366,11 +399,18 @@ export function DataTable<TData, TValue>({
|
|
|
366
399
|
<TableRow
|
|
367
400
|
onClick={() => onRowClick?.(row.original)}
|
|
368
401
|
data-state={row.getIsSelected() && "selected"}
|
|
369
|
-
className={
|
|
402
|
+
className={
|
|
403
|
+
onRowClick
|
|
404
|
+
? "hover:bg-neutral-alpha-5 cursor-pointer"
|
|
405
|
+
: ""
|
|
406
|
+
}
|
|
370
407
|
>
|
|
371
408
|
{row.getVisibleCells().map((cell) => (
|
|
372
409
|
<ShadTableCell key={cell.id}>
|
|
373
|
-
{flexRender(
|
|
410
|
+
{flexRender(
|
|
411
|
+
cell.column.columnDef.cell,
|
|
412
|
+
cell.getContext(),
|
|
413
|
+
)}
|
|
374
414
|
</ShadTableCell>
|
|
375
415
|
))}
|
|
376
416
|
</TableRow>
|
|
@@ -396,67 +436,79 @@ export function DataTable<TData, TValue>({
|
|
|
396
436
|
))
|
|
397
437
|
)}
|
|
398
438
|
</ScrollArea>
|
|
399
|
-
{enablePagination &&
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
439
|
+
{enablePagination &&
|
|
440
|
+
(manualPagination
|
|
441
|
+
? (pageCount ?? 0) > 1
|
|
442
|
+
: table.getPageCount() > 1) && (
|
|
443
|
+
<Pagination>
|
|
444
|
+
<PaginationContent>
|
|
445
|
+
<PaginationItem>
|
|
446
|
+
<PaginationPrevious
|
|
447
|
+
onClick={() => table.previousPage()}
|
|
448
|
+
className={
|
|
449
|
+
!table.getCanPreviousPage()
|
|
450
|
+
? "pointer-events-none opacity-50"
|
|
451
|
+
: "cursor-pointer"
|
|
452
|
+
}
|
|
453
|
+
/>
|
|
454
|
+
</PaginationItem>
|
|
455
|
+
{Array.from({ length: table.getPageCount() }, (_, i) => i).map(
|
|
456
|
+
(pageIndex) => {
|
|
457
|
+
const currentPage = table.getState().pagination.pageIndex;
|
|
458
|
+
const totalPages = table.getPageCount();
|
|
413
459
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
460
|
+
// Show first page, last page, current page, and pages around current
|
|
461
|
+
const showPage =
|
|
462
|
+
pageIndex === 0 ||
|
|
463
|
+
pageIndex === totalPages - 1 ||
|
|
464
|
+
(pageIndex >= currentPage - 1 &&
|
|
465
|
+
pageIndex <= currentPage + 1);
|
|
419
466
|
|
|
420
|
-
|
|
421
|
-
|
|
467
|
+
// Show ellipsis before current range (but not right after first page)
|
|
468
|
+
const showEllipsisBefore =
|
|
469
|
+
pageIndex === currentPage - 2 && currentPage > 2;
|
|
422
470
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
471
|
+
// Show ellipsis after current range (but not right before last page)
|
|
472
|
+
const showEllipsisAfter =
|
|
473
|
+
pageIndex === currentPage + 2 &&
|
|
474
|
+
currentPage < totalPages - 3;
|
|
426
475
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
476
|
+
if (showEllipsisBefore || showEllipsisAfter) {
|
|
477
|
+
return (
|
|
478
|
+
<PaginationItem key={pageIndex}>
|
|
479
|
+
<PaginationEllipsis />
|
|
480
|
+
</PaginationItem>
|
|
481
|
+
);
|
|
482
|
+
}
|
|
434
483
|
|
|
435
|
-
|
|
484
|
+
if (!showPage) return null;
|
|
436
485
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
<
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
486
|
+
return (
|
|
487
|
+
<PaginationItem key={pageIndex}>
|
|
488
|
+
<PaginationLink
|
|
489
|
+
onClick={() => table.setPageIndex(pageIndex)}
|
|
490
|
+
isActive={currentPage === pageIndex}
|
|
491
|
+
className="cursor-pointer"
|
|
492
|
+
>
|
|
493
|
+
{pageIndex + 1}
|
|
494
|
+
</PaginationLink>
|
|
495
|
+
</PaginationItem>
|
|
496
|
+
);
|
|
497
|
+
},
|
|
498
|
+
)}
|
|
499
|
+
<PaginationItem>
|
|
500
|
+
<PaginationNext
|
|
501
|
+
onClick={() => table.nextPage()}
|
|
502
|
+
className={
|
|
503
|
+
!table.getCanNextPage()
|
|
504
|
+
? "pointer-events-none opacity-50"
|
|
505
|
+
: "cursor-pointer"
|
|
506
|
+
}
|
|
507
|
+
/>
|
|
508
|
+
</PaginationItem>
|
|
509
|
+
</PaginationContent>
|
|
510
|
+
</Pagination>
|
|
511
|
+
)}
|
|
460
512
|
</div>
|
|
461
513
|
);
|
|
462
514
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export * from "./tx-status";
|
|
2
2
|
export * from "./swap-input";
|
|
3
3
|
export * from "./swap-details";
|
|
4
|
-
export * from "./route-details";
|
|
5
4
|
export * from "./token-selector";
|
|
6
5
|
export * from "./slippage-selector";
|
|
7
6
|
export * from "./tabs";
|
|
8
7
|
export * from "./widget";
|
|
9
8
|
export * from "./opportunity";
|
|
9
|
+
export * from "./route-details";
|
|
@@ -4,7 +4,6 @@ export * from "./opportunity-section";
|
|
|
4
4
|
export * from "./opportunity-disclaimer";
|
|
5
5
|
export * from "./opportunity-type";
|
|
6
6
|
export * from "./opportunity-selector";
|
|
7
|
-
export * from "./opportunity-list";
|
|
8
7
|
|
|
9
8
|
// Re-export OpportunityItem from widget folder
|
|
10
9
|
export { OpportunityItem } from "../widget/opportunity-item";
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import { Card, CardContent } from "
|
|
3
|
-
import { LabelWithIcon } from "../ui";
|
|
4
|
-
import { ScrollArea } from "
|
|
2
|
+
import { Card, CardContent } from "../ui/card";
|
|
3
|
+
import { LabelWithIcon } from "../ui/label-with-icon";
|
|
4
|
+
import { ScrollArea } from "../ui/scroll-area";
|
|
5
5
|
import { ChevronsRight } from "lucide-react";
|
|
6
6
|
import ensoLogo from "../../images/enso.png";
|
|
7
7
|
import { useMemo } from "react";
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
// Local type definitions (no dependency on @turtleclub/hooks)
|
|
10
|
+
export interface SimpleToken {
|
|
10
11
|
icon?: React.ReactNode | string;
|
|
11
12
|
symbol: string;
|
|
12
13
|
}
|
|
14
|
+
|
|
13
15
|
export interface TokenStep {
|
|
14
16
|
in: SimpleToken;
|
|
15
17
|
out: SimpleToken | null;
|
|
@@ -4,7 +4,7 @@ import { Card } from "@/components/ui/card";
|
|
|
4
4
|
import { Input } from "@/components/ui/input";
|
|
5
5
|
import { Chip } from "@/components/ui/chip";
|
|
6
6
|
import { TokenSelector, type Token } from "./token-selector";
|
|
7
|
-
import { BaseSelector
|
|
7
|
+
import { BaseSelector } from "./widget/base-selector";
|
|
8
8
|
|
|
9
9
|
interface SwapInputProps
|
|
10
10
|
extends Omit<React.HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
@@ -105,13 +105,7 @@ const SwapInput = React.forwardRef<HTMLDivElement, SwapInputProps>(
|
|
|
105
105
|
{!hideTokenSelector &&
|
|
106
106
|
(useCustomTokenSelector ? (
|
|
107
107
|
<BaseSelector
|
|
108
|
-
|
|
109
|
-
currentToken?.icon
|
|
110
|
-
? typeof currentToken.icon === "string"
|
|
111
|
-
? iconUrlToImg(currentToken.icon, currentToken.symbol)
|
|
112
|
-
: currentToken.icon
|
|
113
|
-
: undefined
|
|
114
|
-
}
|
|
108
|
+
token={currentToken ?? undefined}
|
|
115
109
|
text={currentToken?.symbol || ""}
|
|
116
110
|
onClick={onCustomTokenSelectorClick}
|
|
117
111
|
placeholder="Select token"
|
|
@@ -10,10 +10,12 @@ import {
|
|
|
10
10
|
import { useEffect } from "react";
|
|
11
11
|
|
|
12
12
|
interface Token {
|
|
13
|
-
icon: React.ReactNode;
|
|
14
13
|
symbol: string;
|
|
15
14
|
address: string;
|
|
16
|
-
|
|
15
|
+
logoUrl?: string;
|
|
16
|
+
// Optional for backwards compatibility
|
|
17
|
+
icon?: React.ReactNode;
|
|
18
|
+
balance?: string;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
interface TokenSelectorProps {
|
|
@@ -48,6 +50,15 @@ const TokenSelector = ({
|
|
|
48
50
|
(token) => token.address === effectiveValue,
|
|
49
51
|
);
|
|
50
52
|
|
|
53
|
+
// Helper to get icon (either provided icon or generated from logoUrl)
|
|
54
|
+
const getTokenIcon = (token: Token) => {
|
|
55
|
+
if (token.icon) return token.icon;
|
|
56
|
+
if (token.logoUrl) {
|
|
57
|
+
return <img src={token.logoUrl} alt={token.symbol} className="size-full rounded-full" />;
|
|
58
|
+
}
|
|
59
|
+
return null;
|
|
60
|
+
};
|
|
61
|
+
|
|
51
62
|
// Handle value change and auto-select first token on mount
|
|
52
63
|
useEffect(() => {
|
|
53
64
|
if (!value && tokens.length > 0 && onValueChange) {
|
|
@@ -90,7 +101,7 @@ const TokenSelector = ({
|
|
|
90
101
|
size === "default" && "h-4 w-5",
|
|
91
102
|
)}
|
|
92
103
|
>
|
|
93
|
-
{selectedToken
|
|
104
|
+
{getTokenIcon(selectedToken)}
|
|
94
105
|
</span>
|
|
95
106
|
<span
|
|
96
107
|
className={cn(
|
|
@@ -133,7 +144,7 @@ const TokenSelector = ({
|
|
|
133
144
|
size === "default" && "h-4 w-5",
|
|
134
145
|
)}
|
|
135
146
|
>
|
|
136
|
-
{token
|
|
147
|
+
{getTokenIcon(token)}
|
|
137
148
|
</span>
|
|
138
149
|
<span
|
|
139
150
|
className={cn(
|