@sudobility/building_blocks 0.0.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/README.md +220 -0
- package/dist/__tests__/app-breadcrumbs.test.d.ts +1 -0
- package/dist/__tests__/app-footer.test.d.ts +1 -0
- package/dist/__tests__/app-page-layout.test.d.ts +1 -0
- package/dist/__tests__/app-topbar.test.d.ts +1 -0
- package/dist/__tests__/language-selector.test.d.ts +1 -0
- package/dist/__tests__/languages.test.d.ts +1 -0
- package/dist/components/breadcrumbs/app-breadcrumbs.d.ts +52 -0
- package/dist/components/breadcrumbs/index.d.ts +1 -0
- package/dist/components/footer/app-footer-for-home-page.d.ts +92 -0
- package/dist/components/footer/app-footer.d.ts +77 -0
- package/dist/components/footer/index.d.ts +2 -0
- package/dist/components/index.d.ts +4 -0
- package/dist/components/layout/app-page-layout.d.ts +73 -0
- package/dist/components/layout/index.d.ts +1 -0
- package/dist/components/topbar/app-topbar-with-firebase-auth.d.ts +80 -0
- package/dist/components/topbar/app-topbar-with-wallet.d.ts +117 -0
- package/dist/components/topbar/app-topbar.d.ts +50 -0
- package/dist/components/topbar/index.d.ts +4 -0
- package/dist/components/topbar/language-selector.d.ts +24 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/languages.d.ts +18 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +769 -0
- package/dist/index.js.map +1 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/types.d.ts +133 -0
- package/dist/utils/index.d.ts +6 -0
- package/package.json +98 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import React, { type ReactNode, type ComponentType } from 'react';
|
|
2
|
+
import { type AppTopBarProps } from './app-topbar';
|
|
3
|
+
/**
|
|
4
|
+
* Wallet menu item for the connected wallet dropdown.
|
|
5
|
+
*/
|
|
6
|
+
export interface WalletMenuItem {
|
|
7
|
+
/** Unique identifier */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Display label */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Icon component */
|
|
12
|
+
icon?: ComponentType<{
|
|
13
|
+
className?: string;
|
|
14
|
+
}>;
|
|
15
|
+
/** Click handler */
|
|
16
|
+
onClick: () => void;
|
|
17
|
+
/** Whether this is a separator */
|
|
18
|
+
separator?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Auth status enum matching @sudobility/types.
|
|
22
|
+
*/
|
|
23
|
+
export declare enum AuthStatus {
|
|
24
|
+
DISCONNECTED = "disconnected",
|
|
25
|
+
CONNECTED = "connected",
|
|
26
|
+
VERIFIED = "verified"
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Chain type enum matching @sudobility/types.
|
|
30
|
+
*/
|
|
31
|
+
export declare enum ChainType {
|
|
32
|
+
EVM = "evm",
|
|
33
|
+
SOLANA = "solana"
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Props for the WalletDropdownMenu component from @sudobility/web3-components.
|
|
37
|
+
*/
|
|
38
|
+
export interface WalletDropdownMenuProps {
|
|
39
|
+
walletAddress: string;
|
|
40
|
+
authStatus: AuthStatus | string;
|
|
41
|
+
chainType: ChainType | string | 'unknown';
|
|
42
|
+
menuItems: WalletMenuItem[];
|
|
43
|
+
avatar?: string;
|
|
44
|
+
displayName?: string;
|
|
45
|
+
statusLabels?: {
|
|
46
|
+
verified?: string;
|
|
47
|
+
connected?: string;
|
|
48
|
+
disconnected?: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface AppTopBarWithWalletProps extends Omit<AppTopBarProps, 'renderAccountSection'> {
|
|
52
|
+
/**
|
|
53
|
+
* WalletDropdownMenu component from @sudobility/web3-components.
|
|
54
|
+
* This is passed as a prop to avoid hard dependency on web3-components.
|
|
55
|
+
*/
|
|
56
|
+
WalletDropdownMenuComponent?: ComponentType<WalletDropdownMenuProps>;
|
|
57
|
+
/** Whether wallet is connected */
|
|
58
|
+
isConnected: boolean;
|
|
59
|
+
/** Connected wallet address */
|
|
60
|
+
walletAddress?: string;
|
|
61
|
+
/** Authentication status */
|
|
62
|
+
authStatus?: AuthStatus | string;
|
|
63
|
+
/** Chain type (EVM, Solana, etc.) */
|
|
64
|
+
chainType?: ChainType | string | 'unknown';
|
|
65
|
+
/** Connect button click handler */
|
|
66
|
+
onConnect: () => void;
|
|
67
|
+
/** Disconnect handler */
|
|
68
|
+
onDisconnect: () => Promise<void>;
|
|
69
|
+
/** Custom menu items for wallet dropdown */
|
|
70
|
+
walletMenuItems?: WalletMenuItem[];
|
|
71
|
+
/** Connect button content (default: "Connect Wallet") */
|
|
72
|
+
connectButtonContent?: ReactNode;
|
|
73
|
+
/** Connect button className (supports gradient classes from @sudobility/design) */
|
|
74
|
+
connectButtonClassName?: string;
|
|
75
|
+
/** Use gradient styling for connect button */
|
|
76
|
+
useGradientButton?: boolean;
|
|
77
|
+
/** Optional user avatar */
|
|
78
|
+
avatar?: string;
|
|
79
|
+
/** Optional display name */
|
|
80
|
+
displayName?: string;
|
|
81
|
+
/** Custom status labels */
|
|
82
|
+
statusLabels?: {
|
|
83
|
+
verified?: string;
|
|
84
|
+
connected?: string;
|
|
85
|
+
disconnected?: string;
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* AppTopBarWithWallet - TopBar with wallet connection integration.
|
|
90
|
+
*
|
|
91
|
+
* This component wraps AppTopBar and provides wallet connection UI
|
|
92
|
+
* for the account section. Uses WalletDropdownMenu from @sudobility/web3-components
|
|
93
|
+
* when provided.
|
|
94
|
+
*
|
|
95
|
+
* @example
|
|
96
|
+
* ```tsx
|
|
97
|
+
* import { WalletDropdownMenu } from '@sudobility/web3-components';
|
|
98
|
+
*
|
|
99
|
+
* <AppTopBarWithWallet
|
|
100
|
+
* logo={{ src: '/logo.png', appName: 'My App' }}
|
|
101
|
+
* menuItems={[...]}
|
|
102
|
+
* WalletDropdownMenuComponent={WalletDropdownMenu}
|
|
103
|
+
* isConnected={isConnected}
|
|
104
|
+
* walletAddress={walletAddress}
|
|
105
|
+
* authStatus={authStatus}
|
|
106
|
+
* chainType={chainType}
|
|
107
|
+
* onConnect={() => navigate('/connect')}
|
|
108
|
+
* onDisconnect={handleDisconnect}
|
|
109
|
+
* walletMenuItems={[
|
|
110
|
+
* { id: 'copy', label: 'Copy Address', icon: ClipboardIcon, onClick: handleCopy },
|
|
111
|
+
* { id: 'disconnect', label: 'Disconnect', icon: LogoutIcon, onClick: handleDisconnect },
|
|
112
|
+
* ]}
|
|
113
|
+
* />
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
export declare const AppTopBarWithWallet: React.FC<AppTopBarWithWalletProps>;
|
|
117
|
+
export default AppTopBarWithWallet;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React, { type ComponentType, type ReactNode } from 'react';
|
|
2
|
+
import { type LanguageSelectorProps } from './language-selector';
|
|
3
|
+
import type { MenuItemConfig, LogoConfig, LanguageConfig, LinkComponentProps } from '../../types';
|
|
4
|
+
export interface AppTopBarProps {
|
|
5
|
+
/** Logo configuration */
|
|
6
|
+
logo: LogoConfig;
|
|
7
|
+
/** Navigation menu items */
|
|
8
|
+
menuItems: MenuItemConfig[];
|
|
9
|
+
/** Available languages for selector (defaults to 16 built-in languages) */
|
|
10
|
+
languages?: LanguageConfig[];
|
|
11
|
+
/** Current language code */
|
|
12
|
+
currentLanguage?: string;
|
|
13
|
+
/** Language change handler */
|
|
14
|
+
onLanguageChange?: (languageCode: string) => void;
|
|
15
|
+
/** Hide language selector */
|
|
16
|
+
hideLanguageSelector?: boolean;
|
|
17
|
+
/** Language selector props override */
|
|
18
|
+
languageSelectorProps?: Partial<LanguageSelectorProps>;
|
|
19
|
+
/** Breakpoint to collapse navigation to hamburger menu */
|
|
20
|
+
collapseBelow?: 'sm' | 'md' | 'lg' | 'xl';
|
|
21
|
+
/** Render prop for account/auth section (right side of topbar) */
|
|
22
|
+
renderAccountSection?: () => ReactNode;
|
|
23
|
+
/** Custom Link component for navigation (for react-router-dom, Next.js, etc.) */
|
|
24
|
+
LinkComponent?: ComponentType<LinkComponentProps>;
|
|
25
|
+
/** Optional sticky positioning */
|
|
26
|
+
sticky?: boolean;
|
|
27
|
+
/** Optional variant */
|
|
28
|
+
variant?: 'default' | 'app';
|
|
29
|
+
/** Mobile menu label for accessibility */
|
|
30
|
+
mobileMenuLabel?: string;
|
|
31
|
+
/** Custom className for topbar */
|
|
32
|
+
className?: string;
|
|
33
|
+
/** z-index level */
|
|
34
|
+
zIndex?: 'default' | 'highest' | 'high';
|
|
35
|
+
/** Aria label for navigation */
|
|
36
|
+
ariaLabel?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* AppTopBar - Base topbar component for Sudobility apps.
|
|
40
|
+
*
|
|
41
|
+
* Features:
|
|
42
|
+
* - Logo with app name on the left
|
|
43
|
+
* - Navigation menu items with icons
|
|
44
|
+
* - Language selector
|
|
45
|
+
* - Render prop for account/auth section
|
|
46
|
+
* - Responsive with hamburger menu on mobile
|
|
47
|
+
* - Dark mode support
|
|
48
|
+
*/
|
|
49
|
+
export declare const AppTopBar: React.FC<AppTopBarProps>;
|
|
50
|
+
export default AppTopBar;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { AppTopBar, type AppTopBarProps } from './app-topbar';
|
|
2
|
+
export { AppTopBarWithFirebaseAuth, type AppTopBarWithFirebaseAuthProps, type AuthMenuItem, type AuthActionProps, } from './app-topbar-with-firebase-auth';
|
|
3
|
+
export { AppTopBarWithWallet, type AppTopBarWithWalletProps, type WalletMenuItem, type WalletDropdownMenuProps, AuthStatus, ChainType, } from './app-topbar-with-wallet';
|
|
4
|
+
export { LanguageSelector, type LanguageSelectorProps, } from './language-selector';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type LanguageConfig } from '../../constants/languages';
|
|
3
|
+
export interface LanguageSelectorProps {
|
|
4
|
+
/** Available languages (defaults to 16 built-in languages) */
|
|
5
|
+
languages?: LanguageConfig[];
|
|
6
|
+
/** Current language code */
|
|
7
|
+
currentLanguage?: string;
|
|
8
|
+
/** Language change handler */
|
|
9
|
+
onLanguageChange?: (languageCode: string) => void;
|
|
10
|
+
/** Variant: 'compact' for topbar, 'full' for settings */
|
|
11
|
+
variant?: 'compact' | 'full';
|
|
12
|
+
/** Custom className */
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Label text for full variant */
|
|
15
|
+
label?: string;
|
|
16
|
+
/** Helper text for full variant */
|
|
17
|
+
helperText?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* LanguageSelector component with dropdown for switching languages.
|
|
21
|
+
* Uses default 16 languages if none provided.
|
|
22
|
+
*/
|
|
23
|
+
export declare const LanguageSelector: React.FC<LanguageSelectorProps>;
|
|
24
|
+
export default LanguageSelector;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './languages';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface LanguageConfig {
|
|
2
|
+
code: string;
|
|
3
|
+
name: string;
|
|
4
|
+
flag: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Default set of 16 supported languages with their flags.
|
|
8
|
+
* Apps can override this list by passing their own languages prop.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_LANGUAGES: LanguageConfig[];
|
|
11
|
+
/**
|
|
12
|
+
* Languages that use right-to-left text direction.
|
|
13
|
+
*/
|
|
14
|
+
export declare const RTL_LANGUAGES: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Check if a language code is RTL.
|
|
17
|
+
*/
|
|
18
|
+
export declare function isRTL(languageCode: string): boolean;
|
package/dist/index.d.ts
ADDED