Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/rainbowkit/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,23 +133,36 @@ const walletsBuildOptions = {
outdir: 'dist/wallets/walletConnectors',
};

const componentsBuildOptions = {
...baseBuildConfig((result) => {
if (result.errors.length) {
console.error('❌ components build failed', result.errors);
} else console.log('✅ components build succeeded');
}),
entryPoints: await getAllEntryPoints('src/components'),
outdir: 'dist/components',
};

const build = async () => {
// Build and watch for new changes if --watch flag is passed
if (isWatching) {
const [mainContext, walletsContext] = await Promise.all([
const [mainContext, walletsContext, componentsContext] = await Promise.all([
esbuild.context(mainBuildOptions),
esbuild.context(walletsBuildOptions),
esbuild.context(componentsBuildOptions),
]);

await mainContext.watch();
await walletsContext.watch();
await componentsContext.watch();
return;
}

// Only build once
await Promise.all([
esbuild.build(mainBuildOptions),
esbuild.build(walletsBuildOptions),
esbuild.build(componentsBuildOptions),
]);
};

Expand Down
3 changes: 3 additions & 0 deletions packages/rainbowkit/components/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"main": "../dist/components/index.js"
}
6 changes: 4 additions & 2 deletions packages/rainbowkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
"files": [
"dist",
"styles.css",
"wallets"
"wallets",
"components"
],
"type": "module",
"exports": {
".": "./dist/index.js",
"./styles.css": "./dist/index.css",
"./wallets": "./dist/wallets/walletConnectors/index.js"
"./wallets": "./dist/wallets/walletConnectors/index.js",
"./components": "./dist/components/index.js"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions packages/rainbowkit/src/components/Avatar/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import { Box } from '../Box/Box';
import { SpinnerIcon } from '../Icons/Spinner';
import { AvatarContext } from '../RainbowKitProvider/AvatarContext';

interface AvatarProps {
export type AvatarProps = {
address: string;
loading?: boolean;
imageUrl?: string | null;
size: number;
}
};

export function Avatar({ address, imageUrl, loading, size }: AvatarProps) {
const AvatarComponent = useContext(AvatarContext);
Expand Down
28 changes: 27 additions & 1 deletion packages/rainbowkit/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
// ============================ Button Components ============================
// Main connect button with wallet connection flow
export { ConnectButton } from './ConnectButton/ConnectButton';
export type { ConnectButtonProps } from './ConnectButton/ConnectButton';

// Individual wallet button for specific wallet connections
export { WalletButton } from './WalletButton/WalletButton';
export { RainbowKitProvider } from './RainbowKitProvider/RainbowKitProvider';
export type { WalletButtonProps } from './WalletButton/WalletButton';

// ============================ Avatar Components ============================
// Main Avatar component that displays user avatars with optional loading states
export { Avatar } from './Avatar/Avatar';
export type { AvatarProps } from './Avatar/Avatar';

// Default emoji-based avatar implementation
export { EmojiAvatar } from './Avatar/EmojiAvatar';
export type { AvatarComponentProps as EmojiAvatarProps } from './RainbowKitProvider/AvatarContext';

// Utility function to generate emoji avatars based on wallet addresses
export { emojiAvatarForAddress } from './Avatar/emojiAvatarForAddress';

// ============================ Modal Components ============================
// Modal for displaying account details, balance, and disconnect functionality
export { AccountModal } from './AccountModal/AccountModal';
export type { AccountModalProps } from './AccountModal/AccountModal';

// Modal for switching between different chains
export { ChainModal } from './ChainModal/ChainModal';
export type { ChainModalProps } from './ChainModal/ChainModal';
Loading