@ledgerhq/react-ui 0.24.0-nightly.3 → 0.25.0-next.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.
Files changed (76) hide show
  1. package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.js +102 -0
  2. package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.js.map +7 -0
  3. package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.stories.js +113 -0
  4. package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.stories.js.map +7 -0
  5. package/lib/cjs/pre-ldls/components/AccountList/AccountList.js +47 -0
  6. package/lib/cjs/pre-ldls/components/AccountList/AccountList.js.map +7 -0
  7. package/lib/cjs/pre-ldls/components/AccountList/AccountList.stories.js +73 -0
  8. package/lib/cjs/pre-ldls/components/AccountList/AccountList.stories.js.map +7 -0
  9. package/lib/cjs/pre-ldls/components/Address/Address.js +79 -0
  10. package/lib/cjs/pre-ldls/components/Address/Address.js.map +7 -0
  11. package/lib/cjs/pre-ldls/components/Address/Address.stories.js +56 -0
  12. package/lib/cjs/pre-ldls/components/Address/Address.stories.js.map +7 -0
  13. package/lib/cjs/pre-ldls/components/AssetItem/AssetItem.js +4 -4
  14. package/lib/cjs/pre-ldls/components/AssetItem/AssetItem.js.map +1 -1
  15. package/lib/cjs/pre-ldls/components/AssetList/AssetList.js +4 -7
  16. package/lib/cjs/pre-ldls/components/AssetList/AssetList.js.map +2 -2
  17. package/lib/cjs/pre-ldls/components/Input/Input.js +2 -2
  18. package/lib/cjs/pre-ldls/components/Input/Input.js.map +1 -1
  19. package/lib/cjs/pre-ldls/components/NetworkItem/NetworkItem.js +4 -4
  20. package/lib/cjs/pre-ldls/components/NetworkItem/NetworkItem.js.map +1 -1
  21. package/lib/cjs/pre-ldls/components/NetworkList/NetworkList.js +4 -7
  22. package/lib/cjs/pre-ldls/components/NetworkList/NetworkList.js.map +2 -2
  23. package/lib/cjs/pre-ldls/components/Tag/Tag.js +54 -0
  24. package/lib/cjs/pre-ldls/components/Tag/Tag.js.map +7 -0
  25. package/lib/cjs/pre-ldls/components/Tag/Tag.stories.js +43 -0
  26. package/lib/cjs/pre-ldls/components/Tag/Tag.stories.js.map +7 -0
  27. package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.js +14 -8
  28. package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.js.map +3 -3
  29. package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.stories.js +8 -11
  30. package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.stories.js.map +3 -3
  31. package/lib/cjs/pre-ldls/components/index.js +4 -0
  32. package/lib/cjs/pre-ldls/components/index.js.map +2 -2
  33. package/lib/cjs/pre-ldls/libs/index.js +18 -3
  34. package/lib/cjs/pre-ldls/libs/index.js.map +2 -2
  35. package/lib/pre-ldls/components/AccountItem/AccountItem.d.ts +19 -0
  36. package/lib/pre-ldls/components/AccountItem/AccountItem.d.ts.map +1 -0
  37. package/lib/pre-ldls/components/AccountItem/AccountItem.js +46 -0
  38. package/lib/pre-ldls/components/AccountItem/AccountItem.js.map +1 -0
  39. package/lib/pre-ldls/components/AccountList/AccountList.d.ts +7 -0
  40. package/lib/pre-ldls/components/AccountList/AccountList.d.ts.map +1 -0
  41. package/lib/pre-ldls/components/AccountList/AccountList.js +8 -0
  42. package/lib/pre-ldls/components/AccountList/AccountList.js.map +1 -0
  43. package/lib/pre-ldls/components/Address/Address.d.ts +8 -0
  44. package/lib/pre-ldls/components/Address/Address.d.ts.map +1 -0
  45. package/lib/pre-ldls/components/Address/Address.js +27 -0
  46. package/lib/pre-ldls/components/Address/Address.js.map +1 -0
  47. package/lib/pre-ldls/components/AssetItem/AssetItem.js +3 -3
  48. package/lib/pre-ldls/components/AssetItem/AssetItem.js.map +1 -1
  49. package/lib/pre-ldls/components/AssetList/AssetList.d.ts.map +1 -1
  50. package/lib/pre-ldls/components/AssetList/AssetList.js +3 -2
  51. package/lib/pre-ldls/components/AssetList/AssetList.js.map +1 -1
  52. package/lib/pre-ldls/components/Input/Input.js +2 -2
  53. package/lib/pre-ldls/components/Input/Input.js.map +1 -1
  54. package/lib/pre-ldls/components/NetworkItem/NetworkItem.js +3 -3
  55. package/lib/pre-ldls/components/NetworkItem/NetworkItem.js.map +1 -1
  56. package/lib/pre-ldls/components/NetworkList/NetworkList.d.ts +6 -4
  57. package/lib/pre-ldls/components/NetworkList/NetworkList.d.ts.map +1 -1
  58. package/lib/pre-ldls/components/NetworkList/NetworkList.js +3 -2
  59. package/lib/pre-ldls/components/NetworkList/NetworkList.js.map +1 -1
  60. package/lib/pre-ldls/components/Tag/Tag.d.ts +5 -0
  61. package/lib/pre-ldls/components/Tag/Tag.d.ts.map +1 -0
  62. package/lib/pre-ldls/components/Tag/Tag.js +17 -0
  63. package/lib/pre-ldls/components/Tag/Tag.js.map +1 -0
  64. package/lib/pre-ldls/components/VirtualList/VirtualList.d.ts +8 -9
  65. package/lib/pre-ldls/components/VirtualList/VirtualList.d.ts.map +1 -1
  66. package/lib/pre-ldls/components/VirtualList/VirtualList.js +11 -5
  67. package/lib/pre-ldls/components/VirtualList/VirtualList.js.map +1 -1
  68. package/lib/pre-ldls/components/index.d.ts +4 -0
  69. package/lib/pre-ldls/components/index.d.ts.map +1 -1
  70. package/lib/pre-ldls/components/index.js +4 -0
  71. package/lib/pre-ldls/components/index.js.map +1 -1
  72. package/lib/pre-ldls/libs/index.d.ts +9 -2
  73. package/lib/pre-ldls/libs/index.d.ts.map +1 -1
  74. package/lib/pre-ldls/libs/index.js +13 -4
  75. package/lib/pre-ldls/libs/index.js.map +1 -1
  76. package/package.json +3 -3
@@ -37,7 +37,7 @@ var import_libs = require("../../libs");
37
37
  const Wrapper = import_styled_components.default.div`
38
38
  ${(0, import_libs.withTokens)(
39
39
  "spacing-s",
40
- "spacing-xs",
40
+ "spacing-xxs",
41
41
  "radius-s",
42
42
  "colors-surface-transparent-subdued-default",
43
43
  "colors-content-subdued-default-default"
@@ -49,7 +49,7 @@ const Wrapper = import_styled_components.default.div`
49
49
  min-width: 328px;
50
50
  padding: 0px var(--spacing-s, 16px);
51
51
  align-items: center;
52
- gap: var(--spacing-xs, 8px);
52
+ gap: var(--spacing-xxs, 8px);
53
53
 
54
54
  border-radius: var(--radius-s, 8px);
55
55
  background: var(--colors-surface-transparent-subdued-default, rgba(0, 0, 0, 0.03));
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/pre-ldls/components/Input/Input.tsx"],
4
- "sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport { withTokens } from \"../../libs\";\n\ntype Props = Readonly<React.ComponentProps<\"input\"> & { icon?: React.ReactNode }>;\n\nconst Wrapper = styled.div`\n ${withTokens(\n \"spacing-s\",\n \"spacing-xs\",\n \"radius-s\",\n \"colors-surface-transparent-subdued-default\",\n \"colors-content-subdued-default-default\",\n )}\n\n display: flex;\n width: 328px;\n height: 40px;\n min-width: 328px;\n padding: 0px var(--spacing-s, 16px);\n align-items: center;\n gap: var(--spacing-xs, 8px);\n\n border-radius: var(--radius-s, 8px);\n background: var(--colors-surface-transparent-subdued-default, rgba(0, 0, 0, 0.03));\n color: var(--colors-content-subdued-default-default);\n`;\n\nconst StyledInput = styled.input`\n background: none;\n border: none;\n width: 100%;\n`;\n\nexport const Input = React.forwardRef<HTMLInputElement, Props>(\n ({ type = \"text\", icon = null, ...props }, ref) => {\n return (\n <Wrapper>\n {icon}\n <StyledInput {...props} type={type} ref={ref} />\n </Wrapper>\n );\n },\n);\nInput.displayName = \"Input\";\n"],
4
+ "sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport { withTokens } from \"../../libs\";\n\ntype Props = Readonly<React.ComponentProps<\"input\"> & { icon?: React.ReactNode }>;\n\nconst Wrapper = styled.div`\n ${withTokens(\n \"spacing-s\",\n \"spacing-xxs\",\n \"radius-s\",\n \"colors-surface-transparent-subdued-default\",\n \"colors-content-subdued-default-default\",\n )}\n\n display: flex;\n width: 328px;\n height: 40px;\n min-width: 328px;\n padding: 0px var(--spacing-s, 16px);\n align-items: center;\n gap: var(--spacing-xxs, 8px);\n\n border-radius: var(--radius-s, 8px);\n background: var(--colors-surface-transparent-subdued-default, rgba(0, 0, 0, 0.03));\n color: var(--colors-content-subdued-default-default);\n`;\n\nconst StyledInput = styled.input`\n background: none;\n border: none;\n width: 100%;\n`;\n\nexport const Input = React.forwardRef<HTMLInputElement, Props>(\n ({ type = \"text\", icon = null, ...props }, ref) => {\n return (\n <Wrapper>\n {icon}\n <StyledInput {...props} type={type} ref={ref} />\n </Wrapper>\n );\n },\n);\nInput.displayName = \"Input\";\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,+BAAmB;AACnB,kBAA2B;AAI3B,MAAM,UAAU,yBAAAA,QAAO;AAAA,QACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAeH,MAAM,cAAc,yBAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAMpB,MAAM,QAAQ,aAAAC,QAAM;AAAA,EACzB,CAAC,EAAE,OAAO,QAAQ,OAAO,MAAM,GAAG,MAAM,GAAG,QAAQ;AACjD,WACE,6BAAAA,QAAA,cAAC,eACE,MACD,6BAAAA,QAAA,cAAC,eAAa,GAAG,OAAO,MAAY,KAAU,CAChD;AAAA,EAEJ;AACF;AACA,MAAM,cAAc;",
6
6
  "names": ["styled", "React"]
7
7
  }
@@ -52,14 +52,14 @@ const TempAssetBadge = () => (
52
52
  );
53
53
  const Wrapper = import_styled_components.default.div`
54
54
  ${(0, import_libs.withTokens)(
55
- "spacing-xs",
56
- "marging-s",
55
+ "spacing-xxs",
56
+ "margin-s",
57
57
  "colors-content-default-default",
58
58
  "colors-surface-transparent-hover",
59
59
  "colors-surface-transparent-pressed"
60
60
  )}
61
61
  display: flex;
62
- padding: var(--spacing-xs);
62
+ padding: var(--spacing-xxs);
63
63
  cursor: pointer;
64
64
 
65
65
  :hover {
@@ -74,7 +74,7 @@ const InfoWrapper = import_styled_components.default.div`
74
74
  display: flex;
75
75
  flex-direction: column;
76
76
  justify-content: center;
77
- margin-left: var(--marging-s);
77
+ margin-left: var(--margin-s);
78
78
  `;
79
79
  const NetworkItem = ({ name, onClick }) => {
80
80
  return /* @__PURE__ */ import_react.default.createElement(Wrapper, { onClick }, /* @__PURE__ */ import_react.default.createElement(TempAssetBadge, null), /* @__PURE__ */ import_react.default.createElement(InfoWrapper, null, /* @__PURE__ */ import_react.default.createElement(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/pre-ldls/components/NetworkItem/NetworkItem.tsx"],
4
- "sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport { withTokens } from \"../../libs\";\nimport { Text } from \"../../../components\";\n\ntype NetworkItemProps = {\n name: string;\n onClick: () => void;\n};\n\nconst TempAssetBadge = () => (\n // TODO: To be replaced with LIVE-18221\n <div style={{ display: \"flex\", alignItems: \"center\" }}>\n <span\n style={{\n height: 48,\n width: 48,\n borderRadius: 48,\n backgroundColor: \"grey\",\n display: \"inline-block\",\n }}\n />\n </div>\n);\n\nconst Wrapper = styled.div`\n ${withTokens(\n \"spacing-xs\",\n \"marging-s\",\n \"colors-content-default-default\",\n \"colors-surface-transparent-hover\",\n \"colors-surface-transparent-pressed\",\n )}\n display: flex;\n padding: var(--spacing-xs);\n cursor: pointer;\n\n :hover {\n background-color: var(--colors-surface-transparent-hover);\n }\n\n :active {\n background-color: var(--colors-surface-transparent-pressed);\n }\n`;\n\nconst InfoWrapper = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-left: var(--marging-s);\n`;\n\nexport const NetworkItem = ({ name, onClick }: NetworkItemProps) => {\n return (\n <Wrapper onClick={onClick}>\n <TempAssetBadge />\n <InfoWrapper>\n <Text\n variant=\"largeLineHeight\"\n fontWeight=\"semiBold\"\n color=\"var(--colors-content-default-default)\"\n >\n {name}\n </Text>\n </InfoWrapper>\n </Wrapper>\n );\n};\n"],
4
+ "sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport { withTokens } from \"../../libs\";\nimport { Text } from \"../../../components\";\n\ntype NetworkItemProps = {\n name: string;\n onClick: () => void;\n};\n\nconst TempAssetBadge = () => (\n // TODO: To be replaced with LIVE-18221\n <div style={{ display: \"flex\", alignItems: \"center\" }}>\n <span\n style={{\n height: 48,\n width: 48,\n borderRadius: 48,\n backgroundColor: \"grey\",\n display: \"inline-block\",\n }}\n />\n </div>\n);\n\nconst Wrapper = styled.div`\n ${withTokens(\n \"spacing-xxs\",\n \"margin-s\",\n \"colors-content-default-default\",\n \"colors-surface-transparent-hover\",\n \"colors-surface-transparent-pressed\",\n )}\n display: flex;\n padding: var(--spacing-xxs);\n cursor: pointer;\n\n :hover {\n background-color: var(--colors-surface-transparent-hover);\n }\n\n :active {\n background-color: var(--colors-surface-transparent-pressed);\n }\n`;\n\nconst InfoWrapper = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-left: var(--margin-s);\n`;\n\nexport const NetworkItem = ({ name, onClick }: NetworkItemProps) => {\n return (\n <Wrapper onClick={onClick}>\n <TempAssetBadge />\n <InfoWrapper>\n <Text\n variant=\"largeLineHeight\"\n fontWeight=\"semiBold\"\n color=\"var(--colors-content-default-default)\"\n >\n {name}\n </Text>\n </InfoWrapper>\n </Wrapper>\n );\n};\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,+BAAmB;AACnB,kBAA2B;AAC3B,wBAAqB;AAOrB,MAAM,iBAAiB;AAAA;AAAA,EAErB,6BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,YAAY,SAAS,KAClD,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,cAAc;AAAA,QACd,iBAAiB;AAAA,QACjB,SAAS;AAAA,MACX;AAAA;AAAA,EACF,CACF;AAAA;AAGF,MAAM,UAAU,yBAAAC,QAAO;AAAA,QACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAcH,MAAM,cAAc,yBAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOpB,MAAM,cAAc,CAAC,EAAE,MAAM,QAAQ,MAAwB;AAClE,SACE,6BAAAD,QAAA,cAAC,WAAQ,WACP,6BAAAA,QAAA,cAAC,oBAAe,GAChB,6BAAAA,QAAA,cAAC,mBACC,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,SAAQ;AAAA,MACR,YAAW;AAAA,MACX,OAAM;AAAA;AAAA,IAEL;AAAA,EACH,CACF,CACF;AAEJ;",
6
6
  "names": ["React", "styled"]
7
7
  }
@@ -38,13 +38,10 @@ const NetworkList = ({
38
38
  networks,
39
39
  onClick
40
40
  }) => {
41
- return /* @__PURE__ */ import_react.default.createElement(
42
- import_VirtualList.VirtualList,
43
- {
44
- itemHeight: 64,
45
- count: networks.length,
46
- renderItem: (i) => /* @__PURE__ */ import_react.default.createElement(import_NetworkItem.NetworkItem, { name: networks[i].name, onClick: () => onClick(networks[i].id) })
47
- }
41
+ const renderNetworkItem = (0, import_react.useCallback)(
42
+ ({ name, id }) => /* @__PURE__ */ import_react.default.createElement(import_NetworkItem.NetworkItem, { name, onClick: () => onClick(id) }),
43
+ [onClick]
48
44
  );
45
+ return /* @__PURE__ */ import_react.default.createElement(import_VirtualList.VirtualList, { items: networks, itemHeight: 64, renderItem: renderNetworkItem });
49
46
  };
50
47
  //# sourceMappingURL=NetworkList.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/pre-ldls/components/NetworkList/NetworkList.tsx"],
4
- "sourcesContent": ["import React from \"react\";\nimport { NetworkItem } from \"../NetworkItem/NetworkItem\";\nimport { VirtualList } from \"../VirtualList/VirtualList\";\n\nexport const NetworkList = ({\n networks,\n onClick,\n}: {\n networks: { name: string; id: string }[];\n onClick: (networkId: string) => void;\n}) => {\n return (\n <VirtualList\n itemHeight={64}\n count={networks.length}\n renderItem={(i: number) => (\n <NetworkItem name={networks[i].name} onClick={() => onClick(networks[i].id)} />\n )}\n />\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,yBAA4B;AAC5B,yBAA4B;AAErB,MAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA;AACF,MAGM;AACJ,SACE,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,YAAY;AAAA,MACZ,OAAO,SAAS;AAAA,MAChB,YAAY,CAAC,MACX,6BAAAA,QAAA,cAAC,kCAAY,MAAM,SAAS,CAAC,EAAE,MAAM,SAAS,MAAM,QAAQ,SAAS,CAAC,EAAE,EAAE,GAAG;AAAA;AAAA,EAEjF;AAEJ;",
4
+ "sourcesContent": ["import React, { useCallback } from \"react\";\nimport { NetworkItem } from \"../NetworkItem/NetworkItem\";\nimport { VirtualList } from \"../VirtualList/VirtualList\";\n\ntype Network = { name: string; id: string };\n\nexport const NetworkList = ({\n networks,\n onClick,\n}: {\n networks: Network[];\n onClick: (networkId: string) => void;\n}) => {\n const renderNetworkItem = useCallback(\n ({ name, id }: Network) => <NetworkItem name={name} onClick={() => onClick(id)} />,\n [onClick],\n );\n\n return <VirtualList items={networks} itemHeight={64} renderItem={renderNetworkItem} />;\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAmC;AACnC,yBAA4B;AAC5B,yBAA4B;AAIrB,MAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA;AACF,MAGM;AACJ,QAAM,wBAAoB;AAAA,IACxB,CAAC,EAAE,MAAM,GAAG,MAAe,6BAAAA,QAAA,cAAC,kCAAY,MAAY,SAAS,MAAM,QAAQ,EAAE,GAAG;AAAA,IAChF,CAAC,OAAO;AAAA,EACV;AAEA,SAAO,6BAAAA,QAAA,cAAC,kCAAY,OAAO,UAAU,YAAY,IAAI,YAAY,mBAAmB;AACtF;",
6
6
  "names": ["React"]
7
7
  }
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var Tag_exports = {};
30
+ __export(Tag_exports, {
31
+ Tag: () => Tag
32
+ });
33
+ module.exports = __toCommonJS(Tag_exports);
34
+ var import_react = __toESM(require("react"));
35
+ var import_components = require("../../../components");
36
+ var import_libs = require("../../libs");
37
+ var import_styled_components = __toESM(require("styled-components"));
38
+ const Wrapper = import_styled_components.default.div`
39
+ ${(0, import_libs.withTokens)(
40
+ "colors-surface-transparent-subdued-default",
41
+ "colors-content-subdued-default-default",
42
+ "radius-xs",
43
+ "spacing-xxxs"
44
+ )}
45
+
46
+ padding: 1px var(--spacing-xxxs);
47
+ border-radius: var(--radius-xs);
48
+ display: inline-flex;
49
+ background-color: var(--colors-surface-transparent-subdued-default);
50
+ `;
51
+ const Tag = ({ children }) => {
52
+ return /* @__PURE__ */ import_react.default.createElement(Wrapper, { "data-testid": "tag" }, /* @__PURE__ */ import_react.default.createElement(import_components.Text, { color: "var(--colors-content-subdued-default-default)", fontSize: "10px", lineHeight: "16px" }, children));
53
+ };
54
+ //# sourceMappingURL=Tag.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/pre-ldls/components/Tag/Tag.tsx"],
4
+ "sourcesContent": ["import React, { ReactNode } from \"react\";\nimport { Text } from \"../../../components\";\nimport { withTokens } from \"../../libs\";\nimport styled from \"styled-components\";\n\nconst Wrapper = styled.div`\n ${withTokens(\n \"colors-surface-transparent-subdued-default\",\n \"colors-content-subdued-default-default\",\n \"radius-xs\",\n \"spacing-xxxs\",\n )}\n\n padding: 1px var(--spacing-xxxs);\n border-radius: var(--radius-xs);\n display: inline-flex;\n background-color: var(--colors-surface-transparent-subdued-default);\n`;\n\nexport const Tag = ({ children }: { children: ReactNode }) => {\n return (\n <Wrapper data-testid=\"tag\">\n <Text color=\"var(--colors-content-subdued-default-default)\" fontSize=\"10px\" lineHeight=\"16px\">\n {children}\n </Text>\n </Wrapper>\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAiC;AACjC,wBAAqB;AACrB,kBAA2B;AAC3B,+BAAmB;AAEnB,MAAM,UAAU,yBAAAA,QAAO;AAAA,QACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQI,MAAM,MAAM,CAAC,EAAE,SAAS,MAA+B;AAC5D,SACE,6BAAAC,QAAA,cAAC,WAAQ,eAAY,SACnB,6BAAAA,QAAA,cAAC,0BAAK,OAAM,iDAAgD,UAAS,QAAO,YAAW,UACpF,QACH,CACF;AAEJ;",
6
+ "names": ["styled", "React"]
7
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var Tag_stories_exports = {};
20
+ __export(Tag_stories_exports, {
21
+ Default: () => Default,
22
+ TestTag: () => TestTag,
23
+ default: () => Tag_stories_default
24
+ });
25
+ module.exports = __toCommonJS(Tag_stories_exports);
26
+ var import_Tag = require("./Tag");
27
+ var import_test = require("@storybook/test");
28
+ const meta = {
29
+ component: import_Tag.Tag,
30
+ title: "PreLdls/Components/Tag",
31
+ tags: ["autodocs"],
32
+ args: { children: "Native Segwit" }
33
+ };
34
+ var Tag_stories_default = meta;
35
+ const Default = {};
36
+ const TestTag = {
37
+ play: async ({ canvasElement }) => {
38
+ const canvas = (0, import_test.within)(canvasElement);
39
+ const input = canvas.getByTestId("tag");
40
+ await (0, import_test.expect)(input).toHaveTextContent("Native Segwit");
41
+ }
42
+ };
43
+ //# sourceMappingURL=Tag.stories.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../../src/pre-ldls/components/Tag/Tag.stories.tsx"],
4
+ "sourcesContent": ["import type { Meta, StoryObj } from \"@storybook/react\";\nimport { Tag } from \"./Tag\";\nimport { within, expect } from \"@storybook/test\";\n\nconst meta: Meta<typeof Tag> = {\n component: Tag,\n title: \"PreLdls/Components/Tag\",\n tags: [\"autodocs\"],\n args: { children: \"Native Segwit\" },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof Tag>;\n\nexport const Default: Story = {};\n\nexport const TestTag: Story = {\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n const input = canvas.getByTestId(\"tag\");\n await expect(input).toHaveTextContent(\"Native Segwit\");\n },\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,iBAAoB;AACpB,kBAA+B;AAE/B,MAAM,OAAyB;AAAA,EAC7B,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,MAAM,EAAE,UAAU,gBAAgB;AACpC;AACA,IAAO,sBAAQ;AAIR,MAAM,UAAiB,CAAC;AAExB,MAAM,UAAiB;AAAA,EAC5B,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AACnC,UAAM,QAAQ,OAAO,YAAY,KAAK;AACtC,cAAM,oBAAO,KAAK,EAAE,kBAAkB,eAAe;AAAA,EACvD;AACF;",
6
+ "names": []
7
+ }
@@ -36,7 +36,6 @@ var import_react_virtual = require("@tanstack/react-virtual");
36
36
  var import_components = require("../../../components");
37
37
  const DefaultLoadingComponent = () => /* @__PURE__ */ import_react.default.createElement(import_components.Flex, { justifyContent: "center", alignItems: "center", height: "76px" }, /* @__PURE__ */ import_react.default.createElement(import_components.InfiniteLoader, null));
38
38
  const VirtualList = ({
39
- count,
40
39
  itemHeight,
41
40
  overscan = 5,
42
41
  LoadingComponent,
@@ -44,24 +43,31 @@ const VirtualList = ({
44
43
  hasNextPage = false,
45
44
  threshold = 5,
46
45
  onVisibleItemsScrollEnd,
46
+ items,
47
47
  renderItem
48
48
  }) => {
49
49
  const parentRef = (0, import_react.useRef)(null);
50
50
  const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
51
- count: hasNextPage ? count + 1 : count,
51
+ count: hasNextPage ? items.length + 1 : items.length,
52
52
  getScrollElement: () => parentRef.current,
53
53
  estimateSize: () => itemHeight,
54
54
  overscan
55
55
  });
56
56
  (0, import_react.useEffect)(() => {
57
- const items = rowVirtualizer.getVirtualItems();
58
- if (!items.length)
57
+ const items2 = rowVirtualizer.getVirtualItems();
58
+ if (!items2.length)
59
59
  return;
60
- const lastItem = items[items.length - 1];
61
- if (lastItem.index >= count - 1 - threshold && hasNextPage && !isLoading && onVisibleItemsScrollEnd) {
60
+ const lastItem = items2[items2.length - 1];
61
+ if (lastItem.index >= items2.length - 1 - threshold && hasNextPage && !isLoading && onVisibleItemsScrollEnd) {
62
62
  onVisibleItemsScrollEnd();
63
63
  }
64
- }, [hasNextPage, onVisibleItemsScrollEnd, count, isLoading, rowVirtualizer.getVirtualItems()]);
64
+ }, [
65
+ hasNextPage,
66
+ onVisibleItemsScrollEnd,
67
+ items.length,
68
+ isLoading,
69
+ rowVirtualizer.getVirtualItems()
70
+ ]);
65
71
  const showCustomLoadingComponent = !!LoadingComponent;
66
72
  return /* @__PURE__ */ import_react.default.createElement("div", { ref: parentRef, style: { width: "100%", height: "100%", overflow: "auto" } }, /* @__PURE__ */ import_react.default.createElement(
67
73
  "div",
@@ -87,7 +93,7 @@ const VirtualList = ({
87
93
  width: "100%"
88
94
  }
89
95
  },
90
- renderItem(virtualRow.index)
96
+ renderItem(items[virtualRow.index])
91
97
  ))
92
98
  ), isLoading && (showCustomLoadingComponent ? LoadingComponent : /* @__PURE__ */ import_react.default.createElement(DefaultLoadingComponent, null)));
93
99
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/pre-ldls/components/VirtualList/VirtualList.tsx"],
4
- "sourcesContent": ["import React, { useEffect, useRef } from \"react\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport { Flex, InfiniteLoader } from \"../../../components\";\n\ninterface VirtualItem {\n key: string | number | bigint;\n index: number;\n start: number;\n end: number;\n size: number;\n}\n\n/**\n * Props for the VirtualList component, which efficiently renders large lists\n * by virtualizing DOM nodes to improve performance.\n */\ntype VirtualListProps = {\n /**\n * Total number of items in the list.\n * This is used to calculate the total height of the list.\n */\n count: number;\n /**\n * Height of each item in the list.\n * This is used to calculate the total height of the list and the position of each item.\n */\n itemHeight: number;\n /**\n * Number of extra items to render outside the visible viewport for smoother scrolling.\n * Defaults to 5.\n */\n overscan?: number;\n /**\n * React component or node to display when the list is loading additional items.\n * If not provided, a default loading spinner will be used.\n */\n LoadingComponent?: React.ReactNode;\n /**\n * Indicates whether new items are currently being loaded.\n */\n isLoading?: boolean;\n /**\n * Indicates if there are more items to load.\n */\n hasNextPage?: boolean;\n /**\n * Number of items to check before the end of the list to trigger loading more items.\n * Defaults to 5.\n */\n threshold?: number;\n /**\n * Callback function to be called when the user scrolls to the end of the visible items.\n * This can be used to load more items when the user reaches the end of the list.\n */\n onVisibleItemsScrollEnd?: () => void;\n /**\n * Function to render each item in the list.\n * Receives the index of the item as an argument and should return a React node.\n */\n renderItem: (index: number) => React.ReactNode;\n};\n\nconst DefaultLoadingComponent = () => (\n <Flex justifyContent=\"center\" alignItems=\"center\" height=\"76px\">\n <InfiniteLoader />\n </Flex>\n);\n\nexport const VirtualList = ({\n count,\n itemHeight,\n overscan = 5,\n LoadingComponent,\n isLoading,\n hasNextPage = false,\n threshold = 5,\n onVisibleItemsScrollEnd,\n renderItem,\n}: VirtualListProps) => {\n const parentRef = useRef<HTMLDivElement>(null);\n\n const rowVirtualizer = useVirtualizer({\n count: hasNextPage ? count + 1 : count,\n getScrollElement: () => parentRef.current,\n estimateSize: () => itemHeight,\n overscan,\n });\n\n useEffect(() => {\n const items = rowVirtualizer.getVirtualItems();\n if (!items.length) return;\n const lastItem = items[items.length - 1];\n\n if (\n lastItem.index >= count - 1 - threshold &&\n hasNextPage &&\n !isLoading &&\n onVisibleItemsScrollEnd\n ) {\n onVisibleItemsScrollEnd();\n }\n }, [hasNextPage, onVisibleItemsScrollEnd, count, isLoading, rowVirtualizer.getVirtualItems()]);\n\n const showCustomLoadingComponent = !!LoadingComponent;\n\n return (\n <div ref={parentRef} style={{ width: \"100%\", height: \"100%\", overflow: \"auto\" }}>\n <div\n style={{\n height: `${rowVirtualizer.getTotalSize()}px`,\n width: \"100%\",\n position: \"relative\",\n }}\n >\n {rowVirtualizer.getVirtualItems().map((virtualRow: VirtualItem) => (\n <div\n key={virtualRow.index}\n data-index={virtualRow.index}\n ref={rowVirtualizer.measureElement}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n transform: `translateY(${virtualRow.start}px)`,\n height: `${itemHeight}px`,\n width: \"100%\",\n }}\n >\n {renderItem(virtualRow.index)}\n </div>\n ))}\n </div>\n {isLoading && (showCustomLoadingComponent ? LoadingComponent : <DefaultLoadingComponent />)}\n </div>\n );\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyC;AACzC,2BAA+B;AAC/B,wBAAqC;AA4DrC,MAAM,0BAA0B,MAC9B,6BAAAA,QAAA,cAAC,0BAAK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cAAc,WAAW,KAAK;AAAA,UACzC,QAAQ,GAAG,UAAU;AAAA,UACrB,OAAO;AAAA,QACT;AAAA;AAAA,MAEC,WAAW,WAAW,KAAK;AAAA,IAC9B,CACD;AAAA,EACH,GACC,cAAc,6BAA6B,mBAAmB,6BAAAA,QAAA,cAAC,6BAAwB,EAC1F;AAEJ;",
6
- "names": ["React"]
4
+ "sourcesContent": ["import React, { useEffect, useRef } from \"react\";\nimport { useVirtualizer } from \"@tanstack/react-virtual\";\nimport { Flex, InfiniteLoader } from \"../../../components\";\n\ninterface VirtualItem {\n key: string | number | bigint;\n index: number;\n start: number;\n end: number;\n size: number;\n}\n\n/**\n * Props for the VirtualList component, which efficiently renders large lists\n * by virtualizing DOM nodes to improve performance.\n */\ntype VirtualListProps<T> = {\n /**\n * Height of each item in the list.\n * This is used to calculate the total height of the list and the position of each item.\n */\n itemHeight: number;\n /**\n * Number of extra items to render outside the visible viewport for smoother scrolling.\n * Defaults to 5.\n */\n overscan?: number;\n /**\n * React component or node to display when the list is loading additional items.\n * If not provided, a default loading spinner will be used.\n */\n LoadingComponent?: React.ReactNode;\n /**\n * Indicates whether new items are currently being loaded.\n */\n isLoading?: boolean;\n /**\n * Indicates if there are more items to load.\n */\n hasNextPage?: boolean;\n /**\n * Number of items to check before the end of the list to trigger loading more items.\n * Defaults to 5.\n */\n threshold?: number;\n /**\n * Callback function to be called when the user scrolls to the end of the visible items.\n * This can be used to load more items when the user reaches the end of the list.\n */\n onVisibleItemsScrollEnd?: () => void;\n /**\n * Function to render each item in the list.\n * Receives a single value from the items array as an argument and should return a React node.\n */\n renderItem: (item: T) => React.ReactNode;\n /**\n * The array of items which will be rendered\n */\n items: T[];\n};\n\nconst DefaultLoadingComponent = () => (\n <Flex justifyContent=\"center\" alignItems=\"center\" height=\"76px\">\n <InfiniteLoader />\n </Flex>\n);\n\nexport const VirtualList = <T,>({\n itemHeight,\n overscan = 5,\n LoadingComponent,\n isLoading,\n hasNextPage = false,\n threshold = 5,\n onVisibleItemsScrollEnd,\n items,\n renderItem,\n}: VirtualListProps<T>) => {\n const parentRef = useRef<HTMLDivElement>(null);\n\n const rowVirtualizer = useVirtualizer({\n count: hasNextPage ? items.length + 1 : items.length,\n getScrollElement: () => parentRef.current,\n estimateSize: () => itemHeight,\n overscan,\n });\n\n useEffect(() => {\n const items = rowVirtualizer.getVirtualItems();\n if (!items.length) return;\n const lastItem = items[items.length - 1];\n\n if (\n lastItem.index >= items.length - 1 - threshold &&\n hasNextPage &&\n !isLoading &&\n onVisibleItemsScrollEnd\n ) {\n onVisibleItemsScrollEnd();\n }\n }, [\n hasNextPage,\n onVisibleItemsScrollEnd,\n items.length,\n isLoading,\n rowVirtualizer.getVirtualItems(),\n ]);\n\n const showCustomLoadingComponent = !!LoadingComponent;\n\n return (\n <div ref={parentRef} style={{ width: \"100%\", height: \"100%\", overflow: \"auto\" }}>\n <div\n style={{\n height: `${rowVirtualizer.getTotalSize()}px`,\n width: \"100%\",\n position: \"relative\",\n }}\n >\n {rowVirtualizer.getVirtualItems().map((virtualRow: VirtualItem) => (\n <div\n key={virtualRow.index}\n data-index={virtualRow.index}\n ref={rowVirtualizer.measureElement}\n style={{\n position: \"absolute\",\n top: 0,\n left: 0,\n transform: `translateY(${virtualRow.start}px)`,\n height: `${itemHeight}px`,\n width: \"100%\",\n }}\n >\n {renderItem(items[virtualRow.index])}\n </div>\n ))}\n </div>\n {isLoading && (showCustomLoadingComponent ? LoadingComponent : <DefaultLoadingComponent />)}\n </div>\n );\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAyC;AACzC,2BAA+B;AAC/B,wBAAqC;AA2DrC,MAAM,0BAA0B,MAC9B,6BAAAA,QAAA,cAAC,0BAAK,gBAAe,UAAS,YAAW,UAAS,QAAO,UACvD,6BAAAA,QAAA,cAAC,sCAAe,CAClB;AAGK,MAAM,cAAc,CAAK;AAAA,EAC9B;AAA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AAO;AAAA,QACT;AAAA;AAAA,MAEC,WAAW,MAAM,WAAW,KAAK,CAAC;AAAA,IACrC,CACD;AAAA,EACH,GACC,cAAc,6BAA6B,mBAAmB,6BAAAA,QAAA,cAAC,6BAAwB,EAC1F;AAEJ;",
6
+ "names": ["React", "items"]
7
7
  }
@@ -38,6 +38,7 @@ var import_react = __toESM(require("react"));
38
38
  var import_VirtualList = require("./VirtualList");
39
39
  var import_addon_actions = require("@storybook/addon-actions");
40
40
  var import_test = require("@storybook/test");
41
+ const items = Array.from({ length: 50 }, (_, i) => ({ i }));
41
42
  const meta = {
42
43
  component: import_VirtualList.VirtualList,
43
44
  decorators: [
@@ -54,9 +55,6 @@ const meta = {
54
55
  }
55
56
  },
56
57
  argTypes: {
57
- count: {
58
- description: "Total number of items in the list."
59
- },
60
58
  itemHeight: {
61
59
  description: "Height of each item in the list."
62
60
  },
@@ -95,7 +93,6 @@ const meta = {
95
93
  },
96
94
  args: {
97
95
  itemHeight: 64,
98
- count: 50,
99
96
  LoadingComponent: void 0,
100
97
  isLoading: false,
101
98
  overscan: 5,
@@ -103,21 +100,22 @@ const meta = {
103
100
  threshold: 5,
104
101
  onVisibleItemsScrollEnd: () => {
105
102
  },
106
- renderItem: (index) => /* @__PURE__ */ import_react.default.createElement("h1", { tabIndex: index }, "Item #", index)
103
+ items,
104
+ renderItem: ({ i }) => /* @__PURE__ */ import_react.default.createElement("h1", { tabIndex: i }, "Item #", i)
107
105
  }
108
106
  };
109
107
  var VirtualList_stories_default = meta;
110
108
  const Default = {
111
109
  args: {
112
- count: 20,
113
110
  itemHeight: 50,
114
111
  overscan: 5,
115
- renderItem: (index) => /* @__PURE__ */ import_react.default.createElement("div", { style: { height: 50, backgroundColor: "lightblue", border: "1px solid black" } }, "Item ", index)
112
+ items,
113
+ renderItem: ({ i }) => /* @__PURE__ */ import_react.default.createElement("div", { style: { height: 50, backgroundColor: "lightblue", border: "1px solid black" } }, "Item ", i)
116
114
  }
117
115
  };
118
116
  const WithPagination = {
119
117
  render: (args) => {
120
- const [items, setItems] = (0, import_react.useState)(Array.from({ length: args.count }, (_, i) => i));
118
+ const [items2, setItems] = (0, import_react.useState)(Array.from({ length: 50 }, (_, i) => i));
121
119
  const [isFetching, setIsFetching] = (0, import_react.useState)(false);
122
120
  const handleFetchNextPage = async () => {
123
121
  (0, import_addon_actions.action)("fetchNextPage")();
@@ -132,16 +130,15 @@ const WithPagination = {
132
130
  import_VirtualList.VirtualList,
133
131
  {
134
132
  ...args,
135
- count: items.length,
136
133
  isLoading: isFetching,
137
134
  onVisibleItemsScrollEnd: handleFetchNextPage,
138
135
  hasNextPage: true,
139
- renderItem: (index) => /* @__PURE__ */ import_react.default.createElement("div", { style: { height: 50, backgroundColor: "lightgreen", border: "1px solid black" } }, "Item ", items[index])
136
+ items: items2,
137
+ renderItem: (item) => /* @__PURE__ */ import_react.default.createElement("div", { style: { height: 50, backgroundColor: "lightgreen", border: "1px solid black" } }, "Item ", item)
140
138
  }
141
139
  );
142
140
  },
143
141
  args: {
144
- count: 50,
145
142
  itemHeight: 50,
146
143
  overscan: 5,
147
144
  hasNextPage: true,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../src/pre-ldls/components/VirtualList/VirtualList.stories.tsx"],
4
- "sourcesContent": ["import React, { useState } from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { VirtualList } from \"./VirtualList\";\nimport { action } from \"@storybook/addon-actions\";\nimport { expect, userEvent, waitFor, within } from \"@storybook/test\";\n\nconst meta: Meta<typeof VirtualList> = {\n component: VirtualList,\n decorators: [\n Story => (\n <div style={{ height: \"400px\" }}>\n <Story />\n </div>\n ),\n ],\n title: \"PreLdls/Components/VirtualList\",\n tags: [\"autodocs\"],\n parameters: {\n layout: \"fullscreen\",\n docs: {\n description: {\n component:\n \"A virtualized list component that renders only the visible items in a scrollable container using the `useVirtualizer` hook from `@tanstack/react-virtual`. It supports pagination and custom item rendering.\",\n },\n },\n },\n argTypes: {\n count: {\n description: \"Total number of items in the list.\",\n },\n itemHeight: {\n description: \"Height of each item in the list.\",\n },\n overscan: {\n description:\n \"Number of extra items to render outside the visible viewport for smoother scrolling.\",\n table: {\n defaultValue: {\n summary: \"5\",\n },\n },\n },\n LoadingComponent: {\n description:\n \"React component or node to display when the list is loading additional items. If not provided, a default loading spinner will be used.\",\n },\n isLoading: {\n description: \"Indicates whether new items are currently being loaded.\",\n },\n hasNextPage: {\n description:\n \"Indicates if there are more items to load. If true, the list will trigger loading more items when scrolled to the end.\",\n defaultValue: {\n summary: \"false\",\n },\n },\n threshold: {\n description:\n \"Number of items to check before the end of the list to trigger loading more items.\",\n defaultValue: {\n summary: \"5\",\n },\n },\n onVisibleItemsScrollEnd: {\n description:\n \"Callback function to be called when the user scrolls to the end of the visible items. This can be used to load more items when the user reaches the end of the list.\",\n },\n renderItem: {\n description:\n \"Function to render each item in the list. Receives the index of the item as an argument and should return a React node.\",\n },\n },\n args: {\n itemHeight: 64,\n count: 50,\n LoadingComponent: undefined,\n isLoading: false,\n overscan: 5,\n hasNextPage: false,\n threshold: 5,\n onVisibleItemsScrollEnd: () => {},\n renderItem: (index: number) => <h1 tabIndex={index}>Item #{index}</h1>,\n },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof VirtualList>;\n\nexport const Default: Story = {\n args: {\n count: 20,\n itemHeight: 50,\n overscan: 5,\n renderItem: (index: number) => (\n <div style={{ height: 50, backgroundColor: \"lightblue\", border: \"1px solid black\" }}>\n Item {index}\n </div>\n ),\n },\n};\n\nexport const WithPagination: Story = {\n render: args => {\n const [items, setItems] = useState(Array.from({ length: args.count }, (_, i) => i));\n const [isFetching, setIsFetching] = useState(false);\n\n const handleFetchNextPage = async () => {\n action(\"fetchNextPage\")();\n if (isFetching) return;\n setIsFetching(true);\n await new Promise(resolve => setTimeout(resolve, 1000));\n setItems(prev => [...prev, ...Array.from({ length: 50 }, (_, i) => prev.length + i)]);\n setIsFetching(false);\n };\n\n return (\n <VirtualList\n {...args}\n count={items.length}\n isLoading={isFetching}\n onVisibleItemsScrollEnd={handleFetchNextPage}\n hasNextPage={true}\n renderItem={index => (\n <div style={{ height: 50, backgroundColor: \"lightgreen\", border: \"1px solid black\" }}>\n Item {items[index]}\n </div>\n )}\n />\n );\n },\n args: {\n count: 50,\n itemHeight: 50,\n overscan: 5,\n hasNextPage: true,\n isLoading: false,\n },\n};\n\nexport const TestVirtualList: Story = {\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n const visibleItems = canvas.getAllByText(/Item #/i);\n const firstVisibleItem = visibleItems[0];\n const lastVisibleItem = visibleItems[visibleItems.length - 1];\n\n // need to add 5 due to the overscan set to 5 (it renders 5 items before and after the visible items)\n await expect(visibleItems.length).toBeLessThanOrEqual(12);\n\n await expect(firstVisibleItem).toBeInTheDocument();\n\n await userEvent.pointer([\n { keys: \"[TouchA>]\", target: lastVisibleItem },\n { target: firstVisibleItem },\n { keys: \"[/TouchA]\" },\n ]);\n\n await waitFor(() => expect(firstVisibleItem).not.toBeInTheDocument());\n },\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgC;AAEhC,yBAA4B;AAC5B,2BAAuB;AACvB,kBAAmD;AAEnD,MAAM,OAAiC;AAAA,EACrC,WAAW;AAAA,EACX,YAAY;AAAA,IACV,WACE,6BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,QAAQ,QAAQ,KAC5B,6BAAAA,QAAA,cAAC,WAAM,CACT;AAAA,EAEJ;AAAA,EACA,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,YAAY;AAAA,IACV,QAAQ;AAAA,IACR,MAAM;AAAA,MACJ,aAAa;AAAA,QACX,WACE;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,MACL,aAAa;AAAA,IACf;A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CAAC;AAED,cAAM,qBAAQ,UAAM,oBAAO,gBAAgB,EAAE,IAAI,kBAAkB,CAAC;AAAA,EACtE;AACF;",
6
- "names": ["React"]
4
+ "sourcesContent": ["import React, { useState } from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { VirtualList } from \"./VirtualList\";\nimport { action } from \"@storybook/addon-actions\";\nimport { expect, userEvent, waitFor, within } from \"@storybook/test\";\n\nconst items = Array.from({ length: 50 }, (_, i) => ({ i }));\n\nconst meta: Meta<typeof VirtualList<{ i: number }>> = {\n component: VirtualList,\n decorators: [\n Story => (\n <div style={{ height: \"400px\" }}>\n <Story />\n </div>\n ),\n ],\n title: \"PreLdls/Components/VirtualList\",\n tags: [\"autodocs\"],\n parameters: {\n layout: \"fullscreen\",\n docs: {\n description: {\n component:\n \"A virtualized list component that renders only the visible items in a scrollable container using the `useVirtualizer` hook from `@tanstack/react-virtual`. It supports pagination and custom item rendering.\",\n },\n },\n },\n argTypes: {\n itemHeight: {\n description: \"Height of each item in the list.\",\n },\n overscan: {\n description:\n \"Number of extra items to render outside the visible viewport for smoother scrolling.\",\n table: {\n defaultValue: {\n summary: \"5\",\n },\n },\n },\n LoadingComponent: {\n description:\n \"React component or node to display when the list is loading additional items. If not provided, a default loading spinner will be used.\",\n },\n isLoading: {\n description: \"Indicates whether new items are currently being loaded.\",\n },\n hasNextPage: {\n description:\n \"Indicates if there are more items to load. If true, the list will trigger loading more items when scrolled to the end.\",\n defaultValue: {\n summary: \"false\",\n },\n },\n threshold: {\n description:\n \"Number of items to check before the end of the list to trigger loading more items.\",\n defaultValue: {\n summary: \"5\",\n },\n },\n onVisibleItemsScrollEnd: {\n description:\n \"Callback function to be called when the user scrolls to the end of the visible items. This can be used to load more items when the user reaches the end of the list.\",\n },\n renderItem: {\n description:\n \"Function to render each item in the list. Receives the index of the item as an argument and should return a React node.\",\n },\n },\n args: {\n itemHeight: 64,\n LoadingComponent: undefined,\n isLoading: false,\n overscan: 5,\n hasNextPage: false,\n threshold: 5,\n onVisibleItemsScrollEnd: () => {},\n items,\n renderItem: ({ i }: { i: number }) => <h1 tabIndex={i}>Item #{i}</h1>,\n },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof VirtualList<{ i: number }>>;\n\nexport const Default: Story = {\n args: {\n itemHeight: 50,\n overscan: 5,\n items,\n renderItem: ({ i }: { i: number }) => (\n <div style={{ height: 50, backgroundColor: \"lightblue\", border: \"1px solid black\" }}>\n Item {i}\n </div>\n ),\n },\n};\n\nexport const WithPagination: Story = {\n render: args => {\n const [items, setItems] = useState(Array.from({ length: 50 }, (_, i) => i));\n const [isFetching, setIsFetching] = useState(false);\n\n const handleFetchNextPage = async () => {\n action(\"fetchNextPage\")();\n if (isFetching) return;\n setIsFetching(true);\n await new Promise(resolve => setTimeout(resolve, 1000));\n setItems(prev => [...prev, ...Array.from({ length: 50 }, (_, i) => prev.length + i)]);\n setIsFetching(false);\n };\n\n return (\n <VirtualList\n {...args}\n isLoading={isFetching}\n onVisibleItemsScrollEnd={handleFetchNextPage}\n hasNextPage={true}\n items={items}\n renderItem={item => (\n <div style={{ height: 50, backgroundColor: \"lightgreen\", border: \"1px solid black\" }}>\n Item {item}\n </div>\n )}\n />\n );\n },\n args: {\n itemHeight: 50,\n overscan: 5,\n hasNextPage: true,\n isLoading: false,\n },\n};\n\nexport const TestVirtualList: Story = {\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n const visibleItems = canvas.getAllByText(/Item #/i);\n const firstVisibleItem = visibleItems[0];\n const lastVisibleItem = visibleItems[visibleItems.length - 1];\n\n // need to add 5 due to the overscan set to 5 (it renders 5 items before and after the visible items)\n await expect(visibleItems.length).toBeLessThanOrEqual(12);\n\n await expect(firstVisibleItem).toBeInTheDocument();\n\n await userEvent.pointer([\n { keys: \"[TouchA>]\", target: lastVisibleItem },\n { target: firstVisibleItem },\n { keys: \"[/TouchA]\" },\n ]);\n\n await waitFor(() => expect(firstVisibleItem).not.toBeInTheDocument());\n },\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AAA;AAAA,IAEJ;AAAA,EAEJ;AAAA,EACA,MAAM;AAAA,IACJ,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,aAAa;AAAA,IACb,WAAW;AAAA,EACb;AACF;AAEO,MAAM,kBAAyB;AAAA,EACpC,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AAEnC,UAAM,eAAe,OAAO,aAAa,SAAS;AAClD,UAAM,mBAAmB,aAAa,CAAC;AACvC,UAAM,kBAAkB,aAAa,aAAa,SAAS,CAAC;AAG5D,cAAM,oBAAO,aAAa,MAAM,EAAE,oBAAoB,EAAE;AAExD,cAAM,oBAAO,gBAAgB,EAAE,kBAAkB;AAEjD,UAAM,sBAAU,QAAQ;AAAA,MACtB,EAAE,MAAM,aAAa,QAAQ,gBAAgB;AAAA,MAC7C,EAAE,QAAQ,iBAAiB;AAAA,MAC3B,EAAE,MAAM,YAAY;AAAA,IACtB,CAAC;AAED,cAAM,qBAAQ,UAAM,oBAAO,gBAAgB,EAAE,IAAI,kBAAkB,CAAC;AAAA,EACtE;AACF;",
6
+ "names": ["React", "items"]
7
7
  }
@@ -15,11 +15,15 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
15
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
16
  var components_exports = {};
17
17
  module.exports = __toCommonJS(components_exports);
18
+ __reExport(components_exports, require("./AccountItem/AccountItem"), module.exports);
19
+ __reExport(components_exports, require("./AccountList/AccountList"), module.exports);
20
+ __reExport(components_exports, require("./Address/Address"), module.exports);
18
21
  __reExport(components_exports, require("./AssetItem/AssetItem"), module.exports);
19
22
  __reExport(components_exports, require("./AssetList/AssetList"), module.exports);
20
23
  __reExport(components_exports, require("./Input/Input"), module.exports);
21
24
  __reExport(components_exports, require("./NetworkItem/NetworkItem"), module.exports);
22
25
  __reExport(components_exports, require("./NetworkList/NetworkList"), module.exports);
23
26
  __reExport(components_exports, require("./Search/Search"), module.exports);
27
+ __reExport(components_exports, require("./Tag/Tag"), module.exports);
24
28
  __reExport(components_exports, require("./VirtualList/VirtualList"), module.exports);
25
29
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/pre-ldls/components/index.ts"],
4
- "sourcesContent": ["export * from \"./AssetItem/AssetItem\";\nexport * from \"./AssetList/AssetList\";\nexport * from \"./Input/Input\";\nexport * from \"./NetworkItem/NetworkItem\";\nexport * from \"./NetworkList/NetworkList\";\nexport * from \"./Search/Search\";\nexport * from \"./VirtualList/VirtualList\";\n"],
5
- "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,kCAAd;AACA,+BAAc,kCADd;AAEA,+BAAc,0BAFd;AAGA,+BAAc,sCAHd;AAIA,+BAAc,sCAJd;AAKA,+BAAc,4BALd;AAMA,+BAAc,sCANd;",
4
+ "sourcesContent": ["export * from \"./AccountItem/AccountItem\";\nexport * from \"./AccountList/AccountList\";\nexport * from \"./Address/Address\";\nexport * from \"./AssetItem/AssetItem\";\nexport * from \"./AssetList/AssetList\";\nexport * from \"./Input/Input\";\nexport * from \"./NetworkItem/NetworkItem\";\nexport * from \"./NetworkList/NetworkList\";\nexport * from \"./Search/Search\";\nexport * from \"./Tag/Tag\";\nexport * from \"./VirtualList/VirtualList\";\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,+BAAc,sCAAd;AACA,+BAAc,sCADd;AAEA,+BAAc,8BAFd;AAGA,+BAAc,kCAHd;AAIA,+BAAc,kCAJd;AAKA,+BAAc,0BALd;AAMA,+BAAc,sCANd;AAOA,+BAAc,sCAPd;AAQA,+BAAc,4BARd;AASA,+BAAc,sBATd;AAUA,+BAAc,sCAVd;",
6
6
  "names": []
7
7
  }
@@ -34,8 +34,23 @@ module.exports = __toCommonJS(libs_exports);
34
34
  var import_memoize = __toESM(require("lodash/memoize"));
35
35
  var import_styled_components = require("styled-components");
36
36
  var import_design_tokens = require("./design-tokens");
37
- const extraOther = {
38
- "radius-s": "8px"
37
+ const overrideOther = {
38
+ "radius-s": "8px",
39
+ // missing from tokens
40
+ "radius-xs": "4px",
41
+ // missing from tokens
42
+ "margin-xs": "8px",
43
+ // redefines marging-xs
44
+ "margin-s": "16px",
45
+ // redefines marging-s
46
+ "margin-m": "24px",
47
+ // redefines marging-m
48
+ "margin-l": "32px",
49
+ // redefines marging-l
50
+ "spacing-xs": "12px",
51
+ // override from "spacing-xxs": "12px"
52
+ "spacing-xxs": "8px"
53
+ // override from "spacing-xs": "8px"
39
54
  };
40
55
  const overrideColor = {
41
56
  light: {
@@ -56,7 +71,7 @@ const withTokens = (...usedTokens) => {
56
71
  return [];
57
72
  return [[`--${color}`, value]];
58
73
  });
59
- const otherEntries = [import_design_tokens.spacing, extraOther].flatMap(Object.entries).flatMap(([key, value]) => {
74
+ const otherEntries = [import_design_tokens.spacing, overrideOther].flatMap(Object.entries).flatMap(([key, value]) => {
60
75
  if (!usedTokens.includes(key))
61
76
  return [];
62
77
  return [[`--${key}`, value]];
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/pre-ldls/libs/index.ts"],
4
- "sourcesContent": ["import memoize from \"lodash/memoize\";\nimport { css, DefaultTheme } from \"styled-components\";\nimport { dark, light, ModeColors, spacing, SpacingScale } from \"./design-tokens\";\n\n// Add temporarily missing tokens here\nconst extraOther = {\n \"radius-s\": \"8px\",\n} as const;\n\n// override colours based on Figma differing from design-tokens.ts\nconst overrideColor = {\n light: {\n \"surface-transparent-hover\": \"#0000000D\",\n \"surface-transparent-pressed\": \"#0000001A\",\n },\n dark: {},\n} as const;\n\ntype ColorToken = `colors-${keyof ModeColors}`;\ntype OtherToken = keyof (SpacingScale & typeof extraOther);\n\nexport const withTokens = (...usedTokens: Array<ColorToken | OtherToken>) => {\n const filterTokens = memoize((theme: DefaultTheme[\"theme\"]) => {\n const colors = {\n dark: { ...dark, ...overrideColor.dark },\n light: { ...light, ...overrideColor.light },\n }[theme];\n\n const colorEntries = Object.entries(colors).flatMap(([key, value]) => {\n const color = `colors-${key}` as ColorToken;\n if (!usedTokens.includes(color)) return [];\n return [[`--${color}`, value]];\n });\n const otherEntries = [spacing, extraOther].flatMap(Object.entries).flatMap(([key, value]) => {\n if (!usedTokens.includes(key as OtherToken)) return [];\n return [[`--${key}`, value]];\n });\n\n return Object.fromEntries([...colorEntries, ...otherEntries]);\n });\n\n return css(({ theme }) => filterTokens(theme.colors.type as DefaultTheme[\"theme\"]));\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,+BAAkC;AAClC,2BAA+D;AAG/D,MAAM,aAAa;AAAA,EACjB,YAAY;AACd;AAGA,MAAM,gBAAgB;AAAA,EACpB,OAAO;AAAA,IACL,6BAA6B;AAAA,IAC7B,+BAA+B;AAAA,EACjC;AAAA,EACA,MAAM,CAAC;AACT;AAKO,MAAM,aAAa,IAAI,eAA+C;AAC3E,QAAM,mBAAe,eAAAA,SAAQ,CAAC,UAAiC;AAC7D,UAAM,SAAS;AAAA,MACb,MAAM,EAAE,GAAG,2BAAM,GAAG,cAAc,KAAK;AAAA,MACvC,OAAO,EAAE,GAAG,4BAAO,GAAG,cAAc,MAAM;AAAA,IAC5C,EAAE,KAAK;AAEP,UAAM,eAAe,OAAO,QAAQ,MAAM,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACpE,YAAM,QAAQ,UAAU,GAAG;AAC3B,UAAI,CAAC,WAAW,SAAS,KAAK;AAAG,eAAO,CAAC;AACzC,aAAO,CAAC,CAAC,KAAK,KAAK,IAAI,KAAK,CAAC;AAAA,IAC/B,CAAC;AACD,UAAM,eAAe,CAAC,8BAAS,UAAU,EAAE,QAAQ,OAAO,OAAO,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AAC3F,UAAI,CAAC,WAAW,SAAS,GAAiB;AAAG,eAAO,CAAC;AACrD,aAAO,CAAC,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC;AAAA,IAC7B,CAAC;AAED,WAAO,OAAO,YAAY,CAAC,GAAG,cAAc,GAAG,YAAY,CAAC;AAAA,EAC9D,CAAC;AAED,aAAO,8BAAI,CAAC,EAAE,MAAM,MAAM,aAAa,MAAM,OAAO,IAA6B,CAAC;AACpF;",
4
+ "sourcesContent": ["import memoize from \"lodash/memoize\";\nimport { css, DefaultTheme } from \"styled-components\";\nimport { dark, light, ModeColors, spacing, SpacingScale } from \"./design-tokens\";\n\n// Add temporarily missing and override incorrect tokens here\nconst overrideOther = {\n \"radius-s\": \"8px\", // missing from tokens\n \"radius-xs\": \"4px\", // missing from tokens\n \"margin-xs\": \"8px\", // redefines marging-xs\n \"margin-s\": \"16px\", // redefines marging-s\n \"margin-m\": \"24px\", // redefines marging-m\n \"margin-l\": \"32px\", // redefines marging-l\n\n \"spacing-xs\": \"12px\", // override from \"spacing-xxs\": \"12px\"\n \"spacing-xxs\": \"8px\", // override from \"spacing-xs\": \"8px\"\n} as const;\n\n// override colours based on Figma differing from design-tokens.ts\nconst overrideColor = {\n light: {\n \"surface-transparent-hover\": \"#0000000D\",\n \"surface-transparent-pressed\": \"#0000001A\",\n },\n dark: {},\n} as const;\n\ntype ColorToken = `colors-${keyof ModeColors}`;\ntype OtherToken = keyof (SpacingScale & typeof overrideOther);\n\nexport const withTokens = (...usedTokens: Array<ColorToken | OtherToken>) => {\n const filterTokens = memoize((theme: DefaultTheme[\"theme\"]) => {\n const colors = {\n dark: { ...dark, ...overrideColor.dark },\n light: { ...light, ...overrideColor.light },\n }[theme];\n\n const colorEntries = Object.entries(colors).flatMap(([key, value]) => {\n const color = `colors-${key}` as ColorToken;\n if (!usedTokens.includes(color)) return [];\n return [[`--${color}`, value]];\n });\n const otherEntries = [spacing, overrideOther]\n .flatMap(Object.entries)\n .flatMap(([key, value]) => {\n if (!usedTokens.includes(key as OtherToken)) return [];\n return [[`--${key}`, value]];\n });\n\n return Object.fromEntries([...colorEntries, ...otherEntries]);\n });\n\n return css(({ theme }) => filterTokens(theme.colors.type as DefaultTheme[\"theme\"]));\n};\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAoB;AACpB,+BAAkC;AAClC,2BAA+D;AAG/D,MAAM,gBAAgB;AAAA,EACpB,YAAY;AAAA;AAAA,EACZ,aAAa;AAAA;AAAA,EACb,aAAa;AAAA;AAAA,EACb,YAAY;AAAA;AAAA,EACZ,YAAY;AAAA;AAAA,EACZ,YAAY;AAAA;AAAA,EAEZ,cAAc;AAAA;AAAA,EACd,eAAe;AAAA;AACjB;AAGA,MAAM,gBAAgB;AAAA,EACpB,OAAO;AAAA,IACL,6BAA6B;AAAA,IAC7B,+BAA+B;AAAA,EACjC;AAAA,EACA,MAAM,CAAC;AACT;AAKO,MAAM,aAAa,IAAI,eAA+C;AAC3E,QAAM,mBAAe,eAAAA,SAAQ,CAAC,UAAiC;AAC7D,UAAM,SAAS;AAAA,MACb,MAAM,EAAE,GAAG,2BAAM,GAAG,cAAc,KAAK;AAAA,MACvC,OAAO,EAAE,GAAG,4BAAO,GAAG,cAAc,MAAM;AAAA,IAC5C,EAAE,KAAK;AAEP,UAAM,eAAe,OAAO,QAAQ,MAAM,EAAE,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACpE,YAAM,QAAQ,UAAU,GAAG;AAC3B,UAAI,CAAC,WAAW,SAAS,KAAK;AAAG,eAAO,CAAC;AACzC,aAAO,CAAC,CAAC,KAAK,KAAK,IAAI,KAAK,CAAC;AAAA,IAC/B,CAAC;AACD,UAAM,eAAe,CAAC,8BAAS,aAAa,EACzC,QAAQ,OAAO,OAAO,EACtB,QAAQ,CAAC,CAAC,KAAK,KAAK,MAAM;AACzB,UAAI,CAAC,WAAW,SAAS,GAAiB;AAAG,eAAO,CAAC;AACrD,aAAO,CAAC,CAAC,KAAK,GAAG,IAAI,KAAK,CAAC;AAAA,IAC7B,CAAC;AAEH,WAAO,OAAO,YAAY,CAAC,GAAG,cAAc,GAAG,YAAY,CAAC;AAAA,EAC9D,CAAC;AAED,aAAO,8BAAI,CAAC,EAAE,MAAM,MAAM,aAAa,MAAM,OAAO,IAA6B,CAAC;AACpF;",
6
6
  "names": ["memoize"]
7
7
  }
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ export type Account = {
3
+ name: string;
4
+ id: string;
5
+ balance: string;
6
+ fiatValue: string;
7
+ address: string;
8
+ protocol?: string;
9
+ cryptoId?: string;
10
+ ticker?: string;
11
+ };
12
+ type AccountItemProps = {
13
+ onClick: () => void;
14
+ showIcon?: boolean;
15
+ account: Account;
16
+ };
17
+ export declare const AccountItem: ({ onClick, account, showIcon }: AccountItemProps) => React.JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=AccountItem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountItem.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/AccountItem/AccountItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AA4BF,eAAO,MAAM,WAAW,mCAA2C,gBAAgB,sBA4ClF,CAAC"}
@@ -0,0 +1,46 @@
1
+ import React from "react";
2
+ import styled from "styled-components";
3
+ import { withTokens } from "../../libs";
4
+ import { Text } from "../../../components";
5
+ import { Tag } from "../Tag/Tag";
6
+ import { Address } from "../Address/Address";
7
+ const Wrapper = styled.div `
8
+ ${withTokens("spacing-xxxs", "spacing-xxs", "spacing-xs", "colors-content-default-default", "colors-surface-transparent-hover", "colors-surface-transparent-pressed", "colors-content-subdued-default-default")}
9
+
10
+ display: flex;
11
+ padding: var(--spacing-xs) var(--spacing-xxs);
12
+ cursor: pointer;
13
+ justify-content: space-between;
14
+ align-items: center;
15
+
16
+ :hover {
17
+ background-color: var(--colors-surface-transparent-hover);
18
+ }
19
+
20
+ :active {
21
+ background-color: var(--colors-surface-transparent-pressed);
22
+ }
23
+ `;
24
+ export const AccountItem = ({ onClick, account, showIcon = true }) => {
25
+ const { name, balance, fiatValue, protocol, address, ticker, cryptoId } = account;
26
+ return (React.createElement(Wrapper, { onClick: onClick },
27
+ React.createElement("div", { style: {
28
+ display: "flex",
29
+ justifyContent: "space-between",
30
+ alignItems: "center",
31
+ } },
32
+ React.createElement("div", { style: { display: "flex", flexDirection: "column", justifyContent: "center" } },
33
+ React.createElement("div", { style: {
34
+ display: "flex",
35
+ flexDirection: "row",
36
+ alignItems: "center",
37
+ marginBottom: "var(--spacing-xxxs)",
38
+ } },
39
+ React.createElement(Text, { variant: "largeLineHeight", fontWeight: "semiBold", color: "var(--colors-content-default-default)", marginRight: "var(--spacing-xxs)", fontSize: "14px", lineHeight: "20px" }, name),
40
+ protocol && React.createElement(Tag, null, protocol)),
41
+ React.createElement(Address, { address: address, cryptoId: cryptoId, ticker: ticker, showIcon: showIcon }))),
42
+ React.createElement("div", { style: { display: "flex", flexDirection: "column", textAlign: "right" } },
43
+ React.createElement(Text, { fontSize: "14px" }, fiatValue),
44
+ React.createElement(Text, { fontSize: "12px", color: "var(--colors-content-subdued-default-default)" }, balance))));
45
+ };
46
+ //# sourceMappingURL=AccountItem.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AccountItem.js","sourceRoot":"","sources":["../../../../src/pre-ldls/components/AccountItem/AccountItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAC3C,OAAO,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAmB7C,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAA;IACtB,UAAU,CACV,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gCAAgC,EAChC,kCAAkC,EAClC,oCAAoC,EACpC,wCAAwC,CACzC;;;;;;;;;;;;;;;CAeF,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,GAAG,IAAI,EAAoB,EAAE,EAAE;IACrF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAElF,OAAO,CACL,oBAAC,OAAO,IAAC,OAAO,EAAE,OAAO;QACvB,6BACE,KAAK,EAAE;gBACL,OAAO,EAAE,MAAM;gBACf,cAAc,EAAE,eAAe;gBAC/B,UAAU,EAAE,QAAQ;aACrB;YAED,6BAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE;gBAChF,6BACE,KAAK,EAAE;wBACL,OAAO,EAAE,MAAM;wBACf,aAAa,EAAE,KAAK;wBACpB,UAAU,EAAE,QAAQ;wBACpB,YAAY,EAAE,qBAAqB;qBACpC;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