@openzeppelin/ui-react 1.0.1 → 1.2.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.
package/dist/index.d.cts CHANGED
@@ -1,8 +1,11 @@
1
1
  import * as react0 from "react";
2
2
  import React, { ReactNode } from "react";
3
- import { Connector, ContractAdapter, EcosystemSpecificReactHooks, NativeConfigLoader, NetworkConfig, UiKitConfiguration } from "@openzeppelin/ui-types";
3
+ import { BaseComponentProps, Connector, ContractAdapter, EcosystemSpecificReactHooks, EcosystemWalletComponents, NativeConfigLoader, NetworkConfig, UiKitConfiguration } from "@openzeppelin/ui-types";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
 
6
+ //#region src/version.d.ts
7
+ declare const VERSION: string;
8
+ //#endregion
6
9
  //#region src/hooks/AdapterContext.d.ts
7
10
  /**
8
11
  * Registry type that maps network IDs to their corresponding adapter instances
@@ -27,9 +30,9 @@ interface AdapterContextValue {
27
30
  * Components can access this through the useAdapterContext hook
28
31
  */
29
32
  declare const AdapterContext: react0.Context<AdapterContextValue | null>;
30
- //# sourceMappingURL=AdapterContext.d.ts.map
31
33
  //#endregion
32
34
  //#region src/hooks/AdapterProvider.d.ts
35
+
33
36
  interface AdapterProviderProps {
34
37
  children: ReactNode;
35
38
  /** Function to resolve/create an adapter instance for a given NetworkConfig. */
@@ -49,7 +52,6 @@ declare function AdapterProvider({
49
52
  children,
50
53
  resolveAdapter
51
54
  }: AdapterProviderProps): react_jsx_runtime0.JSX.Element;
52
- //# sourceMappingURL=AdapterProvider.d.ts.map
53
55
  //#endregion
54
56
  //#region src/hooks/WalletStateContext.d.ts
55
57
  interface WalletStateContextValue {
@@ -67,7 +69,6 @@ declare const WalletStateContext: React.Context<WalletStateContextValue | undefi
67
69
  * @throws Error if used outside of WalletStateProvider
68
70
  */
69
71
  declare function useWalletState(): WalletStateContextValue;
70
- //# sourceMappingURL=WalletStateContext.d.ts.map
71
72
  //#endregion
72
73
  //#region src/hooks/WalletStateProvider.d.ts
73
74
  interface WalletStateProviderProps {
@@ -106,7 +107,6 @@ declare function WalletStateProvider({
106
107
  getNetworkConfigById,
107
108
  loadConfigModule
108
109
  }: WalletStateProviderProps): react_jsx_runtime0.JSX.Element;
109
- //# sourceMappingURL=WalletStateProvider.d.ts.map
110
110
  //#endregion
111
111
  //#region src/hooks/AnalyticsContext.d.ts
112
112
  /**
@@ -157,13 +157,6 @@ interface AnalyticsContextValue {
157
157
  * Must be used within an AnalyticsProvider.
158
158
  */
159
159
  declare const AnalyticsContext: react0.Context<AnalyticsContextValue | null>;
160
- /**
161
- * Internal hook to access analytics context.
162
- * Throws an error if used outside of an AnalyticsProvider.
163
- *
164
- * @internal
165
- * @throws Error if used outside of AnalyticsProvider
166
- */
167
160
  //#endregion
168
161
  //#region src/hooks/AnalyticsProvider.d.ts
169
162
  /**
@@ -193,8 +186,6 @@ interface AnalyticsProviderProps {
193
186
  * ```
194
187
  */
195
188
  declare const AnalyticsProvider: React.FC<AnalyticsProviderProps>;
196
- //# sourceMappingURL=AnalyticsProvider.d.ts.map
197
-
198
189
  //#endregion
199
190
  //#region src/hooks/useAnalytics.d.ts
200
191
  /**
@@ -244,7 +235,6 @@ declare const AnalyticsProvider: React.FC<AnalyticsProviderProps>;
244
235
  * @throws Error if used outside of AnalyticsProvider
245
236
  */
246
237
  declare const useAnalytics: () => AnalyticsContextValue;
247
- //# sourceMappingURL=useAnalytics.d.ts.map
248
238
  //#endregion
249
239
  //#region src/hooks/useAdapterContext.d.ts
250
240
  /**
@@ -260,7 +250,51 @@ declare const useAnalytics: () => AnalyticsContextValue;
260
250
  * @returns The adapter context value
261
251
  */
262
252
  declare function useAdapterContext(): AdapterContextValue;
263
- //# sourceMappingURL=useAdapterContext.d.ts.map
253
+ //#endregion
254
+ //#region src/hooks/useWalletComponents.d.ts
255
+ /**
256
+ * Hook that provides direct access to wallet UI components from the active adapter.
257
+ *
258
+ * Use this hook when you need full control over the layout and composition of
259
+ * wallet components. For standard layouts, prefer using `WalletConnectionUI`
260
+ * with its props forwarding capabilities.
261
+ *
262
+ * @returns The wallet components object, or null if no adapter is active or
263
+ * the adapter doesn't provide wallet components.
264
+ *
265
+ * @example
266
+ * ```tsx
267
+ * import { useWalletComponents } from '@openzeppelin/ui-react';
268
+ *
269
+ * function CustomWalletSection() {
270
+ * const walletComponents = useWalletComponents();
271
+ *
272
+ * if (!walletComponents) {
273
+ * return <p>Loading wallet...</p>;
274
+ * }
275
+ *
276
+ * const { ConnectButton, NetworkSwitcher, AccountDisplay } = walletComponents;
277
+ *
278
+ * return (
279
+ * <div className="flex flex-col gap-4">
280
+ * {ConnectButton && (
281
+ * <ConnectButton
282
+ * size="xl"
283
+ * variant="outline"
284
+ * fullWidth
285
+ * className="font-semibold"
286
+ * />
287
+ * )}
288
+ * <div className="flex gap-2">
289
+ * {NetworkSwitcher && <NetworkSwitcher size="sm" />}
290
+ * {AccountDisplay && <AccountDisplay size="sm" />}
291
+ * </div>
292
+ * </div>
293
+ * );
294
+ * }
295
+ * ```
296
+ */
297
+ declare function useWalletComponents(): EcosystemWalletComponents | null;
264
298
  //#endregion
265
299
  //#region src/hooks/useDerivedAccountStatus.d.ts
266
300
  interface DerivedAccountStatus {
@@ -275,7 +309,6 @@ interface DerivedAccountStatus {
275
309
  * Provides default values if the hook or its properties are unavailable.
276
310
  */
277
311
  declare function useDerivedAccountStatus(): DerivedAccountStatus;
278
- //# sourceMappingURL=useDerivedAccountStatus.d.ts.map
279
312
  //#endregion
280
313
  //#region src/hooks/useDerivedSwitchChainStatus.d.ts
281
314
  interface DerivedSwitchChainStatus {
@@ -295,7 +328,6 @@ interface DerivedSwitchChainStatus {
295
328
  * Provides default values if the hook or its properties are unavailable.
296
329
  */
297
330
  declare function useDerivedSwitchChainStatus(): DerivedSwitchChainStatus;
298
- //# sourceMappingURL=useDerivedSwitchChainStatus.d.ts.map
299
331
  //#endregion
300
332
  //#region src/hooks/useDerivedChainInfo.d.ts
301
333
  interface DerivedChainInfo {
@@ -311,7 +343,6 @@ interface DerivedChainInfo {
311
343
  * Provides default values if the hooks or their properties are unavailable.
312
344
  */
313
345
  declare function useDerivedChainInfo(): DerivedChainInfo;
314
- //# sourceMappingURL=useDerivedChainInfo.d.ts.map
315
346
  //#endregion
316
347
  //#region src/hooks/useDerivedConnectStatus.d.ts
317
348
  interface DerivedConnectStatus {
@@ -334,7 +365,6 @@ interface DerivedConnectStatus {
334
365
  * safely-accessed status and control functions for wallet connection.
335
366
  */
336
367
  declare function useDerivedConnectStatus(): DerivedConnectStatus;
337
- //# sourceMappingURL=useDerivedConnectStatus.d.ts.map
338
368
  //#endregion
339
369
  //#region src/hooks/useDerivedDisconnect.d.ts
340
370
  interface DerivedDisconnectStatus {
@@ -351,7 +381,6 @@ interface DerivedDisconnectStatus {
351
381
  * safely-accessed status and control function for wallet disconnection.
352
382
  */
353
383
  declare function useDerivedDisconnect(): DerivedDisconnectStatus;
354
- //# sourceMappingURL=useDerivedDisconnect.d.ts.map
355
384
  //#endregion
356
385
  //#region src/hooks/useWalletReconnectionHandler.d.ts
357
386
  /**
@@ -367,7 +396,6 @@ declare function useDerivedDisconnect(): DerivedDisconnectStatus;
367
396
  * @param onRequeueSwitch - Callback invoked when a network switch should be re-queued
368
397
  */
369
398
  declare function useWalletReconnectionHandler(selectedNetworkConfigId: string | null, selectedAdapter: ContractAdapter | null, networkToSwitchTo: string | null, onRequeueSwitch: (networkId: string) => void): void;
370
- //# sourceMappingURL=useWalletReconnectionHandler.d.ts.map
371
399
  //#endregion
372
400
  //#region src/components/WalletConnectionHeader.d.ts
373
401
  /**
@@ -375,15 +403,42 @@ declare function useWalletReconnectionHandler(selectedNetworkConfigId: string |
375
403
  * Uses useWalletState to get its data.
376
404
  */
377
405
  declare const WalletConnectionHeader: React.FC;
378
- //# sourceMappingURL=WalletConnectionHeader.d.ts.map
379
406
  //#endregion
380
407
  //#region src/components/WalletConnectionUI.d.ts
408
+ /**
409
+ * Props for the WalletConnectionUI component.
410
+ */
381
411
  interface WalletConnectionUIProps {
412
+ /** Additional CSS classes to apply to the wrapper container */
382
413
  className?: string;
414
+ /** Props forwarded to the ConnectButton component */
415
+ connectButtonProps?: BaseComponentProps;
416
+ /** Props forwarded to the AccountDisplay component */
417
+ accountDisplayProps?: BaseComponentProps;
418
+ /** Props forwarded to the NetworkSwitcher component */
419
+ networkSwitcherProps?: BaseComponentProps;
383
420
  }
384
421
  /**
385
422
  * Component that displays wallet connection UI components
386
423
  * provided by the active adapter.
424
+ *
425
+ * @example
426
+ * ```tsx
427
+ * // Basic usage
428
+ * <WalletConnectionUI />
429
+ *
430
+ * // With custom styling for the connect button
431
+ * <WalletConnectionUI
432
+ * connectButtonProps={{ size: "lg", variant: "outline", fullWidth: true }}
433
+ * />
434
+ *
435
+ * // Customizing all components
436
+ * <WalletConnectionUI
437
+ * connectButtonProps={{ size: "lg" }}
438
+ * accountDisplayProps={{ size: "lg" }}
439
+ * networkSwitcherProps={{ size: "lg" }}
440
+ * />
441
+ * ```
387
442
  */
388
443
  declare const WalletConnectionUI: React.FC<WalletConnectionUIProps>;
389
444
  //#endregion
@@ -414,8 +469,6 @@ interface NetworkSwitchManagerProps {
414
469
  * - Provides completion callback for parent components to handle state cleanup
415
470
  */
416
471
  declare const NetworkSwitchManager: React.FC<NetworkSwitchManagerProps>;
417
- //# sourceMappingURL=NetworkSwitchManager.d.ts.map
418
-
419
472
  //#endregion
420
- export { AdapterContext, type AdapterContextValue, AdapterProvider, type AdapterProviderProps, type AdapterRegistry, AnalyticsContext, type AnalyticsContextValue, AnalyticsProvider, type AnalyticsProviderProps, type DerivedAccountStatus, type DerivedChainInfo, type DerivedConnectStatus, type DerivedDisconnectStatus, type DerivedSwitchChainStatus, NetworkSwitchManager, type NetworkSwitchManagerProps, WalletConnectionHeader, WalletConnectionUI, WalletStateContext, type WalletStateContextValue, WalletStateProvider, type WalletStateProviderProps, useAdapterContext, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useWalletReconnectionHandler, useWalletState };
421
- //# sourceMappingURL=index-Cfc5cQFd.d.cts.map
473
+ export { AdapterContext, type AdapterContextValue, AdapterProvider, type AdapterProviderProps, type AdapterRegistry, AnalyticsContext, type AnalyticsContextValue, AnalyticsProvider, type AnalyticsProviderProps, type DerivedAccountStatus, type DerivedChainInfo, type DerivedConnectStatus, type DerivedDisconnectStatus, type DerivedSwitchChainStatus, NetworkSwitchManager, type NetworkSwitchManagerProps, VERSION, WalletConnectionHeader, WalletConnectionUI, type WalletConnectionUIProps, WalletStateContext, type WalletStateContextValue, WalletStateProvider, type WalletStateProviderProps, useAdapterContext, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useWalletComponents, useWalletReconnectionHandler, useWalletState };
474
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/version.ts","../src/hooks/AdapterContext.tsx","../src/hooks/AdapterProvider.tsx","../src/hooks/WalletStateContext.ts","../src/hooks/WalletStateProvider.tsx","../src/hooks/AnalyticsContext.tsx","../src/hooks/AnalyticsProvider.tsx","../src/hooks/useAnalytics.ts","../src/hooks/useAdapterContext.ts","../src/hooks/useWalletComponents.ts","../src/hooks/useDerivedAccountStatus.ts","../src/hooks/useDerivedSwitchChainStatus.ts","../src/hooks/useDerivedChainInfo.ts","../src/hooks/useDerivedConnectStatus.ts","../src/hooks/useDerivedDisconnect.ts","../src/hooks/useWalletReconnectionHandler.ts","../src/components/WalletConnectionHeader.tsx","../src/components/WalletConnectionUI.tsx","../src/components/NetworkSwitchManager.tsx"],"sourcesContent":[],"mappings":";;;;;;cACa;;;;;;;UCkBI,eAAA;EDlBJ,CAAA,SAAqC,EAAA,MAAA,CAAA,ECmB3B,eDnB2B;;;;ACkBlD;AASA;AAWA;UAXiB,mBAAA;wCACu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D,iBWQpC,uBAAA,CAAA,CXRoC,EWQT,oBXRS;;;UYrBnC,uBAAA;;4BAEW;;;;EdLf,KAAA,EcSJ,KdTyC,GAAA,IAAA;;;;ACkBlD;AASA;AAWA;iBafgB,oBAAA,CAAA,GAAwB;;;;;;;;AdvBxC;;;;ACkBA;AASA;AAWA;iBcpBgB,4BAAA,0DAEG;;;;;;;cCVN,wBAAwB,KAAA,CAAM;;;;;;UCA1B,uBAAA;EjBVJ;;;uBiBcU;EhBIN;EASA,mBAAA,CAAA,EgBXO,kBhBYgB;EAU3B;yBgBpBY;;;AfGzB;;;;;;AAgBA;;;;;;;;;AC7BA;;;;;;AAauD,ccsB1C,kBdtB0C,EcsBtB,KAAA,CAAM,EdtBgB,CcsBb,uBdtBa,CAAA;;;;;;UeXtC,yBAAA;ElBVJ;WkBYF;;;EjBMM;EASA,uBAAmB,CAAA,EAAA,GAAA,GAAA,IACI;AAUxC;;;;ACjBA;;;;;;AAgBA;;;;;AAAkF,cgBJrE,oBhBIqE,EgBJ/C,KAAA,CAAM,EhBIyC,CgBJtC,yBhBIsC,CAAA"}
@@ -1,8 +1,11 @@
1
1
  import * as react0 from "react";
2
2
  import React, { ReactNode } from "react";
3
3
  import * as react_jsx_runtime0 from "react/jsx-runtime";
4
- import { Connector, ContractAdapter, EcosystemSpecificReactHooks, NativeConfigLoader, NetworkConfig, UiKitConfiguration } from "@openzeppelin/ui-types";
4
+ import { BaseComponentProps, Connector, ContractAdapter, EcosystemSpecificReactHooks, EcosystemWalletComponents, NativeConfigLoader, NetworkConfig, UiKitConfiguration } from "@openzeppelin/ui-types";
5
5
 
6
+ //#region src/version.d.ts
7
+ declare const VERSION: string;
8
+ //#endregion
6
9
  //#region src/hooks/AdapterContext.d.ts
7
10
  /**
8
11
  * Registry type that maps network IDs to their corresponding adapter instances
@@ -27,9 +30,9 @@ interface AdapterContextValue {
27
30
  * Components can access this through the useAdapterContext hook
28
31
  */
29
32
  declare const AdapterContext: react0.Context<AdapterContextValue | null>;
30
- //# sourceMappingURL=AdapterContext.d.ts.map
31
33
  //#endregion
32
34
  //#region src/hooks/AdapterProvider.d.ts
35
+
33
36
  interface AdapterProviderProps {
34
37
  children: ReactNode;
35
38
  /** Function to resolve/create an adapter instance for a given NetworkConfig. */
@@ -49,7 +52,6 @@ declare function AdapterProvider({
49
52
  children,
50
53
  resolveAdapter
51
54
  }: AdapterProviderProps): react_jsx_runtime0.JSX.Element;
52
- //# sourceMappingURL=AdapterProvider.d.ts.map
53
55
  //#endregion
54
56
  //#region src/hooks/WalletStateContext.d.ts
55
57
  interface WalletStateContextValue {
@@ -67,7 +69,6 @@ declare const WalletStateContext: React.Context<WalletStateContextValue | undefi
67
69
  * @throws Error if used outside of WalletStateProvider
68
70
  */
69
71
  declare function useWalletState(): WalletStateContextValue;
70
- //# sourceMappingURL=WalletStateContext.d.ts.map
71
72
  //#endregion
72
73
  //#region src/hooks/WalletStateProvider.d.ts
73
74
  interface WalletStateProviderProps {
@@ -106,7 +107,6 @@ declare function WalletStateProvider({
106
107
  getNetworkConfigById,
107
108
  loadConfigModule
108
109
  }: WalletStateProviderProps): react_jsx_runtime0.JSX.Element;
109
- //# sourceMappingURL=WalletStateProvider.d.ts.map
110
110
  //#endregion
111
111
  //#region src/hooks/AnalyticsContext.d.ts
112
112
  /**
@@ -157,13 +157,6 @@ interface AnalyticsContextValue {
157
157
  * Must be used within an AnalyticsProvider.
158
158
  */
159
159
  declare const AnalyticsContext: react0.Context<AnalyticsContextValue | null>;
160
- /**
161
- * Internal hook to access analytics context.
162
- * Throws an error if used outside of an AnalyticsProvider.
163
- *
164
- * @internal
165
- * @throws Error if used outside of AnalyticsProvider
166
- */
167
160
  //#endregion
168
161
  //#region src/hooks/AnalyticsProvider.d.ts
169
162
  /**
@@ -193,8 +186,6 @@ interface AnalyticsProviderProps {
193
186
  * ```
194
187
  */
195
188
  declare const AnalyticsProvider: React.FC<AnalyticsProviderProps>;
196
- //# sourceMappingURL=AnalyticsProvider.d.ts.map
197
-
198
189
  //#endregion
199
190
  //#region src/hooks/useAnalytics.d.ts
200
191
  /**
@@ -244,7 +235,6 @@ declare const AnalyticsProvider: React.FC<AnalyticsProviderProps>;
244
235
  * @throws Error if used outside of AnalyticsProvider
245
236
  */
246
237
  declare const useAnalytics: () => AnalyticsContextValue;
247
- //# sourceMappingURL=useAnalytics.d.ts.map
248
238
  //#endregion
249
239
  //#region src/hooks/useAdapterContext.d.ts
250
240
  /**
@@ -260,7 +250,51 @@ declare const useAnalytics: () => AnalyticsContextValue;
260
250
  * @returns The adapter context value
261
251
  */
262
252
  declare function useAdapterContext(): AdapterContextValue;
263
- //# sourceMappingURL=useAdapterContext.d.ts.map
253
+ //#endregion
254
+ //#region src/hooks/useWalletComponents.d.ts
255
+ /**
256
+ * Hook that provides direct access to wallet UI components from the active adapter.
257
+ *
258
+ * Use this hook when you need full control over the layout and composition of
259
+ * wallet components. For standard layouts, prefer using `WalletConnectionUI`
260
+ * with its props forwarding capabilities.
261
+ *
262
+ * @returns The wallet components object, or null if no adapter is active or
263
+ * the adapter doesn't provide wallet components.
264
+ *
265
+ * @example
266
+ * ```tsx
267
+ * import { useWalletComponents } from '@openzeppelin/ui-react';
268
+ *
269
+ * function CustomWalletSection() {
270
+ * const walletComponents = useWalletComponents();
271
+ *
272
+ * if (!walletComponents) {
273
+ * return <p>Loading wallet...</p>;
274
+ * }
275
+ *
276
+ * const { ConnectButton, NetworkSwitcher, AccountDisplay } = walletComponents;
277
+ *
278
+ * return (
279
+ * <div className="flex flex-col gap-4">
280
+ * {ConnectButton && (
281
+ * <ConnectButton
282
+ * size="xl"
283
+ * variant="outline"
284
+ * fullWidth
285
+ * className="font-semibold"
286
+ * />
287
+ * )}
288
+ * <div className="flex gap-2">
289
+ * {NetworkSwitcher && <NetworkSwitcher size="sm" />}
290
+ * {AccountDisplay && <AccountDisplay size="sm" />}
291
+ * </div>
292
+ * </div>
293
+ * );
294
+ * }
295
+ * ```
296
+ */
297
+ declare function useWalletComponents(): EcosystemWalletComponents | null;
264
298
  //#endregion
265
299
  //#region src/hooks/useDerivedAccountStatus.d.ts
266
300
  interface DerivedAccountStatus {
@@ -275,7 +309,6 @@ interface DerivedAccountStatus {
275
309
  * Provides default values if the hook or its properties are unavailable.
276
310
  */
277
311
  declare function useDerivedAccountStatus(): DerivedAccountStatus;
278
- //# sourceMappingURL=useDerivedAccountStatus.d.ts.map
279
312
  //#endregion
280
313
  //#region src/hooks/useDerivedSwitchChainStatus.d.ts
281
314
  interface DerivedSwitchChainStatus {
@@ -295,7 +328,6 @@ interface DerivedSwitchChainStatus {
295
328
  * Provides default values if the hook or its properties are unavailable.
296
329
  */
297
330
  declare function useDerivedSwitchChainStatus(): DerivedSwitchChainStatus;
298
- //# sourceMappingURL=useDerivedSwitchChainStatus.d.ts.map
299
331
  //#endregion
300
332
  //#region src/hooks/useDerivedChainInfo.d.ts
301
333
  interface DerivedChainInfo {
@@ -311,7 +343,6 @@ interface DerivedChainInfo {
311
343
  * Provides default values if the hooks or their properties are unavailable.
312
344
  */
313
345
  declare function useDerivedChainInfo(): DerivedChainInfo;
314
- //# sourceMappingURL=useDerivedChainInfo.d.ts.map
315
346
  //#endregion
316
347
  //#region src/hooks/useDerivedConnectStatus.d.ts
317
348
  interface DerivedConnectStatus {
@@ -334,7 +365,6 @@ interface DerivedConnectStatus {
334
365
  * safely-accessed status and control functions for wallet connection.
335
366
  */
336
367
  declare function useDerivedConnectStatus(): DerivedConnectStatus;
337
- //# sourceMappingURL=useDerivedConnectStatus.d.ts.map
338
368
  //#endregion
339
369
  //#region src/hooks/useDerivedDisconnect.d.ts
340
370
  interface DerivedDisconnectStatus {
@@ -351,7 +381,6 @@ interface DerivedDisconnectStatus {
351
381
  * safely-accessed status and control function for wallet disconnection.
352
382
  */
353
383
  declare function useDerivedDisconnect(): DerivedDisconnectStatus;
354
- //# sourceMappingURL=useDerivedDisconnect.d.ts.map
355
384
  //#endregion
356
385
  //#region src/hooks/useWalletReconnectionHandler.d.ts
357
386
  /**
@@ -367,7 +396,6 @@ declare function useDerivedDisconnect(): DerivedDisconnectStatus;
367
396
  * @param onRequeueSwitch - Callback invoked when a network switch should be re-queued
368
397
  */
369
398
  declare function useWalletReconnectionHandler(selectedNetworkConfigId: string | null, selectedAdapter: ContractAdapter | null, networkToSwitchTo: string | null, onRequeueSwitch: (networkId: string) => void): void;
370
- //# sourceMappingURL=useWalletReconnectionHandler.d.ts.map
371
399
  //#endregion
372
400
  //#region src/components/WalletConnectionHeader.d.ts
373
401
  /**
@@ -375,15 +403,42 @@ declare function useWalletReconnectionHandler(selectedNetworkConfigId: string |
375
403
  * Uses useWalletState to get its data.
376
404
  */
377
405
  declare const WalletConnectionHeader: React.FC;
378
- //# sourceMappingURL=WalletConnectionHeader.d.ts.map
379
406
  //#endregion
380
407
  //#region src/components/WalletConnectionUI.d.ts
408
+ /**
409
+ * Props for the WalletConnectionUI component.
410
+ */
381
411
  interface WalletConnectionUIProps {
412
+ /** Additional CSS classes to apply to the wrapper container */
382
413
  className?: string;
414
+ /** Props forwarded to the ConnectButton component */
415
+ connectButtonProps?: BaseComponentProps;
416
+ /** Props forwarded to the AccountDisplay component */
417
+ accountDisplayProps?: BaseComponentProps;
418
+ /** Props forwarded to the NetworkSwitcher component */
419
+ networkSwitcherProps?: BaseComponentProps;
383
420
  }
384
421
  /**
385
422
  * Component that displays wallet connection UI components
386
423
  * provided by the active adapter.
424
+ *
425
+ * @example
426
+ * ```tsx
427
+ * // Basic usage
428
+ * <WalletConnectionUI />
429
+ *
430
+ * // With custom styling for the connect button
431
+ * <WalletConnectionUI
432
+ * connectButtonProps={{ size: "lg", variant: "outline", fullWidth: true }}
433
+ * />
434
+ *
435
+ * // Customizing all components
436
+ * <WalletConnectionUI
437
+ * connectButtonProps={{ size: "lg" }}
438
+ * accountDisplayProps={{ size: "lg" }}
439
+ * networkSwitcherProps={{ size: "lg" }}
440
+ * />
441
+ * ```
387
442
  */
388
443
  declare const WalletConnectionUI: React.FC<WalletConnectionUIProps>;
389
444
  //#endregion
@@ -414,8 +469,6 @@ interface NetworkSwitchManagerProps {
414
469
  * - Provides completion callback for parent components to handle state cleanup
415
470
  */
416
471
  declare const NetworkSwitchManager: React.FC<NetworkSwitchManagerProps>;
417
- //# sourceMappingURL=NetworkSwitchManager.d.ts.map
418
-
419
472
  //#endregion
420
- export { AdapterContext, type AdapterContextValue, AdapterProvider, type AdapterProviderProps, type AdapterRegistry, AnalyticsContext, type AnalyticsContextValue, AnalyticsProvider, type AnalyticsProviderProps, type DerivedAccountStatus, type DerivedChainInfo, type DerivedConnectStatus, type DerivedDisconnectStatus, type DerivedSwitchChainStatus, NetworkSwitchManager, type NetworkSwitchManagerProps, WalletConnectionHeader, WalletConnectionUI, WalletStateContext, type WalletStateContextValue, WalletStateProvider, type WalletStateProviderProps, useAdapterContext, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useWalletReconnectionHandler, useWalletState };
421
- //# sourceMappingURL=index-B_dOGVNW.d.ts.map
473
+ export { AdapterContext, type AdapterContextValue, AdapterProvider, type AdapterProviderProps, type AdapterRegistry, AnalyticsContext, type AnalyticsContextValue, AnalyticsProvider, type AnalyticsProviderProps, type DerivedAccountStatus, type DerivedChainInfo, type DerivedConnectStatus, type DerivedDisconnectStatus, type DerivedSwitchChainStatus, NetworkSwitchManager, type NetworkSwitchManagerProps, VERSION, WalletConnectionHeader, WalletConnectionUI, type WalletConnectionUIProps, WalletStateContext, type WalletStateContextValue, WalletStateProvider, type WalletStateProviderProps, useAdapterContext, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useWalletComponents, useWalletReconnectionHandler, useWalletState };
474
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/version.ts","../src/hooks/AdapterContext.tsx","../src/hooks/AdapterProvider.tsx","../src/hooks/WalletStateContext.ts","../src/hooks/WalletStateProvider.tsx","../src/hooks/AnalyticsContext.tsx","../src/hooks/AnalyticsProvider.tsx","../src/hooks/useAnalytics.ts","../src/hooks/useAdapterContext.ts","../src/hooks/useWalletComponents.ts","../src/hooks/useDerivedAccountStatus.ts","../src/hooks/useDerivedSwitchChainStatus.ts","../src/hooks/useDerivedChainInfo.ts","../src/hooks/useDerivedConnectStatus.ts","../src/hooks/useDerivedDisconnect.ts","../src/hooks/useWalletReconnectionHandler.ts","../src/components/WalletConnectionHeader.tsx","../src/components/WalletConnectionUI.tsx","../src/components/NetworkSwitchManager.tsx"],"sourcesContent":[],"mappings":";;;;;;cACa;;;;;;;UCkBI,eAAA;EDlBJ,CAAA,SAAqC,EAAA,MAAA,CAAA,ECmB3B,eDnB2B;;;;ACkBlD;AASA;AAWA;UAXiB,mBAAA;wCACuB;aAC3B;ICRI,SAAA,EAAA,OAAA;EACL,CAAA;;;;;AAeZ;AAAkC,cDCrB,cCDqB,EDCP,MAAA,CAAA,OCDO,CDCP,mBCDO,GAAA,IAAA,CAAA;;;;AAftB,UADK,oBAAA,CACL;EAEsB,QAAA,EAFtB,SAEsB;EAA0B;EAAR,cAAA,EAAA,CAAA,aAAA,EAAlB,aAAkB,EAAA,GAAA,OAAA,CAAQ,eAAR,CAAA;;AAapD;;;;;;;;;AC7BA;AAIuB,iBDyBP,eAAA,CCzBO;EAAA,QAAA;EAAA;AAAA,CAAA,EDyBuC,oBCzBvC,CAAA,EDyB2D,kBAAA,CAAA,GAAA,CAAA,OCzB3D;;;UAJN,uBAAA;;;uBAIM;EHZV,aAAqC,EGejC,eHfiC,GAAA,IAAA;;qBGoB7B;gDAC2B,QAAQ;AFHxD;AASiB,cEsEJ,kBFrE2B,EEqET,KAAA,CAAA,OFpElB,CEoEkB,uBFpEH,GAAA,SAAA,CAAA;AAS5B;;;;ACjBiB,iBCkFD,cAAA,CAAA,CDlFqB,ECkFH,uBDlFG;;;UEMpB,wBA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@@ -3,6 +3,10 @@ import { AnalyticsService, cn, isRecordWithProperties, logger } from "@openzeppe
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { Button } from "@openzeppelin/ui-components";
5
5
 
6
+ //#region src/version.ts
7
+ const VERSION = "1.2.0";
8
+
9
+ //#endregion
6
10
  //#region src/hooks/AdapterContext.tsx
7
11
  /**
8
12
  * AdapterContext.tsx
@@ -540,6 +544,60 @@ const useAnalytics = () => {
540
544
  }
541
545
  };
542
546
 
547
+ //#endregion
548
+ //#region src/hooks/useWalletComponents.ts
549
+ /**
550
+ * Hook that provides direct access to wallet UI components from the active adapter.
551
+ *
552
+ * Use this hook when you need full control over the layout and composition of
553
+ * wallet components. For standard layouts, prefer using `WalletConnectionUI`
554
+ * with its props forwarding capabilities.
555
+ *
556
+ * @returns The wallet components object, or null if no adapter is active or
557
+ * the adapter doesn't provide wallet components.
558
+ *
559
+ * @example
560
+ * ```tsx
561
+ * import { useWalletComponents } from '@openzeppelin/ui-react';
562
+ *
563
+ * function CustomWalletSection() {
564
+ * const walletComponents = useWalletComponents();
565
+ *
566
+ * if (!walletComponents) {
567
+ * return <p>Loading wallet...</p>;
568
+ * }
569
+ *
570
+ * const { ConnectButton, NetworkSwitcher, AccountDisplay } = walletComponents;
571
+ *
572
+ * return (
573
+ * <div className="flex flex-col gap-4">
574
+ * {ConnectButton && (
575
+ * <ConnectButton
576
+ * size="xl"
577
+ * variant="outline"
578
+ * fullWidth
579
+ * className="font-semibold"
580
+ * />
581
+ * )}
582
+ * <div className="flex gap-2">
583
+ * {NetworkSwitcher && <NetworkSwitcher size="sm" />}
584
+ * {AccountDisplay && <AccountDisplay size="sm" />}
585
+ * </div>
586
+ * </div>
587
+ * );
588
+ * }
589
+ * ```
590
+ */
591
+ function useWalletComponents() {
592
+ const { activeAdapter } = useWalletState();
593
+ if (!activeAdapter || typeof activeAdapter.getEcosystemWalletComponents !== "function") return null;
594
+ try {
595
+ return activeAdapter.getEcosystemWalletComponents() ?? null;
596
+ } catch {
597
+ return null;
598
+ }
599
+ }
600
+
543
601
  //#endregion
544
602
  //#region src/hooks/useDerivedAccountStatus.ts
545
603
  const defaultAccountStatus = {
@@ -710,8 +768,26 @@ function useWalletReconnectionHandler(selectedNetworkConfigId, selectedAdapter,
710
768
  /**
711
769
  * Component that displays wallet connection UI components
712
770
  * provided by the active adapter.
771
+ *
772
+ * @example
773
+ * ```tsx
774
+ * // Basic usage
775
+ * <WalletConnectionUI />
776
+ *
777
+ * // With custom styling for the connect button
778
+ * <WalletConnectionUI
779
+ * connectButtonProps={{ size: "lg", variant: "outline", fullWidth: true }}
780
+ * />
781
+ *
782
+ * // Customizing all components
783
+ * <WalletConnectionUI
784
+ * connectButtonProps={{ size: "lg" }}
785
+ * accountDisplayProps={{ size: "lg" }}
786
+ * networkSwitcherProps={{ size: "lg" }}
787
+ * />
788
+ * ```
713
789
  */
714
- const WalletConnectionUI = ({ className }) => {
790
+ const WalletConnectionUI = ({ className, connectButtonProps, accountDisplayProps, networkSwitcherProps }) => {
715
791
  const [isError, setIsError] = useState(false);
716
792
  const { activeAdapter, walletFacadeHooks } = useWalletState();
717
793
  useEffect(() => {
@@ -757,9 +833,9 @@ const WalletConnectionUI = ({ className }) => {
757
833
  return /* @__PURE__ */ jsxs("div", {
758
834
  className: cn("flex items-center gap-4", className),
759
835
  children: [
760
- NetworkSwitcher && /* @__PURE__ */ jsx(NetworkSwitcher, {}),
761
- AccountDisplay && /* @__PURE__ */ jsx(AccountDisplay, {}),
762
- ConnectButton && /* @__PURE__ */ jsx(ConnectButton, {})
836
+ NetworkSwitcher && /* @__PURE__ */ jsx(NetworkSwitcher, { ...networkSwitcherProps }),
837
+ AccountDisplay && /* @__PURE__ */ jsx(AccountDisplay, { ...accountDisplayProps }),
838
+ ConnectButton && /* @__PURE__ */ jsx(ConnectButton, { ...connectButtonProps })
763
839
  ]
764
840
  });
765
841
  };
@@ -916,5 +992,5 @@ const NetworkSwitchManager = ({ adapter, targetNetworkId, onNetworkSwitchComplet
916
992
  };
917
993
 
918
994
  //#endregion
919
- export { AdapterContext, AdapterProvider, AnalyticsContext, AnalyticsProvider, NetworkSwitchManager, WalletConnectionHeader, WalletConnectionUI, WalletStateContext, WalletStateProvider, useAdapterContext, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useWalletReconnectionHandler, useWalletState };
920
- //# sourceMappingURL=index.js.map
995
+ export { AdapterContext, AdapterProvider, AnalyticsContext, AnalyticsProvider, NetworkSwitchManager, VERSION, WalletConnectionHeader, WalletConnectionUI, WalletStateContext, WalletStateProvider, useAdapterContext, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useWalletComponents, useWalletReconnectionHandler, useWalletState };
996
+ //# sourceMappingURL=index.mjs.map