@ledgerhq/react-ui 0.2.0 → 0.5.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/README.md +47 -4
- package/assets/logos/LedgerLiveAltRegular.d.ts +0 -1
- package/assets/logos/LedgerLiveRegular.d.ts +0 -1
- package/components/Chart/index.d.ts +0 -1
- package/components/Chart/index.js +1 -1
- package/components/Table/Columns.d.ts +62 -13
- package/components/Table/Columns.js +8 -18
- package/components/Table/index.d.ts +47 -14
- package/components/Table/index.js +37 -20
- package/components/Table/stories.helper.js +19 -18
- package/components/Tag/index.d.ts +18 -5
- package/components/Tag/index.js +54 -21
- package/components/animations/GlitchText/index.d.ts +6 -0
- package/components/animations/GlitchText/index.js +35 -0
- package/components/asorted/Divider/index.d.ts +0 -1
- package/components/asorted/Divider/index.js +2 -2
- package/components/asorted/Icon/BoxedIcon.d.ts +48 -0
- package/components/asorted/Icon/BoxedIcon.js +58 -0
- package/components/asorted/Icon/Icon.d.ts +0 -1
- package/components/asorted/Icon/index.d.ts +2 -0
- package/components/asorted/Icon/index.js +2 -0
- package/components/asorted/Text/index.d.ts +6 -22
- package/components/asorted/Text/index.js +7 -16
- package/components/asorted/Text/styles.d.ts +2 -1
- package/components/asorted/Text/styles.js +21 -9
- package/components/asorted/index.d.ts +1 -1
- package/components/asorted/index.js +1 -1
- package/components/cards/Carousel/Slide.js +3 -3
- package/components/cards/Carousel/index.js +8 -8
- package/components/cta/Button/index.d.ts +16 -8
- package/components/cta/Button/index.js +76 -65
- package/components/cta/Link/index.d.ts +59 -2
- package/components/cta/Link/index.js +17 -12
- package/components/cta/Toggle/index.d.ts +0 -1
- package/components/cta/Toggle/index.js +1 -1
- package/components/form/BaseInput/index.d.ts +81 -11
- package/components/form/BaseInput/index.js +42 -19
- package/components/form/Checkbox/Checkbox.js +12 -9
- package/components/form/Dropdown/index.d.ts +0 -1
- package/components/form/Dropdown/index.js +2 -2
- package/components/form/LegendInput/index.d.ts +26 -2
- package/components/form/LegendInput/index.js +5 -4
- package/components/form/NumberInput/index.d.ts +25 -3
- package/components/form/NumberInput/index.js +19 -7
- package/components/form/QrCodeInput/index.d.ts +25 -3
- package/components/form/QrCodeInput/index.js +7 -6
- package/components/form/QuantityInput/index.d.ts +26 -4
- package/components/form/QuantityInput/index.js +9 -8
- package/components/form/Radio/RadioElement.d.ts +5 -2
- package/components/form/Radio/RadioElement.js +15 -13
- package/components/form/Radio/RadioListElement.d.ts +22 -0
- package/components/form/Radio/RadioListElement.js +63 -0
- package/components/form/Radio/index.d.ts +8 -1
- package/components/form/Radio/index.js +2 -0
- package/components/form/SearchInput/index.d.ts +24 -2
- package/components/form/SearchInput/index.js +4 -3
- package/components/form/SelectInput/Control.d.ts +2 -2
- package/components/form/SelectInput/Control.js +3 -7
- package/components/form/SelectInput/DropdownIndicator.d.ts +0 -1
- package/components/form/SelectInput/DropdownIndicator.js +1 -1
- package/components/form/SelectInput/IndicatorsContainer.d.ts +0 -1
- package/components/form/SelectInput/MenuList.d.ts +0 -1
- package/components/form/SelectInput/MenuList.js +1 -1
- package/components/form/SelectInput/Option.js +11 -11
- package/components/form/SelectInput/ValueContainer.js +1 -1
- package/components/form/SelectInput/index.d.ts +3 -2
- package/components/form/SelectInput/index.js +5 -5
- package/components/form/SplitInput/index.js +5 -5
- package/components/form/Switch/Switch.js +8 -8
- package/components/helpers.d.ts +2 -2
- package/components/layout/Box/index.d.ts +8 -0
- package/components/layout/Box/index.js +3 -0
- package/components/layout/Drawer/index.d.ts +13 -0
- package/components/layout/{Side/Side.js → Drawer/index.js} +12 -12
- package/components/layout/Flex/index.d.ts +7 -7
- package/components/layout/Flex/index.js +2 -11
- package/components/layout/Grid/index.d.ts +3 -2
- package/components/layout/Grid/index.js +3 -6
- package/components/layout/Popin/index.d.ts +27 -6
- package/components/layout/Popin/index.js +65 -41
- package/components/layout/Side/index.d.ts +0 -1
- package/components/layout/Side/index.js +2 -2
- package/components/layout/index.d.ts +2 -0
- package/components/layout/index.js +2 -0
- package/components/loaders/ProgressLoader/index.d.ts +0 -1
- package/components/loaders/ProgressLoader/index.js +3 -3
- package/components/message/Alert/index.d.ts +22 -3
- package/components/message/Alert/index.js +31 -23
- package/components/message/Log/index.js +1 -1
- package/components/message/Notification/Badge.js +2 -2
- package/components/message/Notification/index.js +4 -6
- package/components/message/StatusNotification/index.d.ts +11 -0
- package/components/message/StatusNotification/index.js +33 -0
- package/components/message/Tip/index.d.ts +7 -0
- package/components/message/Tip/index.js +43 -0
- package/components/message/Tooltip/index.d.ts +3 -3
- package/components/message/Tooltip/index.js +1 -1
- package/components/message/Tooltip/styles.js +3 -3
- package/components/message/index.d.ts +3 -0
- package/components/message/index.js +3 -0
- package/components/navigation/Aside/index.d.ts +5 -1
- package/components/navigation/Breadcrumb/index.js +6 -6
- package/components/navigation/Header/index.d.ts +3 -3
- package/components/navigation/progress/ProgressBar/Onboarding.d.ts +0 -1
- package/components/navigation/progress/ProgressBar/Onboarding.js +6 -6
- package/components/navigation/progress/Stepper/index.js +9 -9
- package/components/navigation/sideBar/Item/Item.d.ts +4 -3
- package/components/navigation/sideBar/Item/Item.js +34 -16
- package/components/navigation/sideBar/Logo/Logo.d.ts +0 -1
- package/components/navigation/sideBar/SideBar/SideBar.d.ts +1 -2
- package/components/navigation/sideBar/SideBar/SideBar.js +14 -6
- package/components/navigation/sideBar/Toggle/Toggle.d.ts +0 -1
- package/components/navigation/sideBar/Toggle/Toggle.js +2 -2
- package/components/styled.d.ts +16 -0
- package/components/styled.js +13 -0
- package/components/tabs/Bar/index.js +4 -4
- package/components/tabs/Chip/index.d.ts +13 -0
- package/components/tabs/Chip/index.js +21 -0
- package/components/tabs/Pill/index.js +7 -7
- package/components/tabs/Tabs/index.js +8 -7
- package/components/tabs/index.d.ts +2 -0
- package/components/tabs/index.js +2 -0
- package/package.json +4 -4
- package/styles/InvertTheme.d.ts +1 -8
- package/styles/StyleProvider.d.ts +3 -3
- package/styles/StyleProvider.js +3 -3
- package/styles/global.d.ts +1 -0
- package/styles/global.js +15 -36
- package/styles/index.d.ts +0 -1
- package/styles/index.js +0 -1
- package/styles/theme.d.ts +5 -2
- package/styles/theme.js +7 -8
- package/components/layout/Side/Side.d.ts +0 -13
- package/styles/reset.d.ts +0 -2
- package/styles/reset.js +0 -62
|
@@ -15,12 +15,12 @@ const Bar = styled.div `
|
|
|
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};
|
|
18
|
-
background: ${(p) => p.on ? p.theme.colors.
|
|
18
|
+
background: ${(p) => (p.on ? p.theme.colors.neutral.c100 : p.theme.colors.neutral.c40)};
|
|
19
19
|
`;
|
|
20
20
|
const Handler = styled.div `
|
|
21
21
|
transition: all 600ms linear;
|
|
22
22
|
padding: 4px;
|
|
23
|
-
background: ${(p) => p.theme.colors.
|
|
23
|
+
background: ${(p) => p.theme.colors.neutral.c100};
|
|
24
24
|
border-radius: ${(p) => `${p.theme.radii[1]}px`};
|
|
25
25
|
|
|
26
26
|
display: flex;
|
|
@@ -35,8 +35,8 @@ const Handler = styled.div `
|
|
|
35
35
|
width: 16px;
|
|
36
36
|
justify-content: center;
|
|
37
37
|
align-items: center;
|
|
38
|
-
color: ${(p) => p.theme.colors.
|
|
39
|
-
background: ${(p) => p.theme.colors.
|
|
38
|
+
color: ${(p) => p.theme.colors.neutral.c100};
|
|
39
|
+
background: ${(p) => p.theme.colors.neutral.c00};
|
|
40
40
|
}
|
|
41
41
|
`;
|
|
42
42
|
const Onboarding = ({ steps, currentIndex }) => {
|
|
@@ -45,8 +45,8 @@ const Onboarding = ({ steps, currentIndex }) => {
|
|
|
45
45
|
return (React.createElement(Container, null,
|
|
46
46
|
React.createElement(Bar, { on: true, fill: fill }),
|
|
47
47
|
React.createElement(Handler, { key: currentStep.key },
|
|
48
|
-
React.createElement(Text, { className: "index", color: "
|
|
49
|
-
React.createElement(Text, { color: "
|
|
48
|
+
React.createElement(Text, { className: "index", color: "neutral.c00", fontWeight: "medium", variant: "micro" }, currentIndex + 1),
|
|
49
|
+
React.createElement(Text, { color: "neutral.c00", fontWeight: "medium", textTransform: "uppercase", variant: "micro" }, currentStep.label)),
|
|
50
50
|
React.createElement(Bar, { fill: 100 - Number(fill) })));
|
|
51
51
|
};
|
|
52
52
|
export default Onboarding;
|
|
@@ -24,7 +24,7 @@ export const Item = {
|
|
|
24
24
|
${space}
|
|
25
25
|
`,
|
|
26
26
|
Current: styled.div.attrs({
|
|
27
|
-
backgroundColor: "
|
|
27
|
+
backgroundColor: "primary.c90",
|
|
28
28
|
}) `
|
|
29
29
|
width: 6px;
|
|
30
30
|
height: 6px;
|
|
@@ -32,7 +32,7 @@ export const Item = {
|
|
|
32
32
|
${color}
|
|
33
33
|
`,
|
|
34
34
|
Pending: styled.div.attrs({
|
|
35
|
-
backgroundColor: "
|
|
35
|
+
backgroundColor: "neutral.c70",
|
|
36
36
|
}) `
|
|
37
37
|
width: ${(p) => p.theme.space[2]}px;
|
|
38
38
|
height: ${(p) => p.theme.space[2]}px;
|
|
@@ -45,19 +45,19 @@ export const Item = {
|
|
|
45
45
|
const StepText = styled(Text) `
|
|
46
46
|
color: ${(p) => {
|
|
47
47
|
if (p.errored) {
|
|
48
|
-
return p.theme.colors.
|
|
48
|
+
return p.theme.colors.error.c100;
|
|
49
49
|
}
|
|
50
50
|
if (p.inactive) {
|
|
51
|
-
return p.theme.colors.
|
|
51
|
+
return p.theme.colors.neutral.c70;
|
|
52
52
|
}
|
|
53
|
-
return p.theme.colors.
|
|
53
|
+
return p.theme.colors.neutral.c100;
|
|
54
54
|
}};
|
|
55
55
|
`;
|
|
56
56
|
const BaseSeparator = styled.div `
|
|
57
57
|
flex: 1;
|
|
58
58
|
position: relative;
|
|
59
59
|
overflow-x: hidden;
|
|
60
|
-
background-color: ${(p) => p.theme.colors.
|
|
60
|
+
background-color: ${(p) => p.theme.colors.neutral.c40};
|
|
61
61
|
height: 1px;
|
|
62
62
|
top: ${(p) => p.theme.space[5]}px;
|
|
63
63
|
`;
|
|
@@ -68,11 +68,11 @@ const Separator = {
|
|
|
68
68
|
const stepContentsByState = {
|
|
69
69
|
pending: (React.createElement(Item.Container, null,
|
|
70
70
|
React.createElement(Item.Pending, null))),
|
|
71
|
-
current: (React.createElement(Item.Container, { backgroundColor: "
|
|
71
|
+
current: (React.createElement(Item.Container, { backgroundColor: "primary.c20", borderRadius: "8px" },
|
|
72
72
|
React.createElement(Item.Current, null))),
|
|
73
|
-
completed: (React.createElement(Item.Container, { color: "
|
|
73
|
+
completed: (React.createElement(Item.Container, { color: "primary.c90", backgroundColor: "primary.c20", borderRadius: "8px" },
|
|
74
74
|
React.createElement(Item.Completed, null))),
|
|
75
|
-
errored: (React.createElement(Item.Container, { color: "
|
|
75
|
+
errored: (React.createElement(Item.Container, { color: "error.c100", backgroundColor: "warning.c30", borderRadius: "8px" },
|
|
76
76
|
React.createElement(Item.Errored, null))),
|
|
77
77
|
};
|
|
78
78
|
export const Step = memo(function Step({ state, label, hideLeftSeparator, nextState, }) {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const ItemLabel: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("../../../asorted/Text").BaseTextProps, never>;
|
|
1
|
+
export declare const ItemLabel: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("../../../asorted/Text").TextProps, keyof import("../../../asorted/Text").TextProps>;
|
|
3
2
|
export declare type ItemType = {
|
|
4
3
|
label: string;
|
|
5
4
|
children: JSX.Element;
|
|
6
5
|
onClick: () => void;
|
|
7
6
|
isActive?: boolean;
|
|
8
7
|
isDisabled?: boolean;
|
|
8
|
+
displayNotificationBadge?: boolean;
|
|
9
|
+
customNotificationBadge?: JSX.Element;
|
|
9
10
|
};
|
|
10
|
-
declare const Item: ({ label, children, onClick, isActive, isDisabled }: ItemType) => JSX.Element;
|
|
11
|
+
declare const Item: ({ label, children, onClick, isActive, isDisabled, displayNotificationBadge, customNotificationBadge, }: ItemType) => JSX.Element;
|
|
11
12
|
export default Item;
|
|
@@ -3,10 +3,11 @@ import styled from "styled-components";
|
|
|
3
3
|
import SideBarContext from "../index";
|
|
4
4
|
import Text from "../../../asorted/Text";
|
|
5
5
|
import TransitionInOut from "../../../transitions/TransitionInOut";
|
|
6
|
+
import Flex from "../../../layout/Flex";
|
|
6
7
|
const ItemWrapper = styled.li `
|
|
7
8
|
/** DEFAULT VARIANT **/
|
|
8
|
-
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.
|
|
9
|
-
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.
|
|
9
|
+
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.neutral.c80};
|
|
10
|
+
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.neutral.c80};
|
|
10
11
|
--ll-sidebar-item-background-color: unset;
|
|
11
12
|
|
|
12
13
|
display: flex;
|
|
@@ -25,8 +26,8 @@ const ItemWrapper = styled.li `
|
|
|
25
26
|
|
|
26
27
|
/** HOVER VARIANT **/
|
|
27
28
|
&:hover {
|
|
28
|
-
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.
|
|
29
|
-
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.
|
|
29
|
+
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.neutral.c100};
|
|
30
|
+
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.primary.c80};
|
|
30
31
|
--ll-sidebar-item-background-color: unset;
|
|
31
32
|
}
|
|
32
33
|
|
|
@@ -37,37 +38,54 @@ const ItemWrapper = styled.li `
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
/** ACTIVE VARIANT **/
|
|
40
|
-
&[data-active] {
|
|
41
|
-
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.
|
|
42
|
-
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.
|
|
43
|
-
--ll-sidebar-item-background-color: ${(props) => props.theme.colors.
|
|
41
|
+
&[data-active="true"] {
|
|
42
|
+
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.neutral.c100};
|
|
43
|
+
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.primary.c80};
|
|
44
|
+
--ll-sidebar-item-background-color: ${(props) => props.theme.colors.primary.c20};
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
/** DISABLE VARIANT **/
|
|
47
|
-
&[data-disable] {
|
|
48
|
-
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.
|
|
49
|
-
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.
|
|
48
|
+
&[data-disable="true"] {
|
|
49
|
+
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.neutral.c80};
|
|
50
|
+
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.neutral.c80};
|
|
50
51
|
--ll-sidebar-item-background-color: unset;
|
|
51
52
|
opacity: 0.3;
|
|
52
53
|
cursor: unset;
|
|
54
|
+
pointer-events: none;
|
|
53
55
|
}
|
|
54
56
|
`;
|
|
57
|
+
const CollapsedBadgeContainer = styled.div `
|
|
58
|
+
position: absolute;
|
|
59
|
+
margin-top: -${(p) => p.theme.space[11]}px;
|
|
60
|
+
margin-left: ${(p) => p.theme.space[8]}px;
|
|
61
|
+
`;
|
|
62
|
+
const DefaultBadge = styled.div `
|
|
63
|
+
height: ${(p) => p.theme.space[4]}px;
|
|
64
|
+
width: ${(p) => p.theme.space[4]}px;
|
|
65
|
+
border-radius: ${(p) => p.theme.radii[2]}px;
|
|
66
|
+
background-color: ${(p) => p.theme.colors.primary.c80};
|
|
67
|
+
`;
|
|
55
68
|
export const ItemLabel = styled(Text) `
|
|
56
69
|
display: inline-block;
|
|
57
70
|
color: var(--ll-sidebar-item-label-color);
|
|
58
71
|
|
|
59
72
|
text-transform: capitalize;
|
|
60
73
|
`;
|
|
61
|
-
const Item = ({ label, children, onClick, isActive, isDisabled }) => {
|
|
74
|
+
const Item = ({ label, children, onClick, isActive, isDisabled, displayNotificationBadge, customNotificationBadge, }) => {
|
|
62
75
|
const { isExpanded } = useContext(SideBarContext);
|
|
63
76
|
const handleClick = () => {
|
|
64
77
|
if (isDisabled)
|
|
65
78
|
return;
|
|
66
79
|
onClick();
|
|
67
80
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
React.createElement(
|
|
71
|
-
|
|
81
|
+
const badge = customNotificationBadge !== null && customNotificationBadge !== void 0 ? customNotificationBadge : React.createElement(DefaultBadge, null);
|
|
82
|
+
return (React.createElement(React.Fragment, null,
|
|
83
|
+
React.createElement(ItemWrapper, { role: "button", onClick: handleClick, "data-active": isActive, "data-disable": isDisabled, tabIndex: 0 },
|
|
84
|
+
children,
|
|
85
|
+
React.createElement(CollapsedBadgeContainer, null,
|
|
86
|
+
React.createElement(TransitionInOut, { unmountOnExit: true, mountOnEnter: true, in: !isExpanded, style: { transitionDelay: !isExpanded ? "200ms" : 0 } }, displayNotificationBadge && badge)),
|
|
87
|
+
React.createElement(TransitionInOut, { timeout: 200, in: isExpanded, unmountOnExit: true, mountOnEnter: true, style: { transitionDelay: isExpanded ? "200ms" : 0, display: "flex", flex: "1" } },
|
|
88
|
+
React.createElement(ItemLabel, { variant: "paragraph" }, label),
|
|
89
|
+
React.createElement(Flex, { alignItems: "center", justifyContent: "flex-end", ml: 2, flexGrow: 1 }, displayNotificationBadge && badge)))));
|
|
72
90
|
};
|
|
73
91
|
export default Item;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
export declare type SideBarProps = {
|
|
3
2
|
children: Array<JSX.Element>;
|
|
4
3
|
onToggle: () => void;
|
|
@@ -6,6 +5,6 @@ export declare type SideBarProps = {
|
|
|
6
5
|
};
|
|
7
6
|
declare const SideBar: {
|
|
8
7
|
({ children, onToggle, isExpanded }: SideBarProps): JSX.Element;
|
|
9
|
-
Item: ({ label, children, onClick, isActive, isDisabled }: import("../Item/Item").ItemType) => JSX.Element;
|
|
8
|
+
Item: ({ label, children, onClick, isActive, isDisabled, displayNotificationBadge, customNotificationBadge, }: import("../Item/Item").ItemType) => JSX.Element;
|
|
10
9
|
};
|
|
11
10
|
export default SideBar;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useMemo, useState } from "react";
|
|
2
2
|
import { CSSTransition } from "react-transition-group";
|
|
3
3
|
import styled from "styled-components";
|
|
4
4
|
import SideBarContext from "../../../navigation/sideBar";
|
|
@@ -12,10 +12,10 @@ const Nav = styled(Flex) `
|
|
|
12
12
|
row-gap: 1.5rem;
|
|
13
13
|
height: 100vh;
|
|
14
14
|
max-width: 14.875rem;
|
|
15
|
-
color: ${(props) => props.theme.colors.
|
|
16
|
-
border-right: 1px solid ${(props) => props.theme.colors.
|
|
17
|
-
background-color: ${(props) => props.theme.colors.
|
|
18
|
-
transition: max-width
|
|
15
|
+
color: ${(props) => props.theme.colors.neutral.c100};
|
|
16
|
+
border-right: 1px solid ${(props) => props.theme.colors.neutral.c40};
|
|
17
|
+
background-color: ${(props) => props.theme.colors.background.main};
|
|
18
|
+
transition: max-width 200ms;
|
|
19
19
|
will-change: max-width;
|
|
20
20
|
|
|
21
21
|
&.nav-enter {
|
|
@@ -31,12 +31,20 @@ const Nav = styled(Flex) `
|
|
|
31
31
|
max-width: ${(p) => `${p.theme.space[19]}px`};
|
|
32
32
|
}
|
|
33
33
|
`;
|
|
34
|
+
const TransparentMouseZone = styled.div `
|
|
35
|
+
position: absolute;
|
|
36
|
+
left: 100%;
|
|
37
|
+
top: 0;
|
|
38
|
+
width: ${(p) => `${p.theme.space[8]}px`};
|
|
39
|
+
height: 100%;
|
|
40
|
+
`;
|
|
34
41
|
const SideBar = ({ children, onToggle, isExpanded = true }) => {
|
|
35
42
|
const [isToggleDisplayed, setToggleDisplayed] = useState(false);
|
|
36
43
|
const providerValue = useMemo(() => ({ isExpanded, onToggle }), [isExpanded, onToggle]);
|
|
37
44
|
return (React.createElement(SideBarContext.Provider, { value: providerValue },
|
|
38
|
-
React.createElement(CSSTransition, { in: isExpanded, timeout:
|
|
45
|
+
React.createElement(CSSTransition, { in: isExpanded, timeout: 200, classNames: "nav" },
|
|
39
46
|
React.createElement(Nav, { flexDirection: "column", justifyContent: "flex-start", alignContent: "stretch", role: "navigation", "aria-label": "Main", onMouseEnter: () => setToggleDisplayed(true), onMouseLeave: () => setToggleDisplayed(false) },
|
|
47
|
+
React.createElement(TransparentMouseZone, null),
|
|
40
48
|
React.createElement(Toggle, { isDisplayed: isToggleDisplayed }),
|
|
41
49
|
React.createElement(Logo, null),
|
|
42
50
|
React.createElement(Flex, { flexDirection: "column", justifyContent: "flex-start", alignContent: "stretch" }, children)))));
|
|
@@ -15,8 +15,8 @@ const ToggleButtonContainer = styled(TransitionInOut) `
|
|
|
15
15
|
right: calc(var(--ll-side-bar-toggle-button-size) / -2);
|
|
16
16
|
cursor: pointer;
|
|
17
17
|
|
|
18
|
-
background: ${(p) => p.theme.colors.
|
|
19
|
-
border: 1px solid ${(p) => p.theme.colors.
|
|
18
|
+
background: ${(p) => p.theme.colors.neutral.c20};
|
|
19
|
+
border: 1px solid ${(p) => p.theme.colors.neutral.c100};
|
|
20
20
|
border-radius: 50%;
|
|
21
21
|
width: var(--ll-side-bar-toggle-button-size);
|
|
22
22
|
height: var(--ll-side-bar-toggle-button-size);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { StyledInterface, InterpolationFunction } from "styled-components";
|
|
2
|
+
import { FlexboxProps, SpaceProps, PositionProps, ColorProps, LayoutProps, OverflowProps, BorderProps } from "styled-system";
|
|
3
|
+
export declare type BaseStyledProps = SpaceProps & FlexboxProps & PositionProps & ColorProps & LayoutProps & BorderProps & OverflowProps & {
|
|
4
|
+
/**
|
|
5
|
+
* The columnGap CSS property sets the size of the gap (gutter) between an element's grid columns.
|
|
6
|
+
*/
|
|
7
|
+
columnGap?: string | number;
|
|
8
|
+
/**
|
|
9
|
+
* The rowGap CSS property sets the size of the gap (gutter) between an element's grid rows.
|
|
10
|
+
*/
|
|
11
|
+
rowGap?: string | number;
|
|
12
|
+
color?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const baseStyles: InterpolationFunction<unknown>;
|
|
15
|
+
declare const _default: StyledInterface;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import gaps from "../styles/system/gaps";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { compose, flexbox, space, position, color, layout, overflow, border, } from "styled-system";
|
|
4
|
+
export const baseStyles = compose(flexbox, space, position, color, layout, overflow, gaps, border);
|
|
5
|
+
const proxyStyled = new Proxy(styled, {
|
|
6
|
+
apply(target, thisArg, argumentsList) {
|
|
7
|
+
return styled(target.apply(thisArg, argumentsList)(baseStyles));
|
|
8
|
+
},
|
|
9
|
+
get(target, property) {
|
|
10
|
+
return styled(target[property].apply(styled, [baseStyles]));
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
export default proxyStyled;
|
|
@@ -3,7 +3,7 @@ import styled from "styled-components";
|
|
|
3
3
|
import Flex from "../../layout/Flex";
|
|
4
4
|
const Bar = styled.div `
|
|
5
5
|
display: inline-flex;
|
|
6
|
-
border: 1px solid ${(p) => p.theme.colors.
|
|
6
|
+
border: 1px solid ${(p) => p.theme.colors.neutral.c40};
|
|
7
7
|
border-radius: 33px;
|
|
8
8
|
padding: 2px;
|
|
9
9
|
`;
|
|
@@ -15,12 +15,12 @@ const Item = styled(Flex).attrs({
|
|
|
15
15
|
cursor: pointer;
|
|
16
16
|
padding: 8px 12px 8px 12px;
|
|
17
17
|
border-radius: 33px;
|
|
18
|
-
color: ${(p) => p.active ? p.theme.colors.
|
|
19
|
-
background-color: ${(p) => (p.active ? p.theme.colors.
|
|
18
|
+
color: ${(p) => (p.active ? p.theme.colors.neutral.c00 : p.theme.colors.neutral.c80)};
|
|
19
|
+
background-color: ${(p) => (p.active ? p.theme.colors.neutral.c100 : "unset")};
|
|
20
20
|
`;
|
|
21
21
|
export default function BarTabs({ children, onTabChange, initialActiveIndex }) {
|
|
22
22
|
const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
|
|
23
|
-
return (React.createElement(Bar, null, React.Children.toArray(children).map((child, index) => (React.createElement(Item, { key: index, active: index === activeIndex, onClick: (
|
|
23
|
+
return (React.createElement(Bar, null, React.Children.toArray(children).map((child, index) => (React.createElement(Item, { key: index, active: index === activeIndex, onClick: () => {
|
|
24
24
|
setActiveIndex(index);
|
|
25
25
|
onTabChange && onTabChange(index);
|
|
26
26
|
} }, child)))));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare type Props = React.PropsWithChildren<{
|
|
3
|
+
/**
|
|
4
|
+
* An optional callback that will be called when the active tab changes.
|
|
5
|
+
*/
|
|
6
|
+
onTabChange?: (activeIndex: number) => void;
|
|
7
|
+
/**
|
|
8
|
+
* The tab index to mark as active when rendering for the first time.
|
|
9
|
+
* If omitted, then initially no tabs will be selected.
|
|
10
|
+
*/
|
|
11
|
+
initialActiveIndex?: number;
|
|
12
|
+
}>;
|
|
13
|
+
export default function BarTabs({ children, onTabChange, initialActiveIndex }: Props): JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React, { useState } from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import Flex from "../../layout/Flex";
|
|
4
|
+
const Item = styled(Flex).attrs({
|
|
5
|
+
flex: 1,
|
|
6
|
+
justifyContent: "center",
|
|
7
|
+
alignItems: "center",
|
|
8
|
+
}) `
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
padding: 8px 12px 8px 12px;
|
|
11
|
+
border-radius: ${(p) => p.theme.radii[2]}px;
|
|
12
|
+
color: ${(p) => p.theme.colors.neutral.c100};
|
|
13
|
+
background-color: ${(p) => (p.active ? p.theme.colors.primary.c30 : "unset")};
|
|
14
|
+
`;
|
|
15
|
+
export default function BarTabs({ children, onTabChange, initialActiveIndex }) {
|
|
16
|
+
const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
|
|
17
|
+
return (React.createElement(Flex, { justifyContent: "space-between", flex: 1, columnGap: 5 }, React.Children.toArray(children).map((child, index) => (React.createElement(Item, { key: index, active: index === activeIndex, onClick: () => {
|
|
18
|
+
setActiveIndex(index);
|
|
19
|
+
onTabChange && onTabChange(index);
|
|
20
|
+
} }, child)))));
|
|
21
|
+
}
|
|
@@ -24,14 +24,14 @@ const Item = styled(Flex).attrs({ flex: 1, justifyContent: "center", alignItems:
|
|
|
24
24
|
padding: 8px 10px 8px 10px;
|
|
25
25
|
border: 1px solid;
|
|
26
26
|
&[data-active="false"] {
|
|
27
|
-
color: ${(p) => p.theme.colors.
|
|
28
|
-
background-color: ${(p) => p.theme.colors.
|
|
29
|
-
border-color: ${(p) => p.theme.colors.
|
|
27
|
+
color: ${(p) => p.theme.colors.neutral.c80};
|
|
28
|
+
background-color: ${(p) => p.theme.colors.neutral.c00};
|
|
29
|
+
border-color: ${(p) => p.theme.colors.neutral.c40};
|
|
30
30
|
}
|
|
31
31
|
&[data-active="true"] {
|
|
32
|
-
color: ${(p) => p.theme.colors.
|
|
33
|
-
background-color: ${(p) => p.theme.colors.
|
|
34
|
-
border-color: ${(p) => p.theme.colors.
|
|
32
|
+
color: ${(p) => p.theme.colors.neutral.c00};
|
|
33
|
+
background-color: ${(p) => p.theme.colors.neutral.c100};
|
|
34
|
+
border-color: ${(p) => p.theme.colors.neutral.c100};
|
|
35
35
|
|
|
36
36
|
&:not(:last-child) {
|
|
37
37
|
border-right-width: 0;
|
|
@@ -43,7 +43,7 @@ const Item = styled(Flex).attrs({ flex: 1, justifyContent: "center", alignItems:
|
|
|
43
43
|
`;
|
|
44
44
|
export default function PillTabs({ children, onTabChange, initialActiveIndex, }) {
|
|
45
45
|
const [activeIndex, setActiveIndex] = useState(initialActiveIndex);
|
|
46
|
-
return (React.createElement(Pill, null, React.Children.toArray(children).map((child, index) => (React.createElement(Item, { key: index, "data-active": index === activeIndex, onClick: (
|
|
46
|
+
return (React.createElement(Pill, null, React.Children.toArray(children).map((child, index) => (React.createElement(Item, { key: index, "data-active": index === activeIndex, onClick: () => {
|
|
47
47
|
setActiveIndex(index);
|
|
48
48
|
onTabChange && onTabChange(index);
|
|
49
49
|
} }, child)))));
|
|
@@ -32,7 +32,7 @@ const HeaderTitle = styled(Text).attrs({
|
|
|
32
32
|
fontWeight: "600",
|
|
33
33
|
}) `
|
|
34
34
|
margin-inline: 12px;
|
|
35
|
-
color: ${(p) => p.selected ? p.theme.colors.
|
|
35
|
+
color: ${(p) => (p.selected ? p.theme.colors.neutral.c100 : p.theme.colors.neutral.c80)};
|
|
36
36
|
`;
|
|
37
37
|
const HeaderBottomBarFixed = styled(Flex).attrs({
|
|
38
38
|
flex: 1,
|
|
@@ -40,7 +40,7 @@ const HeaderBottomBarFixed = styled(Flex).attrs({
|
|
|
40
40
|
width: 100%;
|
|
41
41
|
position: relative;
|
|
42
42
|
top: 3px;
|
|
43
|
-
border-bottom: 1px solid ${(p) => p.theme.colors.
|
|
43
|
+
border-bottom: 1px solid ${(p) => p.theme.colors.neutral.c40};
|
|
44
44
|
`;
|
|
45
45
|
const HeaderBottomBarMoving = styled.div `
|
|
46
46
|
position: relative;
|
|
@@ -48,12 +48,12 @@ const HeaderBottomBarMoving = styled.div `
|
|
|
48
48
|
width: ${(p) => p.width}px;
|
|
49
49
|
transition: all 400ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
50
50
|
border-bottom: solid 3px;
|
|
51
|
-
border-bottom-color: ${(p) => p.theme.colors.
|
|
51
|
+
border-bottom-color: ${(p) => p.theme.colors.primary.c70};
|
|
52
52
|
`;
|
|
53
53
|
const Badge = styled(Tag).attrs((p) => ({
|
|
54
54
|
borderRadius: p.theme.radii[3],
|
|
55
|
-
backgroundColor: p.theme.colors.
|
|
56
|
-
color: p.theme.colors.
|
|
55
|
+
backgroundColor: p.theme.colors.primary.c70,
|
|
56
|
+
color: p.theme.colors.neutral.c00,
|
|
57
57
|
})) `
|
|
58
58
|
padding: 5px;
|
|
59
59
|
min-width: 24px;
|
|
@@ -74,8 +74,8 @@ const MainContent = styled(Flex).attrs({
|
|
|
74
74
|
flex: 1,
|
|
75
75
|
}) `
|
|
76
76
|
width: 100%;
|
|
77
|
-
color: ${(p) => p.active ? p.theme.colors.
|
|
78
|
-
background-color: ${(p) => p.active ? p.theme.colors.
|
|
77
|
+
color: ${(p) => (p.active ? p.theme.colors.neutral.c00 : p.theme.colors.neutral.c70)};
|
|
78
|
+
background-color: ${(p) => (p.active ? p.theme.colors.neutral.c100 : p.theme.colors.neutral.c00)};
|
|
79
79
|
`;
|
|
80
80
|
export default function Tabs(props) {
|
|
81
81
|
const { tabs, onTabChange } = props;
|
|
@@ -97,6 +97,7 @@ export default function Tabs(props) {
|
|
|
97
97
|
left,
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
100
101
|
}, [activeIndex]);
|
|
101
102
|
const onTabClick = (index) => {
|
|
102
103
|
const tab = tabs.find((t) => t.index === index);
|
package/components/tabs/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/react-ui",
|
|
3
3
|
"description": "Ledger Live - Desktop UI",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"author": "Ledger Live Team <team-live@ledger.fr>",
|
|
6
6
|
"repository": "https://github.com/LedgerHQ/ui",
|
|
7
7
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@ledgerhq/ui-shared": "^0.1.3",
|
|
32
32
|
"@tippyjs/react": "^4.2.6",
|
|
33
33
|
"@types/color": "^3.0.2",
|
|
34
|
-
"@types/react": "~17.0.
|
|
34
|
+
"@types/react": "~17.0.37",
|
|
35
35
|
"@types/react-dom": "^17.0.11",
|
|
36
36
|
"@types/react-select": "^4.0.18",
|
|
37
37
|
"@types/react-transition-group": "^4.4.2",
|
|
@@ -47,11 +47,11 @@
|
|
|
47
47
|
"react-select": "^3.2.0",
|
|
48
48
|
"react-transition-group": "^4.4.2",
|
|
49
49
|
"react-window": "^1.8.6",
|
|
50
|
-
"styled-components": "^5.2.3",
|
|
51
50
|
"styled-system": "^5.1.5"
|
|
52
51
|
},
|
|
53
52
|
"peerDependencies": {
|
|
54
53
|
"react": "^17.0.2",
|
|
55
|
-
"react-dom": "^17.0.2"
|
|
54
|
+
"react-dom": "^17.0.2",
|
|
55
|
+
"styled-components": "^5.3.3"
|
|
56
56
|
}
|
|
57
57
|
}
|
package/styles/InvertTheme.d.ts
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
interface Props {
|
|
4
|
-
children: React.ReactNode;
|
|
5
|
-
selectedPalette?: ThemeNames;
|
|
6
|
-
fontsPath?: string;
|
|
7
|
-
}
|
|
8
|
-
export declare const InvertTheme: ({ children }: Props) => React.ReactElement;
|
|
9
|
-
export {};
|
|
2
|
+
export declare const InvertTheme: ({ children }: React.PropsWithChildren<unknown>) => React.ReactElement;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { GlobalStyleProps } from ".";
|
|
2
3
|
import { ThemeNames } from "@ledgerhq/ui-shared";
|
|
3
|
-
interface Props {
|
|
4
|
+
interface Props extends GlobalStyleProps {
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
selectedPalette?: ThemeNames;
|
|
6
|
-
fontsPath?: string;
|
|
7
7
|
}
|
|
8
|
-
export declare const StyleProvider: ({ children, fontsPath, selectedPalette, }: Props) => React.ReactElement;
|
|
8
|
+
export declare const StyleProvider: ({ children, fontsPath, fontMappings, selectedPalette, }: Props) => React.ReactElement;
|
|
9
9
|
export {};
|
package/styles/StyleProvider.js
CHANGED
|
@@ -2,9 +2,9 @@ import React, { useMemo } from "react";
|
|
|
2
2
|
import { ThemeProvider } from "styled-components";
|
|
3
3
|
import { defaultTheme, GlobalStyle } from ".";
|
|
4
4
|
import { palettes } from "@ledgerhq/ui-shared";
|
|
5
|
-
export const StyleProvider = ({ children, fontsPath, selectedPalette = "light", }) => {
|
|
6
|
-
const theme = useMemo(() => (Object.assign(Object.assign({}, defaultTheme), { colors: Object.assign(Object.assign({}, defaultTheme.colors), { palette: palettes[selectedPalette] }), theme: selectedPalette })), [selectedPalette]);
|
|
5
|
+
export const StyleProvider = ({ children, fontsPath, fontMappings, selectedPalette = "light", }) => {
|
|
6
|
+
const theme = useMemo(() => (Object.assign(Object.assign({}, defaultTheme), { colors: Object.assign(Object.assign(Object.assign({}, defaultTheme.colors), palettes[selectedPalette]), { palette: palettes[selectedPalette] }), theme: selectedPalette })), [selectedPalette]);
|
|
7
7
|
return (React.createElement(ThemeProvider, { theme: theme },
|
|
8
|
-
React.createElement(GlobalStyle, { fontsPath: fontsPath }),
|
|
8
|
+
React.createElement(GlobalStyle, { fontsPath: fontsPath, fontMappings: fontMappings }),
|
|
9
9
|
children));
|
|
10
10
|
};
|
package/styles/global.d.ts
CHANGED
package/styles/global.js
CHANGED
|
@@ -1,59 +1,38 @@
|
|
|
1
1
|
import { createGlobalStyle } from "styled-components";
|
|
2
2
|
import { rgba } from "./helpers";
|
|
3
|
-
import reset from "./reset";
|
|
4
3
|
import tippyStyles from "../components/message/Tooltip/styles";
|
|
5
4
|
import { fontStyles } from "../components/asorted/Text/styles";
|
|
6
5
|
export const GlobalStyle = createGlobalStyle `
|
|
7
|
-
|
|
6
|
+
html {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
8
9
|
|
|
9
10
|
body {
|
|
10
11
|
font-family: Inter;
|
|
11
12
|
font-size: 100%;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.spectron-run canvas:not(.visible-for-spectron) {
|
|
17
|
-
visibility: hidden;
|
|
15
|
+
*, *:before, *:after {
|
|
16
|
+
box-sizing: inherit;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
19
|
+
* {
|
|
20
|
+
margin: 0;
|
|
21
|
+
padding: 0;
|
|
22
|
+
font: inherit;
|
|
23
|
+
color: inherit;
|
|
24
|
+
user-select: inherit;
|
|
25
|
+
cursor: inherit;
|
|
26
|
+
outline: none;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
::selection {
|
|
31
|
-
background: ${(p) => rgba(p.theme.colors.
|
|
30
|
+
background: ${(p) => rgba(p.theme.colors.primary.c100, 0.1)};
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
--track-color: rgba(0,0,0,0);
|
|
35
34
|
|
|
36
|
-
|
|
37
|
-
width: ${(p) => p.theme.overflow.trackSize}px;
|
|
38
|
-
height: ${(p) => p.theme.overflow.trackSize}px;
|
|
39
|
-
background-color: rgba(0,0,0,0);
|
|
40
|
-
}
|
|
41
|
-
::-webkit-scrollbar-button {
|
|
42
|
-
opacity: 0;
|
|
43
|
-
height: 0;
|
|
44
|
-
width: 0;
|
|
45
|
-
}
|
|
46
|
-
::-webkit-scrollbar-track {
|
|
47
|
-
background-color: rgba(0,0,0,0);
|
|
48
|
-
}
|
|
49
|
-
::-webkit-scrollbar-thumb {
|
|
50
|
-
box-shadow: inset 0 0 0 ${(p) => p.theme.overflow.trackSize}px var(--track-color);
|
|
51
|
-
border: 2px solid rgba(0,0,0,0);
|
|
52
|
-
border-radius: ${(p) => p.theme.overflow.trackSize}px;
|
|
53
|
-
}
|
|
54
|
-
::-webkit-scrollbar-corner {
|
|
55
|
-
opacity: 0;
|
|
56
|
-
}
|
|
35
|
+
${(props) => (typeof props.fontsPath === "string" ? fontStyles : "")}
|
|
57
36
|
|
|
58
37
|
${tippyStyles}
|
|
59
38
|
`;
|
package/styles/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { default as defaultTheme } from "./theme";
|
|
2
2
|
export * from "./helpers";
|
|
3
3
|
export * from "./global";
|
|
4
|
-
export { default as resetCss } from "./reset";
|
|
5
4
|
export * from "./StyleProvider";
|
|
6
5
|
export type { ThemeNames, ColorPalette } from "@ledgerhq/ui-shared";
|
|
7
6
|
export { palettes } from "@ledgerhq/ui-shared";
|