@babylonlabs-io/core-ui 1.14.0 → 1.15.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,11 +1,11 @@
1
1
  interface FeesSectionProps {
2
2
  className?: string;
3
- feeRate: number | string;
3
+ feeRate?: number | string;
4
4
  onFeeRateEdit?: () => void;
5
- feeAmount: number | string;
6
- coinSymbol: string;
5
+ feeAmount?: number | string;
6
+ coinSymbol?: string;
7
7
  feeAmountHint?: string;
8
- total: number | string;
8
+ total?: number | string;
9
9
  totalHint?: string;
10
10
  bbnFeeAmount?: number | string;
11
11
  bbnCoinSymbol?: string;
@@ -6,5 +6,5 @@ import { BTCFeeAmount } from "./BTCFeeAmount";
6
6
  import { BBNFeeAmount } from "./BBNFeeAmount";
7
7
  import { Total } from "./Total";
8
8
  export function FeesSection({ className, feeRate, onFeeRateEdit, feeAmount, coinSymbol, feeAmountHint, total, totalHint, bbnFeeAmount, bbnCoinSymbol, bbnFeeAmountHint, bbnFeeDecimals, }) {
9
- return (_jsx(SubSection, { className: twMerge("flex w-full flex-col content-center justify-between gap-4", className), children: _jsxs("div", { className: "flex flex-col gap-6 p-4", children: [_jsx(BTCFeeRate, { value: feeRate, onEdit: onFeeRateEdit }), _jsx(BTCFeeAmount, { amount: feeAmount, coinSymbol: coinSymbol, hint: feeAmountHint }), bbnFeeAmount !== undefined && bbnCoinSymbol ? (_jsx(BBNFeeAmount, { amount: bbnFeeAmount, coinSymbol: bbnCoinSymbol, hint: bbnFeeAmountHint, decimals: bbnFeeDecimals })) : null, _jsx("div", { className: "divider my-4" }), _jsx(Total, { total: total, coinSymbol: coinSymbol, hint: totalHint })] }) }));
9
+ return (_jsx(SubSection, { className: twMerge("flex w-full flex-col content-center justify-between gap-4", className), children: _jsxs("div", { className: "flex flex-col gap-6 p-4", children: [feeRate !== undefined && _jsx(BTCFeeRate, { value: feeRate, onEdit: onFeeRateEdit }), feeAmount !== undefined && coinSymbol !== undefined && (_jsx(BTCFeeAmount, { amount: feeAmount, coinSymbol: coinSymbol, hint: feeAmountHint })), bbnFeeAmount !== undefined && bbnCoinSymbol ? (_jsx(BBNFeeAmount, { amount: bbnFeeAmount, coinSymbol: bbnCoinSymbol, hint: bbnFeeAmountHint, decimals: bbnFeeDecimals })) : null, total !== undefined && coinSymbol !== undefined && _jsx("div", { className: "divider my-4" }), total !== undefined && coinSymbol !== undefined && _jsx(Total, { total: total, coinSymbol: coinSymbol, hint: totalHint })] }) }));
10
10
  }
@@ -4,3 +4,4 @@ declare const meta: Meta<typeof FeesSection>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
6
  export declare const Default: Story;
7
+ export declare const BabylonNetworkFee: Story;
@@ -1,3 +1,4 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
1
2
  import { FeesSection } from "./FeesSection";
2
3
  const meta = {
3
4
  component: FeesSection,
@@ -12,3 +13,6 @@ export const Default = {
12
13
  total: "0.0001",
13
14
  },
14
15
  };
16
+ export const BabylonNetworkFee = {
17
+ render: () => (_jsx(FeesSection, { bbnFeeAmount: 0, bbnCoinSymbol: "BABY", bbnFeeAmountHint: "$0,00" })),
18
+ };
@@ -5,6 +5,8 @@ interface Props {
5
5
  actionText: string;
6
6
  onAdd: () => void;
7
7
  onRemove: (id?: string) => void;
8
+ /** Whether to display chain information (logo and name) for each provider item. Defaults to true. */
9
+ showChain?: boolean;
8
10
  }
9
- export declare function FinalityProviderSubsection({ max, items, actionText, onAdd, onRemove }: Props): import("react/jsx-runtime").JSX.Element;
11
+ export declare function FinalityProviderSubsection({ max, items, actionText, onAdd, onRemove, showChain }: Props): import("react/jsx-runtime").JSX.Element;
10
12
  export {};
@@ -3,7 +3,7 @@ import { SubSection } from "../../../components/SubSection";
3
3
  import { useMemo } from "react";
4
4
  import { CounterButton } from "../../../components/CounterButton/CounterButton";
5
5
  import { ProvidersList } from "../../../elements/ProvidersList/ProvidersList";
6
- export function FinalityProviderSubsection({ max, items = [], actionText, onAdd, onRemove }) {
6
+ export function FinalityProviderSubsection({ max, items = [], actionText, onAdd, onRemove, showChain = true }) {
7
7
  const count = useMemo(() => items.length, [items]);
8
- return (_jsx(SubSection, { children: _jsxs("div", { className: "flex w-full flex-col gap-4", children: [_jsx("div", { className: "flex flex-row", children: _jsxs("div", { className: "flex w-full flex-row content-center items-center justify-between font-normal", children: [_jsx("span", { className: "text-sm sm:text-base", children: actionText }), _jsx(CounterButton, { counter: count, max: max, onAdd: onAdd })] }) }), count > 0 && _jsx(ProvidersList, { items: items, onRemove: onRemove })] }) }));
8
+ return (_jsx(SubSection, { children: _jsxs("div", { className: "flex w-full flex-col gap-4", children: [_jsx("div", { className: "flex flex-row", children: _jsxs("div", { className: "flex w-full flex-row content-center items-center justify-between font-normal", children: [_jsx("span", { className: "text-sm sm:text-base", children: actionText }), _jsx(CounterButton, { counter: count, max: max, onAdd: onAdd })] }) }), count > 0 && _jsx(ProvidersList, { items: items, onRemove: onRemove, showChain: showChain })] }) }));
9
9
  }
@@ -11,3 +11,4 @@ export declare const SingleProviderMode: Story;
11
11
  export declare const SingleProviderModeWithItem: Story;
12
12
  export declare const ProvidersWithoutLogos: Story;
13
13
  export declare const ProvidersWithoutDescriptions: Story;
14
+ export declare const SingleProviderWithoutBsnLogo: Story;
@@ -189,3 +189,24 @@ export const ProvidersWithoutDescriptions = {
189
189
  },
190
190
  render: ({ max, items, actionText, onAdd, onRemove }) => (_jsx(FinalityProviderSubsection, { max: max, items: items, actionText: actionText, onAdd: onAdd, onRemove: onRemove })),
191
191
  };
192
+ export const SingleProviderWithoutBsnLogo = {
193
+ args: {
194
+ max: 1,
195
+ items: [
196
+ {
197
+ bsnId: "babylon",
198
+ bsnName: "Babylon Genesis",
199
+ provider: {
200
+ rank: 1,
201
+ logo_url: "https://placehold.co/40x40",
202
+ description: { moniker: "Babylon Provider" },
203
+ },
204
+ },
205
+ ],
206
+ actionText: "Select Validator",
207
+ onAdd: () => alert("Add clicked"),
208
+ onRemove: (bsnId) => alert(`Remove clicked for ${bsnId}`),
209
+ showChain: false,
210
+ },
211
+ render: ({ max, items, actionText, onAdd, onRemove, showChain }) => (_jsx(FinalityProviderSubsection, { max: max, items: items, actionText: actionText, onAdd: onAdd, onRemove: onRemove, showChain: showChain })),
212
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonlabs-io/core-ui",
3
- "version": "1.14.0",
3
+ "version": "1.15.0",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "publishConfig": {