@openzeppelin/ui-utils 1.0.0 → 1.1.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-qy1AQMhr.d.ts → index-BxQFU6OX.d.cts} +109 -3
- package/dist/index-BxQFU6OX.d.cts.map +1 -0
- package/dist/{index-DNIN-Squ.d.cts → index-CgrWFuYK.d.ts} +109 -3
- package/dist/index-CgrWFuYK.d.ts.map +1 -0
- package/dist/index.cjs +158 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +109 -3
- package/dist/index.d.ts +109 -3
- package/dist/index.js +155 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/index-DNIN-Squ.d.cts.map +0 -1
- package/dist/index-qy1AQMhr.d.ts.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccessSnapshot, AppRuntimeConfig, ContractAdapter, FieldType, FieldValidation, FieldValue, FormValues, IndexerEndpointConfig, RoleAssignment, RoleIdentifier, RpcEndpointConfig, ServiceParameterConfig, UiKitName, UserExplorerConfig, UserRpcProviderConfig } from "@openzeppelin/ui-types";
|
|
1
|
+
import { AccessSnapshot, AppRuntimeConfig, ContractAdapter, FieldType, FieldValidation, FieldValue, FormValues, IndexerEndpointConfig, RoleAssignment, RoleIdentifier, RpcEndpointConfig, ServiceParameterConfig, UiKitName, UserExplorerConfig, UserRpcProviderConfig, WalletComponentSize, WalletComponentVariant } from "@openzeppelin/ui-types";
|
|
2
2
|
import { ClassValue } from "clsx";
|
|
3
3
|
|
|
4
4
|
//#region src/contractInputs.d.ts
|
|
@@ -1201,5 +1201,111 @@ declare function getErrorMessage(error: unknown): string;
|
|
|
1201
1201
|
*/
|
|
1202
1202
|
declare function formatAccessControlError(error: AccessControlErrorLike): string;
|
|
1203
1203
|
//#endregion
|
|
1204
|
-
|
|
1205
|
-
|
|
1204
|
+
//#region src/walletComponentSizing.d.ts
|
|
1205
|
+
/**
|
|
1206
|
+
* Size properties for wallet connect button components
|
|
1207
|
+
*/
|
|
1208
|
+
interface WalletButtonSizeProps {
|
|
1209
|
+
/** Button component size prop */
|
|
1210
|
+
size: 'sm' | 'default' | 'lg';
|
|
1211
|
+
/** Additional Tailwind classes for fine-tuned sizing */
|
|
1212
|
+
className: string;
|
|
1213
|
+
/** Icon size class (e.g., 'size-4') */
|
|
1214
|
+
iconSize: string;
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Size properties for wallet account display components
|
|
1218
|
+
*/
|
|
1219
|
+
interface WalletAccountDisplaySizeProps {
|
|
1220
|
+
/** Primary text size class */
|
|
1221
|
+
textSize: string;
|
|
1222
|
+
/** Secondary/subtitle text size class */
|
|
1223
|
+
subTextSize: string;
|
|
1224
|
+
/** Icon button container size class */
|
|
1225
|
+
iconButtonSize: string;
|
|
1226
|
+
/** Icon size class */
|
|
1227
|
+
iconSize: string;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Size properties for wallet network switcher components
|
|
1231
|
+
*/
|
|
1232
|
+
interface WalletNetworkSwitcherSizeProps {
|
|
1233
|
+
/** Select trigger className */
|
|
1234
|
+
triggerClassName: string;
|
|
1235
|
+
/** Select item className */
|
|
1236
|
+
itemClassName: string;
|
|
1237
|
+
/** Loader icon size class */
|
|
1238
|
+
loaderSize: string;
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Maps WalletComponentSize to Button component props and styling.
|
|
1242
|
+
* Used for ConnectButton and similar button-based wallet components.
|
|
1243
|
+
*
|
|
1244
|
+
* @param walletSize - The wallet component size ('sm' | 'default' | 'lg' | 'xl')
|
|
1245
|
+
* @returns Button size props including component size, className overrides, and icon size
|
|
1246
|
+
*
|
|
1247
|
+
* @example
|
|
1248
|
+
* ```tsx
|
|
1249
|
+
* const sizeProps = getWalletButtonSizeProps(size);
|
|
1250
|
+
* <Button size={sizeProps.size} className={sizeProps.className}>
|
|
1251
|
+
* <Icon className={sizeProps.iconSize} />
|
|
1252
|
+
* </Button>
|
|
1253
|
+
* ```
|
|
1254
|
+
*/
|
|
1255
|
+
declare function getWalletButtonSizeProps(walletSize: WalletComponentSize | undefined): WalletButtonSizeProps;
|
|
1256
|
+
/**
|
|
1257
|
+
* Maps WalletComponentSize to AccountDisplay component styling.
|
|
1258
|
+
* Provides text sizes and icon button dimensions for account info display.
|
|
1259
|
+
*
|
|
1260
|
+
* @param walletSize - The wallet component size ('sm' | 'default' | 'lg' | 'xl')
|
|
1261
|
+
* @returns Account display size props for text, subtitle, and disconnect button
|
|
1262
|
+
*
|
|
1263
|
+
* @example
|
|
1264
|
+
* ```tsx
|
|
1265
|
+
* const sizeProps = getWalletAccountDisplaySizeProps(size);
|
|
1266
|
+
* <span className={sizeProps.textSize}>{address}</span>
|
|
1267
|
+
* <Button className={sizeProps.iconButtonSize}>
|
|
1268
|
+
* <LogOut className={sizeProps.iconSize} />
|
|
1269
|
+
* </Button>
|
|
1270
|
+
* ```
|
|
1271
|
+
*/
|
|
1272
|
+
declare function getWalletAccountDisplaySizeProps(walletSize: WalletComponentSize | undefined): WalletAccountDisplaySizeProps;
|
|
1273
|
+
/**
|
|
1274
|
+
* Maps WalletComponentSize to NetworkSwitcher component styling.
|
|
1275
|
+
* Provides sizing for select trigger, items, and loading indicator.
|
|
1276
|
+
*
|
|
1277
|
+
* @param walletSize - The wallet component size ('sm' | 'default' | 'lg' | 'xl')
|
|
1278
|
+
* @returns Network switcher size props for select components
|
|
1279
|
+
*
|
|
1280
|
+
* @example
|
|
1281
|
+
* ```tsx
|
|
1282
|
+
* const sizeProps = getWalletNetworkSwitcherSizeProps(size);
|
|
1283
|
+
* <SelectTrigger className={sizeProps.triggerClassName}>
|
|
1284
|
+
* ...
|
|
1285
|
+
* </SelectTrigger>
|
|
1286
|
+
* <Loader2 className={sizeProps.loaderSize} />
|
|
1287
|
+
* ```
|
|
1288
|
+
*/
|
|
1289
|
+
declare function getWalletNetworkSwitcherSizeProps(walletSize: WalletComponentSize | undefined): WalletNetworkSwitcherSizeProps;
|
|
1290
|
+
/**
|
|
1291
|
+
* Maps WalletComponentVariant to NetworkSwitcher SelectTrigger styling.
|
|
1292
|
+
* Since Select components don't have a native variant prop like Button,
|
|
1293
|
+
* this maps variants to appropriate Tailwind CSS classes.
|
|
1294
|
+
*
|
|
1295
|
+
* @param variant - The wallet component variant ('default' | 'outline' | 'ghost' | 'secondary')
|
|
1296
|
+
* @returns CSS class string for the SelectTrigger
|
|
1297
|
+
*
|
|
1298
|
+
* @example
|
|
1299
|
+
* ```tsx
|
|
1300
|
+
* const variantClassName = getWalletNetworkSwitcherVariantClassName(variant);
|
|
1301
|
+
* <SelectTrigger className={cn(sizeProps.triggerClassName, variantClassName)}>
|
|
1302
|
+
* ...
|
|
1303
|
+
* </SelectTrigger>
|
|
1304
|
+
* ```
|
|
1305
|
+
*/
|
|
1306
|
+
declare function getWalletNetworkSwitcherVariantClassName(variant: WalletComponentVariant | undefined): string;
|
|
1307
|
+
//# sourceMappingURL=walletComponentSizing.d.ts.map
|
|
1308
|
+
|
|
1309
|
+
//#endregion
|
|
1310
|
+
export { AnalyticsService, AppConfigService, BytesValidationOptions, BytesValidationResult, ConfigLoadStrategy, DEFAULT_CONCURRENCY_LIMIT, DeepLinkParams, ExplorerConfigEvent, NumericBoundsMap, RouterService, RpcConfigEvent, ServiceConfigEvent, UserExplorerConfigService, UserNetworkServiceConfigService, UserRpcConfigService, WalletAccountDisplaySizeProps, WalletButtonSizeProps, WalletNetworkSwitcherSizeProps, addressesEqual, appConfigService, base64ToBytes, buildRequiredInputSnapshot, bytesToHex, cn, compareSnapshots, computeEffectiveProviderPreference, createEmptySnapshot, delay, deserializeSnapshot, detectBytesEncoding, enhanceNumericValidation, findRoleAssignment, formatAccessControlError, formatTimestamp, generateId, getAllMembers, getBytesSize, getDefaultValueForType, getErrorMessage, getForcedService, getInvalidUrlMessage, getMissingRequiredContractInputs, getTotalMemberCount, getWalletAccountDisplaySizeProps, getWalletButtonSizeProps, getWalletNetworkSwitcherSizeProps, getWalletNetworkSwitcherVariantClassName, hasMissingRequiredContractInputs, hasOwnership, hasRoles, hexToBytes, isAccessControlError, isDevelopmentOrTestEnvironment, isPlainObject, isProductionEnvironment, isRecordWithProperties, isValidUrl, logger, normalizeAddress, parseDeepLink, promiseAllSettledWithLimit, promiseAllWithLimit, rateLimitedBatch, requiredSnapshotsEqual, routerService, sanitizeHtml, serializeSnapshot, simpleHash, stringToBytes, truncateMiddle, userExplorerConfigService, userNetworkServiceConfigService, userRpcConfigService, validateBytes, validateBytesSimple, validateSnapshot, withTimeout };
|
|
1311
|
+
//# sourceMappingURL=index-BxQFU6OX.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClassValue } from "clsx";
|
|
2
|
-
import { AccessSnapshot, AppRuntimeConfig, ContractAdapter, FieldType, FieldValidation, FieldValue, FormValues, IndexerEndpointConfig, RoleAssignment, RoleIdentifier, RpcEndpointConfig, ServiceParameterConfig, UiKitName, UserExplorerConfig, UserRpcProviderConfig } from "@openzeppelin/ui-types";
|
|
2
|
+
import { AccessSnapshot, AppRuntimeConfig, ContractAdapter, FieldType, FieldValidation, FieldValue, FormValues, IndexerEndpointConfig, RoleAssignment, RoleIdentifier, RpcEndpointConfig, ServiceParameterConfig, UiKitName, UserExplorerConfig, UserRpcProviderConfig, WalletComponentSize, WalletComponentVariant } from "@openzeppelin/ui-types";
|
|
3
3
|
|
|
4
4
|
//#region src/contractInputs.d.ts
|
|
5
5
|
/**
|
|
@@ -1201,5 +1201,111 @@ declare function getErrorMessage(error: unknown): string;
|
|
|
1201
1201
|
*/
|
|
1202
1202
|
declare function formatAccessControlError(error: AccessControlErrorLike): string;
|
|
1203
1203
|
//#endregion
|
|
1204
|
-
|
|
1205
|
-
|
|
1204
|
+
//#region src/walletComponentSizing.d.ts
|
|
1205
|
+
/**
|
|
1206
|
+
* Size properties for wallet connect button components
|
|
1207
|
+
*/
|
|
1208
|
+
interface WalletButtonSizeProps {
|
|
1209
|
+
/** Button component size prop */
|
|
1210
|
+
size: 'sm' | 'default' | 'lg';
|
|
1211
|
+
/** Additional Tailwind classes for fine-tuned sizing */
|
|
1212
|
+
className: string;
|
|
1213
|
+
/** Icon size class (e.g., 'size-4') */
|
|
1214
|
+
iconSize: string;
|
|
1215
|
+
}
|
|
1216
|
+
/**
|
|
1217
|
+
* Size properties for wallet account display components
|
|
1218
|
+
*/
|
|
1219
|
+
interface WalletAccountDisplaySizeProps {
|
|
1220
|
+
/** Primary text size class */
|
|
1221
|
+
textSize: string;
|
|
1222
|
+
/** Secondary/subtitle text size class */
|
|
1223
|
+
subTextSize: string;
|
|
1224
|
+
/** Icon button container size class */
|
|
1225
|
+
iconButtonSize: string;
|
|
1226
|
+
/** Icon size class */
|
|
1227
|
+
iconSize: string;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Size properties for wallet network switcher components
|
|
1231
|
+
*/
|
|
1232
|
+
interface WalletNetworkSwitcherSizeProps {
|
|
1233
|
+
/** Select trigger className */
|
|
1234
|
+
triggerClassName: string;
|
|
1235
|
+
/** Select item className */
|
|
1236
|
+
itemClassName: string;
|
|
1237
|
+
/** Loader icon size class */
|
|
1238
|
+
loaderSize: string;
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* Maps WalletComponentSize to Button component props and styling.
|
|
1242
|
+
* Used for ConnectButton and similar button-based wallet components.
|
|
1243
|
+
*
|
|
1244
|
+
* @param walletSize - The wallet component size ('sm' | 'default' | 'lg' | 'xl')
|
|
1245
|
+
* @returns Button size props including component size, className overrides, and icon size
|
|
1246
|
+
*
|
|
1247
|
+
* @example
|
|
1248
|
+
* ```tsx
|
|
1249
|
+
* const sizeProps = getWalletButtonSizeProps(size);
|
|
1250
|
+
* <Button size={sizeProps.size} className={sizeProps.className}>
|
|
1251
|
+
* <Icon className={sizeProps.iconSize} />
|
|
1252
|
+
* </Button>
|
|
1253
|
+
* ```
|
|
1254
|
+
*/
|
|
1255
|
+
declare function getWalletButtonSizeProps(walletSize: WalletComponentSize | undefined): WalletButtonSizeProps;
|
|
1256
|
+
/**
|
|
1257
|
+
* Maps WalletComponentSize to AccountDisplay component styling.
|
|
1258
|
+
* Provides text sizes and icon button dimensions for account info display.
|
|
1259
|
+
*
|
|
1260
|
+
* @param walletSize - The wallet component size ('sm' | 'default' | 'lg' | 'xl')
|
|
1261
|
+
* @returns Account display size props for text, subtitle, and disconnect button
|
|
1262
|
+
*
|
|
1263
|
+
* @example
|
|
1264
|
+
* ```tsx
|
|
1265
|
+
* const sizeProps = getWalletAccountDisplaySizeProps(size);
|
|
1266
|
+
* <span className={sizeProps.textSize}>{address}</span>
|
|
1267
|
+
* <Button className={sizeProps.iconButtonSize}>
|
|
1268
|
+
* <LogOut className={sizeProps.iconSize} />
|
|
1269
|
+
* </Button>
|
|
1270
|
+
* ```
|
|
1271
|
+
*/
|
|
1272
|
+
declare function getWalletAccountDisplaySizeProps(walletSize: WalletComponentSize | undefined): WalletAccountDisplaySizeProps;
|
|
1273
|
+
/**
|
|
1274
|
+
* Maps WalletComponentSize to NetworkSwitcher component styling.
|
|
1275
|
+
* Provides sizing for select trigger, items, and loading indicator.
|
|
1276
|
+
*
|
|
1277
|
+
* @param walletSize - The wallet component size ('sm' | 'default' | 'lg' | 'xl')
|
|
1278
|
+
* @returns Network switcher size props for select components
|
|
1279
|
+
*
|
|
1280
|
+
* @example
|
|
1281
|
+
* ```tsx
|
|
1282
|
+
* const sizeProps = getWalletNetworkSwitcherSizeProps(size);
|
|
1283
|
+
* <SelectTrigger className={sizeProps.triggerClassName}>
|
|
1284
|
+
* ...
|
|
1285
|
+
* </SelectTrigger>
|
|
1286
|
+
* <Loader2 className={sizeProps.loaderSize} />
|
|
1287
|
+
* ```
|
|
1288
|
+
*/
|
|
1289
|
+
declare function getWalletNetworkSwitcherSizeProps(walletSize: WalletComponentSize | undefined): WalletNetworkSwitcherSizeProps;
|
|
1290
|
+
/**
|
|
1291
|
+
* Maps WalletComponentVariant to NetworkSwitcher SelectTrigger styling.
|
|
1292
|
+
* Since Select components don't have a native variant prop like Button,
|
|
1293
|
+
* this maps variants to appropriate Tailwind CSS classes.
|
|
1294
|
+
*
|
|
1295
|
+
* @param variant - The wallet component variant ('default' | 'outline' | 'ghost' | 'secondary')
|
|
1296
|
+
* @returns CSS class string for the SelectTrigger
|
|
1297
|
+
*
|
|
1298
|
+
* @example
|
|
1299
|
+
* ```tsx
|
|
1300
|
+
* const variantClassName = getWalletNetworkSwitcherVariantClassName(variant);
|
|
1301
|
+
* <SelectTrigger className={cn(sizeProps.triggerClassName, variantClassName)}>
|
|
1302
|
+
* ...
|
|
1303
|
+
* </SelectTrigger>
|
|
1304
|
+
* ```
|
|
1305
|
+
*/
|
|
1306
|
+
declare function getWalletNetworkSwitcherVariantClassName(variant: WalletComponentVariant | undefined): string;
|
|
1307
|
+
//# sourceMappingURL=walletComponentSizing.d.ts.map
|
|
1308
|
+
|
|
1309
|
+
//#endregion
|
|
1310
|
+
export { AnalyticsService, AppConfigService, BytesValidationOptions, BytesValidationResult, ConfigLoadStrategy, DEFAULT_CONCURRENCY_LIMIT, DeepLinkParams, ExplorerConfigEvent, NumericBoundsMap, RouterService, RpcConfigEvent, ServiceConfigEvent, UserExplorerConfigService, UserNetworkServiceConfigService, UserRpcConfigService, WalletAccountDisplaySizeProps, WalletButtonSizeProps, WalletNetworkSwitcherSizeProps, addressesEqual, appConfigService, base64ToBytes, buildRequiredInputSnapshot, bytesToHex, cn, compareSnapshots, computeEffectiveProviderPreference, createEmptySnapshot, delay, deserializeSnapshot, detectBytesEncoding, enhanceNumericValidation, findRoleAssignment, formatAccessControlError, formatTimestamp, generateId, getAllMembers, getBytesSize, getDefaultValueForType, getErrorMessage, getForcedService, getInvalidUrlMessage, getMissingRequiredContractInputs, getTotalMemberCount, getWalletAccountDisplaySizeProps, getWalletButtonSizeProps, getWalletNetworkSwitcherSizeProps, getWalletNetworkSwitcherVariantClassName, hasMissingRequiredContractInputs, hasOwnership, hasRoles, hexToBytes, isAccessControlError, isDevelopmentOrTestEnvironment, isPlainObject, isProductionEnvironment, isRecordWithProperties, isValidUrl, logger, normalizeAddress, parseDeepLink, promiseAllSettledWithLimit, promiseAllWithLimit, rateLimitedBatch, requiredSnapshotsEqual, routerService, sanitizeHtml, serializeSnapshot, simpleHash, stringToBytes, truncateMiddle, userExplorerConfigService, userNetworkServiceConfigService, userRpcConfigService, validateBytes, validateBytesSimple, validateSnapshot, withTimeout };
|
|
1311
|
+
//# sourceMappingURL=index-CgrWFuYK.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -2075,5 +2075,159 @@ function formatAccessControlError(error) {
|
|
|
2075
2075
|
}
|
|
2076
2076
|
|
|
2077
2077
|
//#endregion
|
|
2078
|
-
|
|
2078
|
+
//#region src/walletComponentSizing.ts
|
|
2079
|
+
/**
|
|
2080
|
+
* Maps WalletComponentSize to Button component props and styling.
|
|
2081
|
+
* Used for ConnectButton and similar button-based wallet components.
|
|
2082
|
+
*
|
|
2083
|
+
* @param walletSize - The wallet component size ('sm' | 'default' | 'lg' | 'xl')
|
|
2084
|
+
* @returns Button size props including component size, className overrides, and icon size
|
|
2085
|
+
*
|
|
2086
|
+
* @example
|
|
2087
|
+
* ```tsx
|
|
2088
|
+
* const sizeProps = getWalletButtonSizeProps(size);
|
|
2089
|
+
* <Button size={sizeProps.size} className={sizeProps.className}>
|
|
2090
|
+
* <Icon className={sizeProps.iconSize} />
|
|
2091
|
+
* </Button>
|
|
2092
|
+
* ```
|
|
2093
|
+
*/
|
|
2094
|
+
function getWalletButtonSizeProps(walletSize) {
|
|
2095
|
+
switch (walletSize) {
|
|
2096
|
+
case "sm": return {
|
|
2097
|
+
size: "sm",
|
|
2098
|
+
className: "h-7 px-2 text-[11px]",
|
|
2099
|
+
iconSize: "size-3"
|
|
2100
|
+
};
|
|
2101
|
+
case "lg": return {
|
|
2102
|
+
size: "lg",
|
|
2103
|
+
className: "h-11 px-5",
|
|
2104
|
+
iconSize: "size-5"
|
|
2105
|
+
};
|
|
2106
|
+
case "xl": return {
|
|
2107
|
+
size: "lg",
|
|
2108
|
+
className: "h-12 px-6 text-base",
|
|
2109
|
+
iconSize: "size-5"
|
|
2110
|
+
};
|
|
2111
|
+
case "default":
|
|
2112
|
+
default: return {
|
|
2113
|
+
size: "default",
|
|
2114
|
+
className: "h-9 px-4 text-sm",
|
|
2115
|
+
iconSize: "size-4"
|
|
2116
|
+
};
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
/**
|
|
2120
|
+
* Maps WalletComponentSize to AccountDisplay component styling.
|
|
2121
|
+
* Provides text sizes and icon button dimensions for account info display.
|
|
2122
|
+
*
|
|
2123
|
+
* @param walletSize - The wallet component size ('sm' | 'default' | 'lg' | 'xl')
|
|
2124
|
+
* @returns Account display size props for text, subtitle, and disconnect button
|
|
2125
|
+
*
|
|
2126
|
+
* @example
|
|
2127
|
+
* ```tsx
|
|
2128
|
+
* const sizeProps = getWalletAccountDisplaySizeProps(size);
|
|
2129
|
+
* <span className={sizeProps.textSize}>{address}</span>
|
|
2130
|
+
* <Button className={sizeProps.iconButtonSize}>
|
|
2131
|
+
* <LogOut className={sizeProps.iconSize} />
|
|
2132
|
+
* </Button>
|
|
2133
|
+
* ```
|
|
2134
|
+
*/
|
|
2135
|
+
function getWalletAccountDisplaySizeProps(walletSize) {
|
|
2136
|
+
switch (walletSize) {
|
|
2137
|
+
case "sm": return {
|
|
2138
|
+
textSize: "text-[11px]",
|
|
2139
|
+
subTextSize: "text-[8px]",
|
|
2140
|
+
iconButtonSize: "size-5",
|
|
2141
|
+
iconSize: "size-3"
|
|
2142
|
+
};
|
|
2143
|
+
case "lg": return {
|
|
2144
|
+
textSize: "text-base",
|
|
2145
|
+
subTextSize: "text-xs",
|
|
2146
|
+
iconButtonSize: "size-8",
|
|
2147
|
+
iconSize: "size-4"
|
|
2148
|
+
};
|
|
2149
|
+
case "xl": return {
|
|
2150
|
+
textSize: "text-lg",
|
|
2151
|
+
subTextSize: "text-sm",
|
|
2152
|
+
iconButtonSize: "size-10",
|
|
2153
|
+
iconSize: "size-5"
|
|
2154
|
+
};
|
|
2155
|
+
case "default":
|
|
2156
|
+
default: return {
|
|
2157
|
+
textSize: "text-xs",
|
|
2158
|
+
subTextSize: "text-[9px]",
|
|
2159
|
+
iconButtonSize: "size-6",
|
|
2160
|
+
iconSize: "size-3.5"
|
|
2161
|
+
};
|
|
2162
|
+
}
|
|
2163
|
+
}
|
|
2164
|
+
/**
|
|
2165
|
+
* Maps WalletComponentSize to NetworkSwitcher component styling.
|
|
2166
|
+
* Provides sizing for select trigger, items, and loading indicator.
|
|
2167
|
+
*
|
|
2168
|
+
* @param walletSize - The wallet component size ('sm' | 'default' | 'lg' | 'xl')
|
|
2169
|
+
* @returns Network switcher size props for select components
|
|
2170
|
+
*
|
|
2171
|
+
* @example
|
|
2172
|
+
* ```tsx
|
|
2173
|
+
* const sizeProps = getWalletNetworkSwitcherSizeProps(size);
|
|
2174
|
+
* <SelectTrigger className={sizeProps.triggerClassName}>
|
|
2175
|
+
* ...
|
|
2176
|
+
* </SelectTrigger>
|
|
2177
|
+
* <Loader2 className={sizeProps.loaderSize} />
|
|
2178
|
+
* ```
|
|
2179
|
+
*/
|
|
2180
|
+
function getWalletNetworkSwitcherSizeProps(walletSize) {
|
|
2181
|
+
switch (walletSize) {
|
|
2182
|
+
case "sm": return {
|
|
2183
|
+
triggerClassName: "h-8 text-xs px-2 min-w-[90px] max-w-[120px]",
|
|
2184
|
+
itemClassName: "text-xs py-1.5",
|
|
2185
|
+
loaderSize: "h-3 w-3"
|
|
2186
|
+
};
|
|
2187
|
+
case "lg": return {
|
|
2188
|
+
triggerClassName: "h-10 text-sm px-3 min-w-[120px] max-w-[180px]",
|
|
2189
|
+
itemClassName: "text-sm py-2",
|
|
2190
|
+
loaderSize: "h-4 w-4"
|
|
2191
|
+
};
|
|
2192
|
+
case "xl": return {
|
|
2193
|
+
triggerClassName: "h-12 text-base px-4 min-w-[140px] max-w-[200px]",
|
|
2194
|
+
itemClassName: "text-base py-2.5",
|
|
2195
|
+
loaderSize: "h-5 w-5"
|
|
2196
|
+
};
|
|
2197
|
+
case "default":
|
|
2198
|
+
default: return {
|
|
2199
|
+
triggerClassName: "h-9 text-sm px-3 min-w-[100px] max-w-[150px]",
|
|
2200
|
+
itemClassName: "text-sm py-1.5",
|
|
2201
|
+
loaderSize: "h-3.5 w-3.5"
|
|
2202
|
+
};
|
|
2203
|
+
}
|
|
2204
|
+
}
|
|
2205
|
+
/**
|
|
2206
|
+
* Maps WalletComponentVariant to NetworkSwitcher SelectTrigger styling.
|
|
2207
|
+
* Since Select components don't have a native variant prop like Button,
|
|
2208
|
+
* this maps variants to appropriate Tailwind CSS classes.
|
|
2209
|
+
*
|
|
2210
|
+
* @param variant - The wallet component variant ('default' | 'outline' | 'ghost' | 'secondary')
|
|
2211
|
+
* @returns CSS class string for the SelectTrigger
|
|
2212
|
+
*
|
|
2213
|
+
* @example
|
|
2214
|
+
* ```tsx
|
|
2215
|
+
* const variantClassName = getWalletNetworkSwitcherVariantClassName(variant);
|
|
2216
|
+
* <SelectTrigger className={cn(sizeProps.triggerClassName, variantClassName)}>
|
|
2217
|
+
* ...
|
|
2218
|
+
* </SelectTrigger>
|
|
2219
|
+
* ```
|
|
2220
|
+
*/
|
|
2221
|
+
function getWalletNetworkSwitcherVariantClassName(variant) {
|
|
2222
|
+
switch (variant) {
|
|
2223
|
+
case "ghost": return "border-transparent bg-transparent hover:bg-accent";
|
|
2224
|
+
case "secondary": return "border-secondary bg-secondary/10 hover:bg-secondary/20";
|
|
2225
|
+
case "outline": return "border-input bg-transparent hover:bg-accent";
|
|
2226
|
+
case "default":
|
|
2227
|
+
default: return "";
|
|
2228
|
+
}
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
//#endregion
|
|
2232
|
+
export { AnalyticsService, AppConfigService, DEFAULT_CONCURRENCY_LIMIT, UserExplorerConfigService, UserNetworkServiceConfigService, UserRpcConfigService, addressesEqual, appConfigService, base64ToBytes, buildRequiredInputSnapshot, bytesToHex, cn, compareSnapshots, computeEffectiveProviderPreference, createEmptySnapshot, delay, deserializeSnapshot, detectBytesEncoding, enhanceNumericValidation, findRoleAssignment, formatAccessControlError, formatTimestamp, generateId, getAllMembers, getBytesSize, getDefaultValueForType, getErrorMessage, getForcedService, getInvalidUrlMessage, getMissingRequiredContractInputs, getTotalMemberCount, getWalletAccountDisplaySizeProps, getWalletButtonSizeProps, getWalletNetworkSwitcherSizeProps, getWalletNetworkSwitcherVariantClassName, hasMissingRequiredContractInputs, hasOwnership, hasRoles, hexToBytes, isAccessControlError, isDevelopmentOrTestEnvironment, isPlainObject, isProductionEnvironment, isRecordWithProperties, isValidUrl, logger, normalizeAddress, parseDeepLink, promiseAllSettledWithLimit, promiseAllWithLimit, rateLimitedBatch, requiredSnapshotsEqual, routerService, sanitizeHtml, serializeSnapshot, simpleHash, stringToBytes, truncateMiddle, userExplorerConfigService, userNetworkServiceConfigService, userRpcConfigService, validateBytes, validateBytesSimple, validateSnapshot, withTimeout };
|
|
2079
2233
|
//# sourceMappingURL=index.js.map
|