@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,142 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import React, { useState } from "react";
|
|
3
|
-
import { WidgetListItems } from "../../widget/widget-list-items";
|
|
4
|
-
import {
|
|
5
|
-
OpportunityItem,
|
|
6
|
-
OpportunityItemValue,
|
|
7
|
-
} from "../../widget/opportunity-item";
|
|
8
|
-
import {
|
|
9
|
-
AssetFilters,
|
|
10
|
-
AssetFilterItem,
|
|
11
|
-
} from "../../widget/asset-list/asset-filters";
|
|
12
|
-
import { useOpportunityFiltering, useOpportunityGrouping } from "./hooks";
|
|
13
|
-
import { ScrollArea } from "@/components/ui/scroll-area";
|
|
14
|
-
import { cn } from "@/lib/utils";
|
|
15
|
-
|
|
16
|
-
export interface OpportunityFilter extends AssetFilterItem {
|
|
17
|
-
filterFn: (opportunity: OpportunityItemValue) => boolean;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface OpportunityListProps {
|
|
21
|
-
// Data
|
|
22
|
-
opportunities: OpportunityItemValue[];
|
|
23
|
-
onOpportunityClick?: (opportunity: OpportunityItemValue) => void;
|
|
24
|
-
|
|
25
|
-
// Display options
|
|
26
|
-
groupBy?: "none" | "partner" | "chain";
|
|
27
|
-
|
|
28
|
-
// Filtering options
|
|
29
|
-
filters?: OpportunityFilter[];
|
|
30
|
-
filterVariant?: "badge" | "navigation";
|
|
31
|
-
multipleFilters?: boolean;
|
|
32
|
-
|
|
33
|
-
// Search options
|
|
34
|
-
showSearch?: boolean;
|
|
35
|
-
searchPlaceholder?: string;
|
|
36
|
-
searchDebounceDelay?: number;
|
|
37
|
-
|
|
38
|
-
// Styling
|
|
39
|
-
className?: string;
|
|
40
|
-
itemClassName?: string;
|
|
41
|
-
emptyState?: React.ReactNode;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// Default filters
|
|
45
|
-
const defaultFilters: OpportunityFilter[] = [
|
|
46
|
-
{
|
|
47
|
-
id: "all",
|
|
48
|
-
label: "All",
|
|
49
|
-
filterFn: (_) => true,
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
id: "stablecoins",
|
|
53
|
-
label: "Stables",
|
|
54
|
-
filterFn: (opportunity) => opportunity.name.includes("USD"),
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
id: "eth",
|
|
58
|
-
label: "ETH",
|
|
59
|
-
filterFn: (opportunity) => opportunity.name.includes("ETH"),
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
id: "btc",
|
|
63
|
-
label: "BTC",
|
|
64
|
-
filterFn: (opportunity) => opportunity.name.includes("BTC"),
|
|
65
|
-
},
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
export const OpportunityList: React.FC<OpportunityListProps> = ({
|
|
69
|
-
opportunities,
|
|
70
|
-
onOpportunityClick,
|
|
71
|
-
groupBy = "none",
|
|
72
|
-
filters = defaultFilters,
|
|
73
|
-
filterVariant = "badge",
|
|
74
|
-
multipleFilters = true,
|
|
75
|
-
showSearch = true,
|
|
76
|
-
searchPlaceholder = "Search opportunities...",
|
|
77
|
-
searchDebounceDelay = 300,
|
|
78
|
-
className,
|
|
79
|
-
itemClassName,
|
|
80
|
-
emptyState,
|
|
81
|
-
}) => {
|
|
82
|
-
const [searchQuery, setSearchQuery] = useState("");
|
|
83
|
-
const [activeFilterIds, setActiveFilterIds] = useState<string[]>([]);
|
|
84
|
-
|
|
85
|
-
// Use custom hooks for filtering and grouping
|
|
86
|
-
const filteredOpportunities = useOpportunityFiltering({
|
|
87
|
-
opportunities,
|
|
88
|
-
searchQuery,
|
|
89
|
-
activeFilterIds,
|
|
90
|
-
filters,
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
const groups = useOpportunityGrouping({
|
|
94
|
-
opportunities: filteredOpportunities,
|
|
95
|
-
groupBy,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const renderOpportunity = (opportunity: OpportunityItemValue) => (
|
|
99
|
-
<OpportunityItem
|
|
100
|
-
value={opportunity}
|
|
101
|
-
onSelect={() => onOpportunityClick?.(opportunity)}
|
|
102
|
-
className={itemClassName}
|
|
103
|
-
/>
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<div className={cn("flex h-full flex-col", className)}>
|
|
108
|
-
<div className="mb-4 flex-shrink-0">
|
|
109
|
-
<AssetFilters
|
|
110
|
-
filters={filters.map(({ filterFn, ...rest }) => rest)}
|
|
111
|
-
activeFilters={activeFilterIds}
|
|
112
|
-
onFiltersChange={setActiveFilterIds}
|
|
113
|
-
variant={filterVariant}
|
|
114
|
-
multipleFilters={multipleFilters}
|
|
115
|
-
showSearch={showSearch}
|
|
116
|
-
searchValue={searchQuery}
|
|
117
|
-
onSearchChange={setSearchQuery}
|
|
118
|
-
searchPlaceholder={searchPlaceholder}
|
|
119
|
-
searchDebounceDelay={searchDebounceDelay}
|
|
120
|
-
/>
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<ScrollArea className="flex-1">
|
|
124
|
-
<WidgetListItems
|
|
125
|
-
groups={groups}
|
|
126
|
-
renderItem={renderOpportunity}
|
|
127
|
-
getItemKey={(opportunity) => opportunity.name}
|
|
128
|
-
showGroupHeaders={groupBy !== "none"}
|
|
129
|
-
emptyState={
|
|
130
|
-
emptyState || (
|
|
131
|
-
<div className="text-muted-foreground py-8 text-center">
|
|
132
|
-
{searchQuery || activeFilterIds.length > 0
|
|
133
|
-
? "No opportunities match your filters"
|
|
134
|
-
: "No opportunities available"}
|
|
135
|
-
</div>
|
|
136
|
-
)
|
|
137
|
-
}
|
|
138
|
-
/>
|
|
139
|
-
</ScrollArea>
|
|
140
|
-
</div>
|
|
141
|
-
);
|
|
142
|
-
};
|