@babylonlabs-io/core-ui 1.31.0 → 1.32.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.
@@ -28,10 +28,10 @@ interface PreviewModalProps {
28
28
  * Labels should match the exact ones defined internally (e.g. "Stake Amount", "Transaction Fees").
29
29
  */
30
30
  visibleFields?: string[];
31
- /** Custom notice text displayed under "Attention!" heading. If not provided, default disclaimers are shown. */
32
- attentionText?: string;
31
+ /** Warning lines rendered under the "Attention!" section. */
32
+ warnings: string[];
33
33
  /** Label for the primary action button; defaults to "Proceed to Signing" */
34
34
  proceedLabel?: string;
35
35
  }
36
- export declare const PreviewModal: ({ open, processing, onClose, onProceed, bsns, finalityProviders, details, visibleFields, attentionText, proceedLabel, }: PropsWithChildren<PreviewModalProps>) => import("react/jsx-runtime").JSX.Element;
36
+ export declare const PreviewModal: ({ open, processing, onClose, onProceed, bsns, finalityProviders, details, visibleFields, warnings, proceedLabel, }: PropsWithChildren<PreviewModalProps>) => import("react/jsx-runtime").JSX.Element;
37
37
  export {};
@@ -12,7 +12,7 @@ function ResponsiveDialog({ className, ...restProps }) {
12
12
  const DialogComponent = isMobileView ? MobileDialog : Dialog;
13
13
  return _jsx(DialogComponent, { ...restProps, className: twMerge("w-[41.25rem] max-w-full", className) });
14
14
  }
15
- export const PreviewModal = ({ open, processing = false, onClose, onProceed, bsns, finalityProviders, details, visibleFields, attentionText, proceedLabel = "Proceed to Signing", }) => {
15
+ export const PreviewModal = ({ open, processing = false, onClose, onProceed, bsns, finalityProviders, details, visibleFields, warnings, proceedLabel = "Proceed to Signing", }) => {
16
16
  const allFields = [
17
17
  { label: "Stake Amount", value: details.stakeAmount },
18
18
  { label: "Fee Rate", value: details.feeRate },
@@ -44,5 +44,5 @@ export const PreviewModal = ({ open, processing = false, onClose, onProceed, bsn
44
44
  ];
45
45
  }),
46
46
  ];
47
- return (_jsxs(ResponsiveDialog, { open: open, onClose: onClose, children: [_jsx(DialogHeader, { title: "Preview", onClose: onClose, className: "text-accent-primary" }), _jsxs(DialogBody, { className: "no-scrollbar mb-8 mt-4 flex max-h-[calc(100vh-12rem)] flex-col gap-4 overflow-y-auto text-accent-primary", children: [_jsx(Table, { data: tableData }), _jsx("div", { className: "flex flex-col", children: fields.map((field, index) => (_jsxs("div", { className: "flex flex-row items-center justify-between py-3", children: [_jsx(Text, { variant: "body1", className: "text-secondary font-normal", children: field.label }), _jsx(Text, { variant: "body1", className: "text-right font-normal", children: field.value })] }, index))) }), _jsx("div", { className: "border-divider w-full border-t" }), _jsxs("div", { className: "pt-2", children: [_jsx(Heading, { variant: "h6", className: "text-primary mb-2", children: "Attention!" }), attentionText ? (_jsx(Text, { variant: "body2", className: "text-secondary", children: attentionText })) : (_jsxs(_Fragment, { children: [_jsx(Text, { variant: "body2", className: "text-secondary", children: "1. No third party possesses your staked BTC. You are the only one who can unbond and withdraw your stake." }), _jsx(Text, { variant: "body2", className: "text-secondary", children: "2. Your stake will first be sent to Babylon Genesis for verification (~20 seconds), then you will be prompted to submit it to the Bitcoin ledger. It will be marked as 'Pending' until it receives 10 Bitcoin confirmations." })] }))] })] }), _jsxs(DialogFooter, { className: "flex flex-col gap-4 pb-8 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..." : proceedLabel }), _jsx(Button, { variant: "outlined", color: "primary", onClick: onClose, className: "w-full sm:flex-1 sm:order-1", children: "Cancel" })] })] }));
47
+ return (_jsxs(ResponsiveDialog, { open: open, onClose: onClose, children: [_jsx(DialogHeader, { title: "Preview", onClose: onClose, className: "text-accent-primary" }), _jsxs(DialogBody, { className: "no-scrollbar mb-8 mt-4 flex max-h-[calc(100vh-12rem)] flex-col gap-4 overflow-y-auto text-accent-primary", children: [_jsx(Table, { data: tableData }), _jsx("div", { className: "flex flex-col", children: fields.map((field, index) => (_jsxs("div", { className: "flex flex-row items-center justify-between py-3", children: [_jsx(Text, { variant: "body1", className: "text-secondary font-normal", children: field.label }), _jsx(Text, { variant: "body1", className: "text-right font-normal", children: field.value })] }, index))) }), _jsx("div", { className: "border-divider w-full border-t" }), _jsxs("div", { className: "pt-2", children: [_jsx(Heading, { variant: "h6", className: "text-primary mb-2", children: "Attention!" }), warnings.map((line, idx) => (_jsx(Text, { variant: "body2", className: "text-secondary", children: line }, idx)))] })] }), _jsxs(DialogFooter, { className: "flex flex-col gap-4 pb-8 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..." : proceedLabel }), _jsx(Button, { variant: "outlined", color: "primary", onClick: onClose, className: "w-full sm:flex-1 sm:order-1", children: "Cancel" })] })] }));
48
48
  };
@@ -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 ValidatorOnly: Story;
8
+ export declare const CustomWarnings: Story;
@@ -43,6 +43,10 @@ export const Default = {
43
43
  unbonding: "~ 1 day",
44
44
  unbondingFee: "0 BTC",
45
45
  },
46
+ warnings: [
47
+ "1. No third party possesses your staked BTC. You are the only one who can unbond and withdraw your stake.",
48
+ "2. Your stake will first be sent to Babylon Genesis for verification (~20 seconds), then you will be prompted to submit it to the Bitcoin ledger. It will be marked as 'Pending' until it receives 10 Bitcoin confirmations.",
49
+ ],
46
50
  },
47
51
  };
48
52
  export const ValidatorOnly = {
@@ -70,7 +74,42 @@ export const ValidatorOnly = {
70
74
  unbondingFee: "0 BTC",
71
75
  },
72
76
  visibleFields: ["Stake Amount", "Transaction Fees"],
73
- attentionText: "The staking transaction may take up to one (1) hour to process. Funds will not be deducted instantly; a sufficient available balance must be maintained until the transaction is confirmed and the deduction is finalized.",
77
+ warnings: [
78
+ "The staking transaction may take up to one (1) hour to process.",
79
+ "Funds will not be deducted instantly; maintain sufficient balance until confirmed.",
80
+ ],
74
81
  proceedLabel: "Stake",
75
82
  },
76
83
  };
84
+ export const CustomWarnings = {
85
+ args: {
86
+ open: true,
87
+ processing: false,
88
+ onClose: () => { },
89
+ onProceed: () => { },
90
+ bsns: [
91
+ {
92
+ icon: _jsx(PlaceholderIcon, { text: "B", bgColor: "bg-black" }),
93
+ name: "Babylon Genesis",
94
+ },
95
+ ],
96
+ finalityProviders: [],
97
+ details: {
98
+ stakeAmount: "0.25 BTC",
99
+ feeRate: "4 sat/vB",
100
+ transactionFees: "0.00005 BTC",
101
+ term: {
102
+ blocks: "40320 blocks",
103
+ duration: "~ 4 weeks",
104
+ },
105
+ unbonding: "~ 1 day",
106
+ unbondingFee: "0 BTC",
107
+ },
108
+ warnings: [
109
+ "1. Custom line one for this integration.",
110
+ "2. Second line explaining processing behavior.",
111
+ "3. Optional extra note about timelock reset in expansions.",
112
+ ],
113
+ proceedLabel: "Proceed",
114
+ },
115
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babylonlabs-io/core-ui",
3
- "version": "1.31.0",
3
+ "version": "1.32.0",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "publishConfig": {