@ledgerhq/react-ui 0.24.0 → 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.
- package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.js +102 -0
- package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.js.map +7 -0
- package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.stories.js +113 -0
- package/lib/cjs/pre-ldls/components/AccountItem/AccountItem.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/AccountList/AccountList.js +47 -0
- package/lib/cjs/pre-ldls/components/AccountList/AccountList.js.map +7 -0
- package/lib/cjs/pre-ldls/components/AccountList/AccountList.stories.js +73 -0
- package/lib/cjs/pre-ldls/components/AccountList/AccountList.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/Address/Address.js +79 -0
- package/lib/cjs/pre-ldls/components/Address/Address.js.map +7 -0
- package/lib/cjs/pre-ldls/components/Address/Address.stories.js +56 -0
- package/lib/cjs/pre-ldls/components/Address/Address.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/AssetItem/AssetItem.js +4 -4
- package/lib/cjs/pre-ldls/components/AssetItem/AssetItem.js.map +1 -1
- package/lib/cjs/pre-ldls/components/AssetList/AssetList.js +4 -7
- package/lib/cjs/pre-ldls/components/AssetList/AssetList.js.map +2 -2
- package/lib/cjs/pre-ldls/components/Input/Input.js +2 -2
- package/lib/cjs/pre-ldls/components/Input/Input.js.map +1 -1
- package/lib/cjs/pre-ldls/components/NetworkItem/NetworkItem.js +90 -0
- package/lib/cjs/pre-ldls/components/NetworkItem/NetworkItem.js.map +7 -0
- package/lib/cjs/pre-ldls/components/NetworkItem/NetworkItem.stories.js +43 -0
- package/lib/cjs/pre-ldls/components/NetworkItem/NetworkItem.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/NetworkList/NetworkList.js +47 -0
- package/lib/cjs/pre-ldls/components/NetworkList/NetworkList.js.map +7 -0
- package/lib/cjs/pre-ldls/components/NetworkList/NetworkList.stories.js +62 -0
- package/lib/cjs/pre-ldls/components/NetworkList/NetworkList.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/Tag/Tag.js +54 -0
- package/lib/cjs/pre-ldls/components/Tag/Tag.js.map +7 -0
- package/lib/cjs/pre-ldls/components/Tag/Tag.stories.js +43 -0
- package/lib/cjs/pre-ldls/components/Tag/Tag.stories.js.map +7 -0
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.js +58 -12
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.js.map +3 -3
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.stories.js +105 -11
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.stories.js.map +3 -3
- package/lib/cjs/pre-ldls/components/index.js +6 -0
- package/lib/cjs/pre-ldls/components/index.js.map +2 -2
- package/lib/cjs/pre-ldls/libs/index.js +18 -3
- package/lib/cjs/pre-ldls/libs/index.js.map +2 -2
- package/lib/pre-ldls/components/AccountItem/AccountItem.d.ts +19 -0
- package/lib/pre-ldls/components/AccountItem/AccountItem.d.ts.map +1 -0
- package/lib/pre-ldls/components/AccountItem/AccountItem.js +46 -0
- package/lib/pre-ldls/components/AccountItem/AccountItem.js.map +1 -0
- package/lib/pre-ldls/components/AccountList/AccountList.d.ts +7 -0
- package/lib/pre-ldls/components/AccountList/AccountList.d.ts.map +1 -0
- package/lib/pre-ldls/components/AccountList/AccountList.js +8 -0
- package/lib/pre-ldls/components/AccountList/AccountList.js.map +1 -0
- package/lib/pre-ldls/components/Address/Address.d.ts +8 -0
- package/lib/pre-ldls/components/Address/Address.d.ts.map +1 -0
- package/lib/pre-ldls/components/Address/Address.js +27 -0
- package/lib/pre-ldls/components/Address/Address.js.map +1 -0
- package/lib/pre-ldls/components/AssetItem/AssetItem.js +3 -3
- package/lib/pre-ldls/components/AssetItem/AssetItem.js.map +1 -1
- package/lib/pre-ldls/components/AssetList/AssetList.d.ts.map +1 -1
- package/lib/pre-ldls/components/AssetList/AssetList.js +3 -2
- package/lib/pre-ldls/components/AssetList/AssetList.js.map +1 -1
- package/lib/pre-ldls/components/Input/Input.js +2 -2
- package/lib/pre-ldls/components/Input/Input.js.map +1 -1
- package/lib/pre-ldls/components/NetworkItem/NetworkItem.d.ts +8 -0
- package/lib/pre-ldls/components/NetworkItem/NetworkItem.d.ts.map +1 -0
- package/lib/pre-ldls/components/NetworkItem/NetworkItem.js +41 -0
- package/lib/pre-ldls/components/NetworkItem/NetworkItem.js.map +1 -0
- package/lib/pre-ldls/components/NetworkList/NetworkList.d.ts +11 -0
- package/lib/pre-ldls/components/NetworkList/NetworkList.d.ts.map +1 -0
- package/lib/pre-ldls/components/NetworkList/NetworkList.js +8 -0
- package/lib/pre-ldls/components/NetworkList/NetworkList.js.map +1 -0
- package/lib/pre-ldls/components/Tag/Tag.d.ts +5 -0
- package/lib/pre-ldls/components/Tag/Tag.d.ts.map +1 -0
- package/lib/pre-ldls/components/Tag/Tag.js +17 -0
- package/lib/pre-ldls/components/Tag/Tag.js.map +1 -0
- package/lib/pre-ldls/components/VirtualList/VirtualList.d.ts +50 -5
- package/lib/pre-ldls/components/VirtualList/VirtualList.d.ts.map +1 -1
- package/lib/pre-ldls/components/VirtualList/VirtualList.js +46 -5
- package/lib/pre-ldls/components/VirtualList/VirtualList.js.map +1 -1
- package/lib/pre-ldls/components/index.d.ts +6 -0
- package/lib/pre-ldls/components/index.d.ts.map +1 -1
- package/lib/pre-ldls/components/index.js +6 -0
- package/lib/pre-ldls/components/index.js.map +1 -1
- package/lib/pre-ldls/libs/index.d.ts +9 -2
- package/lib/pre-ldls/libs/index.d.ts.map +1 -1
- package/lib/pre-ldls/libs/index.js +13 -4
- package/lib/pre-ldls/libs/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -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-
|
|
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-
|
|
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-
|
|
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
|
}
|
|
@@ -0,0 +1,90 @@
|
|
|
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 NetworkItem_exports = {};
|
|
30
|
+
__export(NetworkItem_exports, {
|
|
31
|
+
NetworkItem: () => NetworkItem
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(NetworkItem_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
36
|
+
var import_libs = require("../../libs");
|
|
37
|
+
var import_components = require("../../../components");
|
|
38
|
+
const TempAssetBadge = () => (
|
|
39
|
+
// TODO: To be replaced with LIVE-18221
|
|
40
|
+
/* @__PURE__ */ import_react.default.createElement("div", { style: { display: "flex", alignItems: "center" } }, /* @__PURE__ */ import_react.default.createElement(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
style: {
|
|
44
|
+
height: 48,
|
|
45
|
+
width: 48,
|
|
46
|
+
borderRadius: 48,
|
|
47
|
+
backgroundColor: "grey",
|
|
48
|
+
display: "inline-block"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
))
|
|
52
|
+
);
|
|
53
|
+
const Wrapper = import_styled_components.default.div`
|
|
54
|
+
${(0, import_libs.withTokens)(
|
|
55
|
+
"spacing-xxs",
|
|
56
|
+
"margin-s",
|
|
57
|
+
"colors-content-default-default",
|
|
58
|
+
"colors-surface-transparent-hover",
|
|
59
|
+
"colors-surface-transparent-pressed"
|
|
60
|
+
)}
|
|
61
|
+
display: flex;
|
|
62
|
+
padding: var(--spacing-xxs);
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
|
|
65
|
+
:hover {
|
|
66
|
+
background-color: var(--colors-surface-transparent-hover);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:active {
|
|
70
|
+
background-color: var(--colors-surface-transparent-pressed);
|
|
71
|
+
}
|
|
72
|
+
`;
|
|
73
|
+
const InfoWrapper = import_styled_components.default.div`
|
|
74
|
+
display: flex;
|
|
75
|
+
flex-direction: column;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
margin-left: var(--margin-s);
|
|
78
|
+
`;
|
|
79
|
+
const NetworkItem = ({ name, onClick }) => {
|
|
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(
|
|
81
|
+
import_components.Text,
|
|
82
|
+
{
|
|
83
|
+
variant: "largeLineHeight",
|
|
84
|
+
fontWeight: "semiBold",
|
|
85
|
+
color: "var(--colors-content-default-default)"
|
|
86
|
+
},
|
|
87
|
+
name
|
|
88
|
+
)));
|
|
89
|
+
};
|
|
90
|
+
//# sourceMappingURL=NetworkItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 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-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
|
+
"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
|
+
"names": ["React", "styled"]
|
|
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 NetworkItem_stories_exports = {};
|
|
20
|
+
__export(NetworkItem_stories_exports, {
|
|
21
|
+
Default: () => Default,
|
|
22
|
+
TestNetworkItem: () => TestNetworkItem,
|
|
23
|
+
default: () => NetworkItem_stories_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(NetworkItem_stories_exports);
|
|
26
|
+
var import_NetworkItem = require("./NetworkItem");
|
|
27
|
+
var import_test = require("@storybook/test");
|
|
28
|
+
const meta = {
|
|
29
|
+
component: import_NetworkItem.NetworkItem,
|
|
30
|
+
title: "PreLdls/Components/NetworkItem",
|
|
31
|
+
tags: ["autodocs"],
|
|
32
|
+
args: { name: "Bitcoin" }
|
|
33
|
+
};
|
|
34
|
+
var NetworkItem_stories_default = meta;
|
|
35
|
+
const Default = {};
|
|
36
|
+
const TestNetworkItem = {
|
|
37
|
+
play: async ({ canvasElement }) => {
|
|
38
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
39
|
+
const name = canvas.getByText("Bitcoin");
|
|
40
|
+
await (0, import_test.expect)(name).toBeInTheDocument();
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=NetworkItem.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/NetworkItem/NetworkItem.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from \"@storybook/react\";\nimport { NetworkItem } from \"./NetworkItem\";\nimport { expect, within } from \"@storybook/test\";\n\nconst meta: Meta<typeof NetworkItem> = {\n component: NetworkItem,\n title: \"PreLdls/Components/NetworkItem\",\n tags: [\"autodocs\"],\n args: { name: \"Bitcoin\" },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof NetworkItem>;\n\nexport const Default: Story = {};\n\nexport const TestNetworkItem: Story = {\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n const name = canvas.getByText(\"Bitcoin\");\n\n await expect(name).toBeInTheDocument();\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,yBAA4B;AAC5B,kBAA+B;AAE/B,MAAM,OAAiC;AAAA,EACrC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,MAAM,EAAE,MAAM,UAAU;AAC1B;AACA,IAAO,8BAAQ;AAIR,MAAM,UAAiB,CAAC;AAExB,MAAM,kBAAyB;AAAA,EACpC,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AAEnC,UAAM,OAAO,OAAO,UAAU,SAAS;AAEvC,cAAM,oBAAO,IAAI,EAAE,kBAAkB;AAAA,EACvC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 NetworkList_exports = {};
|
|
30
|
+
__export(NetworkList_exports, {
|
|
31
|
+
NetworkList: () => NetworkList
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(NetworkList_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_NetworkItem = require("../NetworkItem/NetworkItem");
|
|
36
|
+
var import_VirtualList = require("../VirtualList/VirtualList");
|
|
37
|
+
const NetworkList = ({
|
|
38
|
+
networks,
|
|
39
|
+
onClick
|
|
40
|
+
}) => {
|
|
41
|
+
const renderNetworkItem = (0, import_react.useCallback)(
|
|
42
|
+
({ name, id }) => /* @__PURE__ */ import_react.default.createElement(import_NetworkItem.NetworkItem, { name, onClick: () => onClick(id) }),
|
|
43
|
+
[onClick]
|
|
44
|
+
);
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(import_VirtualList.VirtualList, { items: networks, itemHeight: 64, renderItem: renderNetworkItem });
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=NetworkList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/NetworkList/NetworkList.tsx"],
|
|
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
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 NetworkList_stories_exports = {};
|
|
30
|
+
__export(NetworkList_stories_exports, {
|
|
31
|
+
Default: () => Default,
|
|
32
|
+
TestNetworkClick: () => TestNetworkClick,
|
|
33
|
+
default: () => NetworkList_stories_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(NetworkList_stories_exports);
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_NetworkList = require("./NetworkList");
|
|
38
|
+
var import_test = require("@storybook/test");
|
|
39
|
+
const testFn = (0, import_test.fn)();
|
|
40
|
+
const meta = {
|
|
41
|
+
component: import_NetworkList.NetworkList,
|
|
42
|
+
decorators: [
|
|
43
|
+
(Story) => /* @__PURE__ */ import_react.default.createElement("div", { style: { height: "400px" } }, /* @__PURE__ */ import_react.default.createElement(Story, null))
|
|
44
|
+
],
|
|
45
|
+
title: "PreLdls/Components/NetworkList",
|
|
46
|
+
tags: ["autodocs"],
|
|
47
|
+
args: {
|
|
48
|
+
networks: Array.from({ length: 50 }, (_, i) => ({ name: `Bitcoin ${i}`, id: `btc${i}` })),
|
|
49
|
+
onClick: testFn
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var NetworkList_stories_default = meta;
|
|
53
|
+
const Default = {};
|
|
54
|
+
const TestNetworkClick = {
|
|
55
|
+
play: async ({ canvasElement }) => {
|
|
56
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
57
|
+
const input = canvas.getByText("Bitcoin 1");
|
|
58
|
+
await import_test.userEvent.click(input);
|
|
59
|
+
await (0, import_test.expect)(testFn).toHaveBeenCalledWith("btc1");
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=NetworkList.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/NetworkList/NetworkList.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { NetworkList } from \"./NetworkList\";\nimport { expect, fn, userEvent, within } from \"@storybook/test\";\n\nconst testFn = fn();\n\nconst meta: Meta<typeof NetworkList> = {\n component: NetworkList,\n decorators: [\n Story => (\n <div style={{ height: \"400px\" }}>\n <Story />\n </div>\n ),\n ],\n title: \"PreLdls/Components/NetworkList\",\n tags: [\"autodocs\"],\n args: {\n networks: Array.from({ length: 50 }, (_, i) => ({ name: `Bitcoin ${i}`, id: `btc${i}` })),\n onClick: testFn,\n },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof NetworkList>;\n\nexport const Default: Story = {};\n\nexport const TestNetworkClick: Story = {\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n const input = canvas.getByText(\"Bitcoin 1\");\n await userEvent.click(input);\n await expect(testFn).toHaveBeenCalledWith(\"btc1\");\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,yBAA4B;AAC5B,kBAA8C;AAE9C,MAAM,aAAS,gBAAG;AAElB,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,MAAM;AAAA,IACJ,UAAU,MAAM,KAAK,EAAE,QAAQ,GAAG,GAAG,CAAC,GAAG,OAAO,EAAE,MAAM,WAAW,CAAC,IAAI,IAAI,MAAM,CAAC,GAAG,EAAE;AAAA,IACxF,SAAS;AAAA,EACX;AACF;AACA,IAAO,8BAAQ;AAIR,MAAM,UAAiB,CAAC;AAExB,MAAM,mBAA0B;AAAA,EACrC,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AACnC,UAAM,QAAQ,OAAO,UAAU,WAAW;AAC1C,UAAM,sBAAU,MAAM,KAAK;AAC3B,cAAM,oBAAO,MAAM,EAAE,qBAAqB,MAAM;AAAA,EAClD;AACF;",
|
|
6
|
+
"names": ["React"]
|
|
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
|
+
}
|
|
@@ -32,23 +32,69 @@ __export(VirtualList_exports, {
|
|
|
32
32
|
});
|
|
33
33
|
module.exports = __toCommonJS(VirtualList_exports);
|
|
34
34
|
var import_react = __toESM(require("react"));
|
|
35
|
-
var
|
|
36
|
-
var
|
|
35
|
+
var import_react_virtual = require("@tanstack/react-virtual");
|
|
36
|
+
var import_components = require("../../../components");
|
|
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));
|
|
37
38
|
const VirtualList = ({
|
|
38
|
-
count,
|
|
39
39
|
itemHeight,
|
|
40
|
+
overscan = 5,
|
|
41
|
+
LoadingComponent,
|
|
42
|
+
isLoading,
|
|
43
|
+
hasNextPage = false,
|
|
44
|
+
threshold = 5,
|
|
45
|
+
onVisibleItemsScrollEnd,
|
|
46
|
+
items,
|
|
40
47
|
renderItem
|
|
41
48
|
}) => {
|
|
42
|
-
|
|
43
|
-
|
|
49
|
+
const parentRef = (0, import_react.useRef)(null);
|
|
50
|
+
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
51
|
+
count: hasNextPage ? items.length + 1 : items.length,
|
|
52
|
+
getScrollElement: () => parentRef.current,
|
|
53
|
+
estimateSize: () => itemHeight,
|
|
54
|
+
overscan
|
|
55
|
+
});
|
|
56
|
+
(0, import_react.useEffect)(() => {
|
|
57
|
+
const items2 = rowVirtualizer.getVirtualItems();
|
|
58
|
+
if (!items2.length)
|
|
59
|
+
return;
|
|
60
|
+
const lastItem = items2[items2.length - 1];
|
|
61
|
+
if (lastItem.index >= items2.length - 1 - threshold && hasNextPage && !isLoading && onVisibleItemsScrollEnd) {
|
|
62
|
+
onVisibleItemsScrollEnd();
|
|
63
|
+
}
|
|
64
|
+
}, [
|
|
65
|
+
hasNextPage,
|
|
66
|
+
onVisibleItemsScrollEnd,
|
|
67
|
+
items.length,
|
|
68
|
+
isLoading,
|
|
69
|
+
rowVirtualizer.getVirtualItems()
|
|
70
|
+
]);
|
|
71
|
+
const showCustomLoadingComponent = !!LoadingComponent;
|
|
72
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { ref: parentRef, style: { width: "100%", height: "100%", overflow: "auto" } }, /* @__PURE__ */ import_react.default.createElement(
|
|
73
|
+
"div",
|
|
44
74
|
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
75
|
+
style: {
|
|
76
|
+
height: `${rowVirtualizer.getTotalSize()}px`,
|
|
77
|
+
width: "100%",
|
|
78
|
+
position: "relative"
|
|
79
|
+
}
|
|
50
80
|
},
|
|
51
|
-
(
|
|
52
|
-
|
|
81
|
+
rowVirtualizer.getVirtualItems().map((virtualRow) => /* @__PURE__ */ import_react.default.createElement(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
key: virtualRow.index,
|
|
85
|
+
"data-index": virtualRow.index,
|
|
86
|
+
ref: rowVirtualizer.measureElement,
|
|
87
|
+
style: {
|
|
88
|
+
position: "absolute",
|
|
89
|
+
top: 0,
|
|
90
|
+
left: 0,
|
|
91
|
+
transform: `translateY(${virtualRow.start}px)`,
|
|
92
|
+
height: `${itemHeight}px`,
|
|
93
|
+
width: "100%"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
renderItem(items[virtualRow.index])
|
|
97
|
+
))
|
|
98
|
+
), isLoading && (showCustomLoadingComponent ? LoadingComponent : /* @__PURE__ */ import_react.default.createElement(DefaultLoadingComponent, null)));
|
|
53
99
|
};
|
|
54
100
|
//# sourceMappingURL=VirtualList.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/pre-ldls/components/VirtualList/VirtualList.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
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;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACF,MAA2B;AACzB,QAAM,gBAAY,qBAAuB,IAAI;AAE7C,QAAM,qBAAiB,qCAAe;AAAA,IACpC,OAAO,cAAc,MAAM,SAAS,IAAI,MAAM;AAAA,IAC9C,kBAAkB,MAAM,UAAU;AAAA,IAClC,cAAc,MAAM;AAAA,IACpB;AAAA,EACF,CAAC;AAED,8BAAU,MAAM;AACd,UAAMC,SAAQ,eAAe,gBAAgB;AAC7C,QAAI,CAACA,OAAM;AAAQ;AACnB,UAAM,WAAWA,OAAMA,OAAM,SAAS,CAAC;AAEvC,QACE,SAAS,SAASA,OAAM,SAAS,IAAI,aACrC,eACA,CAAC,aACD,yBACA;AACA,8BAAwB;AAAA,IAC1B;AAAA,EACF,GAAG;AAAA,IACD;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN;AAAA,IACA,eAAe,gBAAgB;AAAA,EACjC,CAAC;AAED,QAAM,6BAA6B,CAAC,CAAC;AAErC,SACE,6BAAAD,QAAA,cAAC,SAAI,KAAK,WAAW,OAAO,EAAE,OAAO,QAAQ,QAAQ,QAAQ,UAAU,OAAO,KAC5E,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,QAAQ,GAAG,eAAe,aAAa,CAAC;AAAA,QACxC,OAAO;AAAA,QACP,UAAU;AAAA,MACZ;AAAA;AAAA,IAEC,eAAe,gBAAgB,EAAE,IAAI,CAAC,eACrC,6BAAAA,QAAA;AAAA,MAAC;AAAA;AAAA,QACC,KAAK,WAAW;AAAA,QAChB,cAAY,WAAW;AAAA,QACvB,KAAK,eAAe;AAAA,QACpB,OAAO;AAAA,UACL,UAAU;AAAA,UACV,KAAK;AAAA,UACL,MAAM;AAAA,UACN,WAAW,cAAc,WAAW,KAAK;AAAA,UACzC,QAAQ,GAAG,UAAU;AAAA,UACrB,OAAO;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
|
}
|