@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.
- 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 +4 -4
- package/lib/cjs/pre-ldls/components/NetworkItem/NetworkItem.js.map +1 -1
- package/lib/cjs/pre-ldls/components/NetworkList/NetworkList.js +4 -7
- package/lib/cjs/pre-ldls/components/NetworkList/NetworkList.js.map +2 -2
- 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 +14 -8
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.js.map +3 -3
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.stories.js +8 -11
- package/lib/cjs/pre-ldls/components/VirtualList/VirtualList.stories.js.map +3 -3
- package/lib/cjs/pre-ldls/components/index.js +4 -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.js +3 -3
- package/lib/pre-ldls/components/NetworkItem/NetworkItem.js.map +1 -1
- package/lib/pre-ldls/components/NetworkList/NetworkList.d.ts +6 -4
- package/lib/pre-ldls/components/NetworkList/NetworkList.d.ts.map +1 -1
- package/lib/pre-ldls/components/NetworkList/NetworkList.js +3 -2
- package/lib/pre-ldls/components/NetworkList/NetworkList.js.map +1 -1
- 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 +8 -9
- package/lib/pre-ldls/components/VirtualList/VirtualList.d.ts.map +1 -1
- package/lib/pre-ldls/components/VirtualList/VirtualList.js +11 -5
- package/lib/pre-ldls/components/VirtualList/VirtualList.js.map +1 -1
- package/lib/pre-ldls/components/index.d.ts +4 -0
- package/lib/pre-ldls/components/index.d.ts.map +1 -1
- package/lib/pre-ldls/components/index.js +4 -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 +3 -3
|
@@ -0,0 +1,102 @@
|
|
|
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 AccountItem_exports = {};
|
|
30
|
+
__export(AccountItem_exports, {
|
|
31
|
+
AccountItem: () => AccountItem
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(AccountItem_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
|
+
var import_Tag = require("../Tag/Tag");
|
|
39
|
+
var import_Address = require("../Address/Address");
|
|
40
|
+
const Wrapper = import_styled_components.default.div`
|
|
41
|
+
${(0, import_libs.withTokens)(
|
|
42
|
+
"spacing-xxxs",
|
|
43
|
+
"spacing-xxs",
|
|
44
|
+
"spacing-xs",
|
|
45
|
+
"colors-content-default-default",
|
|
46
|
+
"colors-surface-transparent-hover",
|
|
47
|
+
"colors-surface-transparent-pressed",
|
|
48
|
+
"colors-content-subdued-default-default"
|
|
49
|
+
)}
|
|
50
|
+
|
|
51
|
+
display: flex;
|
|
52
|
+
padding: var(--spacing-xs) var(--spacing-xxs);
|
|
53
|
+
cursor: pointer;
|
|
54
|
+
justify-content: space-between;
|
|
55
|
+
align-items: center;
|
|
56
|
+
|
|
57
|
+
:hover {
|
|
58
|
+
background-color: var(--colors-surface-transparent-hover);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:active {
|
|
62
|
+
background-color: var(--colors-surface-transparent-pressed);
|
|
63
|
+
}
|
|
64
|
+
`;
|
|
65
|
+
const AccountItem = ({ onClick, account, showIcon = true }) => {
|
|
66
|
+
const { name, balance, fiatValue, protocol, address, ticker, cryptoId } = account;
|
|
67
|
+
return /* @__PURE__ */ import_react.default.createElement(Wrapper, { onClick }, /* @__PURE__ */ import_react.default.createElement(
|
|
68
|
+
"div",
|
|
69
|
+
{
|
|
70
|
+
style: {
|
|
71
|
+
display: "flex",
|
|
72
|
+
justifyContent: "space-between",
|
|
73
|
+
alignItems: "center"
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
/* @__PURE__ */ import_react.default.createElement("div", { style: { display: "flex", flexDirection: "column", justifyContent: "center" } }, /* @__PURE__ */ import_react.default.createElement(
|
|
77
|
+
"div",
|
|
78
|
+
{
|
|
79
|
+
style: {
|
|
80
|
+
display: "flex",
|
|
81
|
+
flexDirection: "row",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
marginBottom: "var(--spacing-xxxs)"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
87
|
+
import_components.Text,
|
|
88
|
+
{
|
|
89
|
+
variant: "largeLineHeight",
|
|
90
|
+
fontWeight: "semiBold",
|
|
91
|
+
color: "var(--colors-content-default-default)",
|
|
92
|
+
marginRight: "var(--spacing-xxs)",
|
|
93
|
+
fontSize: "14px",
|
|
94
|
+
lineHeight: "20px"
|
|
95
|
+
},
|
|
96
|
+
name
|
|
97
|
+
),
|
|
98
|
+
protocol && /* @__PURE__ */ import_react.default.createElement(import_Tag.Tag, null, protocol)
|
|
99
|
+
), /* @__PURE__ */ import_react.default.createElement(import_Address.Address, { address, cryptoId, ticker, showIcon }))
|
|
100
|
+
), /* @__PURE__ */ import_react.default.createElement("div", { style: { display: "flex", flexDirection: "column", textAlign: "right" } }, /* @__PURE__ */ import_react.default.createElement(import_components.Text, { fontSize: "14px" }, fiatValue), /* @__PURE__ */ import_react.default.createElement(import_components.Text, { fontSize: "12px", color: "var(--colors-content-subdued-default-default)" }, balance)));
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=AccountItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/AccountItem/AccountItem.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport { withTokens } from \"../../libs\";\nimport { Text } from \"../../../components\";\nimport { Tag } from \"../Tag/Tag\";\nimport { Address } from \"../Address/Address\";\n\nexport type Account = {\n name: string;\n id: string;\n balance: string;\n fiatValue: string;\n address: string;\n protocol?: string;\n cryptoId?: string;\n ticker?: string;\n};\n\ntype AccountItemProps = {\n onClick: () => void;\n showIcon?: boolean;\n account: Account;\n};\n\nconst Wrapper = styled.div`\n ${withTokens(\n \"spacing-xxxs\",\n \"spacing-xxs\",\n \"spacing-xs\",\n \"colors-content-default-default\",\n \"colors-surface-transparent-hover\",\n \"colors-surface-transparent-pressed\",\n \"colors-content-subdued-default-default\",\n )}\n\n display: flex;\n padding: var(--spacing-xs) var(--spacing-xxs);\n cursor: pointer;\n justify-content: space-between;\n align-items: center;\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\nexport const AccountItem = ({ onClick, account, showIcon = true }: AccountItemProps) => {\n const { name, balance, fiatValue, protocol, address, ticker, cryptoId } = account;\n\n return (\n <Wrapper onClick={onClick}>\n <div\n style={{\n display: \"flex\",\n justifyContent: \"space-between\",\n alignItems: \"center\",\n }}\n >\n <div style={{ display: \"flex\", flexDirection: \"column\", justifyContent: \"center\" }}>\n <div\n style={{\n display: \"flex\",\n flexDirection: \"row\",\n alignItems: \"center\",\n marginBottom: \"var(--spacing-xxxs)\",\n }}\n >\n <Text\n variant=\"largeLineHeight\"\n fontWeight=\"semiBold\"\n color=\"var(--colors-content-default-default)\"\n marginRight=\"var(--spacing-xxs)\"\n fontSize=\"14px\"\n lineHeight=\"20px\"\n >\n {name}\n </Text>\n {protocol && <Tag>{protocol}</Tag>}\n </div>\n <Address address={address} cryptoId={cryptoId} ticker={ticker} showIcon={showIcon} />\n </div>\n </div>\n <div style={{ display: \"flex\", flexDirection: \"column\", textAlign: \"right\" }}>\n <Text fontSize=\"14px\">{fiatValue}</Text>\n <Text fontSize=\"12px\" color=\"var(--colors-content-subdued-default-default)\">\n {balance}\n </Text>\n </div>\n </Wrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,+BAAmB;AACnB,kBAA2B;AAC3B,wBAAqB;AACrB,iBAAoB;AACpB,qBAAwB;AAmBxB,MAAM,UAAU,yBAAAA,QAAO;AAAA,QACnB;AAAA,EACA;AAAA,EACA;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;AAAA;AAAA;AAiBI,MAAM,cAAc,CAAC,EAAE,SAAS,SAAS,WAAW,KAAK,MAAwB;AACtF,QAAM,EAAE,MAAM,SAAS,WAAW,UAAU,SAAS,QAAQ,SAAS,IAAI;AAE1E,SACE,6BAAAC,QAAA,cAAC,WAAQ,WACP,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,SAAS;AAAA,QACT,gBAAgB;AAAA,QAChB,YAAY;AAAA,MACd;AAAA;AAAA,IAEA,6BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,gBAAgB,SAAS,KAC/E,6BAAAA,QAAA;AAAA,MAAC;AAAA;AAAA,QACC,OAAO;AAAA,UACL,SAAS;AAAA,UACT,eAAe;AAAA,UACf,YAAY;AAAA,UACZ,cAAc;AAAA,QAChB;AAAA;AAAA,MAEA,6BAAAA,QAAA;AAAA,QAAC;AAAA;AAAA,UACC,SAAQ;AAAA,UACR,YAAW;AAAA,UACX,OAAM;AAAA,UACN,aAAY;AAAA,UACZ,UAAS;AAAA,UACT,YAAW;AAAA;AAAA,QAEV;AAAA,MACH;AAAA,MACC,YAAY,6BAAAA,QAAA,cAAC,sBAAK,QAAS;AAAA,IAC9B,GACA,6BAAAA,QAAA,cAAC,0BAAQ,SAAkB,UAAoB,QAAgB,UAAoB,CACrF;AAAA,EACF,GACA,6BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,eAAe,UAAU,WAAW,QAAQ,KACzE,6BAAAA,QAAA,cAAC,0BAAK,UAAS,UAAQ,SAAU,GACjC,6BAAAA,QAAA,cAAC,0BAAK,UAAS,QAAO,OAAM,mDACzB,OACH,CACF,CACF;AAEJ;",
|
|
6
|
+
"names": ["styled", "React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
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 AccountItem_stories_exports = {};
|
|
20
|
+
__export(AccountItem_stories_exports, {
|
|
21
|
+
Default: () => Default,
|
|
22
|
+
TestAccount: () => TestAccount,
|
|
23
|
+
TestWithoutAddressIcon: () => TestWithoutAddressIcon,
|
|
24
|
+
TestWithoutProtocol: () => TestWithoutProtocol,
|
|
25
|
+
default: () => AccountItem_stories_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(AccountItem_stories_exports);
|
|
28
|
+
var import_AccountItem = require("./AccountItem");
|
|
29
|
+
var import_test = require("@storybook/test");
|
|
30
|
+
const meta = {
|
|
31
|
+
component: import_AccountItem.AccountItem,
|
|
32
|
+
title: "PreLdls/Components/AccountItem",
|
|
33
|
+
tags: ["autodocs"],
|
|
34
|
+
args: {
|
|
35
|
+
account: {
|
|
36
|
+
id: "1234",
|
|
37
|
+
name: "Main BTC",
|
|
38
|
+
balance: "0.118 ETH",
|
|
39
|
+
fiatValue: "$5,969.83",
|
|
40
|
+
address: "n4A9...Zgty",
|
|
41
|
+
cryptoId: "bitcoin",
|
|
42
|
+
ticker: "btc"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
var AccountItem_stories_default = meta;
|
|
47
|
+
const Default = {};
|
|
48
|
+
const TestAccount = {
|
|
49
|
+
args: {
|
|
50
|
+
account: {
|
|
51
|
+
id: "1234",
|
|
52
|
+
name: "Main BTC",
|
|
53
|
+
balance: "0.118 BTC",
|
|
54
|
+
fiatValue: "$5,969.83",
|
|
55
|
+
protocol: "Native Segwit",
|
|
56
|
+
address: "n4A9...Zgty",
|
|
57
|
+
cryptoId: "bitcoin",
|
|
58
|
+
ticker: "btc"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
play: async ({ canvasElement }) => {
|
|
62
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
63
|
+
const name = canvas.getByText("Main BTC");
|
|
64
|
+
const protocol = canvas.getByTestId("tag");
|
|
65
|
+
const address = canvas.getByText("n4A9...Zgty");
|
|
66
|
+
const addressIcon = canvas.getByTestId("address-icon");
|
|
67
|
+
const fiatValue = canvas.getByText("$5,969.83");
|
|
68
|
+
const balance = canvas.getByText("0.118 BTC");
|
|
69
|
+
await (0, import_test.expect)(name).toBeInTheDocument();
|
|
70
|
+
await (0, import_test.expect)(protocol).toBeInTheDocument();
|
|
71
|
+
await (0, import_test.expect)(protocol).toHaveTextContent("Native Segwit");
|
|
72
|
+
await (0, import_test.expect)(address).toBeInTheDocument();
|
|
73
|
+
await (0, import_test.expect)(addressIcon).toBeInTheDocument();
|
|
74
|
+
await (0, import_test.expect)(fiatValue).toBeInTheDocument();
|
|
75
|
+
await (0, import_test.expect)(balance).toBeInTheDocument();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
const TestWithoutProtocol = {
|
|
79
|
+
args: {
|
|
80
|
+
account: {
|
|
81
|
+
id: "1234",
|
|
82
|
+
name: "Main BTC",
|
|
83
|
+
balance: "0.118 BTC",
|
|
84
|
+
fiatValue: "$5,969.83",
|
|
85
|
+
address: "n4A9...Zgty",
|
|
86
|
+
cryptoId: "bitcoin",
|
|
87
|
+
ticker: "btc"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
play: async ({ canvasElement }) => {
|
|
91
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
92
|
+
const protocol = canvas.queryByTestId("tag");
|
|
93
|
+
await (0, import_test.expect)(protocol).not.toBeInTheDocument();
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const TestWithoutAddressIcon = {
|
|
97
|
+
args: {
|
|
98
|
+
account: {
|
|
99
|
+
id: "1234",
|
|
100
|
+
name: "Main BTC",
|
|
101
|
+
balance: "0.118 BTC",
|
|
102
|
+
fiatValue: "$5,969.83",
|
|
103
|
+
address: "n4A9...Zgty"
|
|
104
|
+
},
|
|
105
|
+
showIcon: false
|
|
106
|
+
},
|
|
107
|
+
play: async ({ canvasElement }) => {
|
|
108
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
109
|
+
const addressIcon = canvas.queryByTestId("address-icon");
|
|
110
|
+
await (0, import_test.expect)(addressIcon).not.toBeInTheDocument();
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=AccountItem.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/AccountItem/AccountItem.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from \"@storybook/react\";\nimport { AccountItem } from \"./AccountItem\";\nimport { expect, within } from \"@storybook/test\";\n\nconst meta: Meta<typeof AccountItem> = {\n component: AccountItem,\n title: \"PreLdls/Components/AccountItem\",\n tags: [\"autodocs\"],\n args: {\n account: {\n id: \"1234\",\n name: \"Main BTC\",\n balance: \"0.118 ETH\",\n fiatValue: \"$5,969.83\",\n address: \"n4A9...Zgty\",\n cryptoId: \"bitcoin\",\n ticker: \"btc\",\n },\n },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof AccountItem>;\n\nexport const Default: Story = {};\n\nexport const TestAccount: Story = {\n args: {\n account: {\n id: \"1234\",\n name: \"Main BTC\",\n balance: \"0.118 BTC\",\n fiatValue: \"$5,969.83\",\n protocol: \"Native Segwit\",\n address: \"n4A9...Zgty\",\n cryptoId: \"bitcoin\",\n ticker: \"btc\",\n },\n },\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n const name = canvas.getByText(\"Main BTC\");\n const protocol = canvas.getByTestId(\"tag\");\n const address = canvas.getByText(\"n4A9...Zgty\");\n const addressIcon = canvas.getByTestId(\"address-icon\");\n const fiatValue = canvas.getByText(\"$5,969.83\");\n const balance = canvas.getByText(\"0.118 BTC\");\n\n await expect(name).toBeInTheDocument();\n await expect(protocol).toBeInTheDocument();\n await expect(protocol).toHaveTextContent(\"Native Segwit\");\n await expect(address).toBeInTheDocument();\n await expect(addressIcon).toBeInTheDocument();\n await expect(fiatValue).toBeInTheDocument();\n await expect(balance).toBeInTheDocument();\n },\n};\n\nexport const TestWithoutProtocol: Story = {\n args: {\n account: {\n id: \"1234\",\n name: \"Main BTC\",\n balance: \"0.118 BTC\",\n fiatValue: \"$5,969.83\",\n address: \"n4A9...Zgty\",\n cryptoId: \"bitcoin\",\n ticker: \"btc\",\n },\n },\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n const protocol = canvas.queryByTestId(\"tag\");\n\n await expect(protocol).not.toBeInTheDocument();\n },\n};\n\nexport const TestWithoutAddressIcon: Story = {\n args: {\n account: {\n id: \"1234\",\n name: \"Main BTC\",\n balance: \"0.118 BTC\",\n fiatValue: \"$5,969.83\",\n address: \"n4A9...Zgty\",\n },\n showIcon: false,\n },\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n const addressIcon = canvas.queryByTestId(\"address-icon\");\n\n await expect(addressIcon).not.toBeInTheDocument();\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;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;AAAA,IACJ,SAAS;AAAA,MACP,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW;AAAA,MACX,SAAS;AAAA,MACT,UAAU;AAAA,MACV,QAAQ;AAAA,IACV;AAAA,EACF;AACF;AACA,IAAO,8BAAQ;AAIR,MAAM,UAAiB,CAAC;AAExB,MAAM,cAAqB;AAAA,EAChC,MAAM;AAAA,IACJ,SAAS;AAAA,MACP,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW;AAAA,MACX,UAAU;AAAA,MACV,SAAS;AAAA,MACT,UAAU;AAAA,MACV,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACA,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AAEnC,UAAM,OAAO,OAAO,UAAU,UAAU;AACxC,UAAM,WAAW,OAAO,YAAY,KAAK;AACzC,UAAM,UAAU,OAAO,UAAU,aAAa;AAC9C,UAAM,cAAc,OAAO,YAAY,cAAc;AACrD,UAAM,YAAY,OAAO,UAAU,WAAW;AAC9C,UAAM,UAAU,OAAO,UAAU,WAAW;AAE5C,cAAM,oBAAO,IAAI,EAAE,kBAAkB;AACrC,cAAM,oBAAO,QAAQ,EAAE,kBAAkB;AACzC,cAAM,oBAAO,QAAQ,EAAE,kBAAkB,eAAe;AACxD,cAAM,oBAAO,OAAO,EAAE,kBAAkB;AACxC,cAAM,oBAAO,WAAW,EAAE,kBAAkB;AAC5C,cAAM,oBAAO,SAAS,EAAE,kBAAkB;AAC1C,cAAM,oBAAO,OAAO,EAAE,kBAAkB;AAAA,EAC1C;AACF;AAEO,MAAM,sBAA6B;AAAA,EACxC,MAAM;AAAA,IACJ,SAAS;AAAA,MACP,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW;AAAA,MACX,SAAS;AAAA,MACT,UAAU;AAAA,MACV,QAAQ;AAAA,IACV;AAAA,EACF;AAAA,EACA,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AAEnC,UAAM,WAAW,OAAO,cAAc,KAAK;AAE3C,cAAM,oBAAO,QAAQ,EAAE,IAAI,kBAAkB;AAAA,EAC/C;AACF;AAEO,MAAM,yBAAgC;AAAA,EAC3C,MAAM;AAAA,IACJ,SAAS;AAAA,MACP,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,WAAW;AAAA,MACX,SAAS;AAAA,IACX;AAAA,IACA,UAAU;AAAA,EACZ;AAAA,EACA,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AAEnC,UAAM,cAAc,OAAO,cAAc,cAAc;AAEvD,cAAM,oBAAO,WAAW,EAAE,IAAI,kBAAkB;AAAA,EAClD;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 AccountList_exports = {};
|
|
30
|
+
__export(AccountList_exports, {
|
|
31
|
+
AccountList: () => AccountList
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(AccountList_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_AccountItem = require("../AccountItem/AccountItem");
|
|
36
|
+
var import_VirtualList = require("../VirtualList/VirtualList");
|
|
37
|
+
const AccountList = ({
|
|
38
|
+
accounts,
|
|
39
|
+
onClick
|
|
40
|
+
}) => {
|
|
41
|
+
const renderAccountItem = (0, import_react.useCallback)(
|
|
42
|
+
(account) => /* @__PURE__ */ import_react.default.createElement(import_AccountItem.AccountItem, { onClick: () => onClick(account.id), account }),
|
|
43
|
+
[onClick]
|
|
44
|
+
);
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(import_VirtualList.VirtualList, { items: accounts, itemHeight: 68, renderItem: renderAccountItem });
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=AccountList.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/AccountList/AccountList.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useCallback } from \"react\";\nimport { Account, AccountItem } from \"../AccountItem/AccountItem\";\nimport { VirtualList } from \"../VirtualList/VirtualList\";\n\nexport const AccountList = ({\n accounts,\n onClick,\n}: {\n accounts: Account[];\n onClick: (networkId: string) => void;\n}) => {\n const renderAccountItem = useCallback(\n (account: Account) => <AccountItem onClick={() => onClick(account.id)} account={account} />,\n [onClick],\n );\n\n return <VirtualList items={accounts} itemHeight={68} renderItem={renderAccountItem} />;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAmC;AACnC,yBAAqC;AACrC,yBAA4B;AAErB,MAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA;AACF,MAGM;AACJ,QAAM,wBAAoB;AAAA,IACxB,CAAC,YAAqB,6BAAAA,QAAA,cAAC,kCAAY,SAAS,MAAM,QAAQ,QAAQ,EAAE,GAAG,SAAkB;AAAA,IACzF,CAAC,OAAO;AAAA,EACV;AAEA,SAAO,6BAAAA,QAAA,cAAC,kCAAY,OAAO,UAAU,YAAY,IAAI,YAAY,mBAAmB;AACtF;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
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 AccountList_stories_exports = {};
|
|
30
|
+
__export(AccountList_stories_exports, {
|
|
31
|
+
Default: () => Default,
|
|
32
|
+
TestAccountClick: () => TestAccountClick,
|
|
33
|
+
default: () => AccountList_stories_default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(AccountList_stories_exports);
|
|
36
|
+
var import_react = __toESM(require("react"));
|
|
37
|
+
var import_AccountList = require("./AccountList");
|
|
38
|
+
var import_test = require("@storybook/test");
|
|
39
|
+
const testFn = (0, import_test.fn)();
|
|
40
|
+
const meta = {
|
|
41
|
+
component: import_AccountList.AccountList,
|
|
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/AccountList",
|
|
46
|
+
tags: ["autodocs"],
|
|
47
|
+
args: {
|
|
48
|
+
accounts: Array.from({ length: 50 }, (_, i) => {
|
|
49
|
+
return {
|
|
50
|
+
name: `Bitcoin ${i}`,
|
|
51
|
+
id: `btc${i}`,
|
|
52
|
+
balance: "0.004 BTC",
|
|
53
|
+
fiatValue: "\xA3288.53",
|
|
54
|
+
protocol: "Native Segwit",
|
|
55
|
+
address: "n4A9...Zgty",
|
|
56
|
+
ticker: "btc",
|
|
57
|
+
cryptoId: "bitcoin"
|
|
58
|
+
};
|
|
59
|
+
}),
|
|
60
|
+
onClick: testFn
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
var AccountList_stories_default = meta;
|
|
64
|
+
const Default = {};
|
|
65
|
+
const TestAccountClick = {
|
|
66
|
+
play: async ({ canvasElement }) => {
|
|
67
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
68
|
+
const input = canvas.getByText("Bitcoin 1");
|
|
69
|
+
await import_test.userEvent.click(input);
|
|
70
|
+
await (0, import_test.expect)(testFn).toHaveBeenCalledWith("btc1");
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=AccountList.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/AccountList/AccountList.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport type { Meta, StoryObj } from \"@storybook/react\";\nimport { AccountList } from \"./AccountList\";\nimport { expect, fn, userEvent, within } from \"@storybook/test\";\n\nconst testFn = fn();\n\nconst meta: Meta<typeof AccountList> = {\n component: AccountList,\n decorators: [\n Story => (\n <div style={{ height: \"400px\" }}>\n <Story />\n </div>\n ),\n ],\n title: \"PreLdls/Components/AccountList\",\n tags: [\"autodocs\"],\n args: {\n accounts: Array.from({ length: 50 }, (_, i) => {\n return {\n name: `Bitcoin ${i}`,\n id: `btc${i}`,\n balance: \"0.004 BTC\",\n fiatValue: \"\u00A3288.53\",\n protocol: \"Native Segwit\",\n address: \"n4A9...Zgty\",\n ticker: \"btc\",\n cryptoId: \"bitcoin\",\n };\n }),\n onClick: testFn,\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj<typeof AccountList>;\n\nexport const Default: Story = {};\n\nexport const TestAccountClick: 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,MAAM;AAC7C,aAAO;AAAA,QACL,MAAM,WAAW,CAAC;AAAA,QAClB,IAAI,MAAM,CAAC;AAAA,QACX,SAAS;AAAA,QACT,WAAW;AAAA,QACX,UAAU;AAAA,QACV,SAAS;AAAA,QACT,QAAQ;AAAA,QACR,UAAU;AAAA,MACZ;AAAA,IACF,CAAC;AAAA,IACD,SAAS;AAAA,EACX;AACF;AAEA,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,79 @@
|
|
|
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 Address_exports = {};
|
|
30
|
+
__export(Address_exports, {
|
|
31
|
+
Address: () => Address
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(Address_exports);
|
|
34
|
+
var import_react = __toESM(require("react"));
|
|
35
|
+
var import_components = require("../../../components");
|
|
36
|
+
var import_styled_components = __toESM(require("styled-components"));
|
|
37
|
+
var import_libs = require("../../libs");
|
|
38
|
+
const TempAssetBadge = ({
|
|
39
|
+
ledgerId: _ledgerId,
|
|
40
|
+
ticker: _ticker
|
|
41
|
+
}) => (
|
|
42
|
+
// TODO: To be replaced with LIVE-18221
|
|
43
|
+
/* @__PURE__ */ import_react.default.createElement("div", { style: { display: "flex", alignItems: "center" }, "data-testid": "address-icon" }, /* @__PURE__ */ import_react.default.createElement(
|
|
44
|
+
"span",
|
|
45
|
+
{
|
|
46
|
+
style: {
|
|
47
|
+
height: 20,
|
|
48
|
+
width: 20,
|
|
49
|
+
borderRadius: 20,
|
|
50
|
+
backgroundColor: "grey",
|
|
51
|
+
display: "inline-block"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
))
|
|
55
|
+
);
|
|
56
|
+
const Wrapper = import_styled_components.default.div`
|
|
57
|
+
${(0, import_libs.withTokens)("spacing-xxxs", "colors-content-subdued-default-default")}
|
|
58
|
+
|
|
59
|
+
display: flex;
|
|
60
|
+
flex-direction: row;
|
|
61
|
+
align-items: center;
|
|
62
|
+
`;
|
|
63
|
+
const Address = ({
|
|
64
|
+
address,
|
|
65
|
+
showIcon,
|
|
66
|
+
cryptoId,
|
|
67
|
+
ticker
|
|
68
|
+
}) => {
|
|
69
|
+
return /* @__PURE__ */ import_react.default.createElement(Wrapper, null, /* @__PURE__ */ import_react.default.createElement(
|
|
70
|
+
import_components.Text,
|
|
71
|
+
{
|
|
72
|
+
marginRight: "var(--spacing-xxxs)",
|
|
73
|
+
fontSize: "12px",
|
|
74
|
+
color: "var(--colors-content-subdued-default-default)"
|
|
75
|
+
},
|
|
76
|
+
address
|
|
77
|
+
), showIcon && /* @__PURE__ */ import_react.default.createElement(TempAssetBadge, { ledgerId: cryptoId, ticker }));
|
|
78
|
+
};
|
|
79
|
+
//# sourceMappingURL=Address.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/Address/Address.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport { Text } from \"../../../components\";\nimport styled from \"styled-components\";\nimport { withTokens } from \"../../libs\";\n\nconst TempAssetBadge = ({\n ledgerId: _ledgerId,\n ticker: _ticker,\n}: {\n ledgerId?: string;\n ticker?: string;\n}) => (\n // TODO: To be replaced with LIVE-18221\n <div style={{ display: \"flex\", alignItems: \"center\" }} data-testid=\"address-icon\">\n <span\n style={{\n height: 20,\n width: 20,\n borderRadius: 20,\n backgroundColor: \"grey\",\n display: \"inline-block\",\n }}\n />\n </div>\n);\n\nconst Wrapper = styled.div`\n ${withTokens(\"spacing-xxxs\", \"colors-content-subdued-default-default\")}\n\n display: flex;\n flex-direction: row;\n align-items: center;\n`;\n\nexport const Address = ({\n address,\n showIcon,\n cryptoId,\n ticker,\n}: {\n address: string;\n showIcon: boolean;\n cryptoId?: string;\n ticker?: string;\n}) => {\n return (\n <Wrapper>\n <Text\n marginRight=\"var(--spacing-xxxs)\"\n fontSize=\"12px\"\n color=\"var(--colors-content-subdued-default-default)\"\n >\n {address}\n </Text>\n {showIcon && <TempAssetBadge ledgerId={cryptoId} ticker={ticker} />}\n </Wrapper>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,wBAAqB;AACrB,+BAAmB;AACnB,kBAA2B;AAE3B,MAAM,iBAAiB,CAAC;AAAA,EACtB,UAAU;AAAA,EACV,QAAQ;AACV;AAAA;AAAA,EAKE,6BAAAA,QAAA,cAAC,SAAI,OAAO,EAAE,SAAS,QAAQ,YAAY,SAAS,GAAG,eAAY,kBACjE,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,wBAAW,gBAAgB,wCAAwC,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAOjE,MAAM,UAAU,CAAC;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAKM;AACJ,SACE,6BAAAD,QAAA,cAAC,eACC,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,aAAY;AAAA,MACZ,UAAS;AAAA,MACT,OAAM;AAAA;AAAA,IAEL;AAAA,EACH,GACC,YAAY,6BAAAA,QAAA,cAAC,kBAAe,UAAU,UAAU,QAAgB,CACnE;AAEJ;",
|
|
6
|
+
"names": ["React", "styled"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 Address_stories_exports = {};
|
|
20
|
+
__export(Address_stories_exports, {
|
|
21
|
+
Default: () => Default,
|
|
22
|
+
TestAddress: () => TestAddress,
|
|
23
|
+
TestAddressWithIcon: () => TestAddressWithIcon,
|
|
24
|
+
default: () => Address_stories_default
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(Address_stories_exports);
|
|
27
|
+
var import_Address = require("./Address");
|
|
28
|
+
var import_test = require("@storybook/test");
|
|
29
|
+
const meta = {
|
|
30
|
+
component: import_Address.Address,
|
|
31
|
+
title: "PreLdls/Components/Address",
|
|
32
|
+
tags: ["autodocs"],
|
|
33
|
+
args: { address: "n4A9...Zgty", cryptoId: "bitcoin", ticker: "BTC" }
|
|
34
|
+
};
|
|
35
|
+
var Address_stories_default = meta;
|
|
36
|
+
const Default = {};
|
|
37
|
+
const TestAddress = {
|
|
38
|
+
play: async ({ canvasElement }) => {
|
|
39
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
40
|
+
const name = canvas.getByText("n4A9...Zgty");
|
|
41
|
+
const icon = canvas.queryByTestId("address-icon");
|
|
42
|
+
await (0, import_test.expect)(name).toBeInTheDocument();
|
|
43
|
+
await (0, import_test.expect)(icon).not.toBeInTheDocument();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const TestAddressWithIcon = {
|
|
47
|
+
args: { showIcon: true },
|
|
48
|
+
play: async ({ canvasElement }) => {
|
|
49
|
+
const canvas = (0, import_test.within)(canvasElement);
|
|
50
|
+
const name = canvas.getByText("n4A9...Zgty");
|
|
51
|
+
const icon = canvas.getByTestId("address-icon");
|
|
52
|
+
await (0, import_test.expect)(name).toBeInTheDocument();
|
|
53
|
+
await (0, import_test.expect)(icon).toBeInTheDocument();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=Address.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/pre-ldls/components/Address/Address.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from \"@storybook/react\";\nimport { Address } from \"./Address\";\nimport { expect, within } from \"@storybook/test\";\n\nconst meta: Meta<typeof Address> = {\n component: Address,\n title: \"PreLdls/Components/Address\",\n tags: [\"autodocs\"],\n args: { address: \"n4A9...Zgty\", cryptoId: \"bitcoin\", ticker: \"BTC\" },\n};\nexport default meta;\n\ntype Story = StoryObj<typeof Address>;\n\nexport const Default: Story = {};\n\nexport const TestAddress: Story = {\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n const name = canvas.getByText(\"n4A9...Zgty\");\n const icon = canvas.queryByTestId(\"address-icon\");\n\n await expect(name).toBeInTheDocument();\n await expect(icon).not.toBeInTheDocument();\n },\n};\n\nexport const TestAddressWithIcon: Story = {\n args: { showIcon: true },\n play: async ({ canvasElement }) => {\n const canvas = within(canvasElement);\n\n const name = canvas.getByText(\"n4A9...Zgty\");\n const icon = canvas.getByTestId(\"address-icon\");\n\n await expect(name).toBeInTheDocument();\n await expect(icon).toBeInTheDocument();\n },\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,qBAAwB;AACxB,kBAA+B;AAE/B,MAAM,OAA6B;AAAA,EACjC,WAAW;AAAA,EACX,OAAO;AAAA,EACP,MAAM,CAAC,UAAU;AAAA,EACjB,MAAM,EAAE,SAAS,eAAe,UAAU,WAAW,QAAQ,MAAM;AACrE;AACA,IAAO,0BAAQ;AAIR,MAAM,UAAiB,CAAC;AAExB,MAAM,cAAqB;AAAA,EAChC,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AAEnC,UAAM,OAAO,OAAO,UAAU,aAAa;AAC3C,UAAM,OAAO,OAAO,cAAc,cAAc;AAEhD,cAAM,oBAAO,IAAI,EAAE,kBAAkB;AACrC,cAAM,oBAAO,IAAI,EAAE,IAAI,kBAAkB;AAAA,EAC3C;AACF;AAEO,MAAM,sBAA6B;AAAA,EACxC,MAAM,EAAE,UAAU,KAAK;AAAA,EACvB,MAAM,OAAO,EAAE,cAAc,MAAM;AACjC,UAAM,aAAS,oBAAO,aAAa;AAEnC,UAAM,OAAO,OAAO,UAAU,aAAa;AAC3C,UAAM,OAAO,OAAO,YAAY,cAAc;AAE9C,cAAM,oBAAO,IAAI,EAAE,kBAAkB;AACrC,cAAM,oBAAO,IAAI,EAAE,kBAAkB;AAAA,EACvC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -52,8 +52,8 @@ const TempAssetBadge = () => (
|
|
|
52
52
|
);
|
|
53
53
|
const Wrapper = import_styled_components.default.div`
|
|
54
54
|
${(0, import_libs.withTokens)(
|
|
55
|
-
"spacing-
|
|
56
|
-
"
|
|
55
|
+
"spacing-xxs",
|
|
56
|
+
"margin-s",
|
|
57
57
|
"colors-content-subdued-default-default",
|
|
58
58
|
"colors-content-default-default",
|
|
59
59
|
"colors-surface-transparent-hover",
|
|
@@ -61,7 +61,7 @@ const Wrapper = import_styled_components.default.div`
|
|
|
61
61
|
)}
|
|
62
62
|
|
|
63
63
|
display: flex;
|
|
64
|
-
padding: var(--spacing-
|
|
64
|
+
padding: var(--spacing-xxs);
|
|
65
65
|
cursor: pointer;
|
|
66
66
|
|
|
67
67
|
:hover {
|
|
@@ -76,7 +76,7 @@ const InfoWrapper = import_styled_components.default.div`
|
|
|
76
76
|
display: flex;
|
|
77
77
|
flex-direction: column;
|
|
78
78
|
justify-content: center;
|
|
79
|
-
margin-left: var(--
|
|
79
|
+
margin-left: var(--margin-s);
|
|
80
80
|
`;
|
|
81
81
|
const AssetItem = ({ name, ticker, onClick }) => {
|
|
82
82
|
return /* @__PURE__ */ import_react.default.createElement(Wrapper, { onClick: () => onClick({ name, ticker }) }, /* @__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/AssetItem/AssetItem.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport { withTokens } from \"../../libs\";\nimport { Text } from \"../../../components\";\n\nexport type AssetType = {\n name: string;\n ticker: string;\n};\n\ntype AssetItemProps = AssetType & {\n onClick: (asset: AssetType) => 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-
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport { withTokens } from \"../../libs\";\nimport { Text } from \"../../../components\";\n\nexport type AssetType = {\n name: string;\n ticker: string;\n};\n\ntype AssetItemProps = AssetType & {\n onClick: (asset: AssetType) => 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-subdued-default-default\",\n \"colors-content-default-default\",\n \"colors-surface-transparent-hover\",\n \"colors-surface-transparent-pressed\",\n )}\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 AssetItem = ({ name, ticker, onClick }: AssetItemProps) => {\n return (\n <Wrapper onClick={() => onClick({ name, ticker })}>\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 <Text\n variant=\"bodyLineHeight\"\n fontWeight=\"semiBold\"\n color=\"var(--colors-content-subdued-default-default)\"\n >\n {ticker}\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;AAWrB,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;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;AAAA;AAOpB,MAAM,YAAY,CAAC,EAAE,MAAM,QAAQ,QAAQ,MAAsB;AACtE,SACE,6BAAAD,QAAA,cAAC,WAAQ,SAAS,MAAM,QAAQ,EAAE,MAAM,OAAO,CAAC,KAC9C,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,GACA,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 AssetList = ({
|
|
|
38
38
|
assets,
|
|
39
39
|
onClick
|
|
40
40
|
}) => {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
itemHeight: 64,
|
|
45
|
-
count: assets.length,
|
|
46
|
-
renderItem: (i) => /* @__PURE__ */ import_react.default.createElement(import_AssetItem.AssetItem, { name: assets[i].name, ticker: assets[i].ticker, onClick })
|
|
47
|
-
}
|
|
41
|
+
const renderAssetItem = (0, import_react.useCallback)(
|
|
42
|
+
({ name, ticker }) => /* @__PURE__ */ import_react.default.createElement(import_AssetItem.AssetItem, { name, ticker, onClick }),
|
|
43
|
+
[onClick]
|
|
48
44
|
);
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(import_VirtualList.VirtualList, { itemHeight: 64, items: assets, renderItem: renderAssetItem });
|
|
49
46
|
};
|
|
50
47
|
//# sourceMappingURL=AssetList.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/pre-ldls/components/AssetList/AssetList.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from \"react\";\nimport { AssetItem, AssetType } from \"../AssetItem/AssetItem\";\nimport { VirtualList } from \"../VirtualList/VirtualList\";\n\nexport const AssetList = ({\n assets,\n onClick,\n}: {\n assets: AssetType[];\n onClick: (asset: AssetType) => void;\n}) => {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import React, { useCallback } from \"react\";\nimport { AssetItem, AssetType } from \"../AssetItem/AssetItem\";\nimport { VirtualList } from \"../VirtualList/VirtualList\";\n\nexport const AssetList = ({\n assets,\n onClick,\n}: {\n assets: AssetType[];\n onClick: (asset: AssetType) => void;\n}) => {\n const renderAssetItem = useCallback(\n ({ name, ticker }: AssetType) => <AssetItem name={name} ticker={ticker} onClick={onClick} />,\n [onClick],\n );\n\n return <VirtualList itemHeight={64} items={assets} renderItem={renderAssetItem} />;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAmC;AACnC,uBAAqC;AACrC,yBAA4B;AAErB,MAAM,YAAY,CAAC;AAAA,EACxB;AAAA,EACA;AACF,MAGM;AACJ,QAAM,sBAAkB;AAAA,IACtB,CAAC,EAAE,MAAM,OAAO,MAAiB,6BAAAA,QAAA,cAAC,8BAAU,MAAY,QAAgB,SAAkB;AAAA,IAC1F,CAAC,OAAO;AAAA,EACV;AAEA,SAAO,6BAAAA,QAAA,cAAC,kCAAY,YAAY,IAAI,OAAO,QAAQ,YAAY,iBAAiB;AAClF;",
|
|
6
6
|
"names": ["React"]
|
|
7
7
|
}
|