@babylonlabs-io/core-ui 1.19.0 → 1.20.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.
@@ -11,7 +11,6 @@ interface PreviewModalProps {
11
11
  onProceed: () => void;
12
12
  warning: string;
13
13
  bsns: Info[];
14
- finalityProviders: Info[];
15
14
  amount: {
16
15
  token: string;
17
16
  usd: string;
@@ -18,6 +18,8 @@ interface Reward {
18
18
  }
19
19
  interface Props {
20
20
  rewards: Reward[];
21
+ onClick?: () => void;
22
+ disabled?: boolean;
21
23
  }
22
- export declare const RewardsSubsection: ({ rewards }: Props) => import("react/jsx-runtime").JSX.Element;
24
+ export declare const RewardsSubsection: ({ rewards, onClick, disabled }: Props) => import("react/jsx-runtime").JSX.Element;
23
25
  export default RewardsSubsection;
@@ -3,11 +3,11 @@ import { SubSection } from "@/components/SubSection";
3
3
  import { calculateTokenValueInCurrency } from "@/utils/helpers";
4
4
  import { AmountItem } from "../../../components/AmountItem";
5
5
  import { Button } from "../../../components/Button";
6
- export const RewardsSubsection = ({ rewards }) => {
6
+ export const RewardsSubsection = ({ rewards, onClick, disabled }) => {
7
7
  return (_jsxs(SubSection, { className: "flex w-full flex-col content-center justify-between gap-4", children: [rewards.map((reward, index) => {
8
8
  const amountValue = parseFloat(String(reward.amount));
9
9
  const amountUsd = calculateTokenValueInCurrency(amountValue, reward.balanceDetails?.price ?? 0, { zeroDisplay: "$0.00" });
10
10
  return (_jsx(AmountItem, { amount: reward.amount, currencyIcon: reward.currencyIcon, currencyName: reward.currencyName, placeholder: reward.placeholder ?? "Enter Amount", displayBalance: reward.displayBalance, balanceDetails: reward.balanceDetails, min: reward.min ?? "0", step: reward.step ?? "any", autoFocus: false, onChange: () => { }, onKeyDown: () => { }, amountUsd: amountUsd, disabled: true, subtitle: reward.chainName }, index));
11
- }), _jsx(Button, { children: "Claim" })] }));
11
+ }), _jsx(Button, { onClick: onClick, disabled: disabled, children: "Claim" })] }));
12
12
  };
13
13
  export default RewardsSubsection;
@@ -5,3 +5,4 @@ export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
7
  export declare const MultipleRewards: Story;
8
+ export declare const DisabledClaim: Story;
@@ -1,3 +1,4 @@
1
+ import { action } from "@storybook/addon-actions";
1
2
  import { RewardsSubsection } from "./RewardsSubsection";
2
3
  const meta = {
3
4
  component: RewardsSubsection,
@@ -22,6 +23,11 @@ export const Default = {
22
23
  },
23
24
  },
24
25
  ],
26
+ onClick: () => {
27
+ action("claim-button-clicked")();
28
+ alert("Claim button clicked!");
29
+ },
30
+ disabled: false,
25
31
  },
26
32
  };
27
33
  export const MultipleRewards = {
@@ -56,5 +62,35 @@ export const MultipleRewards = {
56
62
  },
57
63
  },
58
64
  ],
65
+ onClick: () => {
66
+ action("claim-button-clicked")();
67
+ alert("Claim button clicked!");
68
+ },
69
+ disabled: false,
70
+ },
71
+ };
72
+ export const DisabledClaim = {
73
+ args: {
74
+ rewards: [
75
+ {
76
+ amount: 123,
77
+ currencyIcon: "https://placehold.co/40x40",
78
+ currencyName: "BBN",
79
+ displayBalance: true,
80
+ chainName: "Babylon",
81
+ balanceDetails: {
82
+ balance: 1234.56789,
83
+ symbol: "BBN",
84
+ price: 0.25,
85
+ displayUSD: true,
86
+ decimals: 8,
87
+ },
88
+ },
89
+ ],
90
+ onClick: () => {
91
+ action("claim-button-clicked")();
92
+ alert("This should not appear - button is disabled!");
93
+ },
94
+ disabled: true,
59
95
  },
60
96
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonlabs-io/core-ui",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "publishConfig": {
@@ -45,7 +45,7 @@
45
45
  "@chromatic-com/storybook": "^3.2.2",
46
46
  "@commitlint/cli": "^19.8.0",
47
47
  "@commitlint/config-conventional": "^19.8.0",
48
- "@eslint/js": "^9.13.0",
48
+ "@eslint/js": "^9.31.0",
49
49
  "@internal/eslint-config": "*",
50
50
  "@semantic-release/github": "^11.0.2",
51
51
  "@semantic-release/npm": "^12.0.1",
@@ -61,21 +61,21 @@
61
61
  "@types/react-dom": "^18.3.1",
62
62
  "@vitejs/plugin-react": "^4.3.3",
63
63
  "autoprefixer": "^10.4.20",
64
- "globals": "^15.11.0",
64
+ "globals": "^16.3.0",
65
65
  "husky": "^9.1.7",
66
66
  "lint-staged": "^15.2.10",
67
67
  "lodash.throttle": "^4.1.1",
68
68
  "nodemon": "^3.1.0",
69
69
  "postcss": "^8.4.47",
70
- "prettier": "^3.3.3",
70
+ "prettier": "^3.6.2",
71
71
  "prettier-plugin-tailwindcss": "^0.6.8",
72
72
  "react-icons": "^5.3.0",
73
73
  "semantic-release": "^24.2.3",
74
74
  "storybook": "^8.4.2",
75
75
  "storybook-dark-mode": "^4.0.2",
76
76
  "tailwindcss": "^3.4.14",
77
- "typescript": "~5.6.2",
78
- "typescript-eslint": "^8.11.0",
77
+ "typescript": "^5.8.2",
78
+ "typescript-eslint": "^8.37.0",
79
79
  "vite": "^5.4.10",
80
80
  "vite-plugin-dts": "^4.3.0"
81
81
  },