@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.
Files changed (45) hide show
  1. package/.turbo/turbo-build.log +54 -56
  2. package/CHANGELOG.md +10 -0
  3. package/dist/index.cjs +17 -17
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.js +5222 -5320
  6. package/dist/index.js.map +1 -1
  7. package/dist/styles.css +1 -1
  8. package/dist/types/components/features/data-table/data-table.d.ts.map +1 -1
  9. package/dist/types/components/molecules/index.d.ts +1 -1
  10. package/dist/types/components/molecules/index.d.ts.map +1 -1
  11. package/dist/types/components/molecules/opportunity/index.d.ts +0 -1
  12. package/dist/types/components/molecules/opportunity/index.d.ts.map +1 -1
  13. package/dist/types/components/molecules/route-details.d.ts +1 -1
  14. package/dist/types/components/molecules/route-details.d.ts.map +1 -1
  15. package/dist/types/components/molecules/swap-input.d.ts.map +1 -1
  16. package/dist/types/components/molecules/token-selector.d.ts +3 -2
  17. package/dist/types/components/molecules/token-selector.d.ts.map +1 -1
  18. package/dist/types/components/molecules/widget/base-selector.d.ts +9 -3
  19. package/dist/types/components/molecules/widget/base-selector.d.ts.map +1 -1
  20. package/dist/types/components/ui/combobox.d.ts.map +1 -1
  21. package/package.json +3 -3
  22. package/src/components/features/data-table/data-table.tsx +134 -82
  23. package/src/components/molecules/index.ts +1 -1
  24. package/src/components/molecules/opportunity/index.ts +0 -1
  25. package/src/components/molecules/route-details.tsx +6 -4
  26. package/src/components/molecules/swap-input.tsx +2 -8
  27. package/src/components/molecules/token-selector.tsx +15 -4
  28. package/src/components/molecules/widget/base-selector.tsx +23 -6
  29. package/src/components/ui/combobox.tsx +67 -34
  30. package/src/components/ui/tooltip.tsx +1 -1
  31. package/dist/types/components/molecules/opportunity/opportunity-list/hooks/index.d.ts +0 -3
  32. package/dist/types/components/molecules/opportunity/opportunity-list/hooks/index.d.ts.map +0 -1
  33. package/dist/types/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-filtering.d.ts +0 -11
  34. package/dist/types/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-filtering.d.ts.map +0 -1
  35. package/dist/types/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-grouping.d.ts +0 -9
  36. package/dist/types/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-grouping.d.ts.map +0 -1
  37. package/dist/types/components/molecules/opportunity/opportunity-list/index.d.ts +0 -2
  38. package/dist/types/components/molecules/opportunity/opportunity-list/index.d.ts.map +0 -1
  39. package/dist/types/components/molecules/opportunity/opportunity-list/opportunity-list.d.ts +0 -22
  40. package/dist/types/components/molecules/opportunity/opportunity-list/opportunity-list.d.ts.map +0 -1
  41. package/src/components/molecules/opportunity/opportunity-list/hooks/index.ts +0 -2
  42. package/src/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-filtering.ts +0 -45
  43. package/src/components/molecules/opportunity/opportunity-list/hooks/use-opportunity-grouping.ts +0 -85
  44. package/src/components/molecules/opportunity/opportunity-list/index.ts +0 -1
  45. 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
- };