@babylonlabs-io/core-ui 1.29.0 → 1.29.1
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.
- package/dist/components/Card/Card.stories.d.ts +2 -0
- package/dist/components/Card/Card.stories.js +21 -2
- package/dist/components/Icons/common/BugReportIcon.d.ts +2 -0
- package/dist/components/Icons/common/BugReportIcon.js +7 -0
- package/dist/components/Icons/common/ChevronLeftIcon.d.ts +2 -0
- package/dist/components/Icons/common/ChevronLeftIcon.js +7 -0
- package/dist/components/Icons/index.d.ts +2 -0
- package/dist/components/Icons/index.js +2 -0
- package/dist/components/Menu/Menu.js +1 -1
- package/dist/components/Menu/MenuDrawer.js +3 -1
- package/dist/components/Popover/Popover.js +1 -1
- package/dist/components/Portal/Portal.d.ts +5 -1
- package/dist/components/Portal/Portal.js +27 -28
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/useCopy.js +22 -27
- package/dist/hooks/useDrawerAnimation.d.ts +18 -0
- package/dist/hooks/useDrawerAnimation.js +42 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +1487 -1373
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1 -0
- package/dist/providers/CoreUIProvider.d.ts +11 -0
- package/dist/providers/CoreUIProvider.js +9 -0
- package/dist/style.css +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/widgets/sections/SettingMenu/SettingMenu.js +2 -1
- package/dist/widgets/sections/WalletMenu/WalletMenu.d.ts +7 -0
- package/dist/widgets/sections/WalletMenu/WalletMenu.js +6 -3
- package/dist/widgets/sections/WalletMenu/components/WalletInfoCard.js +1 -1
- package/dist/widgets/sections/WalletMenu/components/WalletInfoSection.js +1 -1
- package/dist/widgets/sections/WalletMenu/components/WalletSettingItem.js +1 -1
- package/package.json +1 -1
- package/tailwind.config.js +86 -3
|
@@ -3,9 +3,10 @@ import { Menu } from "@/components/Menu";
|
|
|
3
3
|
import { Spacer } from "@/components/Spacer";
|
|
4
4
|
import { SettingsIcon } from "@/elements/Icons";
|
|
5
5
|
import { SettingMenuTitle, SettingMenuGroup, SettingMenuItem, SettingMenuSubMenu, SettingMenuDescription, SettingMenuCustomContent, } from "./components";
|
|
6
|
+
import { twJoin } from "tailwind-merge";
|
|
6
7
|
const SettingMenuBase = ({ trigger, open, onOpenChange, placement = "bottom-end", className, offset = [0, 8], children, }) => {
|
|
7
8
|
const defaultTrigger = (_jsx("button", { className: "flex h-10 w-10 items-center justify-center rounded-lg transition-colors hover:bg-accent-primary/10", "aria-label": "Settings menu", children: _jsx(SettingsIcon, {}) }));
|
|
8
|
-
return (_jsx(Menu, { trigger: trigger || defaultTrigger, open: open, onOpenChange: onOpenChange, placement: placement, className: className, offset: offset, children: children }));
|
|
9
|
+
return (_jsx(Menu, { trigger: trigger || defaultTrigger, open: open, onOpenChange: onOpenChange, placement: placement, className: twJoin("relative", className), offset: offset, mobileMode: "drawer", children: children }));
|
|
9
10
|
};
|
|
10
11
|
export const SettingMenu = SettingMenuBase;
|
|
11
12
|
SettingMenu.Title = SettingMenuTitle;
|
|
@@ -16,5 +16,12 @@ export interface WalletMenuProps {
|
|
|
16
16
|
onDisconnect: () => void;
|
|
17
17
|
forceOpen?: boolean;
|
|
18
18
|
onOpenChange?: (isOpen: boolean) => void;
|
|
19
|
+
className?: string;
|
|
20
|
+
mobileMode?: "drawer" | "dialog";
|
|
21
|
+
copy?: {
|
|
22
|
+
isCopied?: (key: "btc" | "bbn" | "publicKey") => boolean;
|
|
23
|
+
copyToClipboard?: (key: "btc" | "bbn" | "publicKey", value: string) => void;
|
|
24
|
+
timeout?: number;
|
|
25
|
+
};
|
|
19
26
|
}
|
|
20
27
|
export declare const WalletMenu: React.FC<WalletMenuProps>;
|
|
@@ -7,8 +7,11 @@ import { WalletSettingItem } from "./components/WalletSettingItem";
|
|
|
7
7
|
import { WalletInfoSection } from "./components/WalletInfoSection";
|
|
8
8
|
import { UsingInscriptionIcon, LinkWalletIcon, BitcoinPublicKeyIcon } from "../../../components/Icons";
|
|
9
9
|
import { useCopy } from "../../../hooks/useCopy";
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import { twJoin } from "tailwind-merge";
|
|
11
|
+
export const WalletMenu = ({ trigger, btcAddress, bbnAddress, selectedWallets, ordinalsExcluded, linkedDelegationsVisibility, onIncludeOrdinals, onExcludeOrdinals, onDisplayLinkedDelegations, publicKeyNoCoord, onDisconnect, forceOpen = false, onOpenChange, className, mobileMode = "dialog", copy, }) => {
|
|
12
|
+
const { copyToClipboard: internalCopy, isCopied: internalIsCopied } = useCopy({ timeout: copy?.timeout });
|
|
13
|
+
const isCopied = copy?.isCopied ?? internalIsCopied;
|
|
14
|
+
const copyToClipboard = copy?.copyToClipboard ?? internalCopy;
|
|
12
15
|
const [isOpen, setIsOpen] = useState(forceOpen);
|
|
13
16
|
const handleOpenChange = useCallback((open) => {
|
|
14
17
|
setIsOpen(open);
|
|
@@ -18,5 +21,5 @@ export const WalletMenu = ({ trigger, btcAddress, bbnAddress, selectedWallets, o
|
|
|
18
21
|
setIsOpen(false);
|
|
19
22
|
onDisconnect();
|
|
20
23
|
}, [onDisconnect]);
|
|
21
|
-
return (_jsx(Menu, { trigger: trigger, open: isOpen, onOpenChange: handleOpenChange, mobileMode:
|
|
24
|
+
return (_jsx(Menu, { trigger: trigger, open: isOpen, onOpenChange: handleOpenChange, mobileMode: mobileMode, className: twJoin("shadow-lg border border-[#38708533] bg-[#FFFFFF] dark:bg-[#252525] dark:border-[#404040] rounded-lg", className), children: _jsxs("div", { className: "p-4 space-y-6 w-full text-primary-main", children: [_jsxs("div", { className: "flex flex-row gap-2 w-full md:flex-col overflow-x-auto", children: [_jsx(WalletInfoCard, { walletType: "Bitcoin", walletName: selectedWallets["BTC"]?.name, walletIcon: selectedWallets["BTC"]?.icon, address: btcAddress, isCopied: isCopied("btc"), onCopy: () => copyToClipboard("btc", btcAddress) }), _jsx(WalletInfoCard, { walletType: "Babylon", walletName: selectedWallets["BBN"]?.name, walletIcon: selectedWallets["BBN"]?.icon, address: bbnAddress, isCopied: isCopied("bbn"), onCopy: () => copyToClipboard("bbn", bbnAddress) })] }), _jsxs("div", { className: "flex flex-col w-full bg-[#F9F9F9] dark:bg-[#2F2F2F] rounded-lg md:bg-transparent md:dark:bg-transparent md:border-none md:gap-8", children: [_jsx(WalletSettingItem, { icon: _jsx(UsingInscriptionIcon, {}), title: "Using Inscriptions", status: ordinalsExcluded ? "Off" : "On", value: !ordinalsExcluded, onChange: (value) => value ? onIncludeOrdinals() : onExcludeOrdinals() }), _jsx(WalletSettingItem, { icon: _jsx(LinkWalletIcon, {}), title: "Linked Wallet Stakes", status: linkedDelegationsVisibility ? "On" : "Off", value: linkedDelegationsVisibility, onChange: onDisplayLinkedDelegations }), _jsx(WalletInfoSection, { title: "Bitcoin Public Key", value: publicKeyNoCoord, isCopied: isCopied("publicKey"), onCopy: () => copyToClipboard("publicKey", publicKeyNoCoord), icon: _jsx(BitcoinPublicKeyIcon, {}), className: "rounded-b-lg rounded-t-none md:rounded-none" })] }), _jsx("div", { className: "pt-2", children: _jsx(WalletDisconnectButton, { onClick: handleDisconnect, fluid: true, children: "Disconnect Wallets" }) })] }) }));
|
|
22
25
|
};
|
|
@@ -5,5 +5,5 @@ import { DisplayHash } from '../../../../components/DisplayHash';
|
|
|
5
5
|
import { CopyIcon } from '../../../../components/Icons';
|
|
6
6
|
import { twJoin } from 'tailwind-merge';
|
|
7
7
|
export const WalletInfoCard = ({ walletType, walletName, walletIcon, address, isCopied, onCopy, className, }) => {
|
|
8
|
-
return (_jsx("div", { className: twJoin("bg-
|
|
8
|
+
return (_jsx("div", { className: twJoin("bg-[#F9F9F9] dark:bg-[#2F2F2F] rounded-[4px] p-3 flex-1 md:p-4", className), children: _jsxs("div", { className: "flex flex-col w-full", children: [_jsx("div", { className: "flex justify-start mb-2 md:mb-3", children: _jsx(Avatar, { alt: walletName || walletType, url: walletIcon || '', size: "large", className: "w-8 h-8 md:w-10 md:h-10" }) }), _jsx("div", { className: "flex justify-start mb-[1px]", children: _jsxs(Text, { variant: "body1", className: "text-accent-secondary font-medium !text-xs", children: [walletType, " Wallet"] }) }), _jsxs("div", { className: "flex items-center justify-between w-full", children: [_jsx("div", { className: "flex-1 min-w-0", children: isCopied ? (_jsx(Text, { className: "text-accent-primary !text-sm truncate whitespace-nowrap", children: "Copied \u2713" })) : (_jsx(DisplayHash, { className: "text-accent-primary !text-sm", value: address, symbols: 6 })) }), _jsx("button", { onClick: onCopy, className: "flex-shrink-0 ml-3 p-1 rounded hover:bg-[#d7e1e7] dark:hover:bg-[#252525] transition-colors h-6 w-6 flex items-center justify-center hover:opacity-80", children: _jsx(CopyIcon, { size: 14, className: "md:w-4 md:h-4" }) })] })] }) }));
|
|
9
9
|
};
|
|
@@ -4,5 +4,5 @@ import { DisplayHash } from '../../../../components/DisplayHash';
|
|
|
4
4
|
import { CopyIcon } from '../../../../components/Icons';
|
|
5
5
|
import { twJoin } from 'tailwind-merge';
|
|
6
6
|
export const WalletInfoSection = ({ title, value, isCopied, onCopy, className, icon, }) => {
|
|
7
|
-
return (_jsx("div", { className: twJoin("flex items-center justify-between w-full
|
|
7
|
+
return (_jsx("div", { className: twJoin("flex items-center justify-between w-full p-3 md:p-0 md:mb-0", className), children: _jsx("div", { className: "flex flex-col w-full", children: _jsxs("div", { className: "flex items-center gap-4", children: [icon && (_jsx("div", { className: "flex-shrink-0", children: icon })), _jsxs("div", { className: "flex w-full", children: [_jsxs("div", { className: "flex flex-col w-full", children: [_jsx(Text, { variant: "body2", className: "text-accent-primary font-medium text-xs", children: title }), _jsx("div", { className: "flex items-center justify-between w-full", children: _jsx("div", { className: "flex-1 min-w-0", children: isCopied ? (_jsx(Text, { className: "text-accent-secondary !text-xs truncate whitespace-nowrap", children: "Copied \u2713" })) : (_jsx(DisplayHash, { className: "text-accent-secondary !text-xs", value: value, symbols: 6 })) }) })] }), _jsx("button", { onClick: onCopy, className: "flex-shrink-0 ml-3 p-1 rounded hover:bg-surface-tertiary transition-colors h-6 w-6 flex items-center justify-center hover:opacity-80 self-center", children: _jsx(CopyIcon, { size: 16 }) })] })] }) }) }));
|
|
8
8
|
};
|
|
@@ -3,5 +3,5 @@ import { Text } from '../../../../components/Text';
|
|
|
3
3
|
import { WalletToggle } from './WalletToggle';
|
|
4
4
|
import { twJoin } from 'tailwind-merge';
|
|
5
5
|
export const WalletSettingItem = ({ icon, title, status, value, onChange, className, }) => {
|
|
6
|
-
return (_jsxs("div", { className: twJoin("flex items-center justify-between w-full
|
|
6
|
+
return (_jsxs("div", { className: twJoin("flex items-center justify-between w-full p-3 md:p-0 md:mb-0", className), children: [_jsxs("div", { className: "flex items-center gap-4", children: [icon, _jsxs("div", { className: "flex flex-col", children: [_jsx(Text, { variant: "body2", className: "text-accent-primary font-medium", children: title }), _jsx(Text, { className: "text-accent-secondary !text-xs", children: status })] })] }), _jsx(WalletToggle, { value: value, onChange: onChange })] }));
|
|
7
7
|
};
|
package/package.json
CHANGED
package/tailwind.config.js
CHANGED
|
@@ -3,8 +3,93 @@ import { createThemes } from "tw-colors";
|
|
|
3
3
|
|
|
4
4
|
/** @type {import('tailwindcss').Config} */
|
|
5
5
|
export default {
|
|
6
|
-
content: [
|
|
6
|
+
content: [
|
|
7
|
+
"./src/**/*.{js,ts,jsx,tsx,css}",
|
|
8
|
+
"./dist/**/*.{js,ts,jsx,tsx}"
|
|
9
|
+
],
|
|
7
10
|
darkMode: ["class", '[data-mode="dark"]'],
|
|
11
|
+
safelist: [
|
|
12
|
+
// Include theme color classes with proper pattern syntax
|
|
13
|
+
{
|
|
14
|
+
pattern: /(bg|text|border)-(primary|secondary|accent|surface|error|warning|info|success|neutral)-(main|light|dark|contrast|highlight|strokeLight|strokeDark|100|200)/,
|
|
15
|
+
variants: ['dark', 'hover', 'focus', 'disabled'],
|
|
16
|
+
},
|
|
17
|
+
// Animation patterns
|
|
18
|
+
{
|
|
19
|
+
pattern: /animate-(modal|mobile-modal|backdrop)-(in|out)/,
|
|
20
|
+
},
|
|
21
|
+
// Common opacity values used
|
|
22
|
+
{
|
|
23
|
+
pattern: /opacity-(0|30|100)/,
|
|
24
|
+
variants: ['dark', 'hover'],
|
|
25
|
+
},
|
|
26
|
+
// Transform patterns used in dialogs/drawers
|
|
27
|
+
{
|
|
28
|
+
pattern: /-?translate-(x|y)-(0|full|1\/2|1\/4)/,
|
|
29
|
+
},
|
|
30
|
+
// Critical dark mode and color classes
|
|
31
|
+
'dark',
|
|
32
|
+
'bg-[#FFFFFF]',
|
|
33
|
+
'dark:bg-[#252525]',
|
|
34
|
+
'dark:bg-[#404040]',
|
|
35
|
+
'border-[#38708533]',
|
|
36
|
+
'dark:border-[#404040]',
|
|
37
|
+
'bg-black/50',
|
|
38
|
+
// Essential layout classes
|
|
39
|
+
'fixed',
|
|
40
|
+
'absolute',
|
|
41
|
+
'relative',
|
|
42
|
+
'z-40',
|
|
43
|
+
'z-50',
|
|
44
|
+
'z-[9999]',
|
|
45
|
+
'inset-0',
|
|
46
|
+
'inset-x-0',
|
|
47
|
+
'inset-y-0',
|
|
48
|
+
'top-0',
|
|
49
|
+
'right-0',
|
|
50
|
+
'bottom-0',
|
|
51
|
+
'left-0',
|
|
52
|
+
// Essential display/flex
|
|
53
|
+
'hidden',
|
|
54
|
+
'block',
|
|
55
|
+
'flex',
|
|
56
|
+
'inline-block',
|
|
57
|
+
'inline-flex',
|
|
58
|
+
'contents',
|
|
59
|
+
'items-center',
|
|
60
|
+
'justify-center',
|
|
61
|
+
'justify-between',
|
|
62
|
+
// Essential sizing
|
|
63
|
+
'w-full',
|
|
64
|
+
'h-full',
|
|
65
|
+
'min-w-[294px]',
|
|
66
|
+
'max-w-sm',
|
|
67
|
+
'max-h-full',
|
|
68
|
+
// Essential spacing
|
|
69
|
+
'p-4',
|
|
70
|
+
'px-4',
|
|
71
|
+
'pb-4',
|
|
72
|
+
'pt-12',
|
|
73
|
+
'mt-4',
|
|
74
|
+
// Essential borders/rounds
|
|
75
|
+
'border',
|
|
76
|
+
'rounded',
|
|
77
|
+
'rounded-lg',
|
|
78
|
+
'rounded-t-3xl',
|
|
79
|
+
'rounded-full',
|
|
80
|
+
// Essential transitions
|
|
81
|
+
'transition-opacity',
|
|
82
|
+
'transition-transform',
|
|
83
|
+
'transition-colors',
|
|
84
|
+
'duration-300',
|
|
85
|
+
'duration-500',
|
|
86
|
+
// Essential utilities
|
|
87
|
+
'shadow-lg',
|
|
88
|
+
'pointer-events-none',
|
|
89
|
+
'pointer-events-auto',
|
|
90
|
+
'overflow-hidden',
|
|
91
|
+
'overflow-y-auto',
|
|
92
|
+
],
|
|
8
93
|
theme: {
|
|
9
94
|
fontFamily: {
|
|
10
95
|
sans: ["Px Grotesk", ...defaultTheme.fontFamily.sans],
|
|
@@ -104,7 +189,6 @@ export default {
|
|
|
104
189
|
plugins: [
|
|
105
190
|
createThemes({
|
|
106
191
|
light: {
|
|
107
|
-
current: "currentColor",
|
|
108
192
|
transparent: "transparent",
|
|
109
193
|
surface: "#ffffff",
|
|
110
194
|
accent: {
|
|
@@ -152,7 +236,6 @@ export default {
|
|
|
152
236
|
},
|
|
153
237
|
},
|
|
154
238
|
dark: {
|
|
155
|
-
current: "currentColor",
|
|
156
239
|
transparent: "transparent",
|
|
157
240
|
surface: "#202020",
|
|
158
241
|
accent: {
|