@metamask-previews/design-system-react 0.3.0-preview.022dda1 → 0.3.1-preview.374d60e

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +9 -1
  2. package/dist/components/temp-components/Blockies/Blockies.cjs +4 -1
  3. package/dist/components/temp-components/Blockies/Blockies.cjs.map +1 -1
  4. package/dist/components/temp-components/Blockies/Blockies.d.cts.map +1 -1
  5. package/dist/components/temp-components/Blockies/Blockies.d.mts.map +1 -1
  6. package/dist/components/temp-components/Blockies/Blockies.mjs +4 -1
  7. package/dist/components/temp-components/Blockies/Blockies.mjs.map +1 -1
  8. package/dist/components/temp-components/Jazzicon/Jazzicon.cjs +35 -46
  9. package/dist/components/temp-components/Jazzicon/Jazzicon.cjs.map +1 -1
  10. package/dist/components/temp-components/Jazzicon/Jazzicon.d.cts.map +1 -1
  11. package/dist/components/temp-components/Jazzicon/Jazzicon.d.mts.map +1 -1
  12. package/dist/components/temp-components/Jazzicon/Jazzicon.mjs +35 -46
  13. package/dist/components/temp-components/Jazzicon/Jazzicon.mjs.map +1 -1
  14. package/dist/components/temp-components/Maskicon/Maskicon.cjs +14 -6
  15. package/dist/components/temp-components/Maskicon/Maskicon.cjs.map +1 -1
  16. package/dist/components/temp-components/Maskicon/Maskicon.d.cts +1 -1
  17. package/dist/components/temp-components/Maskicon/Maskicon.d.cts.map +1 -1
  18. package/dist/components/temp-components/Maskicon/Maskicon.d.mts +1 -1
  19. package/dist/components/temp-components/Maskicon/Maskicon.d.mts.map +1 -1
  20. package/dist/components/temp-components/Maskicon/Maskicon.mjs +15 -7
  21. package/dist/components/temp-components/Maskicon/Maskicon.mjs.map +1 -1
  22. package/dist/components/temp-components/Maskicon/Maskicon.types.cjs.map +1 -1
  23. package/dist/components/temp-components/Maskicon/Maskicon.types.d.cts +6 -1
  24. package/dist/components/temp-components/Maskicon/Maskicon.types.d.cts.map +1 -1
  25. package/dist/components/temp-components/Maskicon/Maskicon.types.d.mts +6 -1
  26. package/dist/components/temp-components/Maskicon/Maskicon.types.d.mts.map +1 -1
  27. package/dist/components/temp-components/Maskicon/Maskicon.types.mjs.map +1 -1
  28. package/dist/components/temp-components/Maskicon/Maskicon.utilities.cjs +6 -81
  29. package/dist/components/temp-components/Maskicon/Maskicon.utilities.cjs.map +1 -1
  30. package/dist/components/temp-components/Maskicon/Maskicon.utilities.d.cts +0 -26
  31. package/dist/components/temp-components/Maskicon/Maskicon.utilities.d.cts.map +1 -1
  32. package/dist/components/temp-components/Maskicon/Maskicon.utilities.d.mts +0 -26
  33. package/dist/components/temp-components/Maskicon/Maskicon.utilities.d.mts.map +1 -1
  34. package/dist/components/temp-components/Maskicon/Maskicon.utilities.mjs +5 -77
  35. package/dist/components/temp-components/Maskicon/Maskicon.utilities.mjs.map +1 -1
  36. package/package.json +5 -5
  37. package/dist/components/temp-components/Jazzicon/Jazzicon.utilities.cjs +0 -67
  38. package/dist/components/temp-components/Jazzicon/Jazzicon.utilities.cjs.map +0 -1
  39. package/dist/components/temp-components/Jazzicon/Jazzicon.utilities.d.cts +0 -24
  40. package/dist/components/temp-components/Jazzicon/Jazzicon.utilities.d.cts.map +0 -1
  41. package/dist/components/temp-components/Jazzicon/Jazzicon.utilities.d.mts +0 -24
  42. package/dist/components/temp-components/Jazzicon/Jazzicon.utilities.d.mts.map +0 -1
  43. package/dist/components/temp-components/Jazzicon/Jazzicon.utilities.mjs +0 -61
  44. package/dist/components/temp-components/Jazzicon/Jazzicon.utilities.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.1]
11
+
12
+ ### Fixed
13
+
14
+ - Removed DOMPurify dependency from Maskicon component ([#812](https://github.com/MetaMask/metamask-design-system/pull/812))
15
+ - Aligned React peer dependencies with MetaMask extension React 17 ([#809](https://github.com/MetaMask/metamask-design-system/pull/809))
16
+
10
17
  ## [0.3.0]
11
18
 
12
19
  ### Added
@@ -62,7 +69,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
62
69
  - Full TypeScript support with type definitions and enums
63
70
  - Tailwind CSS integration with design token support
64
71
 
65
- [Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.3.0...HEAD
72
+ [Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.3.1...HEAD
73
+ [0.3.1]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.3.0...@metamask/design-system-react@0.3.1
66
74
  [0.3.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.2.0...@metamask/design-system-react@0.3.0
67
75
  [0.2.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react@0.1.0...@metamask/design-system-react@0.2.0
68
76
  [0.1.0]: https://github.com/MetaMask/metamask-design-system/releases/tag/@metamask/design-system-react@0.1.0
@@ -4,10 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.Blockies = void 0;
7
+ const design_system_shared_1 = require("@metamask-previews/design-system-shared");
7
8
  const blo_1 = require("blo");
8
9
  const react_1 = __importDefault(require("react"));
9
10
  const Blockies = ({ address, size = 32, ...props }) => {
10
- return (react_1.default.createElement("img", { src: (0, blo_1.blo)(address), height: size, width: size, alt: `Blockies for ${address}`, ...props }));
11
+ // Extract the account address from CAIP-10 format if needed
12
+ const accountAddress = (0, design_system_shared_1.extractAccountAddress)(address);
13
+ return (react_1.default.createElement("img", { src: (0, blo_1.blo)(accountAddress), height: size, width: size, alt: `Blockies for ${address}`, ...props }));
11
14
  };
12
15
  exports.Blockies = Blockies;
13
16
  exports.Blockies.displayName = 'Blockies';
@@ -1 +1 @@
1
- {"version":3,"file":"Blockies.cjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Blockies/Blockies.tsx"],"names":[],"mappings":";;;;;;AAAA,6BAA0B;AAC1B,kDAA0B;AAInB,MAAM,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,KAAK,EAAiB,EAAE,EAAE;IAC1E,OAAO,CACL,uCACE,GAAG,EAAE,IAAA,SAAG,EAAC,OAAwB,CAAC,EAClC,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,gBAAgB,OAAO,EAAE,KAC1B,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAVW,QAAA,QAAQ,YAUnB;AAEF,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import { blo } from 'blo';\nimport React from 'react';\n\nimport type { BlockiesProps } from './Blockies.types';\n\nexport const Blockies = ({ address, size = 32, ...props }: BlockiesProps) => {\n return (\n <img\n src={blo(address as `0x${string}`)}\n height={size}\n width={size}\n alt={`Blockies for ${address}`} // TODO: Add localization for this\n {...props}\n />\n );\n};\n\nBlockies.displayName = 'Blockies';\n"]}
1
+ {"version":3,"file":"Blockies.cjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Blockies/Blockies.tsx"],"names":[],"mappings":";;;;;;AAAA,kFAAgF;AAChF,6BAA0B;AAC1B,kDAA0B;AAInB,MAAM,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,KAAK,EAAiB,EAAE,EAAE;IAC1E,4DAA4D;IAC5D,MAAM,cAAc,GAAG,IAAA,4CAAqB,EAAC,OAAO,CAAC,CAAC;IAEtD,OAAO,CACL,uCACE,GAAG,EAAE,IAAA,SAAG,EAAC,cAA+B,CAAC,EACzC,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,gBAAgB,OAAO,EAAE,KAC1B,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,QAAQ,YAanB;AAEF,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import { extractAccountAddress } from '@metamask-previews/design-system-shared';\nimport { blo } from 'blo';\nimport React from 'react';\n\nimport type { BlockiesProps } from './Blockies.types';\n\nexport const Blockies = ({ address, size = 32, ...props }: BlockiesProps) => {\n // Extract the account address from CAIP-10 format if needed\n const accountAddress = extractAccountAddress(address);\n\n return (\n <img\n src={blo(accountAddress as `0x${string}`)}\n height={size}\n width={size}\n alt={`Blockies for ${address}`} // TODO: Add localization for this\n {...props}\n />\n );\n};\n\nBlockies.displayName = 'Blockies';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Blockies.d.cts","sourceRoot":"","sources":["../../../../src/components/temp-components/Blockies/Blockies.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAEtD,eAAO,MAAM,QAAQ;kCAAsC,aAAa;;CAUvE,CAAC"}
1
+ {"version":3,"file":"Blockies.d.cts","sourceRoot":"","sources":["../../../../src/components/temp-components/Blockies/Blockies.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAEtD,eAAO,MAAM,QAAQ;kCAAsC,aAAa;;CAavE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Blockies.d.mts","sourceRoot":"","sources":["../../../../src/components/temp-components/Blockies/Blockies.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,cAAc;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAEtD,eAAO,MAAM,QAAQ;kCAAsC,aAAa;;CAUvE,CAAC"}
1
+ {"version":3,"file":"Blockies.d.mts","sourceRoot":"","sources":["../../../../src/components/temp-components/Blockies/Blockies.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc;AAE1B,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAEtD,eAAO,MAAM,QAAQ;kCAAsC,aAAa;;CAavE,CAAC"}
@@ -4,11 +4,14 @@ function $importDefault(module) {
4
4
  }
5
5
  return module;
6
6
  }
7
+ import { extractAccountAddress } from "@metamask-previews/design-system-shared";
7
8
  import { blo } from "blo";
8
9
  import $React from "react";
9
10
  const React = $importDefault($React);
10
11
  export const Blockies = ({ address, size = 32, ...props }) => {
11
- return (React.createElement("img", { src: blo(address), height: size, width: size, alt: `Blockies for ${address}`, ...props }));
12
+ // Extract the account address from CAIP-10 format if needed
13
+ const accountAddress = extractAccountAddress(address);
14
+ return (React.createElement("img", { src: blo(accountAddress), height: size, width: size, alt: `Blockies for ${address}`, ...props }));
12
15
  };
13
16
  Blockies.displayName = 'Blockies';
14
17
  //# sourceMappingURL=Blockies.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Blockies.mjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Blockies/Blockies.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,YAAY;AAC1B,OAAO,MAAK,cAAc;;AAI1B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,KAAK,EAAiB,EAAE,EAAE;IAC1E,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,CAAC,OAAwB,CAAC,EAClC,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,gBAAgB,OAAO,EAAE,KAC1B,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import { blo } from 'blo';\nimport React from 'react';\n\nimport type { BlockiesProps } from './Blockies.types';\n\nexport const Blockies = ({ address, size = 32, ...props }: BlockiesProps) => {\n return (\n <img\n src={blo(address as `0x${string}`)}\n height={size}\n width={size}\n alt={`Blockies for ${address}`} // TODO: Add localization for this\n {...props}\n />\n );\n};\n\nBlockies.displayName = 'Blockies';\n"]}
1
+ {"version":3,"file":"Blockies.mjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Blockies/Blockies.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,qBAAqB,EAAE,gDAAgD;AAChF,OAAO,EAAE,GAAG,EAAE,YAAY;AAC1B,OAAO,MAAK,cAAc;;AAI1B,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,GAAG,KAAK,EAAiB,EAAE,EAAE;IAC1E,4DAA4D;IAC5D,MAAM,cAAc,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAEtD,OAAO,CACL,6BACE,GAAG,EAAE,GAAG,CAAC,cAA+B,CAAC,EACzC,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,IAAI,EACX,GAAG,EAAE,gBAAgB,OAAO,EAAE,KAC1B,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import { extractAccountAddress } from '@metamask-previews/design-system-shared';\nimport { blo } from 'blo';\nimport React from 'react';\n\nimport type { BlockiesProps } from './Blockies.types';\n\nexport const Blockies = ({ address, size = 32, ...props }: BlockiesProps) => {\n // Extract the account address from CAIP-10 format if needed\n const accountAddress = extractAccountAddress(address);\n\n return (\n <img\n src={blo(accountAddress as `0x${string}`)}\n height={size}\n width={size}\n alt={`Blockies for ${address}`} // TODO: Add localization for this\n {...props}\n />\n );\n};\n\nBlockies.displayName = 'Blockies';\n"]}
@@ -27,11 +27,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.Jazzicon = void 0;
30
+ const design_system_shared_1 = require("@metamask-previews/design-system-shared");
30
31
  const jazzicon_1 = __importDefault(require("@metamask/jazzicon"));
31
- const utils_1 = require("@metamask/utils");
32
32
  const react_1 = __importStar(require("react"));
33
33
  const tw_merge_1 = require("../../../utils/tw-merge.cjs");
34
- const Jazzicon_utilities_1 = require("./Jazzicon.utilities.cjs");
35
34
  /**
36
35
  * Cache for storing generated SVG elements by `address:diameter` so
37
36
  * we don't regenerate them repeatedly.
@@ -40,53 +39,43 @@ const iconCache = {};
40
39
  const Jazzicon = ({ address, size = 32, className, ...props }) => {
41
40
  const containerRef = (0, react_1.useRef)(null);
42
41
  (0, react_1.useEffect)(() => {
43
- let isCancelled = false;
44
- const generateJazzicon = async () => {
45
- if (!containerRef.current) {
46
- return;
47
- }
48
- // Clear any existing content
49
- while (containerRef.current.firstChild) {
50
- containerRef.current.removeChild(containerRef.current.firstChild);
51
- }
52
- // Check the cache
53
- const cacheKey = `${address.toLowerCase()}:${size}`;
54
- if (iconCache[cacheKey]) {
55
- // If cached, just append a clone
56
- if (!isCancelled) {
57
- const clone = iconCache[cacheKey].cloneNode(true);
58
- containerRef.current.appendChild(clone);
42
+ if (!containerRef.current) {
43
+ return () => {
44
+ // No cleanup needed if container ref was null
45
+ };
46
+ }
47
+ // Clear any existing content
48
+ while (containerRef.current.firstChild) {
49
+ containerRef.current.removeChild(containerRef.current.firstChild);
50
+ }
51
+ // Check the cache
52
+ const cacheKey = `${address.toLowerCase()}:${size}`;
53
+ if (iconCache[cacheKey]) {
54
+ // If cached, just append a clone
55
+ const clone = iconCache[cacheKey].cloneNode(true);
56
+ containerRef.current.appendChild(clone);
57
+ return () => {
58
+ if (containerRef.current) {
59
+ while (containerRef.current.firstChild) {
60
+ containerRef.current.removeChild(containerRef.current.firstChild);
61
+ }
59
62
  }
60
- return;
61
- }
62
- // Determine the CAIP namespace
63
- const namespace = await (0, Jazzicon_utilities_1.getCaipNamespaceFromAddress)(address);
64
- if (isCancelled) {
65
- return;
66
- }
67
- // Pick seeding strategy based on namespace
68
- let seed;
69
- if (namespace === utils_1.KnownCaipNamespace.Eip155) {
70
- seed = (0, Jazzicon_utilities_1.generateSeedEthereum)(address);
71
- }
72
- else {
73
- seed = (0, Jazzicon_utilities_1.generateSeedNonEthereum)(address);
74
- }
75
- // Create Jazzicon
76
- const newIcon = (0, jazzicon_1.default)(size, seed);
77
- // Cache it
78
- iconCache[cacheKey] = newIcon;
79
- // Append a fresh clone
80
- if (!isCancelled && containerRef.current) {
81
- containerRef.current.appendChild(newIcon.cloneNode(true));
82
- }
83
- };
84
- generateJazzicon().catch(() => {
85
- // Silently ignore errors during async generation
86
- });
63
+ };
64
+ }
65
+ // Extract the account address from CAIP-10 format if needed
66
+ const accountAddress = (0, design_system_shared_1.extractAccountAddress)(address);
67
+ // Generate appropriate seed based on address format
68
+ const seed = (0, design_system_shared_1.generateIconSeed)(accountAddress);
69
+ // Create Jazzicon
70
+ const newIcon = (0, jazzicon_1.default)(size, seed);
71
+ // Cache it
72
+ iconCache[cacheKey] = newIcon;
73
+ // Append a fresh clone
74
+ if (containerRef.current) {
75
+ containerRef.current.appendChild(newIcon.cloneNode(true));
76
+ }
87
77
  // Cleanup
88
78
  return () => {
89
- isCancelled = true;
90
79
  if (containerRef.current) {
91
80
  while (containerRef.current.firstChild) {
92
81
  containerRef.current.removeChild(containerRef.current.firstChild);
@@ -1 +1 @@
1
- {"version":3,"file":"Jazzicon.cjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Jazzicon/Jazzicon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kEAA0C;AAC1C,2CAAqD;AACrD,+CAAiD;AAEjD,0DAAkD;AAGlD,iEAI8B;AAE9B;;;GAGG;AACH,MAAM,SAAS,GAAmC,EAAE,CAAC;AAE9C,MAAM,QAAQ,GAAG,CAAC,EACvB,OAAO,EACP,IAAI,GAAG,EAAE,EACT,SAAS,EACT,GAAG,KAAK,EACM,EAAE,EAAE;IAClB,MAAM,YAAY,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAElD,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,WAAW,GAAG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WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;aAC3D;QACH,CAAC,CAAC;QAEF,gBAAgB,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE;YAC5B,iDAAiD;QACnD,CAAC,CAAC,CAAC;QAEH,UAAU;QACV,OAAO,GAAG,EAAE;YACV,WAAW,GAAG,IAAI,CAAC;YACnB,IAAI,YAAY,CAAC,OAAO,EAAE;gBACxB,OAAO,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE;oBACtC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;iBACnE;aACF;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAEpB,OAAO,CACL,uCACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,IAAA,kBAAO,EAAC,4BAA4B,EAAE,SAAS,CAAC,KACvD,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AA/EW,QAAA,QAAQ,YA+EnB;AAEF,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import jazzicon from '@metamask/jazzicon';\nimport { KnownCaipNamespace } from '@metamask/utils';\nimport React, { useEffect, useRef } from 'react';\n\nimport { twMerge } from '../../../utils/tw-merge';\n\nimport type { JazziconProps } from './Jazzicon.types';\nimport {\n generateSeedEthereum,\n generateSeedNonEthereum,\n getCaipNamespaceFromAddress,\n} from './Jazzicon.utilities';\n\n/**\n * Cache for storing generated SVG elements by `address:diameter` so\n * we don't regenerate them repeatedly.\n */\nconst iconCache: Record<string, HTMLDivElement> = {};\n\nexport const Jazzicon = ({\n address,\n size = 32,\n className,\n ...props\n}: JazziconProps) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n let isCancelled = false;\n\n const generateJazzicon = async () => {\n if (!containerRef.current) {\n return;\n }\n // Clear any existing content\n while (containerRef.current.firstChild) {\n containerRef.current.removeChild(containerRef.current.firstChild);\n }\n\n // Check the cache\n const cacheKey = `${address.toLowerCase()}:${size}`;\n if (iconCache[cacheKey]) {\n // If cached, just append a clone\n if (!isCancelled) {\n const clone = iconCache[cacheKey].cloneNode(true) as HTMLDivElement;\n containerRef.current.appendChild(clone);\n }\n return;\n }\n\n // Determine the CAIP namespace\n const namespace = await getCaipNamespaceFromAddress(address);\n if (isCancelled) {\n return;\n }\n\n // Pick seeding strategy based on namespace\n let seed: number | number[];\n if (namespace === KnownCaipNamespace.Eip155) {\n seed = generateSeedEthereum(address);\n } else {\n seed = generateSeedNonEthereum(address);\n }\n\n // Create Jazzicon\n const newIcon = jazzicon(size, seed) as HTMLDivElement;\n\n // Cache it\n iconCache[cacheKey] = newIcon as HTMLDivElement;\n\n // Append a fresh clone\n if (!isCancelled && containerRef.current) {\n containerRef.current.appendChild(newIcon.cloneNode(true));\n }\n };\n\n generateJazzicon().catch(() => {\n // Silently ignore errors during async generation\n });\n\n // Cleanup\n return () => {\n isCancelled = true;\n if (containerRef.current) {\n while (containerRef.current.firstChild) {\n containerRef.current.removeChild(containerRef.current.firstChild);\n }\n }\n };\n }, [address, size]);\n\n return (\n <div\n ref={containerRef}\n className={twMerge('flex [&>div]:!rounded-none', className)}\n {...props}\n />\n );\n};\n\nJazzicon.displayName = 'Jazzicon';\n"]}
1
+ {"version":3,"file":"Jazzicon.cjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Jazzicon/Jazzicon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,kFAGiD;AACjD,kEAA0C;AAC1C,+CAAiD;AAEjD,0DAAkD;AAIlD;;;GAGG;AACH,MAAM,SAAS,GAAmC,EAAE,CAAC;AAE9C,MAAM,QAAQ,GAAG,CAAC,EACvB,OAAO,EACP,IAAI,GAAG,EAAE,EACT,SAAS,EACT,GAAG,KAAK,EACM,EAAE,EAAE;IAClB,MAAM,YAAY,GAAG,IAAA,cA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,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3D;QAED,UAAU;QACV,OAAO,GAAG,EAAE;YACV,IAAI,YAAY,CAAC,OAAO,EAAE;gBACxB,OAAO,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE;oBACtC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;iBACnE;aACF;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAEpB,OAAO,CACL,uCACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,IAAA,kBAAO,EAAC,4BAA4B,EAAE,SAAS,CAAC,KACvD,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AArEW,QAAA,QAAQ,YAqEnB;AAEF,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import {\n extractAccountAddress,\n generateIconSeed,\n} from '@metamask-previews/design-system-shared';\nimport jazzicon from '@metamask/jazzicon';\nimport React, { useEffect, useRef } from 'react';\n\nimport { twMerge } from '../../../utils/tw-merge';\n\nimport type { JazziconProps } from './Jazzicon.types';\n\n/**\n * Cache for storing generated SVG elements by `address:diameter` so\n * we don't regenerate them repeatedly.\n */\nconst iconCache: Record<string, HTMLDivElement> = {};\n\nexport const Jazzicon = ({\n address,\n size = 32,\n className,\n ...props\n}: JazziconProps) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!containerRef.current) {\n return () => {\n // No cleanup needed if container ref was null\n };\n }\n\n // Clear any existing content\n while (containerRef.current.firstChild) {\n containerRef.current.removeChild(containerRef.current.firstChild);\n }\n\n // Check the cache\n const cacheKey = `${address.toLowerCase()}:${size}`;\n if (iconCache[cacheKey]) {\n // If cached, just append a clone\n const clone = iconCache[cacheKey].cloneNode(true) as HTMLDivElement;\n containerRef.current.appendChild(clone);\n return () => {\n if (containerRef.current) {\n while (containerRef.current.firstChild) {\n containerRef.current.removeChild(containerRef.current.firstChild);\n }\n }\n };\n }\n\n // Extract the account address from CAIP-10 format if needed\n const accountAddress = extractAccountAddress(address);\n\n // Generate appropriate seed based on address format\n const seed = generateIconSeed(accountAddress);\n\n // Create Jazzicon\n const newIcon = jazzicon(size, seed) as HTMLDivElement;\n\n // Cache it\n iconCache[cacheKey] = newIcon as HTMLDivElement;\n\n // Append a fresh clone\n if (containerRef.current) {\n containerRef.current.appendChild(newIcon.cloneNode(true));\n }\n\n // Cleanup\n return () => {\n if (containerRef.current) {\n while (containerRef.current.firstChild) {\n containerRef.current.removeChild(containerRef.current.firstChild);\n }\n }\n };\n }, [address, size]);\n\n return (\n <div\n ref={containerRef}\n className={twMerge('flex [&>div]:!rounded-none', className)}\n {...props}\n />\n );\n};\n\nJazzicon.displayName = 'Jazzicon';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Jazzicon.d.cts","sourceRoot":"","sources":["../../../../src/components/temp-components/Jazzicon/Jazzicon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,cAAc;AAIjD,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAatD,eAAO,MAAM,QAAQ;6CAKlB,aAAa;;CA0Ef,CAAC"}
1
+ {"version":3,"file":"Jazzicon.d.cts","sourceRoot":"","sources":["../../../../src/components/temp-components/Jazzicon/Jazzicon.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA4B,cAAc;AAIjD,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAQtD,eAAO,MAAM,QAAQ;6CAKlB,aAAa;;CAgEf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Jazzicon.d.mts","sourceRoot":"","sources":["../../../../src/components/temp-components/Jazzicon/Jazzicon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4B,cAAc;AAIjD,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAatD,eAAO,MAAM,QAAQ;6CAKlB,aAAa;;CA0Ef,CAAC"}
1
+ {"version":3,"file":"Jazzicon.d.mts","sourceRoot":"","sources":["../../../../src/components/temp-components/Jazzicon/Jazzicon.tsx"],"names":[],"mappings":"AAKA,OAAO,KAA4B,cAAc;AAIjD,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAQtD,eAAO,MAAM,QAAQ;6CAKlB,aAAa;;CAgEf,CAAC"}
@@ -4,13 +4,12 @@ function $importDefault(module) {
4
4
  }
5
5
  return module;
6
6
  }
7
+ import { extractAccountAddress, generateIconSeed } from "@metamask-previews/design-system-shared";
7
8
  import $jazzicon from "@metamask/jazzicon";
8
9
  const jazzicon = $importDefault($jazzicon);
9
- import { KnownCaipNamespace } from "@metamask/utils";
10
10
  import $React, { useEffect, useRef } from "react";
11
11
  const React = $importDefault($React);
12
12
  import { twMerge } from "../../../utils/tw-merge.mjs";
13
- import { generateSeedEthereum, generateSeedNonEthereum, getCaipNamespaceFromAddress } from "./Jazzicon.utilities.mjs";
14
13
  /**
15
14
  * Cache for storing generated SVG elements by `address:diameter` so
16
15
  * we don't regenerate them repeatedly.
@@ -19,53 +18,43 @@ const iconCache = {};
19
18
  export const Jazzicon = ({ address, size = 32, className, ...props }) => {
20
19
  const containerRef = useRef(null);
21
20
  useEffect(() => {
22
- let isCancelled = false;
23
- const generateJazzicon = async () => {
24
- if (!containerRef.current) {
25
- return;
26
- }
27
- // Clear any existing content
28
- while (containerRef.current.firstChild) {
29
- containerRef.current.removeChild(containerRef.current.firstChild);
30
- }
31
- // Check the cache
32
- const cacheKey = `${address.toLowerCase()}:${size}`;
33
- if (iconCache[cacheKey]) {
34
- // If cached, just append a clone
35
- if (!isCancelled) {
36
- const clone = iconCache[cacheKey].cloneNode(true);
37
- containerRef.current.appendChild(clone);
21
+ if (!containerRef.current) {
22
+ return () => {
23
+ // No cleanup needed if container ref was null
24
+ };
25
+ }
26
+ // Clear any existing content
27
+ while (containerRef.current.firstChild) {
28
+ containerRef.current.removeChild(containerRef.current.firstChild);
29
+ }
30
+ // Check the cache
31
+ const cacheKey = `${address.toLowerCase()}:${size}`;
32
+ if (iconCache[cacheKey]) {
33
+ // If cached, just append a clone
34
+ const clone = iconCache[cacheKey].cloneNode(true);
35
+ containerRef.current.appendChild(clone);
36
+ return () => {
37
+ if (containerRef.current) {
38
+ while (containerRef.current.firstChild) {
39
+ containerRef.current.removeChild(containerRef.current.firstChild);
40
+ }
38
41
  }
39
- return;
40
- }
41
- // Determine the CAIP namespace
42
- const namespace = await getCaipNamespaceFromAddress(address);
43
- if (isCancelled) {
44
- return;
45
- }
46
- // Pick seeding strategy based on namespace
47
- let seed;
48
- if (namespace === KnownCaipNamespace.Eip155) {
49
- seed = generateSeedEthereum(address);
50
- }
51
- else {
52
- seed = generateSeedNonEthereum(address);
53
- }
54
- // Create Jazzicon
55
- const newIcon = jazzicon(size, seed);
56
- // Cache it
57
- iconCache[cacheKey] = newIcon;
58
- // Append a fresh clone
59
- if (!isCancelled && containerRef.current) {
60
- containerRef.current.appendChild(newIcon.cloneNode(true));
61
- }
62
- };
63
- generateJazzicon().catch(() => {
64
- // Silently ignore errors during async generation
65
- });
42
+ };
43
+ }
44
+ // Extract the account address from CAIP-10 format if needed
45
+ const accountAddress = extractAccountAddress(address);
46
+ // Generate appropriate seed based on address format
47
+ const seed = generateIconSeed(accountAddress);
48
+ // Create Jazzicon
49
+ const newIcon = jazzicon(size, seed);
50
+ // Cache it
51
+ iconCache[cacheKey] = newIcon;
52
+ // Append a fresh clone
53
+ if (containerRef.current) {
54
+ containerRef.current.appendChild(newIcon.cloneNode(true));
55
+ }
66
56
  // Cleanup
67
57
  return () => {
68
- isCancelled = true;
69
58
  if (containerRef.current) {
70
59
  while (containerRef.current.firstChild) {
71
60
  containerRef.current.removeChild(containerRef.current.firstChild);
@@ -1 +1 @@
1
- {"version":3,"file":"Jazzicon.mjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Jazzicon/Jazzicon.tsx"],"names":[],"mappings":";;;;;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from '@metamask/utils';\nimport React, { useEffect, useRef } from 'react';\n\nimport { twMerge } from '../../../utils/tw-merge';\n\nimport type { JazziconProps } from './Jazzicon.types';\nimport {\n generateSeedEthereum,\n generateSeedNonEthereum,\n getCaipNamespaceFromAddress,\n} from './Jazzicon.utilities';\n\n/**\n * Cache for storing generated SVG elements by `address:diameter` so\n * we don't regenerate them repeatedly.\n */\nconst iconCache: Record<string, HTMLDivElement> = {};\n\nexport const Jazzicon = ({\n address,\n size = 32,\n className,\n ...props\n}: JazziconProps) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n let isCancelled = false;\n\n const generateJazzicon = async () => {\n if (!containerRef.current) {\n return;\n }\n // Clear any existing content\n while (containerRef.current.firstChild) {\n containerRef.current.removeChild(containerRef.current.firstChild);\n }\n\n // Check the cache\n const cacheKey = `${address.toLowerCase()}:${size}`;\n if (iconCache[cacheKey]) {\n // If cached, just append a clone\n if (!isCancelled) {\n const clone = iconCache[cacheKey].cloneNode(true) as HTMLDivElement;\n containerRef.current.appendChild(clone);\n }\n return;\n }\n\n // Determine the CAIP namespace\n const namespace = await getCaipNamespaceFromAddress(address);\n if (isCancelled) {\n return;\n }\n\n // Pick seeding strategy based on namespace\n let seed: number | number[];\n if (namespace === KnownCaipNamespace.Eip155) {\n seed = generateSeedEthereum(address);\n } else {\n seed = generateSeedNonEthereum(address);\n }\n\n // Create Jazzicon\n const newIcon = jazzicon(size, seed) as HTMLDivElement;\n\n // Cache it\n iconCache[cacheKey] = newIcon as HTMLDivElement;\n\n // Append a fresh clone\n if (!isCancelled && containerRef.current) {\n containerRef.current.appendChild(newIcon.cloneNode(true));\n }\n };\n\n generateJazzicon().catch(() => {\n // Silently ignore errors during async generation\n });\n\n // Cleanup\n return () => {\n isCancelled = true;\n if (containerRef.current) {\n while (containerRef.current.firstChild) {\n containerRef.current.removeChild(containerRef.current.firstChild);\n }\n }\n };\n }, [address, size]);\n\n return (\n <div\n ref={containerRef}\n className={twMerge('flex [&>div]:!rounded-none', className)}\n {...props}\n />\n );\n};\n\nJazzicon.displayName = 'Jazzicon';\n"]}
1
+ {"version":3,"file":"Jazzicon.mjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Jazzicon/Jazzicon.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EACjB,gDAAgD;AACjD,OAAO,SAAQ,2BAA2B;;AAC1C,OAAO,QAAO,EAAE,SAAS,EAAE,MAAM,EAAE,cAAc;;AAEjD,OAAO,EAAE,OAAO,EAAE,oCAAgC;AAIlD;;;GAGG;AACH,MAAM,SAAS,GAAmC,EAAE,CAAC;AAErD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,OAAO,EACP,IAAI,GAAG,EAAE,EACT,SAAS,EACT,GAAG,KAAK,EACM,EAAE,EAAE;IAClB,MAAM,YAAY,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAElD,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YACzB,OAAO,GAAG,EAAE;gBACV,8CAA8C;YAChD,CAAC,CAAC;SACH;QAED,6BAA6B;QAC7B,OAAO,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE;YACtC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;SACnE;QAED,kBAAkB;QAClB,MAAM,QAAQ,GAAG,GAAG,OAAO,CAAC,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC;QACpD,IAAI,SAAS,CAAC,QAAQ,CAAC,EAAE;YACvB,iCAAiC;YACjC,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,IAAI,CAAmB,CAAC;YACpE,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;YACxC,OAAO,GAAG,EAAE;gBACV,IAAI,YAAY,CAAC,OAAO,EAAE;oBACxB,OAAO,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE;wBACtC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;qBACnE;iBACF;YACH,CAAC,CAAC;SACH;QAED,4DAA4D;QAC5D,MAAM,cAAc,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;QAEtD,oDAAoD;QACpD,MAAM,IAAI,GAAG,gBAAgB,CAAC,cAAc,CAAC,CAAC;QAE9C,kBAAkB;QAClB,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAmB,CAAC;QAEvD,WAAW;QACX,SAAS,CAAC,QAAQ,CAAC,GAAG,OAAyB,CAAC;QAEhD,uBAAuB;QACvB,IAAI,YAAY,CAAC,OAAO,EAAE;YACxB,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;SAC3D;QAED,UAAU;QACV,OAAO,GAAG,EAAE;YACV,IAAI,YAAY,CAAC,OAAO,EAAE;gBACxB,OAAO,YAAY,CAAC,OAAO,CAAC,UAAU,EAAE;oBACtC,YAAY,CAAC,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;iBACnE;aACF;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAEpB,OAAO,CACL,6BACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,OAAO,CAAC,4BAA4B,EAAE,SAAS,CAAC,KACvD,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import {\n extractAccountAddress,\n generateIconSeed,\n} from '@metamask-previews/design-system-shared';\nimport jazzicon from '@metamask/jazzicon';\nimport React, { useEffect, useRef } from 'react';\n\nimport { twMerge } from '../../../utils/tw-merge';\n\nimport type { JazziconProps } from './Jazzicon.types';\n\n/**\n * Cache for storing generated SVG elements by `address:diameter` so\n * we don't regenerate them repeatedly.\n */\nconst iconCache: Record<string, HTMLDivElement> = {};\n\nexport const Jazzicon = ({\n address,\n size = 32,\n className,\n ...props\n}: JazziconProps) => {\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!containerRef.current) {\n return () => {\n // No cleanup needed if container ref was null\n };\n }\n\n // Clear any existing content\n while (containerRef.current.firstChild) {\n containerRef.current.removeChild(containerRef.current.firstChild);\n }\n\n // Check the cache\n const cacheKey = `${address.toLowerCase()}:${size}`;\n if (iconCache[cacheKey]) {\n // If cached, just append a clone\n const clone = iconCache[cacheKey].cloneNode(true) as HTMLDivElement;\n containerRef.current.appendChild(clone);\n return () => {\n if (containerRef.current) {\n while (containerRef.current.firstChild) {\n containerRef.current.removeChild(containerRef.current.firstChild);\n }\n }\n };\n }\n\n // Extract the account address from CAIP-10 format if needed\n const accountAddress = extractAccountAddress(address);\n\n // Generate appropriate seed based on address format\n const seed = generateIconSeed(accountAddress);\n\n // Create Jazzicon\n const newIcon = jazzicon(size, seed) as HTMLDivElement;\n\n // Cache it\n iconCache[cacheKey] = newIcon as HTMLDivElement;\n\n // Append a fresh clone\n if (containerRef.current) {\n containerRef.current.appendChild(newIcon.cloneNode(true));\n }\n\n // Cleanup\n return () => {\n if (containerRef.current) {\n while (containerRef.current.firstChild) {\n containerRef.current.removeChild(containerRef.current.firstChild);\n }\n }\n };\n }, [address, size]);\n\n return (\n <div\n ref={containerRef}\n className={twMerge('flex [&>div]:!rounded-none', className)}\n {...props}\n />\n );\n};\n\nJazzicon.displayName = 'Jazzicon';\n"]}
@@ -24,11 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.Maskicon = void 0;
27
- const dompurify = __importStar(require("dompurify"));
28
27
  const react_1 = __importStar(require("react"));
29
28
  const Maskicon_utilities_1 = require("./Maskicon.utilities.cjs");
30
- const DOMPurify = dompurify.default;
31
- const Maskicon = ({ address, size = 32, style, ...props }) => {
29
+ const Maskicon = ({ address, size = 32, className, ...props }) => {
32
30
  const [svgString, setSvgString] = (0, react_1.useState)('');
33
31
  (0, react_1.useEffect)(() => {
34
32
  let cancelled = false;
@@ -43,10 +41,20 @@ const Maskicon = ({ address, size = 32, style, ...props }) => {
43
41
  cancelled = true;
44
42
  };
45
43
  }, [address, size]);
46
- if (!svgString) {
47
- return react_1.default.createElement("div", { style: { width: size, height: size, ...style }, ...props });
44
+ const dataUri = (0, react_1.useMemo)(() => {
45
+ if (!svgString) {
46
+ return '';
47
+ }
48
+ // Normalize whitespace and encode the SVG for safe data URI usage
49
+ const cleanedSvg = svgString.replace(/\s+/gu, ' ').trim();
50
+ const encoded = encodeURIComponent(cleanedSvg);
51
+ return `data:image/svg+xml,${encoded}`;
52
+ }, [svgString]);
53
+ if (!dataUri) {
54
+ // Return an img element with transparent placeholder to maintain consistent typing
55
+ return (react_1.default.createElement("img", { alt: "maskicon", width: size, height: size, className: className, src: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E", ...props }));
48
56
  }
49
- return (react_1.default.createElement("div", { style: { width: size, height: size, ...style }, dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(svgString) }, ...props }));
57
+ return (react_1.default.createElement("img", { alt: "maskicon", width: size, height: size, className: className, src: dataUri, ...props }));
50
58
  };
51
59
  exports.Maskicon = Maskicon;
52
60
  exports.Maskicon.displayName = 'Maskicon';
@@ -1 +1 @@
1
- {"version":3,"file":"Maskicon.cjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qDAAuC;AACvC,+CAAmD;AAGnD,iEAAsD;AAEtD,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AAE7B,MAAM,QAAQ,GAAG,CAAC,EACvB,OAAO,EACP,IAAI,GAAG,EAAE,EACT,KAAK,EACL,GAAG,KAAK,EACM,EAAE,EAAE;IAClB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IAE/C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,mCAAmC;QACnC,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,MAAM,GAAG,MAAM,IAAA,mCAAc,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACnD,IAAI,CAAC,SAAS,EAAE;gBACd,YAAY,CAAC,MAAM,CAAC,CAAC;aACtB;QACH,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAEpB,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,uCAAK,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,KAAM,KAAK,GAAI,CAAC;KAC3E;IAED,OAAO,CACL,uCACE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAC9C,uBAAuB,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,KAC9D,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAjCW,QAAA,QAAQ,YAiCnB;AAEF,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import * as dompurify from 'dompurify';\nimport React, { useEffect, useState } from 'react';\n\nimport type { MaskiconProps } from './Maskicon.types';\nimport { getMaskiconSVG } from './Maskicon.utilities';\n\nconst DOMPurify = dompurify.default;\n\nexport const Maskicon = ({\n address,\n size = 32,\n style,\n ...props\n}: MaskiconProps) => {\n const [svgString, setSvgString] = useState('');\n\n useEffect(() => {\n let cancelled = false;\n // eslint-disable-next-line no-void\n void (async () => {\n const newSvg = await getMaskiconSVG(address, size);\n if (!cancelled) {\n setSvgString(newSvg);\n }\n })();\n return () => {\n cancelled = true;\n };\n }, [address, size]);\n\n if (!svgString) {\n return <div style={{ width: size, height: size, ...style }} {...props} />;\n }\n\n return (\n <div\n style={{ width: size, height: size, ...style }}\n dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(svgString) }}\n {...props}\n />\n );\n};\n\nMaskicon.displayName = 'Maskicon';\n"]}
1
+ {"version":3,"file":"Maskicon.cjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA4D;AAG5D,iEAAsD;AAE/C,MAAM,QAAQ,GAAG,CAAC,EACvB,OAAO,EACP,IAAI,GAAG,EAAE,EACT,SAAS,EACT,GAAG,KAAK,EACM,EAAE,EAAE;IAClB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,IAAA,gBAAQ,EAAC,EAAE,CAAC,CAAC;IAE/C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,mCAAmC;QACnC,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,MAAM,GAAG,MAAM,IAAA,mCAAc,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACnD,IAAI,CAAC,SAAS,EAAE;gBACd,YAAY,CAAC,MAAM,CAAC,CAAC;aACtB;QACH,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAEpB,MAAM,OAAO,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAC3B,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,EAAE,CAAC;SACX;QACD,kEAAkE;QAClE,MAAM,UAAU,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QAC1D,MAAM,OAAO,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC/C,OAAO,sBAAsB,OAAO,EAAE,CAAC;IACzC,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,IAAI,CAAC,OAAO,EAAE;QACZ,mFAAmF;QACnF,OAAO,CACL,uCACE,GAAG,EAAC,UAAU,EACd,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,SAAS,EACpB,GAAG,EAAC,kEAAkE,KAClE,KAAK,GACT,CACH,CAAC;KACH;IAED,OAAO,CACL,uCACE,GAAG,EAAC,UAAU,EACd,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,OAAO,KACR,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAxDW,QAAA,QAAQ,YAwDnB;AAEF,gBAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\n\nimport type { MaskiconProps } from './Maskicon.types';\nimport { getMaskiconSVG } from './Maskicon.utilities';\n\nexport const Maskicon = ({\n address,\n size = 32,\n className,\n ...props\n}: MaskiconProps) => {\n const [svgString, setSvgString] = useState('');\n\n useEffect(() => {\n let cancelled = false;\n // eslint-disable-next-line no-void\n void (async () => {\n const newSvg = await getMaskiconSVG(address, size);\n if (!cancelled) {\n setSvgString(newSvg);\n }\n })();\n return () => {\n cancelled = true;\n };\n }, [address, size]);\n\n const dataUri = useMemo(() => {\n if (!svgString) {\n return '';\n }\n // Normalize whitespace and encode the SVG for safe data URI usage\n const cleanedSvg = svgString.replace(/\\s+/gu, ' ').trim();\n const encoded = encodeURIComponent(cleanedSvg);\n return `data:image/svg+xml,${encoded}`;\n }, [svgString]);\n\n if (!dataUri) {\n // Return an img element with transparent placeholder to maintain consistent typing\n return (\n <img\n alt=\"maskicon\"\n width={size}\n height={size}\n className={className}\n src=\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E\"\n {...props}\n />\n );\n }\n\n return (\n <img\n alt=\"maskicon\"\n width={size}\n height={size}\n className={className}\n src={dataUri}\n {...props}\n />\n );\n};\n\nMaskicon.displayName = 'Maskicon';\n"]}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import type { MaskiconProps } from "./Maskicon.types.cjs";
3
3
  export declare const Maskicon: {
4
- ({ address, size, style, ...props }: MaskiconProps): React.JSX.Element;
4
+ ({ address, size, className, ...props }: MaskiconProps): React.JSX.Element;
5
5
  displayName: string;
6
6
  };
7
7
  //# sourceMappingURL=Maskicon.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Maskicon.d.cts","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,cAAc;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAKtD,eAAO,MAAM,QAAQ;yCAKlB,aAAa;;CA4Bf,CAAC"}
1
+ {"version":3,"file":"Maskicon.d.cts","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,cAAc;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAGtD,eAAO,MAAM,QAAQ;6CAKlB,aAAa;;CAmDf,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import type { MaskiconProps } from "./Maskicon.types.mjs";
3
3
  export declare const Maskicon: {
4
- ({ address, size, style, ...props }: MaskiconProps): React.JSX.Element;
4
+ ({ address, size, className, ...props }: MaskiconProps): React.JSX.Element;
5
5
  displayName: string;
6
6
  };
7
7
  //# sourceMappingURL=Maskicon.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Maskicon.d.mts","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.tsx"],"names":[],"mappings":"AACA,OAAO,KAA8B,cAAc;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAKtD,eAAO,MAAM,QAAQ;yCAKlB,aAAa;;CA4Bf,CAAC"}
1
+ {"version":3,"file":"Maskicon.d.mts","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,cAAc;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,6BAAyB;AAGtD,eAAO,MAAM,QAAQ;6CAKlB,aAAa;;CAmDf,CAAC"}
@@ -4,12 +4,10 @@ function $importDefault(module) {
4
4
  }
5
5
  return module;
6
6
  }
7
- import * as dompurify from "dompurify";
8
- import $React, { useEffect, useState } from "react";
7
+ import $React, { useEffect, useMemo, useState } from "react";
9
8
  const React = $importDefault($React);
10
9
  import { getMaskiconSVG } from "./Maskicon.utilities.mjs";
11
- const DOMPurify = dompurify.default;
12
- export const Maskicon = ({ address, size = 32, style, ...props }) => {
10
+ export const Maskicon = ({ address, size = 32, className, ...props }) => {
13
11
  const [svgString, setSvgString] = useState('');
14
12
  useEffect(() => {
15
13
  let cancelled = false;
@@ -24,10 +22,20 @@ export const Maskicon = ({ address, size = 32, style, ...props }) => {
24
22
  cancelled = true;
25
23
  };
26
24
  }, [address, size]);
27
- if (!svgString) {
28
- return React.createElement("div", { style: { width: size, height: size, ...style }, ...props });
25
+ const dataUri = useMemo(() => {
26
+ if (!svgString) {
27
+ return '';
28
+ }
29
+ // Normalize whitespace and encode the SVG for safe data URI usage
30
+ const cleanedSvg = svgString.replace(/\s+/gu, ' ').trim();
31
+ const encoded = encodeURIComponent(cleanedSvg);
32
+ return `data:image/svg+xml,${encoded}`;
33
+ }, [svgString]);
34
+ if (!dataUri) {
35
+ // Return an img element with transparent placeholder to maintain consistent typing
36
+ return (React.createElement("img", { alt: "maskicon", width: size, height: size, className: className, src: "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E", ...props }));
29
37
  }
30
- return (React.createElement("div", { style: { width: size, height: size, ...style }, dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(svgString) }, ...props }));
38
+ return (React.createElement("img", { alt: "maskicon", width: size, height: size, className: className, src: dataUri, ...props }));
31
39
  };
32
40
  Maskicon.displayName = 'Maskicon';
33
41
  //# sourceMappingURL=Maskicon.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Maskicon.mjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,KAAK,SAAS,kBAAkB;AACvC,OAAO,QAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc;;AAGnD,OAAO,EAAE,cAAc,EAAE,iCAA6B;AAEtD,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,CAAC;AAEpC,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EACvB,OAAO,EACP,IAAI,GAAG,EAAE,EACT,KAAK,EACL,GAAG,KAAK,EACM,EAAE,EAAE;IAClB,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE/C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,mCAAmC;QACnC,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YACnD,IAAI,CAAC,SAAS,EAAE;gBACd,YAAY,CAAC,MAAM,CAAC,CAAC;aACtB;QACH,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAEpB,IAAI,CAAC,SAAS,EAAE;QACd,OAAO,6BAAK,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,KAAM,KAAK,GAAI,CAAC;KAC3E;IAED,OAAO,CACL,6BACE,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,EAAE,EAC9C,uBAAuB,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,KAC9D,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import * as dompurify from 'dompurify';\nimport React, { useEffect, useState } from 'react';\n\nimport type { MaskiconProps } from './Maskicon.types';\nimport { getMaskiconSVG } from './Maskicon.utilities';\n\nconst DOMPurify = dompurify.default;\n\nexport const Maskicon = ({\n address,\n size = 32,\n style,\n ...props\n}: MaskiconProps) => {\n const [svgString, setSvgString] = useState('');\n\n useEffect(() => {\n let cancelled = false;\n // eslint-disable-next-line no-void\n void (async () => {\n const newSvg = await getMaskiconSVG(address, size);\n if (!cancelled) {\n setSvgString(newSvg);\n }\n })();\n return () => {\n cancelled = true;\n };\n }, [address, size]);\n\n if (!svgString) {\n return <div style={{ width: size, height: size, ...style }} {...props} />;\n }\n\n return (\n <div\n style={{ width: size, height: size, ...style }}\n dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(svgString) }}\n {...props}\n />\n );\n};\n\nMaskicon.displayName = 'Maskicon';\n"]}
1
+ {"version":3,"file":"Maskicon.mjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,QAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,c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ACH,CAAC;KACH;IAED,OAAO,CACL,6BACE,GAAG,EAAC,UAAU,EACd,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,OAAO,KACR,KAAK,GACT,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["import React, { useEffect, useMemo, useState } from 'react';\n\nimport type { MaskiconProps } from './Maskicon.types';\nimport { getMaskiconSVG } from './Maskicon.utilities';\n\nexport const Maskicon = ({\n address,\n size = 32,\n className,\n ...props\n}: MaskiconProps) => {\n const [svgString, setSvgString] = useState('');\n\n useEffect(() => {\n let cancelled = false;\n // eslint-disable-next-line no-void\n void (async () => {\n const newSvg = await getMaskiconSVG(address, size);\n if (!cancelled) {\n setSvgString(newSvg);\n }\n })();\n return () => {\n cancelled = true;\n };\n }, [address, size]);\n\n const dataUri = useMemo(() => {\n if (!svgString) {\n return '';\n }\n // Normalize whitespace and encode the SVG for safe data URI usage\n const cleanedSvg = svgString.replace(/\\s+/gu, ' ').trim();\n const encoded = encodeURIComponent(cleanedSvg);\n return `data:image/svg+xml,${encoded}`;\n }, [svgString]);\n\n if (!dataUri) {\n // Return an img element with transparent placeholder to maintain consistent typing\n return (\n <img\n alt=\"maskicon\"\n width={size}\n height={size}\n className={className}\n src=\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg'/%3E\"\n {...props}\n />\n );\n }\n\n return (\n <img\n alt=\"maskicon\"\n width={size}\n height={size}\n className={className}\n src={dataUri}\n {...props}\n />\n );\n};\n\nMaskicon.displayName = 'Maskicon';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Maskicon.types.cjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps } from 'react';\n\n/**\n * Maskicon component props.\n */\nexport type MaskiconProps = ComponentProps<'div'> & {\n /**\n * Required address used as a unique identifier to generate the Maskicon.\n */\n address: string;\n /**\n * Optional prop to control the size of the Maskicon.\n */\n size?: number;\n /**\n * Optional prop to add a test id to the icon\n */\n 'data-testid'?: string;\n};\n"]}
1
+ {"version":3,"file":"Maskicon.types.cjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps } from 'react';\n\n/**\n * Maskicon component props.\n */\nexport type MaskiconProps = Omit<ComponentProps<'img'>, 'width' | 'height'> & {\n /**\n * Required address used as a unique identifier to generate the Maskicon.\n */\n address: string;\n /**\n * Optional prop to control the size of the Maskicon.\n * This will set both width and height.\n */\n size?: number;\n /**\n * Optional CSS class name to apply to the Maskicon.\n */\n className?: string;\n /**\n * Optional prop to add a test id to the icon\n */\n 'data-testid'?: string;\n};\n"]}
@@ -2,15 +2,20 @@ import type { ComponentProps } from "react";
2
2
  /**
3
3
  * Maskicon component props.
4
4
  */
5
- export type MaskiconProps = ComponentProps<'div'> & {
5
+ export type MaskiconProps = Omit<ComponentProps<'img'>, 'width' | 'height'> & {
6
6
  /**
7
7
  * Required address used as a unique identifier to generate the Maskicon.
8
8
  */
9
9
  address: string;
10
10
  /**
11
11
  * Optional prop to control the size of the Maskicon.
12
+ * This will set both width and height.
12
13
  */
13
14
  size?: number;
15
+ /**
16
+ * Optional CSS class name to apply to the Maskicon.
17
+ */
18
+ className?: string;
14
19
  /**
15
20
  * Optional prop to add a test id to the icon
16
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Maskicon.types.d.cts","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAClD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
1
+ {"version":3,"file":"Maskicon.types.d.cts","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,GAAG;IAC5E;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
@@ -2,15 +2,20 @@ import type { ComponentProps } from "react";
2
2
  /**
3
3
  * Maskicon component props.
4
4
  */
5
- export type MaskiconProps = ComponentProps<'div'> & {
5
+ export type MaskiconProps = Omit<ComponentProps<'img'>, 'width' | 'height'> & {
6
6
  /**
7
7
  * Required address used as a unique identifier to generate the Maskicon.
8
8
  */
9
9
  address: string;
10
10
  /**
11
11
  * Optional prop to control the size of the Maskicon.
12
+ * This will set both width and height.
12
13
  */
13
14
  size?: number;
15
+ /**
16
+ * Optional CSS class name to apply to the Maskicon.
17
+ */
18
+ className?: string;
14
19
  /**
15
20
  * Optional prop to add a test id to the icon
16
21
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Maskicon.types.d.mts","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAClD;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
1
+ {"version":3,"file":"Maskicon.types.d.mts","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc;AAE5C;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC,GAAG;IAC5E;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Maskicon.types.mjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps } from 'react';\n\n/**\n * Maskicon component props.\n */\nexport type MaskiconProps = ComponentProps<'div'> & {\n /**\n * Required address used as a unique identifier to generate the Maskicon.\n */\n address: string;\n /**\n * Optional prop to control the size of the Maskicon.\n */\n size?: number;\n /**\n * Optional prop to add a test id to the icon\n */\n 'data-testid'?: string;\n};\n"]}
1
+ {"version":3,"file":"Maskicon.types.mjs","sourceRoot":"","sources":["../../../../src/components/temp-components/Maskicon/Maskicon.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ComponentProps } from 'react';\n\n/**\n * Maskicon component props.\n */\nexport type MaskiconProps = Omit<ComponentProps<'img'>, 'width' | 'height'> & {\n /**\n * Required address used as a unique identifier to generate the Maskicon.\n */\n address: string;\n /**\n * Optional prop to control the size of the Maskicon.\n * This will set both width and height.\n */\n size?: number;\n /**\n * Optional CSS class name to apply to the Maskicon.\n */\n className?: string;\n /**\n * Optional prop to add a test id to the icon\n */\n 'data-testid'?: string;\n};\n"]}