@ledgerhq/react-ui 0.8.3 → 0.9.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/assets/cryptoIcons.d.ts +1 -0
- package/lib/assets/cryptoIcons.js +1 -0
- package/lib/assets/index.d.ts +1 -0
- package/lib/assets/index.js +2 -0
- package/lib/cjs/assets/cryptoIcons.js +21 -0
- package/lib/cjs/assets/cryptoIcons.js.map +7 -0
- package/lib/cjs/assets/index.js +2 -0
- package/lib/cjs/assets/index.js.map +2 -2
- package/lib/cjs/components/asorted/Icon/CryptoIcon.js +53 -0
- package/lib/cjs/components/asorted/Icon/CryptoIcon.js.map +7 -0
- package/lib/cjs/components/asorted/Icon/CryptoIcons.stories.js +130 -0
- package/lib/cjs/components/asorted/Icon/CryptoIcons.stories.js.map +7 -0
- package/lib/cjs/components/asorted/Icon/Icons.stories.js +1 -1
- package/lib/cjs/components/asorted/Icon/Icons.stories.js.map +1 -1
- package/lib/cjs/components/asorted/Icon/index.js +2 -0
- package/lib/cjs/components/asorted/Icon/index.js.map +2 -2
- package/lib/cjs/components/asorted/index.js +1 -0
- package/lib/cjs/components/asorted/index.js.map +2 -2
- package/lib/cjs/components/cards/Carousel/Slide.js +1 -2
- package/lib/cjs/components/cards/Carousel/Slide.js.map +2 -2
- package/lib/cjs/components/form/BaseInput/index.js +3 -0
- package/lib/cjs/components/form/BaseInput/index.js.map +2 -2
- package/lib/cjs/components/message/Tooltip/styles.js +13 -13
- package/lib/cjs/components/message/Tooltip/styles.js.map +2 -2
- package/lib/cjs/components/navigation/progress/ProgressBar/Onboarding.js +1 -1
- package/lib/cjs/components/navigation/progress/ProgressBar/Onboarding.js.map +1 -1
- package/lib/cjs/styles/global.js +23 -1
- package/lib/cjs/styles/global.js.map +2 -2
- package/lib/cjs/styles/helpers.js +10 -0
- package/lib/cjs/styles/helpers.js.map +2 -2
- package/lib/components/asorted/Icon/CryptoIcon.d.ts +10 -0
- package/lib/components/asorted/Icon/CryptoIcon.js +23 -0
- package/lib/components/asorted/Icon/index.d.ts +1 -0
- package/lib/components/asorted/Icon/index.js +1 -0
- package/lib/components/asorted/index.d.ts +1 -1
- package/lib/components/asorted/index.js +1 -1
- package/lib/components/cards/Carousel/Slide.js +1 -2
- package/lib/components/form/BaseInput/index.js +3 -0
- package/lib/components/message/Tooltip/styles.js +13 -13
- package/lib/components/navigation/progress/ProgressBar/Onboarding.js +1 -1
- package/lib/styles/global.js +23 -1
- package/lib/styles/helpers.d.ts +1 -0
- package/lib/styles/helpers.js +9 -0
- package/package.json +9 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@ledgerhq/crypto-icons-ui/react";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@ledgerhq/crypto-icons-ui/react";
|
package/lib/assets/index.d.ts
CHANGED
package/lib/assets/index.js
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __reExport = (target, module2, desc) => {
|
|
9
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(module2))
|
|
11
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
12
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return target;
|
|
15
|
+
};
|
|
16
|
+
var __toModule = (module2) => {
|
|
17
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
18
|
+
};
|
|
19
|
+
__markAsModule(exports);
|
|
20
|
+
__reExport(exports, __toModule(require("@ledgerhq/crypto-icons-ui/react")));
|
|
21
|
+
//# sourceMappingURL=cryptoIcons.js.map
|
package/lib/cjs/assets/index.js
CHANGED
|
@@ -22,9 +22,11 @@ var __toModule = (module2) => {
|
|
|
22
22
|
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
23
23
|
};
|
|
24
24
|
__export(exports, {
|
|
25
|
+
CryptoIcons: () => CryptoIcons,
|
|
25
26
|
Icons: () => Icons,
|
|
26
27
|
Logos: () => Logos
|
|
27
28
|
});
|
|
28
29
|
var Icons = __toModule(require("@ledgerhq/icons-ui/react"));
|
|
30
|
+
var CryptoIcons = __toModule(require("@ledgerhq/crypto-icons-ui/react"));
|
|
29
31
|
var Logos = __toModule(require("./logos"));
|
|
30
32
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/assets/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * as Icons from \"@ledgerhq/icons-ui/react\";\nexport * as Logos from \"./logos\";\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,YAAuB;",
|
|
4
|
+
"sourcesContent": ["export * as Icons from \"@ledgerhq/icons-ui/react\";\nexport * as CryptoIcons from \"@ledgerhq/crypto-icons-ui/react\";\nexport * as Logos from \"./logos\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,kBAA6B;AAC7B,YAAuB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
__markAsModule(target);
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, module2, desc) => {
|
|
14
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(module2))
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __toModule = (module2) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
23
|
+
};
|
|
24
|
+
__export(exports, {
|
|
25
|
+
default: () => CryptoIcon_default,
|
|
26
|
+
iconNames: () => iconNames
|
|
27
|
+
});
|
|
28
|
+
var icons = __toModule(require("@ledgerhq/crypto-icons-ui/react"));
|
|
29
|
+
var import_react = __toModule(require("react"));
|
|
30
|
+
var import_styles = __toModule(require("../../../styles"));
|
|
31
|
+
var import_styled_components = __toModule(require("styled-components"));
|
|
32
|
+
const iconNames = Array.from(Object.keys(icons).reduce((set, rawKey) => {
|
|
33
|
+
const key = rawKey;
|
|
34
|
+
if (!set.has(key))
|
|
35
|
+
set.add(key);
|
|
36
|
+
return set;
|
|
37
|
+
}, new Set()));
|
|
38
|
+
const CryptoIcon = ({ name, size = 16, color, backgroundColor }) => {
|
|
39
|
+
const maybeIconName = `${name}`;
|
|
40
|
+
const { colors } = (0, import_styled_components.useTheme)();
|
|
41
|
+
if (maybeIconName in icons) {
|
|
42
|
+
const Component = icons[maybeIconName];
|
|
43
|
+
const defaultColor = Component.DefaultColor;
|
|
44
|
+
const contrastedColor = (0, import_styles.ensureContrast)(color || defaultColor, backgroundColor || colors.background.main);
|
|
45
|
+
return /* @__PURE__ */ import_react.default.createElement(Component, {
|
|
46
|
+
size,
|
|
47
|
+
color: contrastedColor
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
};
|
|
52
|
+
var CryptoIcon_default = CryptoIcon;
|
|
53
|
+
//# sourceMappingURL=CryptoIcon.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/asorted/Icon/CryptoIcon.tsx"],
|
|
4
|
+
"sourcesContent": ["import * as icons from \"@ledgerhq/crypto-icons-ui/react\";\nimport React from \"react\";\nimport { ensureContrast } from \"../../../styles\";\nimport { useTheme } from \"styled-components\";\n\nexport type Props = {\n name: string;\n size?: number;\n color?: string;\n backgroundColor?: string; // overrides background color to ensure contrast with icon color\n};\n\nexport const iconNames = Array.from(\n Object.keys(icons).reduce((set, rawKey) => {\n const key = rawKey;\n if (!set.has(key)) set.add(key);\n return set;\n }, new Set<string>()),\n);\n\nconst CryptoIcon = ({ name, size = 16, color, backgroundColor }: Props): JSX.Element | null => {\n const maybeIconName = `${name}`;\n const { colors } = useTheme();\n if (maybeIconName in icons) {\n // @ts-expect-error FIXME I don't know how to make you happy ts\n const Component = icons[maybeIconName];\n const defaultColor = Component.DefaultColor;\n const contrastedColor = ensureContrast(\n color || defaultColor,\n backgroundColor || colors.background.main,\n );\n return <Component size={size} color={contrastedColor} />;\n }\n return null;\n};\n\nexport default CryptoIcon;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,YAAuB;AACvB,mBAAkB;AAClB,oBAA+B;AAC/B,+BAAyB;AASlB,MAAM,YAAY,MAAM,KAC7B,OAAO,KAAK,OAAO,OAAO,CAAC,KAAK,WAAW;AACzC,QAAM,MAAM;AACZ,MAAI,CAAC,IAAI,IAAI;AAAM,QAAI,IAAI;AAC3B,SAAO;AAAA,GACN,IAAI;AAGT,MAAM,aAAa,CAAC,EAAE,MAAM,OAAO,IAAI,OAAO,sBAAiD;AAC7F,QAAM,gBAAgB,GAAG;AACzB,QAAM,EAAE,WAAW;AACnB,MAAI,iBAAiB,OAAO;AAE1B,UAAM,YAAY,MAAM;AACxB,UAAM,eAAe,UAAU;AAC/B,UAAM,kBAAkB,kCACtB,SAAS,cACT,mBAAmB,OAAO,WAAW;AAEvC,WAAO,mDAAC,WAAD;AAAA,MAAW;AAAA,MAAY,OAAO;AAAA;AAAA;AAEvC,SAAO;AAAA;AAGT,IAAO,qBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
__markAsModule(target);
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, module2, desc) => {
|
|
14
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(module2))
|
|
16
|
+
if (!__hasOwnProp.call(target, key) && key !== "default")
|
|
17
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return target;
|
|
20
|
+
};
|
|
21
|
+
var __toModule = (module2) => {
|
|
22
|
+
return __reExport(__markAsModule(__defProp(module2 != null ? __create(__getProtoOf(module2)) : {}, "default", module2 && module2.__esModule && "default" in module2 ? { get: () => module2.default, enumerable: true } : { value: module2, enumerable: true })), module2);
|
|
23
|
+
};
|
|
24
|
+
__export(exports, {
|
|
25
|
+
ListCryptoIcons: () => ListCryptoIcons,
|
|
26
|
+
SingleCryptoIcon: () => SingleCryptoIcon,
|
|
27
|
+
default: () => CryptoIcons_stories_default
|
|
28
|
+
});
|
|
29
|
+
var import_react = __toModule(require("react"));
|
|
30
|
+
var import_styled_components = __toModule(require("styled-components"));
|
|
31
|
+
var import__ = __toModule(require("../../.."));
|
|
32
|
+
var cryptoIcons = __toModule(require("@ledgerhq/crypto-icons-ui/react"));
|
|
33
|
+
const ScrollArea = (0, import_styled_components.default)(import__.Grid)`
|
|
34
|
+
flex: 1;
|
|
35
|
+
height: auto;
|
|
36
|
+
${(p) => p.theme.overflow.y};
|
|
37
|
+
`;
|
|
38
|
+
const Container = (0, import_styled_components.default)(import__.Flex).attrs({
|
|
39
|
+
flex: 1,
|
|
40
|
+
flexDirection: "column",
|
|
41
|
+
p: 4
|
|
42
|
+
})`
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
height: calc(100vh - 4em);
|
|
45
|
+
`;
|
|
46
|
+
const IconContainer = (0, import_styled_components.default)(import__.Flex).attrs({
|
|
47
|
+
flexDirection: "column",
|
|
48
|
+
justifyContent: "flex-end",
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
p: 4
|
|
51
|
+
})`
|
|
52
|
+
${(p) => p.active ? `background-color: ${p.theme.colors.neutral.c20};` : ``}
|
|
53
|
+
border-radius: 4px;
|
|
54
|
+
height: 100px;
|
|
55
|
+
`;
|
|
56
|
+
const Bold = import_styled_components.default.b`
|
|
57
|
+
color: ${(p) => p.theme.colors.primary.c80};
|
|
58
|
+
`;
|
|
59
|
+
const Story = {
|
|
60
|
+
title: "Asorted/CryptoIcons",
|
|
61
|
+
argTypes: {
|
|
62
|
+
size: {
|
|
63
|
+
type: "number",
|
|
64
|
+
description: "Icon size for preview",
|
|
65
|
+
defaultValue: 32
|
|
66
|
+
},
|
|
67
|
+
color: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: "Color",
|
|
70
|
+
control: { control: "color" }
|
|
71
|
+
},
|
|
72
|
+
name: {
|
|
73
|
+
type: "enum",
|
|
74
|
+
defaultValue: "BTC",
|
|
75
|
+
description: "[Only for single icon], Icon name",
|
|
76
|
+
control: {
|
|
77
|
+
options: Object.keys(cryptoIcons),
|
|
78
|
+
control: {
|
|
79
|
+
type: "select"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
var CryptoIcons_stories_default = Story;
|
|
86
|
+
const ListTemplate = (args) => {
|
|
87
|
+
const color = args.color || void 0;
|
|
88
|
+
const [search, setSearch] = (0, import_react.useState)("");
|
|
89
|
+
const s = search.toLowerCase();
|
|
90
|
+
const regexp = new RegExp(s, "i");
|
|
91
|
+
return /* @__PURE__ */ import_react.default.createElement(Container, null, /* @__PURE__ */ import_react.default.createElement(import__.SearchInput, {
|
|
92
|
+
value: search,
|
|
93
|
+
onChange: setSearch
|
|
94
|
+
}), /* @__PURE__ */ import_react.default.createElement(ScrollArea, {
|
|
95
|
+
gridTemplateColumns: "repeat(auto-fill, 100px);",
|
|
96
|
+
gridTemplateRows: "repeat(auto-fill, 100px);",
|
|
97
|
+
gridGap: 4,
|
|
98
|
+
mt: 4
|
|
99
|
+
}, Object.keys(cryptoIcons).sort((a, b) => {
|
|
100
|
+
return s ? b.toLowerCase().indexOf(s) - a.toLowerCase().indexOf(s) : a.localeCompare(b);
|
|
101
|
+
}).map((name) => {
|
|
102
|
+
const match = name.match(regexp);
|
|
103
|
+
const active = s && match;
|
|
104
|
+
const index = match?.index ?? 0;
|
|
105
|
+
return /* @__PURE__ */ import_react.default.createElement(IconContainer, {
|
|
106
|
+
active: !!active
|
|
107
|
+
}, /* @__PURE__ */ import_react.default.createElement(import__.Flex, {
|
|
108
|
+
flex: 1,
|
|
109
|
+
justifyContent: "center",
|
|
110
|
+
alignItems: "center"
|
|
111
|
+
}, /* @__PURE__ */ import_react.default.createElement(import__.CryptoIcon, {
|
|
112
|
+
key: name,
|
|
113
|
+
name,
|
|
114
|
+
size: args.size,
|
|
115
|
+
color
|
|
116
|
+
})), /* @__PURE__ */ import_react.default.createElement(import__.Text, {
|
|
117
|
+
variant: "extraSmall"
|
|
118
|
+
}, active ? /* @__PURE__ */ import_react.default.createElement(import_react.default.Fragment, null, name.substr(0, index), /* @__PURE__ */ import_react.default.createElement(Bold, null, name.substr(index, s.length)), name.substr(index + s.length)) : name));
|
|
119
|
+
})));
|
|
120
|
+
};
|
|
121
|
+
const IconTemplate = (args) => {
|
|
122
|
+
const color = args.color || void 0;
|
|
123
|
+
return /* @__PURE__ */ import_react.default.createElement(import__.CryptoIcon, {
|
|
124
|
+
...args,
|
|
125
|
+
color
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
const ListCryptoIcons = ListTemplate.bind({});
|
|
129
|
+
const SingleCryptoIcon = IconTemplate.bind({});
|
|
130
|
+
//# sourceMappingURL=CryptoIcons.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/components/asorted/Icon/CryptoIcons.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useState } from \"react\";\nimport styled from \"styled-components\";\nimport { Text, SearchInput, Flex, Grid, CryptoIcon } from \"../../..\";\nimport * as cryptoIcons from \"@ledgerhq/crypto-icons-ui/react\";\n\ntype CryptoIconsProps = {\n name: keyof typeof cryptoIcons;\n size?: number;\n color?: string;\n};\n\nconst ScrollArea = styled(Grid)`\n flex: 1;\n height: auto;\n ${(p) => p.theme.overflow.y};\n`;\n\nconst Container = styled(Flex).attrs({\n flex: 1,\n flexDirection: \"column\",\n p: 4,\n})`\n overflow: hidden;\n height: calc(100vh - 4em);\n`;\n\nconst IconContainer = styled(Flex).attrs<{ active?: boolean }>({\n flexDirection: \"column\",\n justifyContent: \"flex-end\",\n alignItems: \"center\",\n p: 4,\n})<{ active?: boolean }>`\n ${(p) => (p.active ? `background-color: ${p.theme.colors.neutral.c20};` : ``)}\n border-radius: 4px;\n height: 100px;\n`;\n\nconst Bold = styled.b`\n color: ${(p) => p.theme.colors.primary.c80};\n`;\n\nconst Story = {\n title: \"Asorted/CryptoIcons\",\n argTypes: {\n size: {\n type: \"number\",\n description: \"Icon size for preview\",\n defaultValue: 32,\n },\n color: {\n type: \"string\",\n description: \"Color\",\n control: { control: \"color\" },\n },\n name: {\n type: \"enum\",\n defaultValue: \"BTC\",\n description: \"[Only for single icon], Icon name\",\n control: {\n options: Object.keys(cryptoIcons),\n control: {\n type: \"select\",\n },\n },\n },\n },\n};\nexport default Story;\n\nconst ListTemplate = (args: CryptoIconsProps) => {\n const color = args.color || undefined;\n const [search, setSearch] = useState(\"\");\n const s = search.toLowerCase();\n const regexp = new RegExp(s, \"i\");\n\n return (\n <Container>\n <SearchInput value={search} onChange={setSearch} />\n <ScrollArea\n gridTemplateColumns=\"repeat(auto-fill, 100px);\"\n gridTemplateRows=\"repeat(auto-fill, 100px);\"\n gridGap={4}\n mt={4}\n >\n {Object.keys(cryptoIcons)\n .sort((a, b) => {\n return s ? b.toLowerCase().indexOf(s) - a.toLowerCase().indexOf(s) : a.localeCompare(b);\n })\n // @ts-expect-error FIXME I don't know how to make you happy ts\n .map((name: keyof typeof cryptoIcons) => {\n const match = name.match(regexp);\n const active = s && match;\n const index = match?.index ?? 0;\n return (\n <IconContainer active={!!active}>\n <Flex flex={1} justifyContent=\"center\" alignItems=\"center\">\n <CryptoIcon key={name} name={name} size={args.size} color={color} />\n </Flex>\n <Text variant=\"extraSmall\">\n {active ? (\n <>\n {name.substr(0, index)}\n <Bold>{name.substr(index, s.length)}</Bold>\n {name.substr(index + s.length)}\n </>\n ) : (\n name\n )}\n </Text>\n </IconContainer>\n );\n })}\n </ScrollArea>\n </Container>\n );\n};\nconst IconTemplate = (args: CryptoIconsProps) => {\n const color = args.color || undefined;\n\n return <CryptoIcon {...args} color={color} />;\n};\n\nexport const ListCryptoIcons = ListTemplate.bind({});\nexport const SingleCryptoIcon = IconTemplate.bind({});\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgC;AAChC,+BAAmB;AACnB,eAA0D;AAC1D,kBAA6B;AAQ7B,MAAM,aAAa,sCAAO;AAAA;AAAA;AAAA,IAGtB,CAAC,MAAM,EAAE,MAAM,SAAS;AAAA;AAG5B,MAAM,YAAY,sCAAO,eAAM,MAAM;AAAA,EACnC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,GAAG;AAAA;AAAA;AAAA;AAAA;AAML,MAAM,gBAAgB,sCAAO,eAAM,MAA4B;AAAA,EAC7D,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,GAAG;AAAA;AAAA,IAED,CAAC,MAAO,EAAE,SAAS,qBAAqB,EAAE,MAAM,OAAO,QAAQ,SAAS;AAAA;AAAA;AAAA;AAK5E,MAAM,OAAO,iCAAO;AAAA,WACT,CAAC,MAAM,EAAE,MAAM,OAAO,QAAQ;AAAA;AAGzC,MAAM,QAAQ;AAAA,EACZ,OAAO;AAAA,EACP,UAAU;AAAA,I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AAA,OACX,SACC,wFACG,KAAK,OAAO,GAAG,QAChB,mDAAC,MAAD,MAAO,KAAK,OAAO,OAAO,EAAE,UAC3B,KAAK,OAAO,QAAQ,EAAE,WAGzB;AAAA;AAAA;AAUpB,MAAM,eAAe,CAAC,SAA2B;AAC/C,QAAM,QAAQ,KAAK,SAAS;AAE5B,SAAO,mDAAC,qBAAD;AAAA,OAAgB;AAAA,IAAM;AAAA;AAAA;AAGxB,MAAM,kBAAkB,aAAa,KAAK;AAC1C,MAAM,mBAAmB,aAAa,KAAK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -42,7 +42,7 @@ const Container = (0, import_styled_components.default)(import__.Flex).attrs({
|
|
|
42
42
|
p: 4
|
|
43
43
|
})`
|
|
44
44
|
overflow: hidden;
|
|
45
|
-
height: calc(100vh -
|
|
45
|
+
height: calc(100vh - 4em);
|
|
46
46
|
`;
|
|
47
47
|
const IconContainer = (0, import_styled_components.default)(import__.Flex).attrs({
|
|
48
48
|
flexDirection: "column",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/asorted/Icon/Icons.stories.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useState } from \"react\";\nimport styled from \"styled-components\";\nimport Icon, { iconNames, Props as IconProps } from \"./Icon\";\nimport { useTheme } from \"styled-components\";\nimport { Text, SearchInput, Flex, Grid } from \"../../..\";\n\nconst ScrollArea = styled(Grid)`\n flex: 1;\n height: auto;\n ${(p) => p.theme.overflow.y};\n`;\n\nconst Container = styled(Flex).attrs({\n flex: 1,\n flexDirection: \"column\",\n p: 4,\n})`\n overflow: hidden;\n height: calc(100vh -
|
|
4
|
+
"sourcesContent": ["import React, { useState } from \"react\";\nimport styled from \"styled-components\";\nimport Icon, { iconNames, Props as IconProps } from \"./Icon\";\nimport { useTheme } from \"styled-components\";\nimport { Text, SearchInput, Flex, Grid } from \"../../..\";\n\nconst ScrollArea = styled(Grid)`\n flex: 1;\n height: auto;\n ${(p) => p.theme.overflow.y};\n`;\n\nconst Container = styled(Flex).attrs({\n flex: 1,\n flexDirection: \"column\",\n p: 4,\n})`\n overflow: hidden;\n height: calc(100vh - 4em);\n`;\n\nconst IconContainer = styled(Flex).attrs<{ active?: boolean }>({\n flexDirection: \"column\",\n justifyContent: \"flex-end\",\n alignItems: \"center\",\n p: 4,\n})<{ active?: boolean }>`\n ${(p) => (p.active ? `background-color: ${p.theme.colors.neutral.c20};` : ``)}\n border-radius: 4px;\n height: 100px;\n`;\n\nconst Bold = styled.b`\n color: ${(p) => p.theme.colors.primary.c80};\n`;\n\nconst Story = {\n title: \"Asorted/Icons\",\n argTypes: {\n weight: {\n type: \"enum\",\n description: \"Weight\",\n defaultValue: \"Medium\",\n control: {\n options: [\"Light\", \"Medium\", \"Regular\", \"Thin\", \"UltraLight\"],\n control: {\n type: \"select\",\n },\n },\n },\n size: {\n type: \"number\",\n description: \"Icon size for preview\",\n defaultValue: 32,\n },\n color: {\n type: \"string\",\n description: \"Color\",\n control: { control: \"color\" },\n },\n name: {\n type: \"enum\",\n defaultValue: \"Activity\",\n description: \"[Only for single icon], Icon name\",\n control: {\n options: iconNames,\n control: {\n type: \"select\",\n },\n },\n },\n },\n};\nexport default Story;\n\nconst ListTemplate = (args: IconProps) => {\n const theme = useTheme();\n const color = args.color || theme.colors.neutral.c100;\n const [search, setSearch] = useState(\"\");\n const s = search.toLowerCase();\n const regexp = new RegExp(s, \"i\");\n\n return (\n <Container>\n <SearchInput value={search} onChange={setSearch} />\n <ScrollArea\n gridTemplateColumns=\"repeat(auto-fill, 100px);\"\n gridTemplateRows=\"repeat(auto-fill, 100px);\"\n gridGap={4}\n mt={4}\n >\n {iconNames\n .sort((a: string, b: string) => {\n return s ? b.toLowerCase().indexOf(s) - a.toLowerCase().indexOf(s) : a.localeCompare(b);\n })\n .map((name) => {\n const match = name.match(regexp);\n const active = s && match;\n const index = match?.index ?? 0;\n return (\n <IconContainer active={!!active}>\n <Flex flex={1} justifyContent=\"center\" alignItems=\"center\">\n <Icon\n key={name}\n name={name}\n weight={args.weight}\n size={args.size}\n color={color}\n />\n </Flex>\n <Text variant=\"extraSmall\">\n {active ? (\n <>\n {name.substr(0, index)}\n <Bold>{name.substr(index, s.length)}</Bold>\n {name.substr(index + s.length)}\n </>\n ) : (\n name\n )}\n </Text>\n </IconContainer>\n );\n })}\n </ScrollArea>\n </Container>\n );\n};\nconst IconTemplate = (args: IconProps) => {\n const theme = useTheme();\n const color = args.color || theme.colors.neutral.c100;\n\n return <Icon {...args} color={color} />;\n};\n\nexport const List = ListTemplate.bind({});\nexport const SingleIcon = IconTemplate.bind({});\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAgC;AAChC,+BAAmB;AACnB,kBAAoD;AACpD,gCAAyB;AACzB,eAA8C;AAE9C,MAAM,aAAa,sCAAO;AAAA;AAAA;AAAA,IAGtB,CAAC,MAAM,EAAE,MAAM,SAAS;AAAA;AAG5B,MAAM,YAAY,sCAAO,eAAM,MAAM;AAAA,EACnC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,GAAG;AAAA;AAAA;AAAA;AAAA;AAML,MAAM,gBAAgB,sCAAO,eAAM,MAA4B;AAAA,EAC7D,eAAe;AAAA,EACf,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ,GAAG;AAAA;AAAA,IAED,CAAC,MAAO,EAAE,SAAS,qBAAqB,EAAE,MAAM,OAAO,QAAQ,SAAS;AAAA;AAAA;AAAA;AAK5E,MAAM,OAAO,iCAAO;AAAA,WACT,CAAC,MAAM,EAAE,MAAM,OAAO,QAAQ;AAAA;AAGzC,MAAM,QAAQ;AAAA,EACZ,OAAO;AAAA,EACP,UAAU;AAAA,IACR,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,aAAa;AAAA,MACb,cAAc;AAAA,MACd,SAAS;AAAA,QACP,SAA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MACE,KAAK;AAAA,MACL;AAAA,MACA,QAAQ,KAAK;AAAA,MACb,MAAM,KAAK;AAAA,MACX;AAAA,SAGJ,mDAAC,eAAD;AAAA,MAAM,SAAQ;AAAA,OACX,SACC,wFACG,KAAK,OAAO,GAAG,QAChB,mDAAC,MAAD,MAAO,KAAK,OAAO,OAAO,EAAE,UAC3B,KAAK,OAAO,QAAQ,EAAE,WAGzB;AAAA;AAAA;AAUpB,MAAM,eAAe,CAAC,SAAoB;AACxC,QAAM,QAAQ;AACd,QAAM,QAAQ,KAAK,SAAS,MAAM,OAAO,QAAQ;AAEjD,SAAO,mDAAC,qBAAD;AAAA,OAAU;AAAA,IAAM;AAAA;AAAA;AAGlB,MAAM,OAAO,aAAa,KAAK;AAC/B,MAAM,aAAa,aAAa,KAAK;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -23,10 +23,12 @@ var __toModule = (module2) => {
|
|
|
23
23
|
};
|
|
24
24
|
__export(exports, {
|
|
25
25
|
BoxedIcon: () => import_BoxedIcon.default,
|
|
26
|
+
CryptoIcon: () => import_CryptoIcon.default,
|
|
26
27
|
IconBox: () => import_BoxedIcon.IconBox,
|
|
27
28
|
default: () => import_Icon.default,
|
|
28
29
|
iconNames: () => import_Icon.iconNames
|
|
29
30
|
});
|
|
30
31
|
var import_Icon = __toModule(require("./Icon"));
|
|
31
32
|
var import_BoxedIcon = __toModule(require("./BoxedIcon"));
|
|
33
|
+
var import_CryptoIcon = __toModule(require("./CryptoIcon"));
|
|
32
34
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/asorted/Icon/index.tsx"],
|
|
4
|
-
"sourcesContent": ["export { default, iconNames } from \"./Icon\";\nimport BoxedIcon, { IconBox } from \"./BoxedIcon\";\nexport { BoxedIcon, IconBox };\nexport type { Props } from \"./Icon\";\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmC;AACnC,uBAAmC;",
|
|
4
|
+
"sourcesContent": ["export { default, iconNames } from \"./Icon\";\nimport BoxedIcon, { IconBox } from \"./BoxedIcon\";\nexport { BoxedIcon, IconBox };\nexport type { Props } from \"./Icon\";\nexport { default as CryptoIcon } from \"./CryptoIcon\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAmC;AACnC,uBAAmC;AAGnC,wBAAsC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -23,6 +23,7 @@ var __toModule = (module2) => {
|
|
|
23
23
|
};
|
|
24
24
|
__export(exports, {
|
|
25
25
|
BoxedIcon: () => import_Icon.BoxedIcon,
|
|
26
|
+
CryptoIcon: () => import_Icon.CryptoIcon,
|
|
26
27
|
Divider: () => import_Divider.default,
|
|
27
28
|
Icon: () => import_Icon.default,
|
|
28
29
|
IconBox: () => import_Icon.IconBox,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/asorted/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as Divider } from \"./Divider\";\nexport { default as Icon, IconBox, BoxedIcon } from \"./Icon\";\nexport { default as Text } from \"./Text\";\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmC;AACnC,
|
|
4
|
+
"sourcesContent": ["export { default as Divider } from \"./Divider\";\nexport { default as Icon, IconBox, BoxedIcon, CryptoIcon } from \"./Icon\";\nexport { default as Text } from \"./Text\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAmC;AACnC,kBAAgE;AAChE,kBAAgC;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -31,10 +31,9 @@ var import_Flex = __toModule(require("../../layout/Flex"));
|
|
|
31
31
|
const Wrapper = (0, import_styled_components.default)(import_Flex.default)`
|
|
32
32
|
width: 100%;
|
|
33
33
|
height: 100%;
|
|
34
|
-
background: gray;
|
|
35
34
|
flex-direction: column;
|
|
36
35
|
padding: ${(p) => p.theme.space[8]}px ${(p) => p.theme.space[10]}px;
|
|
37
|
-
padding-right: 280px;
|
|
36
|
+
padding-right: 280px; /* Nb gives air to not overlap the illustration */
|
|
38
37
|
z-index: ${(p) => p.theme.zIndexes[8]};
|
|
39
38
|
background: url(${(p) => p.image}) no-repeat ${(p) => p.theme.colors.neutral.c100};
|
|
40
39
|
background-size: contain;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/cards/Carousel/Slide.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport Text from \"../../asorted/Text\";\nimport Flex from \"../../layout/Flex\";\n\nconst Wrapper = styled(Flex)<{ image?: string }>`\n width: 100%;\n height: 100%;\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,+BAAmB;AACnB,kBAAiB;AACjB,kBAAiB;AAEjB,MAAM,UAAU,sCAAO;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport Text from \"../../asorted/Text\";\nimport Flex from \"../../layout/Flex\";\n\nconst Wrapper = styled(Flex)<{ image?: string }>`\n width: 100%;\n height: 100%;\n flex-direction: column;\n padding: ${(p) => p.theme.space[8]}px ${(p) => p.theme.space[10]}px;\n padding-right: 280px; /* Nb gives air to not overlap the illustration */\n z-index: ${(p) => p.theme.zIndexes[8]};\n background: url(${(p) => p.image}) no-repeat ${(p) => p.theme.colors.neutral.c100};\n background-size: contain;\n background-position: right 60px bottom;\n`;\n\nexport type Props = {\n onClick: () => void;\n title: string;\n description: string;\n image?: string;\n};\n\nconst Slide = ({ title, description, image, onClick }: Props): React.ReactElement => {\n return (\n <Wrapper key={\"key\"} image={image} onClick={onClick}>\n <Text variant={\"tiny\"} color=\"neutral.c00\" fontWeight=\"regular\">\n {title}\n </Text>\n <Text variant={\"h5\"} color=\"neutral.c00\" textTransform=\"uppercase\">\n {description}\n </Text>\n </Wrapper>\n );\n};\n\nexport default Slide;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,+BAAmB;AACnB,kBAAiB;AACjB,kBAAiB;AAEjB,MAAM,UAAU,sCAAO;AAAA;AAAA;AAAA;AAAA,aAIV,CAAC,MAAM,EAAE,MAAM,MAAM,QAAQ,CAAC,MAAM,EAAE,MAAM,MAAM;AAAA;AAAA,aAElD,CAAC,MAAM,EAAE,MAAM,SAAS;AAAA,oBACjB,CAAC,MAAM,EAAE,oBAAoB,CAAC,MAAM,EAAE,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAY/E,MAAM,QAAQ,CAAC,EAAE,OAAO,aAAa,OAAO,cAAyC;AACnF,SACE,mDAAC,SAAD;AAAA,IAAS,KAAK;AAAA,IAAO;AAAA,IAAc;AAAA,KACjC,mDAAC,qBAAD;AAAA,IAAM,SAAS;AAAA,IAAQ,OAAM;AAAA,IAAc,YAAW;AAAA,KACnD,QAEH,mDAAC,qBAAD;AAAA,IAAM,SAAS;AAAA,IAAM,OAAM;AAAA,IAAc,eAAc;AAAA,KACpD;AAAA;AAMT,IAAO,gBAAQ;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -91,6 +91,8 @@ const BaseInput = import_styled_components.default.input.attrs({
|
|
|
91
91
|
color: ${(p) => p.disabled ? p.theme.colors.neutral.c50 : p.theme.colors.neutral.c70};
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
+
/* stylelint-disable property-no-vendor-prefix */
|
|
95
|
+
|
|
94
96
|
/* Hide type=number arrow for Chrome, Safari, Edge, Opera */
|
|
95
97
|
&::-webkit-outer-spin-button,
|
|
96
98
|
::-webkit-inner-spin-button {
|
|
@@ -102,6 +104,7 @@ const BaseInput = import_styled_components.default.input.attrs({
|
|
|
102
104
|
&[type="number"] {
|
|
103
105
|
-moz-appearance: textfield;
|
|
104
106
|
}
|
|
107
|
+
/* stylelint-enable property-no-vendor-prefix */
|
|
105
108
|
|
|
106
109
|
${import_styled_system.typography}
|
|
107
110
|
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/form/BaseInput/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import styled, { css } from \"styled-components\";\nimport { typography, TypographyProps } from \"styled-system\";\nimport React, { InputHTMLAttributes, useState, useMemo, useCallback } from \"react\";\nimport CircledCrossSolidMedium from \"@ledgerhq/icons-ui/react/CircledCrossSolidMedium\";\nimport FlexBox from \"../../layout/Flex\";\nimport Text from \"../../asorted/Text\";\nimport { rgba } from \"../../../styles/helpers\";\nimport { ButtonUnstyled } from \"../../cta/Button\";\n\ntype ValueType = HTMLInputElement[\"value\"];\n\nexport type CommonProps = InputHTMLAttributes<HTMLInputElement> &\n TypographyProps & {\n disabled?: boolean;\n error?: string;\n warning?: string;\n };\n\nexport type InputProps<T = ValueType> = Omit<CommonProps, \"value\" | \"onChange\"> & {\n value: T;\n onChange?: (value: T) => void;\n onChangeEvent?: InputHTMLAttributes<HTMLInputElement>[\"onChange\"];\n renderLeft?: ((props: InputProps<T>) => React.ReactNode) | React.ReactNode;\n renderRight?: ((props: InputProps<T>) => React.ReactNode) | React.ReactNode;\n unwrapped?: boolean;\n containerProps?: InputContainerProps;\n clearable?: boolean;\n /**\n * A function can be provided to serialize a value of any type to a string.\n *\n * This can be useful to wrap the `<BaseInput />` component (which expects a string)\n * and create higher-level components that will automatically perform the input/output\n * conversion to other types.\n *\n * *A serializer function should always be used in conjunction with a deserializer function.*\n */\n serialize?: (value: T) => ValueType;\n /**\n * A deserializer can be provided to convert the html input value from a string to any other type.\n *\n * *A deserializer function should always be used in conjunction with a serializer function.*\n */\n deserialize?: (value: ValueType) => T;\n};\n\nexport type InputContainerProps = React.ComponentProps<typeof InputContainer>;\nexport const InputContainer = styled.div<Partial<CommonProps> & { focus?: boolean }>`\n display: flex;\n height: 48px;\n border: ${(p) => `1px solid ${p.theme.colors.neutral.c40}`};\n border-radius: 24px;\n transition: all 0.2s ease;\n color: ${(p) => p.theme.colors.neutral.c100};\n\n ${(p) =>\n p.focus &&\n !p.error &&\n !p.warning &&\n css`\n border: 1px solid ${p.theme.colors.primary.c80};\n box-shadow: 0 0 0 4px ${rgba(p.theme.colors.primary.c60, 0.4)};\n `};\n\n ${(p) =>\n p.error &&\n !p.disabled &&\n css`\n border: 1px solid ${p.theme.colors.error.c100};\n `};\n\n ${(p) =>\n !p.error &&\n p.warning &&\n !p.disabled &&\n css`\n border: 1px solid ${p.theme.colors.warning.c80};\n `};\n\n ${(p) =>\n !p.error &&\n !p.warning &&\n !p.disabled &&\n css`\n &:hover {\n border: ${!p.disabled && `1px solid ${p.theme.colors.primary.c80}`};\n }\n `};\n\n ${(p) =>\n p.disabled &&\n css`\n color: ${p.theme.colors.neutral.c60};\n background: ${(p) => p.theme.colors.neutral.c20};\n `};\n`;\n\nexport const BaseInput = styled.input.attrs<\n Partial<CommonProps> & { focus?: boolean } & TypographyProps\n>({\n fontSize: \"paragraph\",\n fontWeight: \"medium\",\n})<Partial<CommonProps> & { focus?: boolean } & TypographyProps>`\n height: 100%;\n width: 100%;\n border: 0;\n caret-color: ${(p) => (p.error ? p.theme.colors.error.c100 : p.theme.colors.primary.c80)};\n background: none;\n outline: none;\n cursor: ${(p) => (p.disabled ? \"not-allowed\" : \"text\")};\n flex-shrink: 1;\n padding-top: 14px;\n padding-bottom: 14px;\n padding-left: 20px;\n padding-right: 20px;\n &::placeholder {\n color: ${(p) => (p.disabled ? p.theme.colors.neutral.c50 : p.theme.colors.neutral.c70)};\n }\n\n /* Hide type=number arrow for Chrome, Safari, Edge, Opera */\n &::-webkit-outer-spin-button,\n ::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Hide type=number arrow for Firefox */\n &[type=\"number\"] {\n -moz-appearance: textfield;\n }\n\n ${typography}\n`;\n\nexport const InputErrorContainer = styled(Text)`\n color: ${(p) => p.theme.colors.error.c100};\n margin-left: 12px;\n`;\nexport const InputWarningContainer = styled(Text)`\n color: ${(p) => p.theme.colors.warning.c80};\n margin-left: 12px;\n`;\n\nexport const InputRenderLeftContainer = styled(FlexBox).attrs(() => ({\n alignItems: \"center\",\n pl: \"16px\",\n}))``;\n\nexport const InputRenderRightContainer = styled(FlexBox).attrs(() => ({\n alignItems: \"center\",\n pr: \"16px\",\n}))``;\n\nexport const ClearableButtonUnstyled = styled(ButtonUnstyled)`\n display: flex;\n`;\n\n// Yes, this is dirty. If you can figure out a better way please change the code :).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst IDENTITY = (_: any): any => _;\n\nfunction Input<T = ValueType>(\n props: InputProps<T>,\n ref?: React.ForwardedRef<HTMLInputElement>,\n): JSX.Element {\n const {\n value,\n disabled,\n error,\n warning,\n onChange,\n onChangeEvent,\n renderLeft,\n renderRight,\n unwrapped,\n containerProps,\n serialize = IDENTITY,\n deserialize = IDENTITY,\n clearable,\n ...htmlInputProps\n } = props;\n const [focus, setFocus] = useState(false);\n const inputValue = useMemo(() => serialize(value), [serialize, value]);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange && onChange(deserialize(e.target.value));\n onChangeEvent && onChangeEvent(e);\n },\n [onChange, onChangeEvent, deserialize],\n );\n\n const handleClear = useCallback(() => {\n onChange && onChange(deserialize(\"\"));\n }, [onChange, deserialize]);\n\n const inner = (\n <>\n {typeof renderLeft === \"function\" ? renderLeft(props) : renderLeft}\n <BaseInput\n ref={ref}\n {...htmlInputProps}\n disabled={disabled}\n error={error}\n warning={warning}\n onChange={handleChange}\n value={inputValue}\n onFocus={(event: React.FocusEvent<HTMLInputElement>) => {\n setFocus(true);\n htmlInputProps.onFocus && htmlInputProps.onFocus(event);\n }}\n onBlur={(event: React.FocusEvent<HTMLInputElement>) => {\n setFocus(false);\n htmlInputProps.onBlur && htmlInputProps.onBlur(event);\n }}\n />\n {clearable && inputValue && (\n <FlexBox alignItems={\"center\"} mr={7}>\n <ClearableButtonUnstyled onClick={handleClear}>\n <CircledCrossSolidMedium size={18} color={\"neutral.c50\"} />\n </ClearableButtonUnstyled>\n </FlexBox>\n )}\n {typeof renderRight === \"function\" ? renderRight(props) : renderRight}\n </>\n );\n\n if (unwrapped) {\n return (\n <FlexBox alignItems=\"stretch\" style={{ height: \"100%\" }}>\n {inner}\n </FlexBox>\n );\n }\n\n return (\n <div>\n <InputContainer\n disabled={disabled}\n focus={focus}\n error={error}\n warning={warning}\n {...containerProps}\n >\n {inner}\n </InputContainer>\n {(error || warning) && !disabled && (\n <FlexBox flexDirection=\"column\" rowGap={2} mt={2}>\n {error && <InputErrorContainer variant=\"small\">{error}</InputErrorContainer>}\n {warning && <InputWarningContainer variant=\"small\">{warning}</InputWarningContainer>}\n </FlexBox>\n )}\n </div>\n );\n}\n\nexport default React.forwardRef(Input) as <T>(\n props: InputProps<T> & { ref?: React.ForwardedRef<HTMLInputElement> },\n) => ReturnType<typeof Input>;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAA4B;AAC5B,2BAA4C;AAC5C,mBAA2E;AAC3E,qCAAoC;AACpC,kBAAoB;AACpB,kBAAiB;AACjB,qBAAqB;AACrB,oBAA+B;A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AA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"sourcesContent": ["import styled, { css } from \"styled-components\";\nimport { typography, TypographyProps } from \"styled-system\";\nimport React, { InputHTMLAttributes, useState, useMemo, useCallback } from \"react\";\nimport CircledCrossSolidMedium from \"@ledgerhq/icons-ui/react/CircledCrossSolidMedium\";\nimport FlexBox from \"../../layout/Flex\";\nimport Text from \"../../asorted/Text\";\nimport { rgba } from \"../../../styles/helpers\";\nimport { ButtonUnstyled } from \"../../cta/Button\";\n\ntype ValueType = HTMLInputElement[\"value\"];\n\nexport type CommonProps = InputHTMLAttributes<HTMLInputElement> &\n TypographyProps & {\n disabled?: boolean;\n error?: string;\n warning?: string;\n };\n\nexport type InputProps<T = ValueType> = Omit<CommonProps, \"value\" | \"onChange\"> & {\n value: T;\n onChange?: (value: T) => void;\n onChangeEvent?: InputHTMLAttributes<HTMLInputElement>[\"onChange\"];\n renderLeft?: ((props: InputProps<T>) => React.ReactNode) | React.ReactNode;\n renderRight?: ((props: InputProps<T>) => React.ReactNode) | React.ReactNode;\n unwrapped?: boolean;\n containerProps?: InputContainerProps;\n clearable?: boolean;\n /**\n * A function can be provided to serialize a value of any type to a string.\n *\n * This can be useful to wrap the `<BaseInput />` component (which expects a string)\n * and create higher-level components that will automatically perform the input/output\n * conversion to other types.\n *\n * *A serializer function should always be used in conjunction with a deserializer function.*\n */\n serialize?: (value: T) => ValueType;\n /**\n * A deserializer can be provided to convert the html input value from a string to any other type.\n *\n * *A deserializer function should always be used in conjunction with a serializer function.*\n */\n deserialize?: (value: ValueType) => T;\n};\n\nexport type InputContainerProps = React.ComponentProps<typeof InputContainer>;\nexport const InputContainer = styled.div<Partial<CommonProps> & { focus?: boolean }>`\n display: flex;\n height: 48px;\n border: ${(p) => `1px solid ${p.theme.colors.neutral.c40}`};\n border-radius: 24px;\n transition: all 0.2s ease;\n color: ${(p) => p.theme.colors.neutral.c100};\n\n ${(p) =>\n p.focus &&\n !p.error &&\n !p.warning &&\n css`\n border: 1px solid ${p.theme.colors.primary.c80};\n box-shadow: 0 0 0 4px ${rgba(p.theme.colors.primary.c60, 0.4)};\n `};\n\n ${(p) =>\n p.error &&\n !p.disabled &&\n css`\n border: 1px solid ${p.theme.colors.error.c100};\n `};\n\n ${(p) =>\n !p.error &&\n p.warning &&\n !p.disabled &&\n css`\n border: 1px solid ${p.theme.colors.warning.c80};\n `};\n\n ${(p) =>\n !p.error &&\n !p.warning &&\n !p.disabled &&\n css`\n &:hover {\n border: ${!p.disabled && `1px solid ${p.theme.colors.primary.c80}`};\n }\n `};\n\n ${(p) =>\n p.disabled &&\n css`\n color: ${p.theme.colors.neutral.c60};\n background: ${(p) => p.theme.colors.neutral.c20};\n `};\n`;\n\nexport const BaseInput = styled.input.attrs<\n Partial<CommonProps> & { focus?: boolean } & TypographyProps\n>({\n fontSize: \"paragraph\",\n fontWeight: \"medium\",\n})<Partial<CommonProps> & { focus?: boolean } & TypographyProps>`\n height: 100%;\n width: 100%;\n border: 0;\n caret-color: ${(p) => (p.error ? p.theme.colors.error.c100 : p.theme.colors.primary.c80)};\n background: none;\n outline: none;\n cursor: ${(p) => (p.disabled ? \"not-allowed\" : \"text\")};\n flex-shrink: 1;\n padding-top: 14px;\n padding-bottom: 14px;\n padding-left: 20px;\n padding-right: 20px;\n &::placeholder {\n color: ${(p) => (p.disabled ? p.theme.colors.neutral.c50 : p.theme.colors.neutral.c70)};\n }\n\n /* stylelint-disable property-no-vendor-prefix */\n\n /* Hide type=number arrow for Chrome, Safari, Edge, Opera */\n &::-webkit-outer-spin-button,\n ::-webkit-inner-spin-button {\n -webkit-appearance: none;\n margin: 0;\n }\n\n /* Hide type=number arrow for Firefox */\n &[type=\"number\"] {\n -moz-appearance: textfield;\n }\n /* stylelint-enable property-no-vendor-prefix */\n\n ${typography}\n`;\n\nexport const InputErrorContainer = styled(Text)`\n color: ${(p) => p.theme.colors.error.c100};\n margin-left: 12px;\n`;\nexport const InputWarningContainer = styled(Text)`\n color: ${(p) => p.theme.colors.warning.c80};\n margin-left: 12px;\n`;\n\nexport const InputRenderLeftContainer = styled(FlexBox).attrs(() => ({\n alignItems: \"center\",\n pl: \"16px\",\n}))``;\n\nexport const InputRenderRightContainer = styled(FlexBox).attrs(() => ({\n alignItems: \"center\",\n pr: \"16px\",\n}))``;\n\nexport const ClearableButtonUnstyled = styled(ButtonUnstyled)`\n display: flex;\n`;\n\n// Yes, this is dirty. If you can figure out a better way please change the code :).\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst IDENTITY = (_: any): any => _;\n\nfunction Input<T = ValueType>(\n props: InputProps<T>,\n ref?: React.ForwardedRef<HTMLInputElement>,\n): JSX.Element {\n const {\n value,\n disabled,\n error,\n warning,\n onChange,\n onChangeEvent,\n renderLeft,\n renderRight,\n unwrapped,\n containerProps,\n serialize = IDENTITY,\n deserialize = IDENTITY,\n clearable,\n ...htmlInputProps\n } = props;\n const [focus, setFocus] = useState(false);\n const inputValue = useMemo(() => serialize(value), [serialize, value]);\n\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n onChange && onChange(deserialize(e.target.value));\n onChangeEvent && onChangeEvent(e);\n },\n [onChange, onChangeEvent, deserialize],\n );\n\n const handleClear = useCallback(() => {\n onChange && onChange(deserialize(\"\"));\n }, [onChange, deserialize]);\n\n const inner = (\n <>\n {typeof renderLeft === \"function\" ? renderLeft(props) : renderLeft}\n <BaseInput\n ref={ref}\n {...htmlInputProps}\n disabled={disabled}\n error={error}\n warning={warning}\n onChange={handleChange}\n value={inputValue}\n onFocus={(event: React.FocusEvent<HTMLInputElement>) => {\n setFocus(true);\n htmlInputProps.onFocus && htmlInputProps.onFocus(event);\n }}\n onBlur={(event: React.FocusEvent<HTMLInputElement>) => {\n setFocus(false);\n htmlInputProps.onBlur && htmlInputProps.onBlur(event);\n }}\n />\n {clearable && inputValue && (\n <FlexBox alignItems={\"center\"} mr={7}>\n <ClearableButtonUnstyled onClick={handleClear}>\n <CircledCrossSolidMedium size={18} color={\"neutral.c50\"} />\n </ClearableButtonUnstyled>\n </FlexBox>\n )}\n {typeof renderRight === \"function\" ? renderRight(props) : renderRight}\n </>\n );\n\n if (unwrapped) {\n return (\n <FlexBox alignItems=\"stretch\" style={{ height: \"100%\" }}>\n {inner}\n </FlexBox>\n );\n }\n\n return (\n <div>\n <InputContainer\n disabled={disabled}\n focus={focus}\n error={error}\n warning={warning}\n {...containerProps}\n >\n {inner}\n </InputContainer>\n {(error || warning) && !disabled && (\n <FlexBox flexDirection=\"column\" rowGap={2} mt={2}>\n {error && <InputErrorContainer variant=\"small\">{error}</InputErrorContainer>}\n {warning && <InputWarningContainer variant=\"small\">{warning}</InputWarningContainer>}\n </FlexBox>\n )}\n </div>\n );\n}\n\nexport default React.forwardRef(Input) as <T>(\n props: InputProps<T> & { ref?: React.ForwardedRef<HTMLInputElement> },\n) => ReturnType<typeof Input>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+BAA4B;AAC5B,2BAA4C;AAC5C,mBAA2E;AAC3E,qCAAoC;AACpC,kBAAoB;AACpB,kBAAiB;AACjB,qBAAqB;AACrB,oBAA+B;AAuCxB,MAAM,iBAAiB,iCAAO;AAAA;AAAA;AAAA,YAGzB,CAAC,MAAM,aAAa,EAAE,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA,WAG5C,CAAC,MAAM,EAAE,MAAM,OAAO,QAAQ;AAAA;AAAA,IAErC,CAAC,MACD,EAAE,SACF,CAAC,EAAE,SACH,CAAC,EAAE,WACH;AAAA,0BACsB,EAAE,MAAM,OAAO,QAAQ;AAAA,8BACnB,yBAAK,EAAE,MAAM,OAAO,QAAQ,KAAK;AAAA;AAAA;AAAA,IAG3D,CAAC,MACD,EAAE,SACF,CAAC,EAAE,YACH;A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;AAI9D,MAAI,WAAW;AACb,WACE,mDAAC,qBAAD;AAAA,MAAS,YAAW;AAAA,MAAU,OAAO,EAAE,QAAQ;AAAA,OAC5C;AAAA;AAKP,SACE,mDAAC,OAAD,MACE,mDAAC,gBAAD;AAAA,IACE;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,OACI;AAAA,KAEH,QAED,UAAS,YAAY,CAAC,YACtB,mDAAC,qBAAD;AAAA,IAAS,eAAc;AAAA,IAAS,QAAQ;AAAA,IAAG,IAAI;AAAA,KAC5C,SAAS,mDAAC,qBAAD;AAAA,IAAqB,SAAQ;AAAA,KAAS,QAC/C,WAAW,mDAAC,uBAAD;AAAA,IAAuB,SAAQ;AAAA,KAAS;AAAA;AAO9D,IAAO,oBAAQ,qBAAM,WAAW;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -45,6 +45,19 @@ var styles_default = import_styled_components.css`
|
|
|
45
45
|
transition-property: transform, visibility, opacity;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
.tippy-arrow {
|
|
49
|
+
width: 16px;
|
|
50
|
+
height: 16px;
|
|
51
|
+
color: ${(p) => p.theme.colors.neutral.c100};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.tippy-arrow:before {
|
|
55
|
+
content: "";
|
|
56
|
+
position: absolute;
|
|
57
|
+
border-color: transparent;
|
|
58
|
+
border-style: solid;
|
|
59
|
+
}
|
|
60
|
+
|
|
48
61
|
.tippy-box[data-placement^="top"] > .tippy-arrow {
|
|
49
62
|
bottom: 0;
|
|
50
63
|
}
|
|
@@ -95,19 +108,6 @@ var styles_default = import_styled_components.css`
|
|
|
95
108
|
transition-timing-function: cubic-bezier(0.54, 1.5, 0.38, 1.11);
|
|
96
109
|
}
|
|
97
110
|
|
|
98
|
-
.tippy-arrow {
|
|
99
|
-
width: 16px;
|
|
100
|
-
height: 16px;
|
|
101
|
-
color: ${(p) => p.theme.colors.neutral.c100};
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.tippy-arrow:before {
|
|
105
|
-
content: "";
|
|
106
|
-
position: absolute;
|
|
107
|
-
border-color: transparent;
|
|
108
|
-
border-style: solid;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
111
|
.tippy-content {
|
|
112
112
|
position: relative;
|
|
113
113
|
padding: 8px 10px;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../src/components/message/Tooltip/styles.ts"],
|
|
4
|
-
"sourcesContent": ["import { DefaultTheme, css } from \"styled-components\";\n\ntype Props = { theme: DefaultTheme };\n\nexport default css`\n .tippy-box[data-animation=\"fade\"][data-state=\"hidden\"] {\n opacity: 0;\n }\n\n [data-tippy-root] {\n max-width: calc(100vw - 10px);\n }\n\n .tippy-box {\n position: relative;\n background-color: ${(p: Props) => p.theme.colors.neutral.c100};\n color: ${(p: Props) => p.theme.colors.neutral.c00};\n border-radius: 4px;\n font-size: 14px;\n line-height: 1.4;\n outline: 0;\n transition-property: transform, visibility, opacity;\n }\n\n .tippy-box[data-placement^=\"top\"] > .tippy-arrow {\n bottom: 0;\n }\n\n .tippy-box[data-placement^=\"top\"] > .tippy-arrow:before {\n bottom: -4px;\n left: 0;\n border-width: 10px 10px 0;\n border-top-color: initial;\n transform-origin: center top;\n }\n\n .tippy-box[data-placement^=\"bottom\"] > .tippy-arrow {\n top: 0;\n }\n\n .tippy-box[data-placement^=\"bottom\"] > .tippy-arrow:before {\n top: -4px;\n left: 0;\n border-width: 0 10px 10px;\n border-bottom-color: initial;\n transform-origin: center bottom;\n }\n\n .tippy-box[data-placement^=\"left\"] > .tippy-arrow {\n right: 0;\n }\n\n .tippy-box[data-placement^=\"left\"] > .tippy-arrow:before {\n border-width: 10px 0 10px 10px;\n border-left-color: initial;\n right: -4px;\n transform-origin: center left;\n }\n\n .tippy-box[data-placement^=\"right\"] > .tippy-arrow {\n left: 0;\n }\n\n .tippy-box[data-placement^=\"right\"] > .tippy-arrow:before {\n left: -4px;\n border-width: 10px 10px 10px 0;\n border-right-color: initial;\n transform-origin: center right;\n }\n\n .tippy-box[data-inertia][data-state=\"visible\"] {\n transition-timing-function: cubic-bezier(0.54, 1.5, 0.38, 1.11);\n }\n\n .tippy-
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAkC;AAIlC,IAAO,iBAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAWS,CAAC,MAAa,EAAE,MAAM,OAAO,QAAQ;AAAA,aAChD,CAAC,MAAa,EAAE,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA
|
|
4
|
+
"sourcesContent": ["import { DefaultTheme, css } from \"styled-components\";\n\ntype Props = { theme: DefaultTheme };\n\nexport default css`\n .tippy-box[data-animation=\"fade\"][data-state=\"hidden\"] {\n opacity: 0;\n }\n\n [data-tippy-root] {\n max-width: calc(100vw - 10px);\n }\n\n .tippy-box {\n position: relative;\n background-color: ${(p: Props) => p.theme.colors.neutral.c100};\n color: ${(p: Props) => p.theme.colors.neutral.c00};\n border-radius: 4px;\n font-size: 14px;\n line-height: 1.4;\n outline: 0;\n transition-property: transform, visibility, opacity;\n }\n\n .tippy-arrow {\n width: 16px;\n height: 16px;\n color: ${(p: Props) => p.theme.colors.neutral.c100};\n }\n\n .tippy-arrow:before {\n content: \"\";\n position: absolute;\n border-color: transparent;\n border-style: solid;\n }\n\n .tippy-box[data-placement^=\"top\"] > .tippy-arrow {\n bottom: 0;\n }\n\n .tippy-box[data-placement^=\"top\"] > .tippy-arrow:before {\n bottom: -4px;\n left: 0;\n border-width: 10px 10px 0;\n border-top-color: initial;\n transform-origin: center top;\n }\n\n .tippy-box[data-placement^=\"bottom\"] > .tippy-arrow {\n top: 0;\n }\n\n .tippy-box[data-placement^=\"bottom\"] > .tippy-arrow:before {\n top: -4px;\n left: 0;\n border-width: 0 10px 10px;\n border-bottom-color: initial;\n transform-origin: center bottom;\n }\n\n .tippy-box[data-placement^=\"left\"] > .tippy-arrow {\n right: 0;\n }\n\n .tippy-box[data-placement^=\"left\"] > .tippy-arrow:before {\n border-width: 10px 0 10px 10px;\n border-left-color: initial;\n right: -4px;\n transform-origin: center left;\n }\n\n .tippy-box[data-placement^=\"right\"] > .tippy-arrow {\n left: 0;\n }\n\n .tippy-box[data-placement^=\"right\"] > .tippy-arrow:before {\n left: -4px;\n border-width: 10px 10px 10px 0;\n border-right-color: initial;\n transform-origin: center right;\n }\n\n .tippy-box[data-inertia][data-state=\"visible\"] {\n transition-timing-function: cubic-bezier(0.54, 1.5, 0.38, 1.11);\n }\n\n .tippy-content {\n position: relative;\n padding: 8px 10px;\n z-index: 1;\n }\n`;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAkC;AAIlC,IAAO,iBAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAWS,CAAC,MAAa,EAAE,MAAM,OAAO,QAAQ;AAAA,aAChD,CAAC,MAAa,EAAE,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,aAWrC,CAAC,MAAa,EAAE,MAAM,OAAO,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -37,7 +37,7 @@ const Bar = import_styled_components.default.div`
|
|
|
37
37
|
transition: all 600ms linear;
|
|
38
38
|
height: 4px;
|
|
39
39
|
border-radius: 2px;
|
|
40
|
-
|
|
40
|
+
/* Disable left/right border radius to match the handler */
|
|
41
41
|
border-top-${(p) => p.on ? "right" : "left"}-radius: 0;
|
|
42
42
|
border-bottom-${(p) => p.on ? "right" : "left"}-radius: 0;
|
|
43
43
|
flex: ${(p) => p.fill};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../../../src/components/navigation/progress/ProgressBar/Onboarding.tsx"],
|
|
4
|
-
"sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport Text from \"../../../asorted/Text\";\n\nconst Container = styled.div`\n display: flex;\n flex-direction: row;\n height: 24px;\n align-items: center;\n`;\n\nconst Bar = styled.div<{ on?: boolean; fill: string | number }>`\n transition: all 600ms linear;\n height: 4px;\n border-radius: 2px;\n
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport styled from \"styled-components\";\nimport Text from \"../../../asorted/Text\";\n\nconst Container = styled.div`\n display: flex;\n flex-direction: row;\n height: 24px;\n align-items: center;\n`;\n\nconst Bar = styled.div<{ on?: boolean; fill: string | number }>`\n transition: all 600ms linear;\n height: 4px;\n border-radius: 2px;\n /* Disable left/right border radius to match the handler */\n border-top-${(p) => (p.on ? \"right\" : \"left\")}-radius: 0;\n border-bottom-${(p) => (p.on ? \"right\" : \"left\")}-radius: 0;\n flex: ${(p) => p.fill};\n background: ${(p) => (p.on ? p.theme.colors.neutral.c100 : p.theme.colors.neutral.c40)};\n`;\n\nconst Handler = styled.div`\n transition: all 600ms linear;\n padding: 4px;\n background: ${(p) => p.theme.colors.neutral.c100};\n border-radius: ${(p) => `${p.theme.radii[1]}px`};\n\n display: flex;\n align-items: center;\n justify-content: center;\n column-gap: 6px;\n\n & span.index {\n display: flex;\n border-radius: 2px;\n height: 16px;\n width: 16px;\n justify-content: center;\n align-items: center;\n color: ${(p) => p.theme.colors.neutral.c100};\n background: ${(p) => p.theme.colors.neutral.c00};\n }\n`;\n\ninterface Step {\n key: string;\n label: string;\n}\n\nexport type OnboardingProps = {\n steps: Step[];\n currentIndex: number;\n};\n\nconst Onboarding = ({ steps, currentIndex }: OnboardingProps): JSX.Element => {\n const currentStep = steps[currentIndex];\n const fill = ((currentIndex / (steps.length - 1)) * 100).toFixed(2);\n\n return (\n <Container>\n <Bar on fill={fill} />\n <Handler key={currentStep.key}>\n <Text className=\"index\" color=\"neutral.c00\" fontWeight=\"medium\" variant={\"micro\"}>\n {currentIndex + 1}\n </Text>\n <Text color=\"neutral.c00\" fontWeight=\"medium\" textTransform=\"uppercase\" variant={\"micro\"}>\n {currentStep.label}\n </Text>\n </Handler>\n <Bar fill={100 - Number(fill)} />\n </Container>\n );\n};\n\nexport default Onboarding;\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,+BAAmB;AACnB,kBAAiB;AAEjB,MAAM,YAAY,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAOzB,MAAM,MAAM,iCAAO;AAAA;AAAA;AAAA;AAAA;AAAA,eAKJ,CAAC,MAAO,EAAE,KAAK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body {
|
|
37
|
-
font-family: Inter;
|
|
37
|
+
font-family: Inter, sans-serif;
|
|
38
38
|
font-size: 100%;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -57,5 +57,27 @@ const GlobalStyle = import_styled_components.createGlobalStyle`
|
|
|
57
57
|
${(props) => typeof props.fontsPath === "string" ? import_styles2.fontStyles : ""}
|
|
58
58
|
|
|
59
59
|
${import_styles.default}
|
|
60
|
+
|
|
61
|
+
::-webkit-scrollbar {
|
|
62
|
+
width: 12px;
|
|
63
|
+
height: 12px;
|
|
64
|
+
background-color: rgba(0,0,0,0);
|
|
65
|
+
}
|
|
66
|
+
::-webkit-scrollbar-button {
|
|
67
|
+
opacity: 0;
|
|
68
|
+
height: 0;
|
|
69
|
+
width: 0;
|
|
70
|
+
}
|
|
71
|
+
::-webkit-scrollbar-track {
|
|
72
|
+
background-color: rgba(0,0,0,0);
|
|
73
|
+
}
|
|
74
|
+
::-webkit-scrollbar-thumb {
|
|
75
|
+
box-shadow: inset 0 0 0 12px var(--track-color);
|
|
76
|
+
border: 2px solid rgba(0,0,0,0);
|
|
77
|
+
border-radius: 12px;
|
|
78
|
+
}
|
|
79
|
+
::-webkit-scrollbar-corner {
|
|
80
|
+
opacity: 0;
|
|
81
|
+
}
|
|
60
82
|
`;
|
|
61
83
|
//# sourceMappingURL=global.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/styles/global.ts"],
|
|
4
|
-
"sourcesContent": ["import { createGlobalStyle } from \"styled-components\";\n\nimport { rgba } from \"./helpers\";\nimport tippyStyles from \"../components/message/Tooltip/styles\";\nimport { fontStyles } from \"../components/asorted/Text/styles\";\n\nexport type GlobalStyleProps = {\n fontsPath?: string;\n fontMappings?: (name: string) => string;\n};\n\nexport const GlobalStyle = createGlobalStyle<GlobalStyleProps>`\n html {\n box-sizing: border-box;\n }\n\n body {\n font-family: Inter;\n font-size: 100%;\n }\n\n * {\n margin: 0;\n padding: 0;\n font: inherit;\n color: inherit;\n user-select: inherit;\n cursor: inherit;\n outline: none;\n }\n\n ::selection {\n background: ${(p) => rgba(p.theme.colors.primary.c100, 0.1)};\n }\n\n --track-color: rgba(0,0,0,0);\n\n ${(props) => (typeof props.fontsPath === \"string\" ? fontStyles : \"\")}\n\n ${tippyStyles}\n`;\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAkC;AAElC,qBAAqB;AACrB,oBAAwB;AACxB,qBAA2B;AAOpB,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAqBT,CAAC,MAAM,yBAAK,EAAE,MAAM,OAAO,QAAQ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAKvD,CAAC,UAAW,OAAO,MAAM,cAAc,WAAW,4BAAa;AAAA;AAAA,IAE/D;AAAA;",
|
|
4
|
+
"sourcesContent": ["import { createGlobalStyle } from \"styled-components\";\n\nimport { rgba } from \"./helpers\";\nimport tippyStyles from \"../components/message/Tooltip/styles\";\nimport { fontStyles } from \"../components/asorted/Text/styles\";\n\nexport type GlobalStyleProps = {\n fontsPath?: string;\n fontMappings?: (name: string) => string;\n};\n\nexport const GlobalStyle = createGlobalStyle<GlobalStyleProps>`\n html {\n box-sizing: border-box;\n }\n\n body {\n font-family: Inter, sans-serif;\n font-size: 100%;\n }\n\n * {\n margin: 0;\n padding: 0;\n font: inherit;\n color: inherit;\n user-select: inherit;\n cursor: inherit;\n outline: none;\n }\n\n ::selection {\n background: ${(p) => rgba(p.theme.colors.primary.c100, 0.1)};\n }\n\n --track-color: rgba(0,0,0,0);\n\n ${(props) => (typeof props.fontsPath === \"string\" ? fontStyles : \"\")}\n\n ${tippyStyles}\n\n ::-webkit-scrollbar {\n width: 12px;\n height: 12px;\n background-color: rgba(0,0,0,0);\n }\n ::-webkit-scrollbar-button {\n opacity: 0;\n height: 0;\n width: 0;\n }\n ::-webkit-scrollbar-track {\n background-color: rgba(0,0,0,0);\n }\n ::-webkit-scrollbar-thumb {\n box-shadow: inset 0 0 0 12px var(--track-color);\n border: 2px solid rgba(0,0,0,0);\n border-radius: 12px;\n }\n ::-webkit-scrollbar-corner {\n opacity: 0;\n }\n`;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,+BAAkC;AAElC,qBAAqB;AACrB,oBAAwB;AACxB,qBAA2B;AAOpB,MAAM,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAqBT,CAAC,MAAM,yBAAK,EAAE,MAAM,OAAO,QAAQ,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,IAKvD,CAAC,UAAW,OAAO,MAAM,cAAc,WAAW,4BAAa;AAAA;AAAA,IAE/D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -23,6 +23,7 @@ var __toModule = (module2) => {
|
|
|
23
23
|
};
|
|
24
24
|
__export(exports, {
|
|
25
25
|
darken: () => darken,
|
|
26
|
+
ensureContrast: () => ensureContrast,
|
|
26
27
|
ff: () => ff,
|
|
27
28
|
lighten: () => lighten,
|
|
28
29
|
mix: () => mix,
|
|
@@ -44,4 +45,13 @@ const ff = (v) => {
|
|
|
44
45
|
fontStyle: style
|
|
45
46
|
};
|
|
46
47
|
};
|
|
48
|
+
const ensureContrast = (color1, color2) => {
|
|
49
|
+
const colorL1 = (0, import_color.default)(color1).luminosity() + 0.05;
|
|
50
|
+
const colorL2 = (0, import_color.default)(color2).luminosity() + 0.05;
|
|
51
|
+
const lRatio = colorL1 > colorL2 ? colorL1 / colorL2 : colorL2 / colorL1;
|
|
52
|
+
if (lRatio < 1.5) {
|
|
53
|
+
return (0, import_color.default)(color1).rotate(180).negate().string();
|
|
54
|
+
}
|
|
55
|
+
return color1;
|
|
56
|
+
};
|
|
47
57
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/styles/helpers.ts"],
|
|
4
|
-
"sourcesContent": ["import Color from \"color\";\n\nimport { fontFamilies } from \"./theme\";\n\nexport const rgba = (c: string, a: number): string => Color(c).alpha(a).rgb().toString();\n\nexport const darken = (c: string, a: number): string => Color(c).darken(a).toString();\n\nexport const lighten = (c: string, a: number): string => Color(c).lighten(a).toString();\n\nexport const mix = (c: string, b: string, a: number): string =>\n Color(c).mix(Color(b), a).toString();\n\nexport const ff = (v: string) => {\n const [font, type = \"Regular\"] = v.split(\"|\");\n // @ts-expect-error FIXME\n const { style, weight } = fontFamilies[font][type];\n // @ts-expect-error FIXME\n const fallback: string = fontFamilies[font].fallback ?? \"Arial\";\n\n return {\n fontFamily: `${font}, ${fallback}`,\n fontWeight: weight,\n fontStyle: style,\n };\n};\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,mBAA6B;AAEtB,MAAM,OAAO,CAAC,GAAW,MAAsB,0BAAM,GAAG,MAAM,GAAG,MAAM;AAEvE,MAAM,SAAS,CAAC,GAAW,MAAsB,0BAAM,GAAG,OAAO,GAAG;AAEpE,MAAM,UAAU,CAAC,GAAW,MAAsB,0BAAM,GAAG,QAAQ,GAAG;AAEtE,MAAM,MAAM,CAAC,GAAW,GAAW,MACxC,0BAAM,GAAG,IAAI,0BAAM,IAAI,GAAG;AAErB,MAAM,KAAK,CAAC,MAAc;AAC/B,QAAM,CAAC,MAAM,OAAO,aAAa,EAAE,MAAM;AAEzC,QAAM,EAAE,OAAO,WAAW,0BAAa,MAAM;AAE7C,QAAM,WAAmB,0BAAa,MAAM,YAAY;AAExD,SAAO;AAAA,IACL,YAAY,GAAG,SAAS;AAAA,IACxB,YAAY;AAAA,IACZ,WAAW;AAAA;AAAA;",
|
|
4
|
+
"sourcesContent": ["import Color from \"color\";\n\nimport { fontFamilies } from \"./theme\";\n\nexport const rgba = (c: string, a: number): string => Color(c).alpha(a).rgb().toString();\n\nexport const darken = (c: string, a: number): string => Color(c).darken(a).toString();\n\nexport const lighten = (c: string, a: number): string => Color(c).lighten(a).toString();\n\nexport const mix = (c: string, b: string, a: number): string =>\n Color(c).mix(Color(b), a).toString();\n\nexport const ff = (v: string) => {\n const [font, type = \"Regular\"] = v.split(\"|\");\n // @ts-expect-error FIXME\n const { style, weight } = fontFamilies[font][type];\n // @ts-expect-error FIXME\n const fallback: string = fontFamilies[font].fallback ?? \"Arial\";\n\n return {\n fontFamily: `${font}, ${fallback}`,\n fontWeight: weight,\n fontStyle: style,\n };\n};\n\nexport const ensureContrast = (color1: string, color2: string) => {\n const colorL1 = Color(color1).luminosity() + 0.05;\n const colorL2 = Color(color2).luminosity() + 0.05;\n\n const lRatio = colorL1 > colorL2 ? colorL1 / colorL2 : colorL2 / colorL1;\n\n if (lRatio < 1.5) {\n return Color(color1).rotate(180).negate().string();\n }\n return color1;\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,mBAA6B;AAEtB,MAAM,OAAO,CAAC,GAAW,MAAsB,0BAAM,GAAG,MAAM,GAAG,MAAM;AAEvE,MAAM,SAAS,CAAC,GAAW,MAAsB,0BAAM,GAAG,OAAO,GAAG;AAEpE,MAAM,UAAU,CAAC,GAAW,MAAsB,0BAAM,GAAG,QAAQ,GAAG;AAEtE,MAAM,MAAM,CAAC,GAAW,GAAW,MACxC,0BAAM,GAAG,IAAI,0BAAM,IAAI,GAAG;AAErB,MAAM,KAAK,CAAC,MAAc;AAC/B,QAAM,CAAC,MAAM,OAAO,aAAa,EAAE,MAAM;AAEzC,QAAM,EAAE,OAAO,WAAW,0BAAa,MAAM;AAE7C,QAAM,WAAmB,0BAAa,MAAM,YAAY;AAExD,SAAO;AAAA,IACL,YAAY,GAAG,SAAS;AAAA,IACxB,YAAY;AAAA,IACZ,WAAW;AAAA;AAAA;AAIR,MAAM,iBAAiB,CAAC,QAAgB,WAAmB;AAChE,QAAM,UAAU,0BAAM,QAAQ,eAAe;AAC7C,QAAM,UAAU,0BAAM,QAAQ,eAAe;AAE7C,QAAM,SAAS,UAAU,UAAU,UAAU,UAAU,UAAU;AAEjE,MAAI,SAAS,KAAK;AAChB,WAAO,0BAAM,QAAQ,OAAO,KAAK,SAAS;AAAA;AAE5C,SAAO;AAAA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type Props = {
|
|
3
|
+
name: string;
|
|
4
|
+
size?: number;
|
|
5
|
+
color?: string;
|
|
6
|
+
backgroundColor?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const iconNames: string[];
|
|
9
|
+
declare const CryptoIcon: ({ name, size, color, backgroundColor }: Props) => JSX.Element | null;
|
|
10
|
+
export default CryptoIcon;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as icons from "@ledgerhq/crypto-icons-ui/react";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ensureContrast } from "../../../styles";
|
|
4
|
+
import { useTheme } from "styled-components";
|
|
5
|
+
export const iconNames = Array.from(Object.keys(icons).reduce((set, rawKey) => {
|
|
6
|
+
const key = rawKey;
|
|
7
|
+
if (!set.has(key))
|
|
8
|
+
set.add(key);
|
|
9
|
+
return set;
|
|
10
|
+
}, new Set()));
|
|
11
|
+
const CryptoIcon = ({ name, size = 16, color, backgroundColor }) => {
|
|
12
|
+
const maybeIconName = `${name}`;
|
|
13
|
+
const { colors } = useTheme();
|
|
14
|
+
if (maybeIconName in icons) {
|
|
15
|
+
// @ts-expect-error FIXME I don't know how to make you happy ts
|
|
16
|
+
const Component = icons[maybeIconName];
|
|
17
|
+
const defaultColor = Component.DefaultColor;
|
|
18
|
+
const contrastedColor = ensureContrast(color || defaultColor, backgroundColor || colors.background.main);
|
|
19
|
+
return React.createElement(Component, { size: size, color: contrastedColor });
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
export default CryptoIcon;
|
|
@@ -5,10 +5,9 @@ import Flex from "../../layout/Flex";
|
|
|
5
5
|
const Wrapper = styled(Flex) `
|
|
6
6
|
width: 100%;
|
|
7
7
|
height: 100%;
|
|
8
|
-
background: gray;
|
|
9
8
|
flex-direction: column;
|
|
10
9
|
padding: ${(p) => p.theme.space[8]}px ${(p) => p.theme.space[10]}px;
|
|
11
|
-
padding-right: 280px;
|
|
10
|
+
padding-right: 280px; /* Nb gives air to not overlap the illustration */
|
|
12
11
|
z-index: ${(p) => p.theme.zIndexes[8]};
|
|
13
12
|
background: url(${(p) => p.image}) no-repeat ${(p) => p.theme.colors.neutral.c100};
|
|
14
13
|
background-size: contain;
|
|
@@ -81,6 +81,8 @@ export const BaseInput = styled.input.attrs({
|
|
|
81
81
|
color: ${(p) => (p.disabled ? p.theme.colors.neutral.c50 : p.theme.colors.neutral.c70)};
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/* stylelint-disable property-no-vendor-prefix */
|
|
85
|
+
|
|
84
86
|
/* Hide type=number arrow for Chrome, Safari, Edge, Opera */
|
|
85
87
|
&::-webkit-outer-spin-button,
|
|
86
88
|
::-webkit-inner-spin-button {
|
|
@@ -92,6 +94,7 @@ export const BaseInput = styled.input.attrs({
|
|
|
92
94
|
&[type="number"] {
|
|
93
95
|
-moz-appearance: textfield;
|
|
94
96
|
}
|
|
97
|
+
/* stylelint-enable property-no-vendor-prefix */
|
|
95
98
|
|
|
96
99
|
${typography}
|
|
97
100
|
`;
|
|
@@ -19,6 +19,19 @@ export default css `
|
|
|
19
19
|
transition-property: transform, visibility, opacity;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
.tippy-arrow {
|
|
23
|
+
width: 16px;
|
|
24
|
+
height: 16px;
|
|
25
|
+
color: ${(p) => p.theme.colors.neutral.c100};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tippy-arrow:before {
|
|
29
|
+
content: "";
|
|
30
|
+
position: absolute;
|
|
31
|
+
border-color: transparent;
|
|
32
|
+
border-style: solid;
|
|
33
|
+
}
|
|
34
|
+
|
|
22
35
|
.tippy-box[data-placement^="top"] > .tippy-arrow {
|
|
23
36
|
bottom: 0;
|
|
24
37
|
}
|
|
@@ -69,19 +82,6 @@ export default css `
|
|
|
69
82
|
transition-timing-function: cubic-bezier(0.54, 1.5, 0.38, 1.11);
|
|
70
83
|
}
|
|
71
84
|
|
|
72
|
-
.tippy-arrow {
|
|
73
|
-
width: 16px;
|
|
74
|
-
height: 16px;
|
|
75
|
-
color: ${(p) => p.theme.colors.neutral.c100};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.tippy-arrow:before {
|
|
79
|
-
content: "";
|
|
80
|
-
position: absolute;
|
|
81
|
-
border-color: transparent;
|
|
82
|
-
border-style: solid;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
85
|
.tippy-content {
|
|
86
86
|
position: relative;
|
|
87
87
|
padding: 8px 10px;
|
|
@@ -11,7 +11,7 @@ const Bar = styled.div `
|
|
|
11
11
|
transition: all 600ms linear;
|
|
12
12
|
height: 4px;
|
|
13
13
|
border-radius: 2px;
|
|
14
|
-
|
|
14
|
+
/* Disable left/right border radius to match the handler */
|
|
15
15
|
border-top-${(p) => (p.on ? "right" : "left")}-radius: 0;
|
|
16
16
|
border-bottom-${(p) => (p.on ? "right" : "left")}-radius: 0;
|
|
17
17
|
flex: ${(p) => p.fill};
|
package/lib/styles/global.js
CHANGED
|
@@ -8,7 +8,7 @@ export const GlobalStyle = createGlobalStyle `
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
body {
|
|
11
|
-
font-family: Inter;
|
|
11
|
+
font-family: Inter, sans-serif;
|
|
12
12
|
font-size: 100%;
|
|
13
13
|
}
|
|
14
14
|
|
|
@@ -31,4 +31,26 @@ export const GlobalStyle = createGlobalStyle `
|
|
|
31
31
|
${(props) => (typeof props.fontsPath === "string" ? fontStyles : "")}
|
|
32
32
|
|
|
33
33
|
${tippyStyles}
|
|
34
|
+
|
|
35
|
+
::-webkit-scrollbar {
|
|
36
|
+
width: 12px;
|
|
37
|
+
height: 12px;
|
|
38
|
+
background-color: rgba(0,0,0,0);
|
|
39
|
+
}
|
|
40
|
+
::-webkit-scrollbar-button {
|
|
41
|
+
opacity: 0;
|
|
42
|
+
height: 0;
|
|
43
|
+
width: 0;
|
|
44
|
+
}
|
|
45
|
+
::-webkit-scrollbar-track {
|
|
46
|
+
background-color: rgba(0,0,0,0);
|
|
47
|
+
}
|
|
48
|
+
::-webkit-scrollbar-thumb {
|
|
49
|
+
box-shadow: inset 0 0 0 12px var(--track-color);
|
|
50
|
+
border: 2px solid rgba(0,0,0,0);
|
|
51
|
+
border-radius: 12px;
|
|
52
|
+
}
|
|
53
|
+
::-webkit-scrollbar-corner {
|
|
54
|
+
opacity: 0;
|
|
55
|
+
}
|
|
34
56
|
`;
|
package/lib/styles/helpers.d.ts
CHANGED
package/lib/styles/helpers.js
CHANGED
|
@@ -17,3 +17,12 @@ export const ff = (v) => {
|
|
|
17
17
|
fontStyle: style,
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
+
export const ensureContrast = (color1, color2) => {
|
|
21
|
+
const colorL1 = Color(color1).luminosity() + 0.05;
|
|
22
|
+
const colorL2 = Color(color2).luminosity() + 0.05;
|
|
23
|
+
const lRatio = colorL1 > colorL2 ? colorL1 / colorL2 : colorL2 / colorL1;
|
|
24
|
+
if (lRatio < 1.5) {
|
|
25
|
+
return Color(color1).rotate(180).negate().string();
|
|
26
|
+
}
|
|
27
|
+
return color1;
|
|
28
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/react-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0-next.0",
|
|
4
4
|
"description": "Ledger Live - Desktop UI",
|
|
5
5
|
"author": "Ledger Live Team <team-live@ledger.fr>",
|
|
6
6
|
"repository": {
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@floating-ui/react-dom": "^0.4.0",
|
|
60
60
|
"@ledgerhq/icons-ui": "^0.2.7",
|
|
61
|
+
"@ledgerhq/crypto-icons-ui": "^0.2.0-next.0",
|
|
61
62
|
"@ledgerhq/ui-shared": "^0.1.9",
|
|
62
63
|
"@tippyjs/react": "^4.2.6",
|
|
63
64
|
"@types/color": "^3.0.2",
|
|
@@ -111,17 +112,22 @@
|
|
|
111
112
|
"styled-components": "^5.3.3",
|
|
112
113
|
"tiny-glob": "^0.2.9",
|
|
113
114
|
"typescript": "^4.3.5",
|
|
114
|
-
"webpack": "*"
|
|
115
|
+
"webpack": "*",
|
|
116
|
+
"stylelint": "^14.9.1",
|
|
117
|
+
"stylelint-config-recommended": "^8.0.0",
|
|
118
|
+
"stylelint-config-styled-components": "^0.1.1",
|
|
119
|
+
"stylelint-processor-styled-components": "^1.10.0"
|
|
115
120
|
},
|
|
116
121
|
"scripts": {
|
|
117
122
|
"storybook": "start-storybook -p 6006 -s ./src",
|
|
118
123
|
"build": "tsc -p tsconfig.prod.json && node scripts/transpile && node scripts/postBuild",
|
|
119
|
-
"prebuild:storybook": "pnpm -F ui-shared -F icons-ui build",
|
|
124
|
+
"prebuild:storybook": "pnpm -F ui-shared -F icons-ui -F crypto-icons-ui build",
|
|
120
125
|
"build:storybook": "build-storybook -s ./src",
|
|
121
126
|
"watch": "tsc -p tsconfig.prod.json --watch",
|
|
122
127
|
"clean": "rimraf lib",
|
|
123
128
|
"lint": "eslint src --ext .js,.jsx,.ts,.tsx --cache",
|
|
124
129
|
"lint:fix": "pnpm lint --fix",
|
|
130
|
+
"lint:css": "stylelint './src/**/*.{js,jsx,ts,tsx}' --fix",
|
|
125
131
|
"typecheck": "tsc --p . --noEmit",
|
|
126
132
|
"test": "pnpm -w -F ui test:react"
|
|
127
133
|
}
|