@ledgerhq/react-ui 0.8.1 → 0.8.2-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/components/layout/List/VerticalTimeline/TimelineIndicator.js +96 -0
- package/lib/cjs/components/layout/List/VerticalTimeline/TimelineIndicator.js.map +7 -0
- package/lib/cjs/components/layout/List/VerticalTimeline/TimelineItem.js +95 -0
- package/lib/cjs/components/layout/List/VerticalTimeline/TimelineItem.js.map +7 -0
- package/lib/cjs/components/layout/List/VerticalTimeline/VerticalTimeline.stories.js +138 -0
- package/lib/cjs/components/layout/List/VerticalTimeline/VerticalTimeline.stories.js.map +7 -0
- package/lib/cjs/components/layout/List/VerticalTimeline/index.js +41 -0
- package/lib/cjs/components/layout/List/VerticalTimeline/index.js.map +7 -0
- package/lib/cjs/components/layout/index.js +3 -1
- package/lib/cjs/components/layout/index.js.map +2 -2
- package/lib/cjs/styles/global.js +0 -4
- package/lib/cjs/styles/global.js.map +2 -2
- package/lib/components/layout/List/VerticalTimeline/TimelineIndicator.d.ts +8 -0
- package/lib/components/layout/List/VerticalTimeline/TimelineIndicator.js +72 -0
- package/lib/components/layout/List/VerticalTimeline/TimelineItem.d.ts +8 -0
- package/lib/components/layout/List/VerticalTimeline/TimelineItem.js +59 -0
- package/lib/components/layout/List/VerticalTimeline/index.d.ts +13 -0
- package/lib/components/layout/List/VerticalTimeline/index.js +18 -0
- package/lib/components/layout/index.d.ts +1 -0
- package/lib/components/layout/index.js +1 -0
- package/lib/styles/global.js +0 -4
- package/package.json +1 -1
|
@@ -0,0 +1,96 @@
|
|
|
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: () => TimelineIndicator
|
|
26
|
+
});
|
|
27
|
+
var import_react = __toModule(require("react"));
|
|
28
|
+
var import_CircledCheckSolidMedium = __toModule(require("@ledgerhq/icons-ui/react/CircledCheckSolidMedium"));
|
|
29
|
+
var import_styled_components = __toModule(require("styled-components"));
|
|
30
|
+
var import_Flex = __toModule(require("../../Flex"));
|
|
31
|
+
const TopSegment = (0, import_styled_components.default)(import_Flex.default)`
|
|
32
|
+
height: ${(p) => p.status === "inactive" ? "18px" : "20px"};
|
|
33
|
+
border-width: ${(p) => p.hidden ? 0 : 1}px;
|
|
34
|
+
border-style: dashed;
|
|
35
|
+
border-color: ${(p) => p.status === "inactive" ? p.theme.colors.neutral.c50 : p.theme.colors.primary.c80};
|
|
36
|
+
background: ${(p) => p.status !== "inactive" && p.theme.colors.primary.c80};
|
|
37
|
+
margin-top: ${(p) => p.status === "inactive" && "2px"};
|
|
38
|
+
`;
|
|
39
|
+
const BottomSegment = (0, import_styled_components.default)(import_Flex.default)`
|
|
40
|
+
flex: 1;
|
|
41
|
+
border-width: ${(p) => p.hidden ? 0 : 1}px;
|
|
42
|
+
border-style: dashed;
|
|
43
|
+
border-color: ${(p) => p.status === "completed" ? p.theme.colors.primary.c80 : p.theme.colors.neutral.c50};
|
|
44
|
+
background: ${(p) => p.status === "completed" && p.theme.colors.primary.c80};
|
|
45
|
+
`;
|
|
46
|
+
const getIconBackground = (theme, status, isLastItem) => {
|
|
47
|
+
if (status === "completed") {
|
|
48
|
+
return "transparent";
|
|
49
|
+
} else if (isLastItem) {
|
|
50
|
+
return theme.colors.success.c10;
|
|
51
|
+
} else if (status === "active") {
|
|
52
|
+
return theme.colors.neutral.c40;
|
|
53
|
+
}
|
|
54
|
+
return theme.colors.background.main;
|
|
55
|
+
};
|
|
56
|
+
const getIconBorder = (theme, status, isLastItem) => {
|
|
57
|
+
if (isLastItem) {
|
|
58
|
+
return theme.colors.success.c100;
|
|
59
|
+
} else if (status === "inactive") {
|
|
60
|
+
return theme.colors.neutral.c50;
|
|
61
|
+
}
|
|
62
|
+
return theme.colors.primary.c80;
|
|
63
|
+
};
|
|
64
|
+
const CenterSegment = (0, import_styled_components.default)(import_Flex.default)`
|
|
65
|
+
border-radius: 9999px;
|
|
66
|
+
width: 20px;
|
|
67
|
+
height: 20px;
|
|
68
|
+
background: ${(p) => getIconBackground(p.theme, p.status, p.isLastItem)};
|
|
69
|
+
border: 2px solid ${(p) => getIconBorder(p.theme, p.status, p.isLastItem)};
|
|
70
|
+
align-items: center;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
`;
|
|
73
|
+
const IconWrapper = (0, import_styled_components.default)(import_Flex.default)`
|
|
74
|
+
flex: none;
|
|
75
|
+
`;
|
|
76
|
+
function TimelineIndicator({ status, isFirstItem, isLastItem, ...props }) {
|
|
77
|
+
const { colors } = (0, import_styled_components.useTheme)();
|
|
78
|
+
return /* @__PURE__ */ import_react.default.createElement(import_Flex.default, {
|
|
79
|
+
flexDirection: "column",
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
...props
|
|
82
|
+
}, /* @__PURE__ */ import_react.default.createElement(TopSegment, {
|
|
83
|
+
status,
|
|
84
|
+
hidden: isFirstItem
|
|
85
|
+
}), /* @__PURE__ */ import_react.default.createElement(CenterSegment, {
|
|
86
|
+
status,
|
|
87
|
+
isLastItem
|
|
88
|
+
}, status === "completed" && /* @__PURE__ */ import_react.default.createElement(IconWrapper, null, /* @__PURE__ */ import_react.default.createElement(import_CircledCheckSolidMedium.default, {
|
|
89
|
+
color: isLastItem ? colors.success.c100 : colors.primary.c80,
|
|
90
|
+
size: 24
|
|
91
|
+
}))), /* @__PURE__ */ import_react.default.createElement(BottomSegment, {
|
|
92
|
+
status,
|
|
93
|
+
hidden: isLastItem
|
|
94
|
+
}));
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=TimelineIndicator.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/layout/List/VerticalTimeline/TimelineIndicator.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\nimport CircledCheckSolidMedium from \"@ledgerhq/icons-ui/react/CircledCheckSolidMedium\";\nimport styled, { useTheme } from \"styled-components\";\n\nimport Flex, { FlexBoxProps as FlexProps } from \"../../Flex\";\nimport { ItemStatus } from \"./index\";\nimport { Theme } from \"src/styles/theme\";\n\nconst TopSegment = styled(Flex)<{ status: ItemStatus; hidden?: boolean }>`\n height: ${(p) => (p.status === \"inactive\" ? \"18px\" : \"20px\")};\n border-width: ${(p) => (p.hidden ? 0 : 1)}px;\n border-style: dashed;\n border-color: ${(p) =>\n p.status === \"inactive\" ? p.theme.colors.neutral.c50 : p.theme.colors.primary.c80};\n background: ${(p) => p.status !== \"inactive\" && p.theme.colors.primary.c80};\n margin-top: ${(p) => p.status === \"inactive\" && \"2px\"};\n`;\n\nconst BottomSegment = styled(Flex)<{ status: ItemStatus; hidden?: boolean }>`\n flex: 1;\n border-width: ${(p) => (p.hidden ? 0 : 1)}px;\n border-style: dashed;\n border-color: ${(p) =>\n p.status === \"completed\" ? p.theme.colors.primary.c80 : p.theme.colors.neutral.c50};\n background: ${(p) => p.status === \"completed\" && p.theme.colors.primary.c80};\n`;\n\nconst getIconBackground = (theme: Theme, status: ItemStatus, isLastItem?: boolean) => {\n if (status === \"completed\") {\n return \"transparent\";\n } else if (isLastItem) {\n return theme.colors.success.c10;\n } else if (status === \"active\") {\n return theme.colors.neutral.c40;\n }\n return theme.colors.background.main;\n};\n\nconst getIconBorder = (theme: Theme, status: ItemStatus, isLastItem?: boolean) => {\n if (isLastItem) {\n return theme.colors.success.c100;\n } else if (status === \"inactive\") {\n return theme.colors.neutral.c50;\n }\n return theme.colors.primary.c80;\n};\n\nconst CenterSegment = styled(Flex)<{ status: ItemStatus; isLastItem?: boolean }>`\n border-radius: 9999px;\n width: 20px;\n height: 20px;\n background: ${(p) => getIconBackground(p.theme, p.status, p.isLastItem)};\n border: 2px solid ${(p) => getIconBorder(p.theme, p.status, p.isLastItem)};\n align-items: center;\n justify-content: center;\n`;\n\nconst IconWrapper = styled(Flex)`\n flex: none;\n`;\n\nexport type Props = FlexProps & {\n status: \"inactive\" | \"active\" | \"completed\";\n isFirstItem?: boolean;\n isLastItem?: boolean;\n};\n\nexport default function TimelineIndicator({ status, isFirstItem, isLastItem, ...props }: Props) {\n const { colors } = useTheme();\n\n return (\n <Flex flexDirection=\"column\" alignItems=\"center\" {...props}>\n <TopSegment status={status} hidden={isFirstItem} />\n <CenterSegment status={status} isLastItem={isLastItem}>\n {status === \"completed\" && (\n <IconWrapper>\n <CircledCheckSolidMedium\n color={isLastItem ? colors.success.c100 : colors.primary.c80}\n size={24}\n />\n </IconWrapper>\n )}\n </CenterSegment>\n <BottomSegment status={status} hidden={isLastItem} />\n </Flex>\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,qCAAoC;AACpC,+BAAiC;AAEjC,kBAAgD;AAIhD,MAAM,aAAa,sCAAO;AAAA,YACd,CAAC,MAAO,EAAE,WAAW,aAAa,SAAS;AAAA,kBACrC,CAAC,MAAO,EAAE,SAAS,IAAI;AAAA;AAAA,kBAEvB,CAAC,MACf,EAAE,WAAW,aAAa,EAAE,MAAM,OAAO,QAAQ,MAAM,EAAE,MAAM,OAAO,QAAQ;AAAA,gBAClE,CAAC,MAAM,EAAE,WAAW,cAAc,EAAE,MAAM,OAAO,QAAQ;AAAA,gBACzD,CAAC,MAAM,EAAE,WAAW,cAAc;AAAA;AAGlD,MAAM,gBAAgB,sCAAO;AAAA;AAAA,kBAEX,CAAC,MAAO,EAAE,SAAS,IAAI;AAAA;AAAA,kBAEvB,CAAC,MACf,EAAE,WAAW,cAAc,EAAE,MAAM,OAAO,QAAQ,MAAM,EAAE,MAAM,OAAO,QAAQ;AAAA,gBACnE,CAAC,MAAM,EAAE,WAAW,eAAe,EAAE,MAAM,OAAO,QAAQ;AAAA;AAG1E,MAAM,oBAAoB,CAAC,OAAc,QAAoB,eAAyB;AACpF,MAAI,WAAW,aAAa;AAC1B,WAAO;AAAA,aACE,YAAY;AACrB,WAAO,MAAM,OAAO,QAAQ;AAAA,aACnB,WAAW,UAAU;AAC9B,WAAO,MAAM,OAAO,QAAQ;AAAA;AAE9B,SAAO,MAAM,OAAO,WAAW;AAAA;AAGjC,MAAM,gBAAgB,CAAC,OAAc,QAAoB,eAAyB;AAChF,MAAI,YAAY;AACd,WAAO,MAAM,OAAO,QAAQ;AAAA,aACnB,WAAW,YAAY;AAChC,WAAO,MAAM,OAAO,QAAQ;AAAA;AAE9B,SAAO,MAAM,OAAO,QAAQ;AAAA;AAG9B,MAAM,gBAAgB,sCAAO;AAAA;AAAA;AAAA;AAAA,gBAIb,CAAC,MAAM,kBAAkB,EAAE,OAAO,EAAE,QAAQ,EAAE;AAAA,sBACxC,CAAC,MAAM,cAAc,EAAE,OAAO,EAAE,QAAQ,EAAE;AAAA;AAAA;AAAA;AAKhE,MAAM,cAAc,sCAAO;AAAA;AAAA;AAUZ,2BAA2B,EAAE,QAAQ,aAAa,eAAe,SAAgB;AAC9F,QAAM,EAAE,WAAW;AAEnB,SACE,mDAAC,qBAAD;AAAA,IAAM,eAAc;AAAA,IAAS,YAAW;AAAA,OAAa;AAAA,KACnD,mDAAC,YAAD;AAAA,IAAY;AAAA,IAAgB,QAAQ;AAAA,MACpC,mDAAC,eAAD;AAAA,IAAe;AAAA,IAAgB;AAAA,KAC5B,WAAW,eACV,mDAAC,aAAD,MACE,mDAAC,wCAAD;AAAA,IACE,OAAO,aAAa,OAAO,QAAQ,OAAO,OAAO,QAAQ;AAAA,IACzD,MAAM;AAAA,QAKd,mDAAC,eAAD;AAAA,IAAe;AAAA,IAAgB,QAAQ;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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: () => TimelineItem
|
|
26
|
+
});
|
|
27
|
+
var import_react = __toModule(require("react"));
|
|
28
|
+
var import_styled_components = __toModule(require("styled-components"));
|
|
29
|
+
var import__2 = __toModule(require("../.."));
|
|
30
|
+
var import__3 = __toModule(require("../../.."));
|
|
31
|
+
var import_Tag = __toModule(require("../../../Tag"));
|
|
32
|
+
var import_TimelineIndicator = __toModule(require("./TimelineIndicator"));
|
|
33
|
+
const getContainerBackground = (theme, status, isLastItem) => {
|
|
34
|
+
if (isLastItem && status === "completed") {
|
|
35
|
+
return theme.colors.success.c30;
|
|
36
|
+
} else if (status === "completed") {
|
|
37
|
+
return theme.colors.primary.c20;
|
|
38
|
+
} else if (status === "active") {
|
|
39
|
+
return theme.colors.neutral.c20;
|
|
40
|
+
}
|
|
41
|
+
return theme.colors.neutral.c30;
|
|
42
|
+
};
|
|
43
|
+
const getContainerBorder = (theme, status, isLastItem) => {
|
|
44
|
+
if (isLastItem && status === "completed") {
|
|
45
|
+
return theme.colors.success.c30;
|
|
46
|
+
} else if (isLastItem && status === "active") {
|
|
47
|
+
return theme.colors.success.c100;
|
|
48
|
+
} else if (status === "completed") {
|
|
49
|
+
return theme.colors.primary.c20;
|
|
50
|
+
} else if (status === "active") {
|
|
51
|
+
return theme.colors.primary.c80;
|
|
52
|
+
}
|
|
53
|
+
return theme.colors.neutral.c30;
|
|
54
|
+
};
|
|
55
|
+
const Container = (0, import_styled_components.default)(import__2.Flex)`
|
|
56
|
+
flex: 1;
|
|
57
|
+
width: 404px;
|
|
58
|
+
border-radius: ${(p) => p.theme.radii[2]}px;
|
|
59
|
+
background: ${(p) => getContainerBackground(p.theme, p.status, p.isLastItem)};
|
|
60
|
+
border: 1px solid ${(p) => getContainerBorder(p.theme, p.status, p.isLastItem)};
|
|
61
|
+
padding: 20px 16px;
|
|
62
|
+
`;
|
|
63
|
+
const TimelineIndicatorContentHeader = (0, import_styled_components.default)(import__2.Flex)`
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
`;
|
|
66
|
+
function TimelineItem({ item, isFirstItem, isLastItem }) {
|
|
67
|
+
const { colors } = (0, import_styled_components.useTheme)();
|
|
68
|
+
return /* @__PURE__ */ import_react.default.createElement(import__2.Flex, {
|
|
69
|
+
flexDirection: "row"
|
|
70
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_TimelineIndicator.default, {
|
|
71
|
+
status: item.status,
|
|
72
|
+
isFirstItem,
|
|
73
|
+
isLastItem,
|
|
74
|
+
mr: 4
|
|
75
|
+
}), /* @__PURE__ */ import_react.default.createElement(Container, {
|
|
76
|
+
status: item.status,
|
|
77
|
+
isLastItem,
|
|
78
|
+
mb: 4,
|
|
79
|
+
flexDirection: "column"
|
|
80
|
+
}, /* @__PURE__ */ import_react.default.createElement(TimelineIndicatorContentHeader, null, /* @__PURE__ */ import_react.default.createElement(import__3.Text, {
|
|
81
|
+
variant: "body",
|
|
82
|
+
color: item.status === "inactive" ? "neutral.c80" : isLastItem ? "success.c100" : "primary.c90"
|
|
83
|
+
}, item.title), item?.estimatedTime && item.status === "active" && /* @__PURE__ */ import_react.default.createElement(import_Tag.default, {
|
|
84
|
+
size: "small",
|
|
85
|
+
type: "opacity",
|
|
86
|
+
active: true,
|
|
87
|
+
disabled: true,
|
|
88
|
+
textProps: { color: colors.neutral.c100 }
|
|
89
|
+
}, `${item.estimatedTime / 60} min`)), item.renderBody && item.status === "active" && /* @__PURE__ */ import_react.default.createElement(import__2.Flex, {
|
|
90
|
+
position: "relative"
|
|
91
|
+
}, /* @__PURE__ */ import_react.default.createElement(import__2.Flex, {
|
|
92
|
+
pt: 6
|
|
93
|
+
}, item.renderBody(item.status === "active")))));
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=TimelineItem.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/layout/List/VerticalTimeline/TimelineItem.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from \"react\";\n\nimport { Theme } from \"src/styles/theme\";\nimport styled, { useTheme } from \"styled-components\";\n\nimport { Item, ItemStatus } from \".\";\nimport { Flex } from \"../..\";\nimport { Text } from \"../../..\";\nimport Tag from \"../../../Tag\";\n\nimport TimelineIndicator from \"./TimelineIndicator\";\n\nexport type Props = {\n item: Item;\n isFirstItem?: boolean;\n isLastItem?: boolean;\n};\n\nconst getContainerBackground = (theme: Theme, status: ItemStatus, isLastItem?: boolean) => {\n if (isLastItem && status === \"completed\") {\n return theme.colors.success.c30;\n } else if (status === \"completed\") {\n return theme.colors.primary.c20;\n } else if (status === \"active\") {\n return theme.colors.neutral.c20;\n }\n return theme.colors.neutral.c30;\n};\n\nconst getContainerBorder = (theme: Theme, status: ItemStatus, isLastItem?: boolean) => {\n if (isLastItem && status === \"completed\") {\n return theme.colors.success.c30;\n } else if (isLastItem && status === \"active\") {\n return theme.colors.success.c100;\n } else if (status === \"completed\") {\n return theme.colors.primary.c20;\n } else if (status === \"active\") {\n return theme.colors.primary.c80;\n }\n return theme.colors.neutral.c30;\n};\n\nconst Container = styled(Flex)<{ status: ItemStatus; isLastItem?: boolean }>`\n flex: 1;\n width: 404px;\n border-radius: ${(p) => p.theme.radii[2]}px;\n background: ${(p) => getContainerBackground(p.theme, p.status, p.isLastItem)};\n border: 1px solid ${(p) => getContainerBorder(p.theme, p.status, p.isLastItem)};\n padding: 20px 16px;\n`;\n\nconst TimelineIndicatorContentHeader = styled(Flex)`\n justify-content: space-between;\n`;\n\nexport default function TimelineItem({ item, isFirstItem, isLastItem }: Props) {\n const { colors } = useTheme();\n\n return (\n <Flex flexDirection=\"row\">\n <TimelineIndicator\n status={item.status}\n isFirstItem={isFirstItem}\n isLastItem={isLastItem}\n mr={4}\n />\n <Container status={item.status} isLastItem={isLastItem} mb={4} flexDirection=\"column\">\n <TimelineIndicatorContentHeader>\n <Text\n variant=\"body\"\n color={\n item.status === \"inactive\"\n ? \"neutral.c80\"\n : isLastItem\n ? \"success.c100\"\n : \"primary.c90\"\n }\n >\n {item.title}\n </Text>\n {item?.estimatedTime && item.status === \"active\" && (\n <Tag\n size=\"small\"\n type=\"opacity\"\n active\n disabled\n textProps={{ color: colors.neutral.c100 }}\n >{`${item.estimatedTime / 60} min`}</Tag>\n )}\n </TimelineIndicatorContentHeader>\n {item.renderBody && item.status === \"active\" && (\n <Flex position=\"relative\">\n <Flex pt={6}>{item.renderBody(item.status === \"active\")}</Flex>\n </Flex>\n )}\n </Container>\n </Flex>\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAGlB,+BAAiC;AAGjC,gBAAqB;AACrB,gBAAqB;AACrB,iBAAgB;AAEhB,+BAA8B;AAQ9B,MAAM,yBAAyB,CAAC,OAAc,QAAoB,eAAyB;AACzF,MAAI,cAAc,WAAW,aAAa;AACxC,WAAO,MAAM,OAAO,QAAQ;AAAA,aACnB,WAAW,aAAa;AACjC,WAAO,MAAM,OAAO,QAAQ;AAAA,aACnB,WAAW,UAAU;AAC9B,WAAO,MAAM,OAAO,QAAQ;AAAA;AAE9B,SAAO,MAAM,OAAO,QAAQ;AAAA;AAG9B,MAAM,qBAAqB,CAAC,OAAc,QAAoB,eAAyB;AACrF,MAAI,cAAc,WAAW,aAAa;AACxC,WAAO,MAAM,OAAO,QAAQ;AAAA,aACnB,cAAc,WAAW,UAAU;AAC5C,WAAO,MAAM,OAAO,QAAQ;AAAA,aACnB,WAAW,aAAa;AACjC,WAAO,MAAM,OAAO,QAAQ;AAAA,aACnB,WAAW,UAAU;AAC9B,WAAO,MAAM,OAAO,QAAQ;AAAA;AAE9B,SAAO,MAAM,OAAO,QAAQ;AAAA;AAG9B,MAAM,YAAY,sCAAO;AAAA;AAAA;AAAA,mBAGN,CAAC,MAAM,EAAE,MAAM,MAAM;AAAA,gBACxB,CAAC,MAAM,uBAAuB,EAAE,OAAO,EAAE,QAAQ,EAAE;AAAA,sBAC7C,CAAC,MAAM,mBAAmB,EAAE,OAAO,EAAE,QAAQ,EAAE;AAAA;AAAA;AAIrE,MAAM,iCAAiC,sCAAO;AAAA;AAAA;AAI/B,sBAAsB,EAAE,MAAM,aAAa,cAAqB;AAC7E,QAAM,EAAE,WAAW;AAEnB,SACE,mDAAC,gBAAD;AAAA,IAAM,eAAc;AAAA,KAClB,mDAAC,kCAAD;AAAA,IACE,QAAQ,KAAK;AAAA,IACb;AAAA,IACA;AAAA,IACA,IAAI;AAAA,MAEN,mDAAC,WAAD;AAAA,IAAW,QAAQ,KAAK;AAAA,IAAQ;AAAA,IAAwB,IAAI;AAAA,IAAG,eAAc;AAAA,KAC3E,mDAAC,gCAAD,MACE,mDAAC,gBAAD;AAAA,IACE,SAAQ;AAAA,IACR,OACE,KAAK,WAAW,aACZ,gBACA,aACA,iBACA;AAAA,KAGL,KAAK,QAEP,MAAM,iBAAiB,KAAK,WAAW,YACtC,mDAAC,oBAAD;AAAA,IACE,MAAK;AAAA,IACL,MAAK;AAAA,IACL,QAAM;AAAA,IACN,UAAQ;AAAA,IACR,WAAW,EAAE,OAAO,OAAO,QAAQ;AAAA,KACnC,GAAG,KAAK,gBAAgB,YAG7B,KAAK,cAAc,KAAK,WAAW,YAClC,mDAAC,gBAAD;AAAA,IAAM,UAAS;AAAA,KACb,mDAAC,gBAAD;AAAA,IAAM,IAAI;AAAA,KAAI,KAAK,WAAW,KAAK,WAAW;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
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: () => Default,
|
|
26
|
+
default: () => VerticalTimeline_stories_default
|
|
27
|
+
});
|
|
28
|
+
var import_react = __toModule(require("react"));
|
|
29
|
+
var import_Flex = __toModule(require("../../Flex"));
|
|
30
|
+
var import_Text = __toModule(require("../../../asorted/Text"));
|
|
31
|
+
var import__ = __toModule(require("."));
|
|
32
|
+
const description = `
|
|
33
|
+
### A Vertical Timeline
|
|
34
|
+
|
|
35
|
+
This components accepts an Array of object like this:
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
\`\`\`js
|
|
39
|
+
|
|
40
|
+
const steps = [
|
|
41
|
+
{
|
|
42
|
+
/**
|
|
43
|
+
* status is an ItemStatus which can be inactive, active or completed
|
|
44
|
+
*/
|
|
45
|
+
status: ItemStatus;
|
|
46
|
+
/**
|
|
47
|
+
* title is the title of the step
|
|
48
|
+
*/
|
|
49
|
+
title: string;
|
|
50
|
+
/**
|
|
51
|
+
* renderBody is an optional prop which is a ReactNode to be rendered next to the title
|
|
52
|
+
*/
|
|
53
|
+
renderBody?: (isDisplayed?: boolean) => ReactNode;
|
|
54
|
+
/**
|
|
55
|
+
* estimatedTime is an optional prop that take the estimated time to complete the time in second and display it in a tag in minute
|
|
56
|
+
*/
|
|
57
|
+
estimatedTime?: number;
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
status: ItemStatus;
|
|
61
|
+
title: string;
|
|
62
|
+
renderBody?: (isDisplayed?: boolean) => ReactNode;
|
|
63
|
+
estimatedTime?: number;
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
<VerticalTimeline steps={steps as any} />
|
|
68
|
+
\`\`\`
|
|
69
|
+
`;
|
|
70
|
+
var VerticalTimeline_stories_default = {
|
|
71
|
+
title: "Layout/List/VerticalTimeline",
|
|
72
|
+
argTypes: {
|
|
73
|
+
steps: {
|
|
74
|
+
control: "disabled"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
parameters: {
|
|
78
|
+
docs: {
|
|
79
|
+
description: {
|
|
80
|
+
component: description
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
const Template = () => {
|
|
86
|
+
const defaultItems = [
|
|
87
|
+
{
|
|
88
|
+
status: "active",
|
|
89
|
+
title: "Nano paired"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
status: "inactive",
|
|
93
|
+
title: "Set your PIN",
|
|
94
|
+
renderBody: () => /* @__PURE__ */ import_react.default.createElement(import_Text.default, null, `Your PIN can be 4 to 8 digits long. Anyone with access to your Nano and to your PIN can also access all your crypto and NFT assets.`),
|
|
95
|
+
estimatedTime: 120
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
status: "inactive",
|
|
99
|
+
title: "Recovery phrase",
|
|
100
|
+
renderBody: () => /* @__PURE__ */ import_react.default.createElement(import_Text.default, null, `Your recovery phrase is a secret list of 24 words that backs up your private keys. Your Nano generates a unique recovery phrase. Ledger does not keep a copy of it.`),
|
|
101
|
+
estimatedTime: 300
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
status: "inactive",
|
|
105
|
+
title: "Software check",
|
|
106
|
+
renderBody: () => /* @__PURE__ */ import_react.default.createElement(import_Text.default, null, `We'll verify whether your Nano is genuine. This should be quick and easy!`)
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
status: "inactive",
|
|
110
|
+
title: "Nano is ready"
|
|
111
|
+
}
|
|
112
|
+
];
|
|
113
|
+
const [items, setItems] = (0, import_react.useState)(defaultItems);
|
|
114
|
+
const [currentIndex, setCurrentIndex] = (0, import_react.useState)(0);
|
|
115
|
+
(0, import_react.useEffect)(() => {
|
|
116
|
+
setTimeout(() => {
|
|
117
|
+
if (currentIndex === defaultItems.length) {
|
|
118
|
+
setCurrentIndex(0);
|
|
119
|
+
setItems(defaultItems);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const newItems = items.concat([]);
|
|
123
|
+
newItems[currentIndex]["status"] = "completed";
|
|
124
|
+
if (currentIndex + 1 !== defaultItems.length) {
|
|
125
|
+
newItems[currentIndex + 1]["status"] = "active";
|
|
126
|
+
}
|
|
127
|
+
setCurrentIndex(currentIndex + 1);
|
|
128
|
+
setItems(newItems);
|
|
129
|
+
}, 1e3);
|
|
130
|
+
}, [items, currentIndex]);
|
|
131
|
+
return /* @__PURE__ */ import_react.default.createElement(import_Flex.default, {
|
|
132
|
+
width: 300
|
|
133
|
+
}, /* @__PURE__ */ import_react.default.createElement(import__.default, {
|
|
134
|
+
steps: items
|
|
135
|
+
}));
|
|
136
|
+
};
|
|
137
|
+
const Default = Template.bind({});
|
|
138
|
+
//# sourceMappingURL=VerticalTimeline.stories.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/layout/List/VerticalTimeline/VerticalTimeline.stories.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useEffect, useState } from \"react\";\nimport Flex from \"../../Flex\";\nimport Text from \"../../../asorted/Text\";\nimport VerticalTimeline from \".\";\n\nconst description = `\n### A Vertical Timeline\n\nThis components accepts an Array of object like this:\n## Usage\n\n\\`\\`\\`js\n\nconst steps = [\n {\n /**\n * status is an ItemStatus which can be inactive, active or completed\n */\n status: ItemStatus;\n /**\n * title is the title of the step\n */\n title: string;\n /**\n * renderBody is an optional prop which is a ReactNode to be rendered next to the title\n */\n renderBody?: (isDisplayed?: boolean) => ReactNode;\n /**\n * estimatedTime is an optional prop that take the estimated time to complete the time in second and display it in a tag in minute\n */\n estimatedTime?: number;\n },\n { \n status: ItemStatus;\n title: string;\n renderBody?: (isDisplayed?: boolean) => ReactNode;\n estimatedTime?: number;\n }\n ];\n\n<VerticalTimeline steps={steps as any} />\n\\`\\`\\`\n`;\n\nexport default {\n title: \"Layout/List/VerticalTimeline\",\n argTypes: {\n steps: {\n control: \"disabled\",\n },\n },\n parameters: {\n docs: {\n description: {\n component: description,\n },\n },\n },\n};\n\nconst Template = () => {\n const defaultItems = [\n {\n status: \"active\",\n title: \"Nano paired\",\n },\n {\n status: \"inactive\",\n title: \"Set your PIN\",\n renderBody: () => (\n <Text>\n {`Your PIN can be 4 to 8 digits long. Anyone with access to your Nano and to your PIN can also access all your crypto and NFT assets.`}\n </Text>\n ),\n estimatedTime: 120,\n },\n {\n status: \"inactive\",\n title: \"Recovery phrase\",\n renderBody: () => (\n <Text>\n {`Your recovery phrase is a secret list of 24 words that backs up your private keys. Your Nano generates a unique recovery phrase. Ledger does not keep a copy of it.`}\n </Text>\n ),\n estimatedTime: 300,\n },\n {\n status: \"inactive\",\n title: \"Software check\",\n renderBody: () => (\n <Text>{`We'll verify whether your Nano is genuine. This should be quick and easy!`}</Text>\n ),\n },\n {\n status: \"inactive\",\n title: \"Nano is ready\",\n },\n ];\n\n const [items, setItems] = useState(defaultItems);\n const [currentIndex, setCurrentIndex] = useState(0);\n\n useEffect(() => {\n setTimeout(() => {\n if (currentIndex === defaultItems.length) {\n setCurrentIndex(0);\n setItems(defaultItems);\n return;\n }\n const newItems = items.concat([]);\n newItems[currentIndex][\"status\"] = \"completed\";\n if (currentIndex + 1 !== defaultItems.length) {\n newItems[currentIndex + 1][\"status\"] = \"active\";\n }\n setCurrentIndex(currentIndex + 1);\n setItems(newItems);\n }, 1000);\n }, [items, currentIndex]);\n\n return (\n <Flex width={300}>\n <VerticalTimeline steps={items as any} />\n </Flex>\n );\n};\n\nexport const Default = Template.bind({});\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2C;AAC3C,kBAAiB;AACjB,kBAAiB;AACjB,eAA6B;AAE7B,MAAM,cAAc;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;AAuCpB,IAAO,mCAAQ;AAAA,EACb,OAAO;AAAA,EACP,UAAU;AAAA,IACR,OAAO;AAAA,MACL,SAAS;AAAA;AAAA;AAAA,EAGb,YAAY;AAAA,IACV,MAAM;AAAA,MACJ,aAAa;AAAA,QACX,WAAW;AAAA;AAAA;AAAA;AAAA;AAMnB,MAAM,WAAW,MAAM;AACrB,QAAM,eAAe;AAAA,IACnB;AAAA,MACE,QAAQ;AAAA,MACR,OAAO;AAAA;AAAA,IAET;AAAA,MACE,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,YAAY,MACV,mDAAC,qBAAD,MACG;AAAA,MAGL,eAAe;AAAA;AAAA,IAEjB;AAAA,MACE,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,YAAY,MACV,mDAAC,qBAAD,MACG;AAAA,MAGL,eAAe;AAAA;AAAA,IAEjB;AAAA,MACE,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,YAAY,MACV,mDAAC,qBAAD,MAAO;AAAA;AAAA,IAGX;AAAA,MACE,QAAQ;AAAA,MACR,OAAO;AAAA;AAAA;AAIX,QAAM,CAAC,OAAO,YAAY,2BAAS;AACnC,QAAM,CAAC,cAAc,mBAAmB,2BAAS;AAEjD,8BAAU,MAAM;AACd,eAAW,MAAM;AACf,UAAI,iBAAiB,aAAa,QAAQ;AACxC,wBAAgB;AAChB,iBAAS;AACT;AAAA;AAEF,YAAM,WAAW,MAAM,OAAO;AAC9B,eAAS,cAAc,YAAY;AACnC,UAAI,eAAe,MAAM,aAAa,QAAQ;AAC5C,iBAAS,eAAe,GAAG,YAAY;AAAA;AAEzC,sBAAgB,eAAe;AAC/B,eAAS;AAAA,OACR;AAAA,KACF,CAAC,OAAO;AAEX,SACE,mDAAC,qBAAD;AAAA,IAAM,OAAO;AAAA,KACX,mDAAC,kBAAD;AAAA,IAAkB,OAAO;AAAA;AAAA;AAKxB,MAAM,UAAU,SAAS,KAAK;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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: () => VerticalTimeline
|
|
26
|
+
});
|
|
27
|
+
var import_react = __toModule(require("react"));
|
|
28
|
+
var import_TimelineItem = __toModule(require("./TimelineItem"));
|
|
29
|
+
var import__ = __toModule(require("../.."));
|
|
30
|
+
function VerticalTimeline({ steps, ...props }) {
|
|
31
|
+
return /* @__PURE__ */ import_react.default.createElement(import__.Flex, {
|
|
32
|
+
...props,
|
|
33
|
+
flexDirection: "column"
|
|
34
|
+
}, steps?.map((step, index) => /* @__PURE__ */ import_react.default.createElement(import_TimelineItem.default, {
|
|
35
|
+
key: step.title,
|
|
36
|
+
item: step,
|
|
37
|
+
isFirstItem: index === 0,
|
|
38
|
+
isLastItem: index === steps.length - 1
|
|
39
|
+
})));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/components/layout/List/VerticalTimeline/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { ReactNode } from \"react\";\n\nimport TimelineItem from \"./TimelineItem\";\nimport { Flex } from \"../..\";\nimport { BaseStyledProps } from \"src/components/styled\";\n\nexport type ItemStatus = \"inactive\" | \"active\" | \"completed\";\n\nexport type Item = {\n status: ItemStatus;\n title: string;\n renderBody?: (isDisplayed?: boolean) => ReactNode;\n estimatedTime?: number;\n};\n\nexport type Props = BaseStyledProps & {\n steps?: Item[];\n};\n\nexport default function VerticalTimeline({ steps, ...props }: Props) {\n return (\n <Flex {...props} flexDirection=\"column\">\n {steps?.map((step, index) => (\n <TimelineItem\n key={step.title}\n item={step}\n isFirstItem={index === 0}\n isLastItem={index === steps.length - 1}\n />\n ))}\n </Flex>\n );\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,mBAAiC;AAEjC,0BAAyB;AACzB,eAAqB;AAgBN,0BAA0B,EAAE,UAAU,SAAgB;AACnE,SACE,mDAAC,eAAD;AAAA,OAAU;AAAA,IAAO,eAAc;AAAA,KAC5B,OAAO,IAAI,CAAC,MAAM,UACjB,mDAAC,6BAAD;AAAA,IACE,KAAK,KAAK;AAAA,IACV,MAAM;AAAA,IACN,aAAa,UAAU;AAAA,IACvB,YAAY,UAAU,MAAM,SAAS;AAAA;AAAA;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -27,7 +27,8 @@ __export(exports, {
|
|
|
27
27
|
Flex: () => import_Flex.default,
|
|
28
28
|
Grid: () => import_Grid.default,
|
|
29
29
|
Popin: () => import_Popin.default,
|
|
30
|
-
Side: () => import_Side.default
|
|
30
|
+
Side: () => import_Side.default,
|
|
31
|
+
VerticalTimeline: () => import_VerticalTimeline.default
|
|
31
32
|
});
|
|
32
33
|
var import_Flex = __toModule(require("./Flex"));
|
|
33
34
|
var import_Box = __toModule(require("./Box"));
|
|
@@ -35,4 +36,5 @@ var import_Grid = __toModule(require("./Grid"));
|
|
|
35
36
|
var import_Popin = __toModule(require("./Popin"));
|
|
36
37
|
var import_Side = __toModule(require("./Side"));
|
|
37
38
|
var import_Drawer = __toModule(require("./Drawer"));
|
|
39
|
+
var import_VerticalTimeline = __toModule(require("./List/VerticalTimeline"));
|
|
38
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/layout/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as Flex } from \"./Flex\";\nexport { default as Box } from \"./Box\";\nexport { default as Grid } from \"./Grid\";\nexport { default as Popin } from \"./Popin\";\nexport { default as Side } from \"./Side\";\nexport { default as Drawer } from \"./Drawer\";\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgC;AAChC,iBAA+B;AAC/B,kBAAgC;AAChC,mBAAiC;AACjC,kBAAgC;AAChC,oBAAkC;",
|
|
4
|
+
"sourcesContent": ["export { default as Flex } from \"./Flex\";\nexport { default as Box } from \"./Box\";\nexport { default as Grid } from \"./Grid\";\nexport { default as Popin } from \"./Popin\";\nexport { default as Side } from \"./Side\";\nexport { default as Drawer } from \"./Drawer\";\nexport { default as VerticalTimeline } from \"./List/VerticalTimeline\";\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAgC;AAChC,iBAA+B;AAC/B,kBAAgC;AAChC,mBAAiC;AACjC,kBAAgC;AAChC,oBAAkC;AAClC,8BAA4C;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/lib/cjs/styles/global.js
CHANGED
|
@@ -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
|
|
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
|
|
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;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { FlexBoxProps as FlexProps } from "../../Flex";
|
|
3
|
+
export declare type Props = FlexProps & {
|
|
4
|
+
status: "inactive" | "active" | "completed";
|
|
5
|
+
isFirstItem?: boolean;
|
|
6
|
+
isLastItem?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export default function TimelineIndicator({ status, isFirstItem, isLastItem, ...props }: Props): JSX.Element;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import CircledCheckSolidMedium from "@ledgerhq/icons-ui/react/CircledCheckSolidMedium";
|
|
14
|
+
import styled, { useTheme } from "styled-components";
|
|
15
|
+
import Flex from "../../Flex";
|
|
16
|
+
const TopSegment = styled(Flex) `
|
|
17
|
+
height: ${(p) => (p.status === "inactive" ? "18px" : "20px")};
|
|
18
|
+
border-width: ${(p) => (p.hidden ? 0 : 1)}px;
|
|
19
|
+
border-style: dashed;
|
|
20
|
+
border-color: ${(p) => p.status === "inactive" ? p.theme.colors.neutral.c50 : p.theme.colors.primary.c80};
|
|
21
|
+
background: ${(p) => p.status !== "inactive" && p.theme.colors.primary.c80};
|
|
22
|
+
margin-top: ${(p) => p.status === "inactive" && "2px"};
|
|
23
|
+
`;
|
|
24
|
+
const BottomSegment = styled(Flex) `
|
|
25
|
+
flex: 1;
|
|
26
|
+
border-width: ${(p) => (p.hidden ? 0 : 1)}px;
|
|
27
|
+
border-style: dashed;
|
|
28
|
+
border-color: ${(p) => p.status === "completed" ? p.theme.colors.primary.c80 : p.theme.colors.neutral.c50};
|
|
29
|
+
background: ${(p) => p.status === "completed" && p.theme.colors.primary.c80};
|
|
30
|
+
`;
|
|
31
|
+
const getIconBackground = (theme, status, isLastItem) => {
|
|
32
|
+
if (status === "completed") {
|
|
33
|
+
return "transparent";
|
|
34
|
+
}
|
|
35
|
+
else if (isLastItem) {
|
|
36
|
+
return theme.colors.success.c10;
|
|
37
|
+
}
|
|
38
|
+
else if (status === "active") {
|
|
39
|
+
return theme.colors.neutral.c40;
|
|
40
|
+
}
|
|
41
|
+
return theme.colors.background.main;
|
|
42
|
+
};
|
|
43
|
+
const getIconBorder = (theme, status, isLastItem) => {
|
|
44
|
+
if (isLastItem) {
|
|
45
|
+
return theme.colors.success.c100;
|
|
46
|
+
}
|
|
47
|
+
else if (status === "inactive") {
|
|
48
|
+
return theme.colors.neutral.c50;
|
|
49
|
+
}
|
|
50
|
+
return theme.colors.primary.c80;
|
|
51
|
+
};
|
|
52
|
+
const CenterSegment = styled(Flex) `
|
|
53
|
+
border-radius: 9999px;
|
|
54
|
+
width: 20px;
|
|
55
|
+
height: 20px;
|
|
56
|
+
background: ${(p) => getIconBackground(p.theme, p.status, p.isLastItem)};
|
|
57
|
+
border: 2px solid ${(p) => getIconBorder(p.theme, p.status, p.isLastItem)};
|
|
58
|
+
align-items: center;
|
|
59
|
+
justify-content: center;
|
|
60
|
+
`;
|
|
61
|
+
const IconWrapper = styled(Flex) `
|
|
62
|
+
flex: none;
|
|
63
|
+
`;
|
|
64
|
+
export default function TimelineIndicator(_a) {
|
|
65
|
+
var { status, isFirstItem, isLastItem } = _a, props = __rest(_a, ["status", "isFirstItem", "isLastItem"]);
|
|
66
|
+
const { colors } = useTheme();
|
|
67
|
+
return (React.createElement(Flex, Object.assign({ flexDirection: "column", alignItems: "center" }, props),
|
|
68
|
+
React.createElement(TopSegment, { status: status, hidden: isFirstItem }),
|
|
69
|
+
React.createElement(CenterSegment, { status: status, isLastItem: isLastItem }, status === "completed" && (React.createElement(IconWrapper, null,
|
|
70
|
+
React.createElement(CircledCheckSolidMedium, { color: isLastItem ? colors.success.c100 : colors.primary.c80, size: 24 })))),
|
|
71
|
+
React.createElement(BottomSegment, { status: status, hidden: isLastItem })));
|
|
72
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled, { useTheme } from "styled-components";
|
|
3
|
+
import { Flex } from "../..";
|
|
4
|
+
import { Text } from "../../..";
|
|
5
|
+
import Tag from "../../../Tag";
|
|
6
|
+
import TimelineIndicator from "./TimelineIndicator";
|
|
7
|
+
const getContainerBackground = (theme, status, isLastItem) => {
|
|
8
|
+
if (isLastItem && status === "completed") {
|
|
9
|
+
return theme.colors.success.c30;
|
|
10
|
+
}
|
|
11
|
+
else if (status === "completed") {
|
|
12
|
+
return theme.colors.primary.c20;
|
|
13
|
+
}
|
|
14
|
+
else if (status === "active") {
|
|
15
|
+
return theme.colors.neutral.c20;
|
|
16
|
+
}
|
|
17
|
+
return theme.colors.neutral.c30;
|
|
18
|
+
};
|
|
19
|
+
const getContainerBorder = (theme, status, isLastItem) => {
|
|
20
|
+
if (isLastItem && status === "completed") {
|
|
21
|
+
return theme.colors.success.c30;
|
|
22
|
+
}
|
|
23
|
+
else if (isLastItem && status === "active") {
|
|
24
|
+
return theme.colors.success.c100;
|
|
25
|
+
}
|
|
26
|
+
else if (status === "completed") {
|
|
27
|
+
return theme.colors.primary.c20;
|
|
28
|
+
}
|
|
29
|
+
else if (status === "active") {
|
|
30
|
+
return theme.colors.primary.c80;
|
|
31
|
+
}
|
|
32
|
+
return theme.colors.neutral.c30;
|
|
33
|
+
};
|
|
34
|
+
const Container = styled(Flex) `
|
|
35
|
+
flex: 1;
|
|
36
|
+
width: 404px;
|
|
37
|
+
border-radius: ${(p) => p.theme.radii[2]}px;
|
|
38
|
+
background: ${(p) => getContainerBackground(p.theme, p.status, p.isLastItem)};
|
|
39
|
+
border: 1px solid ${(p) => getContainerBorder(p.theme, p.status, p.isLastItem)};
|
|
40
|
+
padding: 20px 16px;
|
|
41
|
+
`;
|
|
42
|
+
const TimelineIndicatorContentHeader = styled(Flex) `
|
|
43
|
+
justify-content: space-between;
|
|
44
|
+
`;
|
|
45
|
+
export default function TimelineItem({ item, isFirstItem, isLastItem }) {
|
|
46
|
+
const { colors } = useTheme();
|
|
47
|
+
return (React.createElement(Flex, { flexDirection: "row" },
|
|
48
|
+
React.createElement(TimelineIndicator, { status: item.status, isFirstItem: isFirstItem, isLastItem: isLastItem, mr: 4 }),
|
|
49
|
+
React.createElement(Container, { status: item.status, isLastItem: isLastItem, mb: 4, flexDirection: "column" },
|
|
50
|
+
React.createElement(TimelineIndicatorContentHeader, null,
|
|
51
|
+
React.createElement(Text, { variant: "body", color: item.status === "inactive"
|
|
52
|
+
? "neutral.c80"
|
|
53
|
+
: isLastItem
|
|
54
|
+
? "success.c100"
|
|
55
|
+
: "primary.c90" }, item.title),
|
|
56
|
+
(item === null || item === void 0 ? void 0 : item.estimatedTime) && item.status === "active" && (React.createElement(Tag, { size: "small", type: "opacity", active: true, disabled: true, textProps: { color: colors.neutral.c100 } }, `${item.estimatedTime / 60} min`))),
|
|
57
|
+
item.renderBody && item.status === "active" && (React.createElement(Flex, { position: "relative" },
|
|
58
|
+
React.createElement(Flex, { pt: 6 }, item.renderBody(item.status === "active")))))));
|
|
59
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { BaseStyledProps } from "src/components/styled";
|
|
3
|
+
export declare type ItemStatus = "inactive" | "active" | "completed";
|
|
4
|
+
export declare type Item = {
|
|
5
|
+
status: ItemStatus;
|
|
6
|
+
title: string;
|
|
7
|
+
renderBody?: (isDisplayed?: boolean) => ReactNode;
|
|
8
|
+
estimatedTime?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare type Props = BaseStyledProps & {
|
|
11
|
+
steps?: Item[];
|
|
12
|
+
};
|
|
13
|
+
export default function VerticalTimeline({ steps, ...props }: Props): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import TimelineItem from "./TimelineItem";
|
|
14
|
+
import { Flex } from "../..";
|
|
15
|
+
export default function VerticalTimeline(_a) {
|
|
16
|
+
var { steps } = _a, props = __rest(_a, ["steps"]);
|
|
17
|
+
return (React.createElement(Flex, Object.assign({}, props, { flexDirection: "column" }), steps === null || steps === void 0 ? void 0 : steps.map((step, index) => (React.createElement(TimelineItem, { key: step.title, item: step, isFirstItem: index === 0, isLastItem: index === steps.length - 1 })))));
|
|
18
|
+
}
|
package/lib/styles/global.js
CHANGED