@babylonlabs-io/core-ui 1.27.0 → 1.29.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.
@@ -1,7 +1,11 @@
1
1
  import { PropsWithChildren, ReactNode } from "react";
2
- interface Info {
3
- icon: ReactNode;
2
+ interface TokenReward {
3
+ icon?: ReactNode;
4
4
  name: string;
5
+ amount?: {
6
+ token: string;
7
+ usd: string;
8
+ };
5
9
  }
6
10
  interface PreviewModalProps {
7
11
  open: boolean;
@@ -9,16 +13,11 @@ interface PreviewModalProps {
9
13
  title: string;
10
14
  onClose: () => void;
11
15
  onProceed: () => void;
12
- warning: string;
13
- bsns: Info[];
14
- amount: {
15
- token: string;
16
- usd: string;
17
- };
16
+ tokens: TokenReward[];
18
17
  transactionFees: {
19
18
  token: string;
20
19
  usd: string;
21
20
  };
22
21
  }
23
- export declare const RewardsPreviewModal: ({ open, processing, title, onClose, onProceed, bsns, warning, amount, transactionFees, }: PropsWithChildren<PreviewModalProps>) => import("react/jsx-runtime").JSX.Element;
22
+ export declare const RewardsPreviewModal: ({ open, processing, title, onClose, onProceed, tokens, transactionFees, }: PropsWithChildren<PreviewModalProps>) => import("react/jsx-runtime").JSX.Element;
24
23
  export {};
@@ -1,6 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Button } from "@/components/Button";
3
- import { Warning } from "@/components/Warning";
4
3
  import { WINDOW_BREAKPOINT } from "../../../utils/constants";
5
4
  import { Dialog, MobileDialog, DialogBody, DialogFooter, DialogHeader } from "@/components/Dialog";
6
5
  import { useIsMobile } from "@/hooks/useIsMobile";
@@ -11,6 +10,6 @@ function ResponsiveDialog({ className, ...restProps }) {
11
10
  const DialogComponent = isMobileView ? MobileDialog : Dialog;
12
11
  return _jsx(DialogComponent, { ...restProps, className: twMerge("w-[41.25rem] max-w-full", className) });
13
12
  }
14
- export const RewardsPreviewModal = ({ open, processing = false, title, onClose, onProceed, bsns, warning, amount, transactionFees, }) => {
15
- return (_jsxs(ResponsiveDialog, { open: open, onClose: onClose, children: [_jsx(DialogHeader, { title: title, className: "text-accent-primary" }), _jsxs(DialogBody, { className: "no-scrollbar mb-[40px] mt-8 flex max-h-[calc(100vh-12rem)] flex-col gap-[40px] overflow-y-auto text-accent-primary", children: [_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(FeeItem, { title: "Receiving", children: _jsx("div", { className: "flex flex-col items-end gap-1", children: bsns.map((item, index) => (_jsxs("div", { className: "flex items-center gap-2", children: [item.icon, item.name] }, `bsn-${index}`))) }) }), _jsx("div", { className: "border-divider w-full border-t" }), _jsx(FeeItem, { title: "Amount", hint: amount.usd, children: amount.token }), _jsx("div", { className: "border-divider w-full border-t" }), _jsx(FeeItem, { title: "Transaction Fees", hint: transactionFees.usd, children: transactionFees.token })] }), _jsx(Warning, { children: warning })] }), _jsxs(DialogFooter, { className: "flex flex-col gap-4 pt-0 sm:flex-row", children: [_jsx(Button, { variant: "contained", color: "primary", onClick: onProceed, className: "w-full sm:flex-1 sm:order-2", disabled: processing, children: processing ? "Processing..." : "Proceed" }), _jsx(Button, { variant: "outlined", color: "primary", onClick: onClose, className: "w-full sm:flex-1 sm:order-1", children: "Cancel" })] })] }));
13
+ export const RewardsPreviewModal = ({ open, processing = false, title, onClose, onProceed, tokens, transactionFees, }) => {
14
+ return (_jsxs(ResponsiveDialog, { open: open, onClose: onClose, children: [_jsx(DialogHeader, { title: title, className: "text-accent-primary" }), _jsx(DialogBody, { className: "no-scrollbar mb-[40px] mt-8 flex max-h-[calc(100vh-12rem)] flex-col overflow-y-auto text-accent-primary", children: _jsxs("div", { className: "flex flex-col", children: [_jsx("div", { className: "max-h-[300px] overflow-y-auto", children: tokens.map((token, index) => (_jsxs("div", { children: [_jsx(FeeItem, { title: token.name, hint: token.amount?.usd, children: _jsxs("div", { className: "flex items-center gap-2", children: [token.icon, token.amount?.token] }) }), index < tokens.length - 1 && _jsx("div", { className: "h-4" })] }, `token-${index}`))) }), _jsx("div", { className: "pt-6 pb-6", children: _jsx("div", { className: "border-divider w-full border-t" }) }), _jsx(FeeItem, { title: "Transaction Fees", hint: transactionFees.usd, children: transactionFees.token })] }) }), _jsxs(DialogFooter, { className: "flex flex-col gap-4 pt-0 sm:flex-row", children: [_jsx(Button, { variant: "contained", color: "primary", onClick: onProceed, className: "w-full sm:flex-1 sm:order-2", disabled: processing, children: processing ? "Processing..." : "Proceed" }), _jsx(Button, { variant: "outlined", color: "primary", onClick: onClose, className: "w-full sm:flex-1 sm:order-1", children: "Cancel" })] })] }));
16
15
  };
@@ -5,3 +5,5 @@ export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const OneReceivingToken: Story;
8
+ export declare const TokensWithoutIcons: Story;
9
+ export declare const LongTokenList: Story;
@@ -12,26 +12,36 @@ export const Default = {
12
12
  processing: false,
13
13
  onClose: () => { },
14
14
  onProceed: () => { },
15
- bsns: [
15
+ tokens: [
16
16
  {
17
17
  icon: _jsx(PlaceholderIcon, { text: "B1", bgColor: "bg-black" }),
18
- name: "Token 1",
18
+ name: "Babylon Genesis",
19
+ amount: {
20
+ token: "1000 BABY",
21
+ usd: "~ $5,677.39 USD",
22
+ },
19
23
  },
20
24
  {
21
- icon: _jsx(PlaceholderIcon, { text: "B2", bgColor: "bg-black" }),
22
- name: "Token 2",
25
+ icon: _jsx(PlaceholderIcon, { text: "C", bgColor: "bg-blue-500" }),
26
+ name: "Cosmos",
27
+ amount: {
28
+ token: "500 ATOM",
29
+ usd: "~ $2,621.78 USD",
30
+ },
31
+ },
32
+ {
33
+ name: "Sui",
34
+ amount: {
35
+ token: "100 SUI",
36
+ usd: "~ $399.79 USD",
37
+ },
23
38
  },
24
39
  ],
25
- amount: {
26
- token: "100.000 BABY",
27
- usd: "$6,677.15 USD",
28
- },
29
40
  transactionFees: {
30
41
  token: "10 BABY",
31
42
  usd: "$0.56 USD",
32
43
  },
33
- warning: "Processing your claim will take approximately 2 blocks to complete. BABY is a test token without any real world value.",
34
- title: "Claim BABY Rewards",
44
+ title: "Claim Rewards",
35
45
  },
36
46
  };
37
47
  export const OneReceivingToken = {
@@ -40,21 +50,141 @@ export const OneReceivingToken = {
40
50
  processing: false,
41
51
  onClose: () => { },
42
52
  onProceed: () => { },
43
- bsns: [
53
+ tokens: [
44
54
  {
45
55
  icon: _jsx(PlaceholderIcon, { text: "B1", bgColor: "bg-black" }),
46
- name: "Token 1",
56
+ name: "Babylon Genesis",
57
+ amount: {
58
+ token: "1000 BABY",
59
+ usd: "~ $5,677.39 USD",
60
+ },
47
61
  },
48
62
  ],
49
- amount: {
50
- token: "100.000 BABY",
51
- usd: "$6,677.15 USD",
52
- },
53
63
  transactionFees: {
54
64
  token: "10 BABY",
55
65
  usd: "$0.56 USD",
56
66
  },
57
- warning: "Processing your claim will take approximately 2 blocks to complete. BABY is a test token without any real world value.",
58
67
  title: "Claim BABY Rewards",
59
68
  },
60
69
  };
70
+ export const TokensWithoutIcons = {
71
+ args: {
72
+ open: true,
73
+ processing: false,
74
+ onClose: () => { },
75
+ onProceed: () => { },
76
+ tokens: [
77
+ {
78
+ name: "Babylon Genesis",
79
+ amount: {
80
+ token: "1000 BABY",
81
+ usd: "~ $5,677.39 USD",
82
+ },
83
+ },
84
+ {
85
+ name: "Cosmos",
86
+ amount: {
87
+ token: "500 ATOM",
88
+ usd: "~ $2,621.78 USD",
89
+ },
90
+ },
91
+ ],
92
+ transactionFees: {
93
+ token: "10 BABY",
94
+ usd: "$0.56 USD",
95
+ },
96
+ title: "Claim Rewards - No Icons",
97
+ },
98
+ };
99
+ export const LongTokenList = {
100
+ args: {
101
+ open: true,
102
+ processing: false,
103
+ onClose: () => { },
104
+ onProceed: () => { },
105
+ tokens: [
106
+ {
107
+ icon: _jsx(PlaceholderIcon, { text: "B", bgColor: "bg-black" }),
108
+ name: "Babylon Genesis",
109
+ amount: {
110
+ token: "1000 BABY",
111
+ usd: "~ $5,677.39 USD",
112
+ },
113
+ },
114
+ {
115
+ icon: _jsx(PlaceholderIcon, { text: "C", bgColor: "bg-blue-500" }),
116
+ name: "Cosmos",
117
+ amount: {
118
+ token: "500 ATOM",
119
+ usd: "~ $2,621.78 USD",
120
+ },
121
+ },
122
+ {
123
+ icon: _jsx(PlaceholderIcon, { text: "S", bgColor: "bg-green-500" }),
124
+ name: "Sui",
125
+ amount: {
126
+ token: "100 SUI",
127
+ usd: "~ $399.79 USD",
128
+ },
129
+ },
130
+ {
131
+ icon: _jsx(PlaceholderIcon, { text: "E", bgColor: "bg-purple-500" }),
132
+ name: "Ethereum",
133
+ amount: {
134
+ token: "2.5 ETH",
135
+ usd: "~ $8,250.00 USD",
136
+ },
137
+ },
138
+ {
139
+ icon: _jsx(PlaceholderIcon, { text: "B", bgColor: "bg-orange-500" }),
140
+ name: "Bitcoin",
141
+ amount: {
142
+ token: "0.15 BTC",
143
+ usd: "~ $6,450.00 USD",
144
+ },
145
+ },
146
+ {
147
+ name: "Polygon",
148
+ amount: {
149
+ token: "2000 MATIC",
150
+ usd: "~ $1,800.00 USD",
151
+ },
152
+ },
153
+ {
154
+ icon: _jsx(PlaceholderIcon, { text: "A", bgColor: "bg-red-500" }),
155
+ name: "Avalanche",
156
+ amount: {
157
+ token: "150 AVAX",
158
+ usd: "~ $5,250.00 USD",
159
+ },
160
+ },
161
+ {
162
+ name: "Solana",
163
+ amount: {
164
+ token: "25 SOL",
165
+ usd: "~ $2,750.00 USD",
166
+ },
167
+ },
168
+ {
169
+ icon: _jsx(PlaceholderIcon, { text: "D", bgColor: "bg-yellow-500" }),
170
+ name: "Dogecoin",
171
+ amount: {
172
+ token: "10000 DOGE",
173
+ usd: "~ $800.00 USD",
174
+ },
175
+ },
176
+ {
177
+ name: "Cardano",
178
+ amount: {
179
+ token: "5000 ADA",
180
+ usd: "~ $2,000.00 USD",
181
+ },
182
+ },
183
+ ],
184
+ transactionFees: {
185
+ token: "15 BABY",
186
+ usd: "$0.84 USD",
187
+ },
188
+ title: "Claim Large Rewards - Scrollable List",
189
+ },
190
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonlabs-io/core-ui",
3
- "version": "1.27.0",
3
+ "version": "1.29.0",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "publishConfig": {