@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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { css } from "styled-components";
|
|
2
2
|
const getFontSource = (name) => (props) => {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
var _a;
|
|
4
|
+
const fontsPath = (_a = props.fontsPath) !== null && _a !== void 0 ? _a : "assets/fonts";
|
|
5
|
+
const fontName = (props.fontMappings && props.fontMappings(name)) || `${name}.woff2`;
|
|
6
|
+
return `url("${fontsPath}/${fontName}") format("woff2")`;
|
|
5
7
|
};
|
|
6
8
|
export const fontStyles = css `
|
|
7
9
|
@font-face {
|
|
@@ -53,86 +55,68 @@ export const fontStyles = css `
|
|
|
53
55
|
font-style: normal;
|
|
54
56
|
}
|
|
55
57
|
`;
|
|
56
|
-
export
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
font-size: 12px;
|
|
122
|
-
line-height: 14.52px;
|
|
123
|
-
}
|
|
124
|
-
.ll-text_subTitle {
|
|
125
|
-
font-family: Inter, Arial;
|
|
126
|
-
font-size: 11px;
|
|
127
|
-
line-height: 13.31px;
|
|
128
|
-
}
|
|
129
|
-
.ll-text_tag {
|
|
130
|
-
font-family: Inter, Arial;
|
|
131
|
-
font-size: 10px;
|
|
132
|
-
line-height: 12.1px;
|
|
133
|
-
}
|
|
134
|
-
.ll-text_paragraph {
|
|
135
|
-
font-family: Inter, Arial;
|
|
136
|
-
font-size: 13px;
|
|
137
|
-
}
|
|
138
|
-
`;
|
|
58
|
+
export const textVariantStyle = {
|
|
59
|
+
h1: {
|
|
60
|
+
fontFamily: "Alpha",
|
|
61
|
+
fontWeight: 500,
|
|
62
|
+
"text-transform": "uppercase",
|
|
63
|
+
},
|
|
64
|
+
h2: {
|
|
65
|
+
fontFamily: "Alpha",
|
|
66
|
+
fontWeight: 500,
|
|
67
|
+
"text-transform": "uppercase",
|
|
68
|
+
},
|
|
69
|
+
h3: {
|
|
70
|
+
fontFamily: "Alpha",
|
|
71
|
+
fontWeight: 500,
|
|
72
|
+
"text-transform": "uppercase",
|
|
73
|
+
},
|
|
74
|
+
h4: {
|
|
75
|
+
fontFamily: "Alpha",
|
|
76
|
+
fontWeight: 500,
|
|
77
|
+
"text-transform": "uppercase",
|
|
78
|
+
},
|
|
79
|
+
h5: {
|
|
80
|
+
fontFamily: "Alpha",
|
|
81
|
+
fontWeight: 500,
|
|
82
|
+
"text-transform": "uppercase",
|
|
83
|
+
},
|
|
84
|
+
large: {
|
|
85
|
+
fontFamily: "Inter",
|
|
86
|
+
},
|
|
87
|
+
largeLineHeight: {
|
|
88
|
+
fontFamily: "Inter",
|
|
89
|
+
lineHeight: 1.7,
|
|
90
|
+
},
|
|
91
|
+
body: {
|
|
92
|
+
fontFamily: "Inter",
|
|
93
|
+
},
|
|
94
|
+
bodyLineHeight: {
|
|
95
|
+
fontFamily: "Inter",
|
|
96
|
+
lineHeight: 1.7,
|
|
97
|
+
},
|
|
98
|
+
paragraph: {
|
|
99
|
+
fontFamily: "Inter",
|
|
100
|
+
},
|
|
101
|
+
paragraphLineHeight: {
|
|
102
|
+
fontFamily: "Inter",
|
|
103
|
+
lineHeight: 1.7,
|
|
104
|
+
},
|
|
105
|
+
small: {
|
|
106
|
+
fontFamily: "Inter",
|
|
107
|
+
},
|
|
108
|
+
extraSmall: {
|
|
109
|
+
fontFamily: "Inter",
|
|
110
|
+
},
|
|
111
|
+
tiny: {
|
|
112
|
+
fontFamily: "Inter",
|
|
113
|
+
},
|
|
114
|
+
micro: {
|
|
115
|
+
fontFamily: "Inter",
|
|
116
|
+
},
|
|
117
|
+
subtitle: {
|
|
118
|
+
fontFamily: "Inter",
|
|
119
|
+
fontWeight: 600,
|
|
120
|
+
"text-transform": "uppercase",
|
|
121
|
+
},
|
|
122
|
+
};
|
|
@@ -10,13 +10,13 @@ const Wrapper = styled(Flex) `
|
|
|
10
10
|
padding: ${(p) => p.theme.space[8]}px ${(p) => p.theme.space[10]}px;
|
|
11
11
|
padding-right: 280px; // Nb gives air to not overlap the illustration
|
|
12
12
|
z-index: ${(p) => p.theme.zIndexes[8]};
|
|
13
|
-
background: url(${(p) => p.image}) no-repeat ${(p) => p.theme.colors.
|
|
13
|
+
background: url(${(p) => p.image}) no-repeat ${(p) => p.theme.colors.neutral.c100};
|
|
14
14
|
background-size: contain;
|
|
15
15
|
background-position: right 60px bottom;
|
|
16
16
|
`;
|
|
17
17
|
const Slide = ({ title, description, image, onClick }) => {
|
|
18
18
|
return (React.createElement(Wrapper, { key: "key", image: image, onClick: onClick },
|
|
19
|
-
React.createElement(Text, { color: "
|
|
20
|
-
React.createElement(Text, {
|
|
19
|
+
React.createElement(Text, { variant: "tiny", color: "neutral.c00", fontWeight: "regular" }, title),
|
|
20
|
+
React.createElement(Text, { variant: "h5", color: "neutral.c00", textTransform: "uppercase" }, description)));
|
|
21
21
|
};
|
|
22
22
|
export default Slide;
|
|
@@ -17,7 +17,7 @@ const CarouselWrapper = styled.div `
|
|
|
17
17
|
cursor: pointer;
|
|
18
18
|
position: relative;
|
|
19
19
|
flex: 1;
|
|
20
|
-
background: ${(p) => p.theme.colors.
|
|
20
|
+
background: ${(p) => p.theme.colors.neutral.c100};
|
|
21
21
|
`;
|
|
22
22
|
const Controllers = styled(Flex) `
|
|
23
23
|
position: absolute;
|
|
@@ -25,7 +25,7 @@ const Controllers = styled(Flex) `
|
|
|
25
25
|
right: ${(p) => p.theme.space[5]}px;
|
|
26
26
|
bottom: ${(p) => p.theme.space[4]}px;
|
|
27
27
|
column-gap: ${(p) => p.theme.space[4]}px;
|
|
28
|
-
color: ${(p) => p.theme.colors.
|
|
28
|
+
color: ${(p) => p.theme.colors.neutral.c00};
|
|
29
29
|
|
|
30
30
|
> div {
|
|
31
31
|
&:hover {
|
|
@@ -45,7 +45,7 @@ const Bullets = styled.div `
|
|
|
45
45
|
position: relative;
|
|
46
46
|
height: ${(p) => p.theme.space[1]}px;
|
|
47
47
|
width: ${(p) => p.theme.space[8]}px;
|
|
48
|
-
background: ${(p) => p.theme.colors.
|
|
48
|
+
background: ${(p) => p.theme.colors.neutral.c00};
|
|
49
49
|
opacity: 0.5;
|
|
50
50
|
&:hover {
|
|
51
51
|
opacity: 0.75;
|
|
@@ -71,7 +71,7 @@ const Close = styled.div `
|
|
|
71
71
|
position: absolute;
|
|
72
72
|
top: ${(p) => p.theme.space[7]}px;
|
|
73
73
|
right: ${(p) => p.theme.space[5]}px;
|
|
74
|
-
color: ${(p) => p.theme.colors.
|
|
74
|
+
color: ${(p) => p.theme.colors.neutral.c00};
|
|
75
75
|
&:hover {
|
|
76
76
|
opacity: 0.5;
|
|
77
77
|
}
|
|
@@ -124,10 +124,10 @@ const Carousel = ({ timeout = DEFAULT_TIMEOUT, queue, isDismissed, onDismiss, di
|
|
|
124
124
|
if (!(queue === null || queue === void 0 ? void 0 : queue.length) || isDismissed)
|
|
125
125
|
return null;
|
|
126
126
|
return (React.createElement(CarouselWrapper, { id: "carousel", onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave }, wantToDismiss ? (React.createElement(DismissWrapper, null,
|
|
127
|
-
React.createElement(Text, { color: "
|
|
128
|
-
React.createElement(Flex,
|
|
129
|
-
React.createElement(Button, { color: "
|
|
130
|
-
React.createElement(Button, { color: "
|
|
127
|
+
React.createElement(Text, { color: "neutral.c00", fontWeight: "medium", variant: "paragraph" }, dismissText),
|
|
128
|
+
React.createElement(Flex, { columnGap: 5 },
|
|
129
|
+
React.createElement(Button, { color: "neutral.c100", backgroundColor: "neutral.c00", onClick: onDismiss }, dismissConfirmText),
|
|
130
|
+
React.createElement(Button, { outline: true, color: "neutral.c00", backgroundColor: "neutral.c100", borderColor: "neutral.c00", onClick: onCancelDismiss }, dismissCancelText)))) : (React.createElement("div", null,
|
|
131
131
|
React.createElement(TransitionGroup, { component: null, childFactory: childFactory },
|
|
132
132
|
React.createElement(TransitionSlide, { key: index, direction: direction },
|
|
133
133
|
React.createElement(Slide, Object.assign({}, queue[index])))),
|
|
@@ -1,29 +1,41 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { BaseStyledProps } from "../../styled";
|
|
3
|
+
import { BordersProps } from "styled-system";
|
|
4
|
+
export declare type ButtonVariants = "main" | "shade" | "error" | "color";
|
|
5
|
+
export declare type IconPosition = "right" | "left";
|
|
6
|
+
interface BaseProps extends BaseStyledProps, BordersProps {
|
|
4
7
|
ff?: string;
|
|
5
8
|
color?: string;
|
|
9
|
+
backgroundColor?: string;
|
|
6
10
|
fontSize?: number;
|
|
7
|
-
|
|
11
|
+
variant?: ButtonVariants;
|
|
8
12
|
outline?: boolean;
|
|
9
|
-
iconPosition?:
|
|
13
|
+
iconPosition?: IconPosition;
|
|
10
14
|
iconButton?: boolean;
|
|
11
15
|
disabled?: boolean;
|
|
12
16
|
}
|
|
13
|
-
export interface ButtonProps
|
|
14
|
-
Icon?: React.ComponentType<
|
|
17
|
+
export interface ButtonProps extends BaseProps {
|
|
18
|
+
Icon?: React.ComponentType<{
|
|
19
|
+
size: number;
|
|
20
|
+
color?: string;
|
|
21
|
+
}>;
|
|
15
22
|
children?: React.ReactNode;
|
|
16
23
|
onClick: (event?: React.SyntheticEvent<HTMLButtonElement>) => void;
|
|
17
24
|
iconSize?: number;
|
|
25
|
+
style?: React.CSSProperties;
|
|
18
26
|
}
|
|
27
|
+
export declare const ButtonUnstyled: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
19
28
|
export declare const Base: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
|
|
20
|
-
|
|
21
|
-
color: string;
|
|
29
|
+
fontFamily: string;
|
|
22
30
|
fontSize: number;
|
|
23
|
-
} & BaseProps, "
|
|
24
|
-
declare const Button:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
} & BaseProps, "fontFamily" | "fontSize">;
|
|
32
|
+
declare const Button: {
|
|
33
|
+
({ Icon, iconPosition, iconSize, children, onClick, ...props }: ButtonProps): React.ReactElement;
|
|
34
|
+
Unstyled: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
35
|
+
};
|
|
36
|
+
export declare type ExpandButtonProps = React.PropsWithChildren<{
|
|
37
|
+
onToggle?: (arg0: boolean) => void;
|
|
38
|
+
onClick?: (arg0: React.SyntheticEvent<HTMLButtonElement>) => void;
|
|
39
|
+
}>;
|
|
40
|
+
export declare const ExpandButton: ({ onToggle, onClick, ...props }: ExpandButtonProps) => React.ReactElement;
|
|
29
41
|
export default Button;
|
|
@@ -11,145 +11,161 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React, { useState } from "react";
|
|
13
13
|
import styled, { css } from "styled-components";
|
|
14
|
-
import
|
|
14
|
+
import baseStyled from "../../styled";
|
|
15
|
+
import { fontSize, border, compose } from "styled-system";
|
|
15
16
|
import fontFamily from "../../../styles/styled/fontFamily";
|
|
16
17
|
import { fontSizes } from "../../../styles/theme";
|
|
17
18
|
import ChevronBottom from "@ledgerhq/icons-ui/react/ChevronBottomRegular";
|
|
18
19
|
const IconContainer = styled.div `
|
|
19
20
|
display: inline-block;
|
|
20
|
-
|
|
21
|
+
${(p) => `${p.iconPosition === "left" ? "margin-right" : "margin-left"}: ${p.theme.space[4]}px;`}
|
|
21
22
|
padding-top: 0.2em;
|
|
22
23
|
`;
|
|
23
24
|
const getVariantColors = (p) => ({
|
|
24
25
|
main: {
|
|
25
26
|
outline: `
|
|
26
|
-
border-color: ${p.theme.colors.
|
|
27
|
-
color: ${p.theme.colors.
|
|
28
|
-
background-color: ${p.theme.colors.
|
|
29
|
-
&:hover {
|
|
30
|
-
background-color: ${p.theme.colors.
|
|
27
|
+
border-color: ${p.theme.colors.neutral.c100};
|
|
28
|
+
color: ${p.theme.colors.neutral.c100};
|
|
29
|
+
background-color: ${p.theme.colors.neutral.c00};
|
|
30
|
+
&:hover, &:focus {
|
|
31
|
+
background-color: ${p.theme.colors.neutral.c20};
|
|
31
32
|
}
|
|
32
33
|
&:active {
|
|
33
|
-
background-color: ${p.theme.colors.
|
|
34
|
+
background-color: ${p.theme.colors.neutral.c30};
|
|
34
35
|
}
|
|
35
36
|
`,
|
|
36
37
|
filled: `
|
|
37
|
-
color: ${p.theme.colors.
|
|
38
|
-
background-color: ${p.theme.colors.
|
|
39
|
-
&:hover {
|
|
40
|
-
background-color: ${p.theme.colors.
|
|
38
|
+
color: ${p.theme.colors.neutral.c00};
|
|
39
|
+
background-color: ${p.theme.colors.neutral.c100};
|
|
40
|
+
&:hover, &:focus {
|
|
41
|
+
background-color: ${p.theme.colors.neutral.c90};
|
|
41
42
|
}
|
|
42
43
|
`,
|
|
43
44
|
},
|
|
44
45
|
shade: `
|
|
45
|
-
border-color: ${p.theme.colors.
|
|
46
|
-
color: ${p.theme.colors.
|
|
47
|
-
background-color: ${p.theme.colors.
|
|
46
|
+
border-color: ${p.theme.colors.neutral.c40};
|
|
47
|
+
color: ${p.theme.colors.neutral.c100};
|
|
48
|
+
background-color: ${p.theme.colors.neutral.c00};
|
|
48
49
|
&:focus {
|
|
49
|
-
border-color: ${p.theme.colors.
|
|
50
|
+
border-color: ${p.theme.colors.primary.c80};
|
|
50
51
|
}
|
|
51
52
|
|
|
52
|
-
&:hover {
|
|
53
|
-
background-color: ${p.theme.colors.
|
|
53
|
+
&:hover, &:focus {
|
|
54
|
+
background-color: ${p.theme.colors.neutral.c20};
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
&:active {
|
|
57
|
-
background-color: ${p.theme.colors.
|
|
58
|
-
}
|
|
58
|
+
background-color: ${p.theme.colors.neutral.c30};
|
|
59
|
+
}
|
|
59
60
|
`,
|
|
60
61
|
error: {
|
|
61
62
|
outline: `
|
|
62
|
-
border-color: ${p.theme.colors.
|
|
63
|
-
color: ${p.theme.colors.
|
|
64
|
-
background-color: ${p.theme.colors.
|
|
63
|
+
border-color: ${p.theme.colors.error.c100};
|
|
64
|
+
color: ${p.theme.colors.error.c100};
|
|
65
|
+
background-color: ${p.theme.colors.neutral.c00};
|
|
65
66
|
&:hover {
|
|
66
|
-
background-color: ${p.theme.colors.
|
|
67
|
+
background-color: ${p.theme.colors.error.c10};
|
|
67
68
|
}
|
|
68
69
|
&:active {
|
|
69
|
-
background-color: ${p.theme.colors.
|
|
70
|
+
background-color: ${p.theme.colors.error.c30};
|
|
70
71
|
}
|
|
71
72
|
`,
|
|
72
73
|
filled: `
|
|
73
|
-
color: ${p.theme.colors.
|
|
74
|
-
background-color: ${p.theme.colors.
|
|
74
|
+
color: ${p.theme.colors.neutral.c00};
|
|
75
|
+
background-color: ${p.theme.colors.error.c100};
|
|
75
76
|
&:hover {
|
|
76
|
-
background-color: ${p.theme.colors.
|
|
77
|
+
background-color: ${p.theme.colors.error.c80};
|
|
77
78
|
}
|
|
78
79
|
`,
|
|
79
80
|
},
|
|
80
81
|
color: {
|
|
81
82
|
outline: `
|
|
82
|
-
border-color: ${p.theme.colors.
|
|
83
|
-
color: ${p.theme.colors.
|
|
84
|
-
background-color: ${p.theme.colors.
|
|
83
|
+
border-color: ${p.theme.colors.primary.c80};
|
|
84
|
+
color: ${p.theme.colors.primary.c80};
|
|
85
|
+
background-color: ${p.theme.colors.neutral.c00};
|
|
85
86
|
&:hover {
|
|
86
|
-
background-color: ${p.theme.colors.
|
|
87
|
+
background-color: ${p.theme.colors.primary.c10};
|
|
87
88
|
}
|
|
88
89
|
&:active {
|
|
89
|
-
background-color: ${p.theme.colors.
|
|
90
|
+
background-color: ${p.theme.colors.primary.c20};
|
|
90
91
|
}
|
|
91
92
|
`,
|
|
92
93
|
filled: `
|
|
93
|
-
color: ${p.theme.colors.
|
|
94
|
-
background-color: ${p.theme.colors.
|
|
94
|
+
color: ${p.theme.colors.neutral.c00};
|
|
95
|
+
background-color: ${p.theme.colors.primary.c80};
|
|
95
96
|
&:hover {
|
|
96
|
-
background-color: ${p.theme.colors.
|
|
97
|
+
background-color: ${p.theme.colors.primary.c70};
|
|
97
98
|
}
|
|
98
99
|
`,
|
|
99
100
|
},
|
|
100
101
|
disabled: {
|
|
101
102
|
outline: `
|
|
102
|
-
border-color: ${p.theme.colors.
|
|
103
|
-
color: ${p.theme.colors.
|
|
104
|
-
background-color: ${p.theme.colors.
|
|
103
|
+
border-color: ${p.theme.colors.neutral.c50};
|
|
104
|
+
color: ${p.theme.colors.neutral.c50};
|
|
105
|
+
background-color: ${p.theme.colors.neutral.c00};
|
|
105
106
|
`,
|
|
106
107
|
filled: `
|
|
107
|
-
color: ${p.theme.colors.
|
|
108
|
-
background-color: ${p.theme.colors.
|
|
108
|
+
color: ${p.theme.colors.neutral.c50};
|
|
109
|
+
background-color: ${p.theme.colors.neutral.c30};
|
|
109
110
|
`,
|
|
110
111
|
},
|
|
112
|
+
default: `
|
|
113
|
+
color: ${p.theme.colors.neutral.c100};
|
|
114
|
+
background-color: transparent;
|
|
115
|
+
&:hover {
|
|
116
|
+
text-decoration: underline;
|
|
117
|
+
}
|
|
118
|
+
`,
|
|
111
119
|
});
|
|
112
|
-
export const
|
|
113
|
-
|
|
120
|
+
export const ButtonUnstyled = styled.button `
|
|
121
|
+
all: unset;
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
|
|
124
|
+
&:disabled {
|
|
125
|
+
cursor: default;
|
|
126
|
+
}
|
|
127
|
+
`;
|
|
128
|
+
export const Base = baseStyled.button.attrs((p) => {
|
|
129
|
+
var _a;
|
|
114
130
|
return ({
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
fontSize: (_b = p.fontSize) !== null && _b !== void 0 ? _b : 4,
|
|
131
|
+
fontFamily: "Inter",
|
|
132
|
+
fontSize: (_a = p.fontSize) !== null && _a !== void 0 ? _a : 4,
|
|
118
133
|
});
|
|
119
134
|
}) `
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
${color};
|
|
135
|
+
background-color: transparent;
|
|
136
|
+
border-color: transparent;
|
|
123
137
|
border-radius: ${(p) => p.theme.space[13]}px;
|
|
138
|
+
border-style: solid;
|
|
139
|
+
border-width: ${(p) => (p.outline || p.variant === "shade" ? 1 : 0)}px;
|
|
140
|
+
font-weight: 600;
|
|
141
|
+
${compose(fontFamily, fontSize, border)};
|
|
124
142
|
height: ${(p) => p.theme.space[13]}px;
|
|
125
143
|
line-height: ${(p) => p.theme.fontSizes[p.fontSize]}px;
|
|
126
|
-
border-style: solid;
|
|
127
|
-
border-width: ${(p) => (p.outline || p.type === "shade" ? 1 : 0)}px;
|
|
128
144
|
text-align: center;
|
|
129
145
|
display: inline-flex;
|
|
130
146
|
align-items: center;
|
|
131
147
|
justify-content: center;
|
|
132
148
|
padding: 0 2em;
|
|
133
|
-
background-color: transparent;
|
|
134
|
-
border-color: transparent;
|
|
135
149
|
overflow: hidden;
|
|
136
150
|
text-overflow: ellipsis;
|
|
137
151
|
white-space: nowrap;
|
|
138
152
|
max-width: 100%;
|
|
139
153
|
position: relative;
|
|
140
154
|
cursor: ${(p) => (p.disabled ? "default" : "pointer")};
|
|
141
|
-
&:
|
|
142
|
-
box-shadow: 0 0 0 4px ${(p) => p.theme.colors.
|
|
155
|
+
&:active {
|
|
156
|
+
box-shadow: 0 0 0 4px ${(p) => p.theme.colors.primary.c60};
|
|
143
157
|
}
|
|
144
158
|
|
|
145
159
|
${(p) => {
|
|
146
160
|
var _a;
|
|
147
161
|
const variants = getVariantColors(p);
|
|
148
162
|
if (p.disabled) {
|
|
149
|
-
return p.outline || p.
|
|
163
|
+
return p.outline || p.variant === "shade"
|
|
164
|
+
? variants.disabled.outline
|
|
165
|
+
: variants.disabled.filled;
|
|
150
166
|
}
|
|
151
|
-
const
|
|
152
|
-
switch (
|
|
167
|
+
const variant = (_a = p.variant) !== null && _a !== void 0 ? _a : "default";
|
|
168
|
+
switch (variant) {
|
|
153
169
|
case "main":
|
|
154
170
|
return p.outline ? variants.main.outline : variants.main.filled;
|
|
155
171
|
case "shade":
|
|
@@ -160,11 +176,7 @@ export const Base = styled.button.attrs((p) => {
|
|
|
160
176
|
return p.outline ? variants.color.outline : variants.color.filled;
|
|
161
177
|
case "default":
|
|
162
178
|
default:
|
|
163
|
-
return
|
|
164
|
-
&:hover {
|
|
165
|
-
text-decoration: underline;
|
|
166
|
-
}
|
|
167
|
-
`;
|
|
179
|
+
return variants.default;
|
|
168
180
|
}
|
|
169
181
|
}}
|
|
170
182
|
${(p) => p.iconButton
|
|
@@ -182,9 +194,7 @@ const ContentContainer = styled.div ``;
|
|
|
182
194
|
const Button = (_a) => {
|
|
183
195
|
var _b;
|
|
184
196
|
var { Icon, iconPosition = "right", iconSize = 16, children, onClick } = _a, props = __rest(_a, ["Icon", "iconPosition", "iconSize", "children", "onClick"]);
|
|
185
|
-
return (
|
|
186
|
-
// @ts-expect-error FIXME type button conflict
|
|
187
|
-
React.createElement(Base, Object.assign({}, props, { iconButton: !(Icon == null) && !children, onClick: onClick }),
|
|
197
|
+
return (React.createElement(Base, Object.assign({}, props, { iconButton: !(Icon == null) && !children, onClick: onClick }),
|
|
188
198
|
iconPosition === "right" ? React.createElement(ContentContainer, null, children) : null,
|
|
189
199
|
Icon != null ? (React.createElement(IconContainer, { iconPosition: iconPosition },
|
|
190
200
|
React.createElement(Icon, { size: iconSize || fontSizes[(_b = props.fontSize) !== null && _b !== void 0 ? _b : 4] }))) : null,
|
|
@@ -208,4 +218,5 @@ export const ExpandButton = function ExpandButton(_a) {
|
|
|
208
218
|
onClick != null && onClick(event);
|
|
209
219
|
} })));
|
|
210
220
|
};
|
|
221
|
+
Button.Unstyled = ButtonUnstyled;
|
|
211
222
|
export default Button;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
import { BaseStyledProps } from "../../styled";
|
|
3
|
+
export declare type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & BaseStyledProps & {
|
|
3
4
|
Icon?: React.ComponentType<{
|
|
4
5
|
size: number;
|
|
5
|
-
color
|
|
6
|
+
color?: string;
|
|
6
7
|
}>;
|
|
7
8
|
type?: "main" | "shade" | "color";
|
|
8
9
|
size?: "small" | "medium" | "large";
|
|
@@ -10,10 +11,17 @@ export declare type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> &
|
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
children?: React.ReactNode;
|
|
12
13
|
};
|
|
13
|
-
export declare const Base: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
14
|
+
export declare const Base: import("styled-components").StyledComponent<"a", import("styled-components").DefaultTheme, React.AnchorHTMLAttributes<HTMLAnchorElement> & import("styled-system").SpaceProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").FlexboxProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").PositionProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").ColorProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, string | number | symbol> & import("styled-system").LayoutProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & import("styled-system").OverflowProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>> & {
|
|
15
|
+
columnGap?: string | number | undefined;
|
|
16
|
+
rowGap?: string | number | undefined;
|
|
17
|
+
color?: string | undefined;
|
|
18
|
+
display?: string | undefined;
|
|
19
|
+
position?: string | undefined;
|
|
20
|
+
maxHeight?: number | undefined;
|
|
21
|
+
} & {
|
|
14
22
|
Icon?: React.ComponentType<{
|
|
15
23
|
size: number;
|
|
16
|
-
color
|
|
24
|
+
color?: string | undefined;
|
|
17
25
|
}> | undefined;
|
|
18
26
|
type?: "main" | "color" | "shade" | undefined;
|
|
19
27
|
size?: "small" | "medium" | "large" | undefined;
|
|
@@ -3,13 +3,14 @@ import styled from "styled-components";
|
|
|
3
3
|
import { getLinkColors } from "./getLinkStyle";
|
|
4
4
|
import { ctaIconSize, ctaTextType } from "../getCtaStyle";
|
|
5
5
|
import { Text } from "../../asorted";
|
|
6
|
+
import baseStyled from "../../styled";
|
|
6
7
|
const IconContainer = styled.div `
|
|
7
8
|
${(p) => p.iconLink ? "" : p.iconPosition === "left" ? `margin-right: 6px;` : `margin-left: 6px;`}
|
|
8
9
|
display: flex;
|
|
9
10
|
align-items: center;
|
|
10
11
|
justify-content: center;
|
|
11
12
|
`;
|
|
12
|
-
export const Base =
|
|
13
|
+
export const Base = baseStyled.a `
|
|
13
14
|
color: ${({ theme, disabled, type = "main" }) => getLinkColors(theme.colors)[disabled ? "disabled" : type]["default"]};
|
|
14
15
|
cursor: pointer;
|
|
15
16
|
display: inline-flex;
|
|
@@ -31,10 +32,10 @@ export const Base = styled.a `
|
|
|
31
32
|
const LinkContainer = (props) => {
|
|
32
33
|
const { Icon, iconPosition = "right", children, size = "medium" } = props;
|
|
33
34
|
return (React.createElement(React.Fragment, null,
|
|
34
|
-
iconPosition === "right" && children ? (React.createElement(Text, {
|
|
35
|
+
iconPosition === "right" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: "inherit" }, children)) : null,
|
|
35
36
|
Icon ? (React.createElement(IconContainer, { iconLink: !children, iconPosition: iconPosition },
|
|
36
37
|
React.createElement(Icon, { size: ctaIconSize[size], color: "currentcolor" }))) : null,
|
|
37
|
-
iconPosition === "left" && children ? (React.createElement(Text, {
|
|
38
|
+
iconPosition === "left" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: "inherit" }, children)) : null));
|
|
38
39
|
};
|
|
39
40
|
const Link = (props) => {
|
|
40
41
|
const { type = "main", size = "medium" } = props;
|
|
@@ -19,6 +19,6 @@ var TypeEnum;
|
|
|
19
19
|
const Toggle = (_a) => {
|
|
20
20
|
var { checked = true } = _a, buttonProps = __rest(_a, ["checked"]);
|
|
21
21
|
const type = useMemo(() => (checked ? TypeEnum.ENABLED : TypeEnum.DISABLED), [checked]);
|
|
22
|
-
return React.createElement(Button, Object.assign({
|
|
22
|
+
return React.createElement(Button, Object.assign({ variant: type, outline: type === TypeEnum.ENABLED }, buttonProps));
|
|
23
23
|
};
|
|
24
24
|
export default Toggle;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TextVariants } from "../../styles/theme";
|
|
2
2
|
export declare const ctaTextType: {
|
|
3
|
-
[index: string]:
|
|
3
|
+
[index: string]: TextVariants;
|
|
4
4
|
};
|
|
5
5
|
export declare const ctaIconSize: {
|
|
6
6
|
[index: string]: number;
|
package/components/cta/index.js
CHANGED