@ledgerhq/react-ui 0.1.1 → 0.4.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 +54 -13
- package/assets/icons.d.ts +1 -0
- package/assets/icons.js +1 -0
- package/components/Chart/index.js +1 -1
- package/components/Table/Columns.d.ts +2 -2
- package/components/Table/Columns.js +2 -2
- package/components/Table/index.d.ts +3 -2
- package/components/Table/index.js +1 -4
- package/components/Table/stories.helper.js +6 -6
- package/components/Tag/index.d.ts +18 -5
- package/components/Tag/index.js +54 -21
- package/components/animations/GlitchText/index.d.ts +7 -0
- package/components/animations/GlitchText/index.js +35 -0
- package/components/asorted/Divider/index.js +2 -2
- package/components/asorted/Icon/Icon.d.ts +1 -0
- package/components/asorted/Icon/Icon.js +8 -1
- package/components/asorted/Icon/index.d.ts +1 -1
- package/components/asorted/Icon/index.js +1 -1
- package/components/asorted/Text/index.d.ts +9 -31
- package/components/asorted/Text/index.js +11 -17
- package/components/asorted/Text/styles.d.ts +7 -2
- package/components/asorted/Text/styles.js +69 -85
- 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 +26 -14
- package/components/cta/Button/index.js +77 -66
- package/components/cta/Link/index.d.ts +12 -4
- package/components/cta/Link/index.js +4 -3
- package/components/cta/Toggle/index.js +1 -1
- package/components/cta/getCtaStyle.d.ts +2 -2
- package/components/cta/index.d.ts +1 -0
- package/components/cta/index.js +1 -0
- package/components/form/BaseInput/index.d.ts +86 -15
- package/components/form/BaseInput/index.js +47 -20
- package/components/form/Checkbox/Checkbox.js +12 -9
- package/components/form/Dropdown/index.js +3 -3
- package/components/form/LegendInput/index.js +3 -3
- package/components/form/NumberInput/index.d.ts +1 -1
- package/components/form/NumberInput/index.js +18 -7
- package/components/form/QrCodeInput/index.js +4 -4
- package/components/form/QuantityInput/index.js +8 -8
- package/components/form/Radio/RadioElement.d.ts +5 -2
- package/components/form/Radio/RadioElement.js +16 -14
- 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.js +1 -1
- package/components/form/SelectInput/DropdownIndicator.js +1 -1
- package/components/form/SelectInput/MenuList.js +1 -1
- package/components/form/SelectInput/Option.js +12 -12
- package/components/form/SelectInput/ValueContainer.js +2 -2
- 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 +9 -9
- package/components/helpers.d.ts +2 -2
- package/components/layout/Box/index.d.ts +11 -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 +10 -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 -3
- package/components/layout/Popin/index.d.ts +33 -6
- package/components/layout/Popin/index.js +65 -41
- package/components/layout/Side/Provider.d.ts +9 -8
- package/components/layout/Side/Provider.js +1 -3
- package/components/layout/Side/index.js +7 -10
- package/components/layout/index.d.ts +2 -0
- package/components/layout/index.js +2 -0
- package/components/loaders/ProgressLoader/index.js +4 -4
- package/components/message/Alert/index.js +7 -7
- package/components/message/Log/index.js +2 -2
- package/components/message/Notification/Badge.js +2 -2
- package/components/message/Notification/index.d.ts +8 -14
- package/components/message/Notification/index.js +9 -29
- package/components/message/StatusNotification/index.d.ts +11 -0
- package/components/message/StatusNotification/index.js +33 -0
- package/components/message/Tip/index.d.ts +8 -0
- package/components/message/Tip/index.js +43 -0
- package/components/message/Tooltip/index.d.ts +3 -2
- package/components/message/Tooltip/index.js +26 -3
- 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 +8 -1
- package/components/navigation/Breadcrumb/index.js +5 -5
- package/components/navigation/Header/index.d.ts +3 -3
- package/components/navigation/progress/ProgressBar/Onboarding.js +6 -6
- package/components/navigation/progress/Stepper/index.js +10 -10
- package/components/navigation/sideBar/Item/Item.d.ts +4 -7
- package/components/navigation/sideBar/Item/Item.js +34 -16
- package/components/navigation/sideBar/SideBar/SideBar.d.ts +1 -1
- package/components/navigation/sideBar/SideBar/SideBar.js +14 -6
- package/components/navigation/sideBar/Toggle/Toggle.js +2 -2
- package/components/styled.d.ts +13 -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 +19 -8
- 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 +16 -38
- package/styles/index.d.ts +0 -1
- package/styles/index.js +0 -1
- package/styles/theme.d.ts +63 -39
- package/styles/theme.js +34 -8
- package/components/layout/Side/Side.d.ts +0 -13
- package/styles/reset.d.ts +0 -2
- package/styles/reset.js +0 -62
|
@@ -7,14 +7,14 @@ import * as ControlModule from "../../form/SelectInput/Control";
|
|
|
7
7
|
const Link = styled(Text).attrs({
|
|
8
8
|
ff: "Inter|SemiBold",
|
|
9
9
|
fontSize: 3,
|
|
10
|
-
color: "
|
|
10
|
+
color: "neutral.c80",
|
|
11
11
|
tabIndex: 0,
|
|
12
12
|
}) `
|
|
13
13
|
cursor: pointer;
|
|
14
14
|
:hover,
|
|
15
15
|
:active,
|
|
16
16
|
:focus {
|
|
17
|
-
color: ${(p) => p.theme.colors.
|
|
17
|
+
color: ${(p) => p.theme.colors.neutral.c100};
|
|
18
18
|
text-decoration: underline;
|
|
19
19
|
}
|
|
20
20
|
`;
|
|
@@ -26,11 +26,11 @@ export default memo(function Breadcrumb({ segments, onChange }) {
|
|
|
26
26
|
const [contents] = segments.reduce(([renderArray, valuesArray], segment, index) => {
|
|
27
27
|
const values = [...valuesArray];
|
|
28
28
|
renderArray.push(React.createElement(React.Fragment, null,
|
|
29
|
-
index > 0 ? (React.createElement(Text, {
|
|
29
|
+
index > 0 ? (React.createElement(Text, { fontWeight: "semiBold", color: "neutral.c40", variant: "paragraph" }, "/")) : null,
|
|
30
30
|
isMultiSegment(segment) ? (React.createElement(Dropdown, { label: "", options: segment.options, value: segment.value, onChange: (elt) => elt && onChange([...values, elt.value]), styles: {
|
|
31
31
|
control: (provided, state) => (Object.assign(Object.assign({}, ControlModule.getStyles()(provided, state)), { cursor: "pointer" })),
|
|
32
|
-
singleValue: (provided) => (Object.assign(Object.assign({}, provided), { margin: 0, top: undefined, position: undefined, overflow: undefined, maxWidth: undefined, transform: undefined, color: theme.colors.
|
|
33
|
-
color: theme.colors.
|
|
32
|
+
singleValue: (provided) => (Object.assign(Object.assign({}, provided), { margin: 0, top: undefined, position: undefined, overflow: undefined, maxWidth: undefined, transform: undefined, color: theme.colors.neutral.c80, ":hover": {
|
|
33
|
+
color: theme.colors.neutral.c100,
|
|
34
34
|
textDecoration: "underline",
|
|
35
35
|
} })),
|
|
36
36
|
} })) : (React.createElement(Link, { onKeyDown: (event) => ["Enter", " "].includes(event.key) && onChange([...values, segment.value]), onClick: () => onChange([...values, segment.value]) }, segment.label))));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import FlexBox from "../../layout/Flex";
|
|
3
3
|
export declare type Props = {
|
|
4
|
-
left
|
|
5
|
-
right
|
|
6
|
-
children
|
|
4
|
+
left?: React.ReactNode;
|
|
5
|
+
right?: React.ReactNode;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
7
|
} & React.ComponentProps<typeof FlexBox>;
|
|
8
8
|
export default function ({ left, right, children, ...rest }: Props): JSX.Element;
|
|
@@ -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, }) {
|
|
@@ -84,7 +84,7 @@ export const Step = memo(function Step({ state, label, hideLeftSeparator, nextSt
|
|
|
84
84
|
(!hideLeftSeparator && React.createElement(Separator.Item, { inactive: inactive, position: "left" })) || (React.createElement(Flex, { flex: "1" })),
|
|
85
85
|
stepContentsByState[state],
|
|
86
86
|
(nextState && React.createElement(Separator.Item, { inactive: nextInactive, position: "right" })) || (React.createElement(Flex, { flex: "1" }))),
|
|
87
|
-
React.createElement(StepText, { inactive: inactive, errored: errored,
|
|
87
|
+
React.createElement(StepText, { inactive: inactive, errored: errored, variant: "small" }, label)));
|
|
88
88
|
});
|
|
89
89
|
function getState(activeIndex, index, errored) {
|
|
90
90
|
if (activeIndex < index) {
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const ItemLabel: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme,
|
|
3
|
-
color: string;
|
|
4
|
-
className: string;
|
|
5
|
-
} & import("../../../asorted/Text").BaseTextProps & {
|
|
6
|
-
theme: import("../../../../styles/theme").Theme;
|
|
7
|
-
}, "className" | "color">;
|
|
2
|
+
export declare const ItemLabel: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, import("../../../asorted/Text").TextProps, keyof import("../../../asorted/Text").TextProps>;
|
|
8
3
|
export declare type ItemType = {
|
|
9
4
|
label: string;
|
|
10
5
|
children: JSX.Element;
|
|
11
6
|
onClick: () => void;
|
|
12
7
|
isActive?: boolean;
|
|
13
8
|
isDisabled?: boolean;
|
|
9
|
+
displayNotificationBadge?: boolean;
|
|
10
|
+
customNotificationBadge?: JSX.Element;
|
|
14
11
|
};
|
|
15
|
-
declare const Item: ({ label, children, onClick, isActive, isDisabled }: ItemType) => JSX.Element;
|
|
12
|
+
declare const Item: ({ label, children, onClick, isActive, isDisabled, displayNotificationBadge, customNotificationBadge, }: ItemType) => JSX.Element;
|
|
16
13
|
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;
|
|
@@ -6,6 +6,6 @@ export declare type SideBarProps = {
|
|
|
6
6
|
};
|
|
7
7
|
declare const SideBar: {
|
|
8
8
|
({ children, onToggle, isExpanded }: SideBarProps): JSX.Element;
|
|
9
|
-
Item: ({ label, children, onClick, isActive, isDisabled }: import("../Item/Item").ItemType) => JSX.Element;
|
|
9
|
+
Item: ({ label, children, onClick, isActive, isDisabled, displayNotificationBadge, customNotificationBadge, }: import("../Item/Item").ItemType) => JSX.Element;
|
|
10
10
|
};
|
|
11
11
|
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,13 @@
|
|
|
1
|
+
import { StyledInterface, InterpolationFunction } from "styled-components";
|
|
2
|
+
import { FlexboxProps, SpaceProps, PositionProps, ColorProps, LayoutProps, OverflowProps } from "styled-system";
|
|
3
|
+
export declare type BaseStyledProps = SpaceProps & FlexboxProps & PositionProps & ColorProps & LayoutProps & OverflowProps & {
|
|
4
|
+
columnGap?: string | number;
|
|
5
|
+
rowGap?: string | number;
|
|
6
|
+
color?: string;
|
|
7
|
+
display?: string;
|
|
8
|
+
position?: string;
|
|
9
|
+
maxHeight?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const baseStyles: InterpolationFunction<unknown>;
|
|
12
|
+
declare const _default: StyledInterface;
|
|
13
|
+
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, } from "styled-system";
|
|
4
|
+
export const baseStyles = compose(flexbox, space, position, color, layout, overflow, gaps);
|
|
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,10 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/react-ui",
|
|
3
3
|
"description": "Ledger Live - Desktop UI",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"author": "Ledger Live Team <team-live@ledger.fr>",
|
|
6
6
|
"repository": "https://github.com/LedgerHQ/ui",
|
|
7
7
|
"license": "MIT",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"require": "./cjs/index.js",
|
|
11
|
+
"default": "./index.js"
|
|
12
|
+
},
|
|
13
|
+
"./": {
|
|
14
|
+
"require": "./cjs/",
|
|
15
|
+
"default": "./"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
8
18
|
"sideEffects": [
|
|
9
19
|
"*.woff2",
|
|
10
20
|
"assets/fonts.js"
|
|
@@ -17,12 +27,12 @@
|
|
|
17
27
|
"index.js"
|
|
18
28
|
],
|
|
19
29
|
"dependencies": {
|
|
20
|
-
"@ledgerhq/icons-ui": "^0.
|
|
21
|
-
"@ledgerhq/ui-shared": "^0.1.
|
|
22
|
-
"@tippyjs/react": "^4.2.
|
|
30
|
+
"@ledgerhq/icons-ui": "^0.2.0",
|
|
31
|
+
"@ledgerhq/ui-shared": "^0.1.3",
|
|
32
|
+
"@tippyjs/react": "^4.2.6",
|
|
23
33
|
"@types/color": "^3.0.2",
|
|
24
|
-
"@types/react": "~17.0.
|
|
25
|
-
"@types/react-dom": "^17.0.
|
|
34
|
+
"@types/react": "~17.0.34",
|
|
35
|
+
"@types/react-dom": "^17.0.11",
|
|
26
36
|
"@types/react-select": "^4.0.18",
|
|
27
37
|
"@types/react-transition-group": "^4.4.2",
|
|
28
38
|
"@types/react-window": "^1.8.5",
|
|
@@ -33,14 +43,15 @@
|
|
|
33
43
|
"color": "^3.1.3",
|
|
34
44
|
"moment": "^2.29.1",
|
|
35
45
|
"react-chartjs-2": "^3.0.5",
|
|
46
|
+
"react-is": "^17.0.2",
|
|
36
47
|
"react-select": "^3.2.0",
|
|
37
48
|
"react-transition-group": "^4.4.2",
|
|
38
49
|
"react-window": "^1.8.6",
|
|
39
|
-
"styled-components": "^5.2.3",
|
|
40
50
|
"styled-system": "^5.1.5"
|
|
41
51
|
},
|
|
42
52
|
"peerDependencies": {
|
|
43
53
|
"react": "^17.0.2",
|
|
44
|
-
"react-dom": "^17.0.2"
|
|
54
|
+
"react-dom": "^17.0.2",
|
|
55
|
+
"styled-components": "^5.3.3"
|
|
45
56
|
}
|
|
46
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