@web3icons/react 4.0.26 → 4.0.27

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.
@@ -2198,13 +2198,27 @@ var globImport_icons_s_tsx = __glob({
2198
2198
 
2199
2199
  // src/utils/loadIcon.ts
2200
2200
  var iconCache = /* @__PURE__ */ new Map();
2201
+ var parseFileName = (fileName) => {
2202
+ const parts = fileName.split(":");
2203
+ if (parts.length !== 2) {
2204
+ throw new Error(
2205
+ `Invalid fileName format: "${fileName}". Expected format: "type:name" (e.g., "network:ethereum")`
2206
+ );
2207
+ }
2208
+ return { type: parts[0], name: parts[1] };
2209
+ };
2201
2210
  var getIconKey = (type, metadata) => {
2202
- return `${type.charAt(0).toUpperCase()}${type.slice(1)}${type === "token" ? metadata.symbol.toUpperCase() : toPascalCase(metadata.id)}`;
2211
+ const fileName = metadata.fileName;
2212
+ const { type: iconType, name: iconName } = parseFileName(fileName);
2213
+ const componentName = iconType === "token" ? iconName.replace(/[- ]+/g, "_").toUpperCase() : toPascalCase(iconName);
2214
+ return `${iconType.charAt(0).toUpperCase()}${iconType.slice(1)}${componentName}`;
2203
2215
  };
2204
2216
  var loadIcon = (type, metadata) => {
2205
2217
  const key = getIconKey(type, metadata);
2218
+ const fileName = metadata.fileName;
2219
+ const { type: iconType } = parseFileName(fileName);
2206
2220
  if (!iconCache.has(key)) {
2207
- const importPromise = /* webpackChunkName: "[request]" */ globImport_icons_s_tsx(`../icons/${type}s/${key}.tsx`).then((module) => module.default).catch((error) => {
2221
+ const importPromise = /* webpackChunkName: "[request]" */ globImport_icons_s_tsx(`../icons/${iconType}s/${key}.tsx`).then((module) => module.default).catch((error) => {
2208
2222
  console.warn(`Failed to load icon: ${key}`, error);
2209
2223
  return null;
2210
2224
  });
package/dist/dynamic.js CHANGED
@@ -1,2 +1,2 @@
1
- export { ExchangeIcon, NetworkIcon, TokenIcon, WalletIcon } from './chunk-YJREC6G5.js';
1
+ export { ExchangeIcon, NetworkIcon, TokenIcon, WalletIcon } from './chunk-6DFWYIXT.js';
2
2
  import './chunk-MLKFOR3D.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ExchangeIcon, NetworkIcon, TokenIcon, WalletIcon } from './chunk-YJREC6G5.js';
1
+ export { ExchangeIcon, NetworkIcon, TokenIcon, WalletIcon } from './chunk-6DFWYIXT.js';
2
2
  export { tokens_exports as tokenIcons } from './chunk-DY4T2EGR.js';
3
3
  export { TokenGT_default as TokenGT } from './chunk-7RCQ34OT.js';
4
4
  export { TokenMAN_default as TokenMAN } from './chunk-4RNGOF5Z.js';
package/package.json CHANGED
@@ -11,7 +11,7 @@
11
11
  "crypto logos",
12
12
  "coin icons"
13
13
  ],
14
- "version": "4.0.26",
14
+ "version": "4.0.27",
15
15
  "private": false,
16
16
  "license": "MIT",
17
17
  "type": "module",
@@ -45,7 +45,7 @@
45
45
  "clean": "rm -rf dist"
46
46
  },
47
47
  "dependencies": {
48
- "@web3icons/common": "0.11.20",
48
+ "@web3icons/common": "0.11.21",
49
49
  "react": "^18.2.0"
50
50
  },
51
51
  "devDependencies": {