@ledgerhq/react-ui 0.3.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 +4 -4
- package/components/Chart/index.js +1 -1
- package/components/Table/Columns.js +2 -2
- package/components/Table/stories.helper.js +6 -6
- package/components/Tag/index.js +7 -7
- package/components/asorted/Divider/index.js +2 -2
- package/components/asorted/Icon/Icon.d.ts +1 -0
- package/components/asorted/Icon/Icon.js +7 -0
- package/components/asorted/Icon/index.d.ts +1 -1
- package/components/asorted/Icon/index.js +1 -1
- package/components/asorted/Text/index.d.ts +2 -0
- package/components/asorted/Text/index.js +2 -1
- 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 +7 -7
- package/components/cta/Button/index.d.ts +2 -2
- package/components/cta/Button/index.js +39 -38
- package/components/form/BaseInput/index.js +13 -13
- package/components/form/Checkbox/Checkbox.js +7 -7
- package/components/form/Dropdown/index.js +2 -2
- package/components/form/LegendInput/index.js +2 -2
- package/components/form/NumberInput/index.js +4 -4
- package/components/form/QrCodeInput/index.js +4 -4
- package/components/form/QuantityInput/index.js +6 -6
- package/components/form/Radio/RadioElement.js +12 -12
- package/components/form/Radio/RadioListElement.js +7 -8
- 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 +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 +4 -4
- 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/Drawer/index.d.ts +0 -1
- package/components/layout/Drawer/index.js +3 -3
- package/components/layout/Popin/index.js +4 -4
- package/components/loaders/ProgressLoader/index.js +3 -3
- package/components/message/Alert/index.js +6 -6
- 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.js +7 -7
- package/components/message/Tooltip/index.js +1 -1
- package/components/message/Tooltip/styles.js +3 -3
- package/components/message/index.d.ts +2 -0
- package/components/message/index.js +2 -0
- package/components/navigation/Breadcrumb/index.js +5 -5
- package/components/navigation/progress/ProgressBar/Onboarding.js +6 -6
- package/components/navigation/progress/Stepper/index.js +9 -9
- package/components/navigation/sideBar/Item/Item.js +10 -10
- package/components/navigation/sideBar/SideBar/SideBar.js +3 -3
- package/components/navigation/sideBar/Toggle/Toggle.js +2 -2
- package/components/tabs/Bar/index.js +3 -3
- package/components/tabs/Chip/index.d.ts +13 -0
- package/components/tabs/Chip/index.js +21 -0
- package/components/tabs/Pill/index.js +6 -6
- package/components/tabs/Tabs/index.js +7 -7
- package/components/tabs/index.d.ts +1 -0
- package/components/tabs/index.js +1 -0
- package/package.json +1 -1
- package/styles/StyleProvider.js +1 -1
- package/styles/global.js +15 -36
- package/styles/index.d.ts +0 -1
- package/styles/index.js +0 -1
- package/styles/theme.d.ts +4 -1
- package/styles/theme.js +5 -7
- package/styles/reset.d.ts +0 -2
- package/styles/reset.js +0 -62
|
@@ -13,19 +13,19 @@ const StyledIconContainer = styled.div `
|
|
|
13
13
|
switch (p.type) {
|
|
14
14
|
case "warning":
|
|
15
15
|
return css `
|
|
16
|
-
background: ${p.theme.colors.
|
|
17
|
-
color: ${p.theme.colors.
|
|
16
|
+
background: ${p.theme.colors.warning.c10};
|
|
17
|
+
color: ${p.theme.colors.warning.c100};
|
|
18
18
|
`;
|
|
19
19
|
case "error":
|
|
20
20
|
return css `
|
|
21
|
-
background: ${p.theme.colors.
|
|
22
|
-
color: ${p.theme.colors.
|
|
21
|
+
background: ${p.theme.colors.error.c10};
|
|
22
|
+
color: ${p.theme.colors.error.c100};
|
|
23
23
|
`;
|
|
24
24
|
case "success":
|
|
25
25
|
default:
|
|
26
26
|
return css `
|
|
27
|
-
background: ${p.theme.colors.
|
|
28
|
-
color: ${p.theme.colors.
|
|
27
|
+
background: ${p.theme.colors.success.c30};
|
|
28
|
+
color: ${p.theme.colors.success.c100};
|
|
29
29
|
`;
|
|
30
30
|
}
|
|
31
31
|
}}
|
|
@@ -39,5 +39,5 @@ const StyledIconContainer = styled.div `
|
|
|
39
39
|
export default function Tip({ type, label }) {
|
|
40
40
|
return (React.createElement(Flex, { alignItems: "center" },
|
|
41
41
|
type && React.createElement(StyledIconContainer, { type: type }, icons[type]),
|
|
42
|
-
React.createElement(Text, { variant: "paragraph", fontWeight: "medium", color: "
|
|
42
|
+
React.createElement(Text, { variant: "paragraph", fontWeight: "medium", color: "neutral.c100", flexShrink: 1 }, label)));
|
|
43
43
|
}
|
|
@@ -36,6 +36,6 @@ const Wrapper = forwardRef((props, ref) => {
|
|
|
36
36
|
});
|
|
37
37
|
export default function Tooltip(props) {
|
|
38
38
|
const { content, placement = "auto", children } = props, rest = __rest(props, ["content", "placement", "children"]);
|
|
39
|
-
return (React.createElement(Tippy, Object.assign({}, rest, { placement: placement, content: React.createElement(Text, { fontWeight: "medium", variant: "paragraph", color: "
|
|
39
|
+
return (React.createElement(Tippy, Object.assign({}, rest, { placement: placement, content: React.createElement(Text, { fontWeight: "medium", variant: "paragraph", color: "neutral.c00" }, content) }),
|
|
40
40
|
React.createElement(Wrapper, { children: children })));
|
|
41
41
|
}
|
|
@@ -10,8 +10,8 @@ export default css `
|
|
|
10
10
|
|
|
11
11
|
.tippy-box {
|
|
12
12
|
position: relative;
|
|
13
|
-
background-color: ${(p) => p.theme.colors.
|
|
14
|
-
color: ${(p) => p.theme.colors.
|
|
13
|
+
background-color: ${(p) => p.theme.colors.neutral.c100};
|
|
14
|
+
color: ${(p) => p.theme.colors.neutral.c00};
|
|
15
15
|
border-radius: 4px;
|
|
16
16
|
font-size: 14px;
|
|
17
17
|
line-height: 1.4;
|
|
@@ -72,7 +72,7 @@ export default css `
|
|
|
72
72
|
.tippy-arrow {
|
|
73
73
|
width: 16px;
|
|
74
74
|
height: 16px;
|
|
75
|
-
color: ${(p) => p.theme.colors.
|
|
75
|
+
color: ${(p) => p.theme.colors.neutral.c100};
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
.tippy-arrow:before {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { default as Alert } from "./Alert";
|
|
2
2
|
export { default as Log } from "./Log";
|
|
3
3
|
export { default as Notification } from "./Notification";
|
|
4
|
+
export { default as Badge } from "./Notification/Badge";
|
|
4
5
|
export { default as Tooltip } from "./Tooltip";
|
|
5
6
|
export { default as Tip } from "./Tip";
|
|
7
|
+
export { default as StatusNotification } from "./StatusNotification";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export { default as Alert } from "./Alert";
|
|
2
2
|
export { default as Log } from "./Log";
|
|
3
3
|
export { default as Notification } from "./Notification";
|
|
4
|
+
export { default as Badge } from "./Notification/Badge";
|
|
4
5
|
export { default as Tooltip } from "./Tooltip";
|
|
5
6
|
export { default as Tip } from "./Tip";
|
|
7
|
+
export { default as StatusNotification } from "./StatusNotification";
|
|
@@ -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, { fontWeight: "semiBold", color: "
|
|
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))));
|
|
@@ -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, }) {
|
|
@@ -6,8 +6,8 @@ import TransitionInOut from "../../../transitions/TransitionInOut";
|
|
|
6
6
|
import Flex from "../../../layout/Flex";
|
|
7
7
|
const ItemWrapper = styled.li `
|
|
8
8
|
/** DEFAULT VARIANT **/
|
|
9
|
-
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.
|
|
10
|
-
--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};
|
|
11
11
|
--ll-sidebar-item-background-color: unset;
|
|
12
12
|
|
|
13
13
|
display: flex;
|
|
@@ -26,8 +26,8 @@ const ItemWrapper = styled.li `
|
|
|
26
26
|
|
|
27
27
|
/** HOVER VARIANT **/
|
|
28
28
|
&:hover {
|
|
29
|
-
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.
|
|
30
|
-
--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};
|
|
31
31
|
--ll-sidebar-item-background-color: unset;
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -39,15 +39,15 @@ const ItemWrapper = styled.li `
|
|
|
39
39
|
|
|
40
40
|
/** ACTIVE VARIANT **/
|
|
41
41
|
&[data-active="true"] {
|
|
42
|
-
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.
|
|
43
|
-
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.
|
|
44
|
-
--ll-sidebar-item-background-color: ${(props) => props.theme.colors.
|
|
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};
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/** DISABLE VARIANT **/
|
|
48
48
|
&[data-disable="true"] {
|
|
49
|
-
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.
|
|
50
|
-
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.
|
|
49
|
+
--ll-sidebar-item-label-color: ${(props) => props.theme.colors.neutral.c80};
|
|
50
|
+
--ll-sidebar-item-icon-color: ${(props) => props.theme.colors.neutral.c80};
|
|
51
51
|
--ll-sidebar-item-background-color: unset;
|
|
52
52
|
opacity: 0.3;
|
|
53
53
|
cursor: unset;
|
|
@@ -63,7 +63,7 @@ const DefaultBadge = styled.div `
|
|
|
63
63
|
height: ${(p) => p.theme.space[4]}px;
|
|
64
64
|
width: ${(p) => p.theme.space[4]}px;
|
|
65
65
|
border-radius: ${(p) => p.theme.radii[2]}px;
|
|
66
|
-
background-color: ${(p) => p.theme.colors.
|
|
66
|
+
background-color: ${(p) => p.theme.colors.primary.c80};
|
|
67
67
|
`;
|
|
68
68
|
export const ItemLabel = styled(Text) `
|
|
69
69
|
display: inline-block;
|
|
@@ -12,9 +12,9 @@ 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.
|
|
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
18
|
transition: max-width 200ms;
|
|
19
19
|
will-change: max-width;
|
|
20
20
|
|
|
@@ -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);
|
|
@@ -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,8 +15,8 @@ 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);
|
|
@@ -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;
|
|
@@ -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;
|
package/components/tabs/index.js
CHANGED
package/package.json
CHANGED
package/styles/StyleProvider.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ThemeProvider } from "styled-components";
|
|
|
3
3
|
import { defaultTheme, GlobalStyle } from ".";
|
|
4
4
|
import { palettes } from "@ledgerhq/ui-shared";
|
|
5
5
|
export const StyleProvider = ({ children, fontsPath, fontMappings, selectedPalette = "light", }) => {
|
|
6
|
-
const theme = useMemo(() => (Object.assign(Object.assign({}, defaultTheme), { colors: Object.assign(Object.assign({}, defaultTheme.colors), { palette: palettes[selectedPalette] }), theme: selectedPalette })), [selectedPalette]);
|
|
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
8
|
React.createElement(GlobalStyle, { fontsPath: fontsPath, fontMappings: fontMappings }),
|
|
9
9
|
children));
|
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";
|
package/styles/index.js
CHANGED
package/styles/theme.d.ts
CHANGED
|
@@ -98,7 +98,10 @@ declare module "styled-components" {
|
|
|
98
98
|
fontSizes: number[];
|
|
99
99
|
space: number[];
|
|
100
100
|
shadows: string[];
|
|
101
|
-
colors: {
|
|
101
|
+
colors: ColorPalette & {
|
|
102
|
+
/**
|
|
103
|
+
* @deprecated Do not use the .palette prefix anymore!
|
|
104
|
+
*/
|
|
102
105
|
palette: ColorPalette;
|
|
103
106
|
};
|
|
104
107
|
fontWeights: Record<string, string>;
|
package/styles/theme.js
CHANGED
|
@@ -141,7 +141,7 @@ const overflow = {
|
|
|
141
141
|
overflow-x: scroll;
|
|
142
142
|
will-change: transform;
|
|
143
143
|
&:hover {
|
|
144
|
-
--track-color: ${(p) => p.theme.colors.
|
|
144
|
+
--track-color: ${(p) => p.theme.colors.neutral.c30};
|
|
145
145
|
}
|
|
146
146
|
`,
|
|
147
147
|
y: css `
|
|
@@ -149,7 +149,7 @@ const overflow = {
|
|
|
149
149
|
overflow-y: scroll;
|
|
150
150
|
will-change: transform;
|
|
151
151
|
&:hover {
|
|
152
|
-
--track-color: ${(p) => p.theme.colors.
|
|
152
|
+
--track-color: ${(p) => p.theme.colors.neutral.c30};
|
|
153
153
|
}
|
|
154
154
|
`,
|
|
155
155
|
yAuto: css `
|
|
@@ -157,14 +157,14 @@ const overflow = {
|
|
|
157
157
|
overflow-y: auto;
|
|
158
158
|
will-change: transform;
|
|
159
159
|
&:hover {
|
|
160
|
-
--track-color: ${(p) => p.theme.colors.
|
|
160
|
+
--track-color: ${(p) => p.theme.colors.neutral.c30};
|
|
161
161
|
}
|
|
162
162
|
`,
|
|
163
163
|
xy: css `
|
|
164
164
|
overflow: scroll;
|
|
165
165
|
will-change: transform;
|
|
166
166
|
&:hover {
|
|
167
|
-
--track-color: ${(p) => p.theme.colors.
|
|
167
|
+
--track-color: ${(p) => p.theme.colors.neutral.c30};
|
|
168
168
|
}
|
|
169
169
|
`,
|
|
170
170
|
trackSize: 12,
|
|
@@ -201,9 +201,7 @@ const theme = {
|
|
|
201
201
|
fontWeights,
|
|
202
202
|
space,
|
|
203
203
|
shadows,
|
|
204
|
-
colors: {
|
|
205
|
-
palette: palettes.light,
|
|
206
|
-
},
|
|
204
|
+
colors: Object.assign({ palette: palettes.light }, palettes.light),
|
|
207
205
|
animations,
|
|
208
206
|
overflow,
|
|
209
207
|
transition,
|
package/styles/reset.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const _default: "\n* {\n -webkit-font-smoothing: antialiased;\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n font: inherit;\n color: inherit;\n user-select: inherit;\n cursor: inherit;\n min-width: 0;\n outline: none;\n\n /* it will surely make problem in the future... to be inspected. */\n /* ;_; */\n flex-shrink: 0;\n}\n\nbody {\n cursor: default;\n font-family: Inter, Arial, Helvetica, sans-serif;\n font-size: 16px;\n font-weight: 300;\n line-height: 1.5;\n user-select: none;\n cursor: default;\n}\n\nb {\n font-weight: bold;\n}\n\nem {\n font-style: italic;\n}\n\n#a11y-status-message {\n display: none;\n}\n\n.scroll-content {\n height: 100%;\n\n > div {\n height: 100%;\n }\n}\n.scrollbar-thumb {\n background: rgb(102, 102, 102) !important;\n padding: 2px;\n background-clip: content-box !important;\n}\n.scrollbar-track {\n background: transparent !important;\n transition: opacity 0.2s ease-in-out !important;\n z-index: 20 !important;\n}\n\n.currentTicker {\n background: palette.background.paper;\n z-index: 11 !important;\n}";
|
|
2
|
-
export default _default;
|