@ledgerhq/react-ui 0.2.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -4
- package/assets/logos/LedgerLiveAltRegular.d.ts +0 -1
- package/assets/logos/LedgerLiveRegular.d.ts +0 -1
- package/components/Chart/index.d.ts +0 -1
- package/components/Chart/index.js +1 -1
- package/components/Table/Columns.d.ts +62 -13
- package/components/Table/Columns.js +8 -18
- package/components/Table/index.d.ts +47 -14
- package/components/Table/index.js +37 -20
- package/components/Table/stories.helper.js +19 -18
- package/components/Tag/index.d.ts +18 -5
- package/components/Tag/index.js +54 -21
- package/components/animations/GlitchText/index.d.ts +6 -0
- package/components/animations/GlitchText/index.js +35 -0
- package/components/asorted/Divider/index.d.ts +0 -1
- package/components/asorted/Divider/index.js +2 -2
- package/components/asorted/Icon/BoxedIcon.d.ts +48 -0
- package/components/asorted/Icon/BoxedIcon.js +58 -0
- package/components/asorted/Icon/Icon.d.ts +0 -1
- package/components/asorted/Icon/index.d.ts +2 -0
- package/components/asorted/Icon/index.js +2 -0
- package/components/asorted/Text/index.d.ts +6 -22
- package/components/asorted/Text/index.js +7 -16
- package/components/asorted/Text/styles.d.ts +2 -1
- package/components/asorted/Text/styles.js +21 -9
- package/components/asorted/index.d.ts +1 -1
- package/components/asorted/index.js +1 -1
- package/components/cards/Carousel/Slide.js +3 -3
- package/components/cards/Carousel/index.js +8 -8
- package/components/cta/Button/index.d.ts +16 -8
- package/components/cta/Button/index.js +76 -65
- package/components/cta/Link/index.d.ts +59 -2
- package/components/cta/Link/index.js +17 -12
- package/components/cta/Toggle/index.d.ts +0 -1
- package/components/cta/Toggle/index.js +1 -1
- package/components/form/BaseInput/index.d.ts +81 -11
- package/components/form/BaseInput/index.js +42 -19
- package/components/form/Checkbox/Checkbox.js +12 -9
- package/components/form/Dropdown/index.d.ts +0 -1
- package/components/form/Dropdown/index.js +2 -2
- package/components/form/LegendInput/index.d.ts +26 -2
- package/components/form/LegendInput/index.js +5 -4
- package/components/form/NumberInput/index.d.ts +25 -3
- package/components/form/NumberInput/index.js +19 -7
- package/components/form/QrCodeInput/index.d.ts +25 -3
- package/components/form/QrCodeInput/index.js +7 -6
- package/components/form/QuantityInput/index.d.ts +26 -4
- package/components/form/QuantityInput/index.js +9 -8
- package/components/form/Radio/RadioElement.d.ts +5 -2
- package/components/form/Radio/RadioElement.js +15 -13
- package/components/form/Radio/RadioListElement.d.ts +22 -0
- package/components/form/Radio/RadioListElement.js +63 -0
- package/components/form/Radio/index.d.ts +8 -1
- package/components/form/Radio/index.js +2 -0
- package/components/form/SearchInput/index.d.ts +24 -2
- package/components/form/SearchInput/index.js +4 -3
- package/components/form/SelectInput/Control.d.ts +2 -2
- package/components/form/SelectInput/Control.js +3 -7
- package/components/form/SelectInput/DropdownIndicator.d.ts +0 -1
- package/components/form/SelectInput/DropdownIndicator.js +1 -1
- package/components/form/SelectInput/IndicatorsContainer.d.ts +0 -1
- package/components/form/SelectInput/MenuList.d.ts +0 -1
- package/components/form/SelectInput/MenuList.js +1 -1
- package/components/form/SelectInput/Option.js +11 -11
- package/components/form/SelectInput/ValueContainer.js +1 -1
- package/components/form/SelectInput/index.d.ts +3 -2
- package/components/form/SelectInput/index.js +5 -5
- package/components/form/SplitInput/index.js +5 -5
- package/components/form/Switch/Switch.js +8 -8
- package/components/helpers.d.ts +2 -2
- package/components/layout/Box/index.d.ts +8 -0
- package/components/layout/Box/index.js +3 -0
- package/components/layout/Drawer/index.d.ts +13 -0
- package/components/layout/{Side/Side.js → Drawer/index.js} +12 -12
- package/components/layout/Flex/index.d.ts +7 -7
- package/components/layout/Flex/index.js +2 -11
- package/components/layout/Grid/index.d.ts +3 -2
- package/components/layout/Grid/index.js +3 -6
- package/components/layout/Popin/index.d.ts +27 -6
- package/components/layout/Popin/index.js +65 -41
- package/components/layout/Side/index.d.ts +0 -1
- package/components/layout/Side/index.js +2 -2
- package/components/layout/index.d.ts +2 -0
- package/components/layout/index.js +2 -0
- package/components/loaders/ProgressLoader/index.d.ts +0 -1
- package/components/loaders/ProgressLoader/index.js +3 -3
- package/components/message/Alert/index.d.ts +22 -3
- package/components/message/Alert/index.js +31 -23
- package/components/message/Log/index.js +1 -1
- package/components/message/Notification/Badge.js +2 -2
- package/components/message/Notification/index.js +4 -6
- package/components/message/StatusNotification/index.d.ts +11 -0
- package/components/message/StatusNotification/index.js +33 -0
- package/components/message/Tip/index.d.ts +7 -0
- package/components/message/Tip/index.js +43 -0
- package/components/message/Tooltip/index.d.ts +3 -3
- package/components/message/Tooltip/index.js +1 -1
- package/components/message/Tooltip/styles.js +3 -3
- package/components/message/index.d.ts +3 -0
- package/components/message/index.js +3 -0
- package/components/navigation/Aside/index.d.ts +5 -1
- package/components/navigation/Breadcrumb/index.js +6 -6
- package/components/navigation/Header/index.d.ts +3 -3
- package/components/navigation/progress/ProgressBar/Onboarding.d.ts +0 -1
- package/components/navigation/progress/ProgressBar/Onboarding.js +6 -6
- package/components/navigation/progress/Stepper/index.js +9 -9
- package/components/navigation/sideBar/Item/Item.d.ts +4 -3
- package/components/navigation/sideBar/Item/Item.js +34 -16
- package/components/navigation/sideBar/Logo/Logo.d.ts +0 -1
- package/components/navigation/sideBar/SideBar/SideBar.d.ts +1 -2
- package/components/navigation/sideBar/SideBar/SideBar.js +14 -6
- package/components/navigation/sideBar/Toggle/Toggle.d.ts +0 -1
- package/components/navigation/sideBar/Toggle/Toggle.js +2 -2
- package/components/styled.d.ts +16 -0
- package/components/styled.js +13 -0
- package/components/tabs/Bar/index.js +4 -4
- package/components/tabs/Chip/index.d.ts +13 -0
- package/components/tabs/Chip/index.js +21 -0
- package/components/tabs/Pill/index.js +7 -7
- package/components/tabs/Tabs/index.js +8 -7
- package/components/tabs/index.d.ts +2 -0
- package/components/tabs/index.js +2 -0
- package/package.json +4 -4
- package/styles/InvertTheme.d.ts +1 -8
- package/styles/StyleProvider.d.ts +3 -3
- package/styles/StyleProvider.js +3 -3
- package/styles/global.d.ts +1 -0
- package/styles/global.js +15 -36
- package/styles/index.d.ts +0 -1
- package/styles/index.js +0 -1
- package/styles/theme.d.ts +5 -2
- package/styles/theme.js +7 -8
- package/components/layout/Side/Side.d.ts +0 -13
- package/styles/reset.d.ts +0 -2
- package/styles/reset.js +0 -62
package/components/Tag/index.js
CHANGED
|
@@ -10,50 +10,83 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React from "react";
|
|
13
|
-
import
|
|
14
|
-
import { border, space, color } from "styled-system";
|
|
13
|
+
import { border } from "styled-system";
|
|
15
14
|
import Text from "../asorted/Text";
|
|
16
|
-
|
|
15
|
+
import baseStyled from "../styled";
|
|
16
|
+
function getColor({ type, active, disabled }) {
|
|
17
17
|
switch (type) {
|
|
18
|
-
case "
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
case "plain":
|
|
19
|
+
if (disabled)
|
|
20
|
+
return active ? "neutral.c00" : "neutral.c70";
|
|
21
|
+
return active ? "neutral.c00" : "primary.c90";
|
|
21
22
|
default:
|
|
22
|
-
return
|
|
23
|
+
return disabled ? "neutral.c70" : "primary.c90";
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
|
-
function getBgColor({ type, active }) {
|
|
26
|
+
function getBgColor({ type, active, disabled }) {
|
|
26
27
|
switch (type) {
|
|
28
|
+
case "plain":
|
|
29
|
+
return active ? (disabled ? "neutral.c70" : "primary.c90") : undefined;
|
|
27
30
|
case "opacity":
|
|
28
|
-
return active ? "
|
|
29
|
-
|
|
31
|
+
return active ? (disabled ? "neutral.c30" : "primary.c20") : undefined;
|
|
32
|
+
default:
|
|
30
33
|
return;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function getBorderColor({ type, active, disabled }) {
|
|
37
|
+
if (!active)
|
|
38
|
+
return;
|
|
39
|
+
switch (type) {
|
|
40
|
+
case "outlined":
|
|
41
|
+
return disabled ? "neutral.c70" : "primary.c90";
|
|
42
|
+
case "outlinedOpacity":
|
|
43
|
+
return disabled ? "neutral.c40" : "primary.c40";
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function getPadding({ size }) {
|
|
47
|
+
switch (size) {
|
|
48
|
+
case "small":
|
|
49
|
+
return "3px 5px";
|
|
50
|
+
case "medium":
|
|
51
|
+
return "6px 8px";
|
|
52
|
+
case "large":
|
|
31
53
|
default:
|
|
32
|
-
return
|
|
54
|
+
return "9px 10px 10px";
|
|
33
55
|
}
|
|
34
56
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
|
|
57
|
+
function getTextProps({ size }) {
|
|
58
|
+
switch (size) {
|
|
59
|
+
case "small":
|
|
60
|
+
case "medium":
|
|
61
|
+
return {
|
|
62
|
+
variant: "tiny",
|
|
63
|
+
fontWeight: "semiBold",
|
|
64
|
+
uppercase: true,
|
|
65
|
+
};
|
|
66
|
+
case "large":
|
|
67
|
+
default:
|
|
68
|
+
return {
|
|
69
|
+
variant: "extraSmall",
|
|
70
|
+
fontWeight: "semiBold",
|
|
71
|
+
};
|
|
38
72
|
}
|
|
39
73
|
}
|
|
40
|
-
const TagContainer =
|
|
74
|
+
const TagContainer = baseStyled.div.attrs((props) => ({
|
|
41
75
|
backgroundColor: props.bg || props.backgroundColor || getBgColor(props),
|
|
42
76
|
color: props.color || getColor(props),
|
|
43
77
|
borderColor: getBorderColor(props),
|
|
44
|
-
p: "7px", // TODO: use spacing from the theme when it gets updated
|
|
45
78
|
})) `
|
|
46
79
|
display: inline-flex;
|
|
47
80
|
justify-content: center;
|
|
48
81
|
border: 1px solid transparent;
|
|
49
82
|
border-radius: ${(p) => `${p.theme.radii[1]}px`};
|
|
83
|
+
padding: ${(p) => getPadding(p)};
|
|
50
84
|
${border}
|
|
51
|
-
${space}
|
|
52
|
-
${color}
|
|
53
85
|
`;
|
|
54
86
|
export default function Tag(_a) {
|
|
55
|
-
var { children } = _a, props = __rest(_a, ["children"]);
|
|
87
|
+
var { children, textProps, size = "large" } = _a, props = __rest(_a, ["children", "textProps", "size"]);
|
|
56
88
|
const textColor = getColor(props);
|
|
57
|
-
|
|
58
|
-
|
|
89
|
+
const baseTextProps = getTextProps(Object.assign({ size }, props));
|
|
90
|
+
return (React.createElement(TagContainer, Object.assign({ size: size }, props),
|
|
91
|
+
React.createElement(Text, Object.assign({}, baseTextProps, { color: textColor }, (textProps ? textProps : {})), children)));
|
|
59
92
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React, { useEffect, useState } from "react";
|
|
2
|
+
function makeRandomString(length) {
|
|
3
|
+
let result = "";
|
|
4
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
5
|
+
const charactersLength = characters.length;
|
|
6
|
+
for (let i = 0; i < length; i++) {
|
|
7
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
8
|
+
}
|
|
9
|
+
return result;
|
|
10
|
+
}
|
|
11
|
+
const INTERVAL = 77;
|
|
12
|
+
export default function GlitchText({ text, duration = 800, delay = 500 }) {
|
|
13
|
+
const [shownText, setShownText] = useState(text);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
let frameT = 0;
|
|
16
|
+
const startFrame = Math.floor((1 + delay) / INTERVAL);
|
|
17
|
+
const totalFrames = Math.floor((delay + duration) / INTERVAL);
|
|
18
|
+
const interval = setInterval(() => {
|
|
19
|
+
if (frameT >= startFrame) {
|
|
20
|
+
if (frameT >= totalFrames) {
|
|
21
|
+
setShownText(text);
|
|
22
|
+
clearInterval(interval);
|
|
23
|
+
frameT = 0;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const t1 = text.substr(0, -totalFrames + frameT + text.length);
|
|
27
|
+
const t2 = t1.length > 0 ? text.substr(t1.length, text.length) : text;
|
|
28
|
+
setShownText(t1 + makeRandomString(t2.length));
|
|
29
|
+
}
|
|
30
|
+
frameT++;
|
|
31
|
+
}, INTERVAL);
|
|
32
|
+
return () => interval && clearInterval(interval);
|
|
33
|
+
}, [delay, duration, text]);
|
|
34
|
+
return React.createElement(React.Fragment, null, shownText);
|
|
35
|
+
}
|
|
@@ -2,11 +2,11 @@ import React from "react";
|
|
|
2
2
|
import styled from "styled-components";
|
|
3
3
|
const Divider = styled.div `
|
|
4
4
|
display: block;
|
|
5
|
-
background: ${(p) => p.theme.colors.
|
|
5
|
+
background: ${(p) => p.theme.colors.neutral.c90};
|
|
6
6
|
height: 1px;
|
|
7
7
|
|
|
8
8
|
&[data-variant="light"] {
|
|
9
|
-
background: ${(p) => p.theme.colors.
|
|
9
|
+
background: ${(p) => p.theme.colors.neutral.c40};
|
|
10
10
|
}
|
|
11
11
|
`;
|
|
12
12
|
export default ({ variant = "default" }) => React.createElement(Divider, { "data-variant": variant });
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const DEFAULT_BOX_SIZE = 40;
|
|
3
|
+
export declare const DEFAULT_ICON_SIZE = 16;
|
|
4
|
+
export declare const DEFAULT_BADGE_SIZE = 20;
|
|
5
|
+
export declare type IconProps = {
|
|
6
|
+
size?: number;
|
|
7
|
+
color?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare type IconBoxProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Component that takes `{size?: number; color?: string}` as props. Will be rendered at the top right with the size provided in `badgeSize` or a default size.
|
|
12
|
+
*/
|
|
13
|
+
Badge?: React.ComponentType<IconProps> | ((props: IconProps) => JSX.Element);
|
|
14
|
+
/**
|
|
15
|
+
* Color of the border
|
|
16
|
+
*/
|
|
17
|
+
borderColor?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Badge color, will be applied to the component provided in the `Badge` prop
|
|
20
|
+
*/
|
|
21
|
+
badgeColor?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Badge size, will be applied to the component provided in the `Badge` prop
|
|
24
|
+
*/
|
|
25
|
+
badgeSize?: number;
|
|
26
|
+
children?: JSX.Element;
|
|
27
|
+
/**
|
|
28
|
+
* Box size for preview
|
|
29
|
+
*/
|
|
30
|
+
size?: number;
|
|
31
|
+
};
|
|
32
|
+
export declare type BoxedIconProps = IconBoxProps & {
|
|
33
|
+
/**
|
|
34
|
+
* Component that takes `{size?: number; color?: string}` as props. Will be rendered at the top right with the size provided in `iconSize` or a default size.
|
|
35
|
+
*/
|
|
36
|
+
Icon: React.ComponentType<IconProps> | ((props: IconProps) => JSX.Element);
|
|
37
|
+
/**
|
|
38
|
+
* Icon size, will be applied to the component provided in the `Icon` prop
|
|
39
|
+
*/
|
|
40
|
+
iconSize?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Icon color, will be applied to the component provided in the `Icon` prop
|
|
43
|
+
*/
|
|
44
|
+
iconColor?: string;
|
|
45
|
+
};
|
|
46
|
+
export declare const IconBox: ({ Badge, size, children, borderColor, badgeColor, badgeSize, }: IconBoxProps) => JSX.Element;
|
|
47
|
+
declare const BoxedIcon: ({ Icon, iconSize, iconColor, ...iconBoxProps }: BoxedIconProps) => JSX.Element;
|
|
48
|
+
export default BoxedIcon;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import React from "react";
|
|
13
|
+
import styled from "styled-components";
|
|
14
|
+
import Flex from "../../layout/Flex";
|
|
15
|
+
export const DEFAULT_BOX_SIZE = 40;
|
|
16
|
+
export const DEFAULT_ICON_SIZE = 16;
|
|
17
|
+
export const DEFAULT_BADGE_SIZE = 20;
|
|
18
|
+
const getTopRightSquareClippedPolygon = (boxSize, rectangleSize) => {
|
|
19
|
+
// clipping path that hides top right square of size `${rectangleSize}px`
|
|
20
|
+
const diff = boxSize - rectangleSize;
|
|
21
|
+
return `polygon(0 0, 0 0, 0 0, ${diff}px 0, ${diff}px ${rectangleSize}px, 100% ${rectangleSize}px, 100% 100%, 100% 100%, 100% 100%, 0 100%, 0 100%, 0 100%)`;
|
|
22
|
+
};
|
|
23
|
+
const Container = styled(Flex).attrs((p) => ({
|
|
24
|
+
heigth: p.size,
|
|
25
|
+
width: p.size,
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
justifyContent: "center",
|
|
28
|
+
position: "relative",
|
|
29
|
+
})) ``;
|
|
30
|
+
const IconBoxBackground = styled(Flex) `
|
|
31
|
+
position: absolute;
|
|
32
|
+
height: ${(p) => p.size}px;
|
|
33
|
+
width: ${(p) => p.size}px;
|
|
34
|
+
${(p) => {
|
|
35
|
+
return p.hasBadge && `clip-path: ${getTopRightSquareClippedPolygon(p.size, 15)};`;
|
|
36
|
+
}};
|
|
37
|
+
border-radius: ${(p) => p.theme.radii[2]}px;
|
|
38
|
+
`;
|
|
39
|
+
const BadgeContainer = styled.div `
|
|
40
|
+
position: absolute;
|
|
41
|
+
${(p) => `
|
|
42
|
+
top: -${p.badgeSize / 2 - 2}px;
|
|
43
|
+
right: -${p.badgeSize / 2 - 2}px;`}
|
|
44
|
+
`;
|
|
45
|
+
export const IconBox = ({ Badge, size = DEFAULT_BOX_SIZE, children, borderColor = "neutral.c40", badgeColor, badgeSize = DEFAULT_BADGE_SIZE, }) => {
|
|
46
|
+
const hasBadge = !!Badge;
|
|
47
|
+
return (React.createElement(Container, { size: size },
|
|
48
|
+
React.createElement(IconBoxBackground, { size: size, hasBadge: hasBadge, border: "1px solid", borderColor: borderColor }),
|
|
49
|
+
children,
|
|
50
|
+
hasBadge && (React.createElement(BadgeContainer, { badgeSize: badgeSize },
|
|
51
|
+
React.createElement(Badge, { size: badgeSize, color: badgeColor })))));
|
|
52
|
+
};
|
|
53
|
+
const BoxedIcon = (_a) => {
|
|
54
|
+
var { Icon, iconSize = DEFAULT_ICON_SIZE, iconColor } = _a, iconBoxProps = __rest(_a, ["Icon", "iconSize", "iconColor"]);
|
|
55
|
+
return (React.createElement(IconBox, Object.assign({}, iconBoxProps),
|
|
56
|
+
React.createElement(Icon, { size: iconSize || DEFAULT_ICON_SIZE, color: iconColor })));
|
|
57
|
+
};
|
|
58
|
+
export default BoxedIcon;
|
|
@@ -1,35 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { SpaceProps, LayoutProps } from "styled-system";
|
|
1
|
+
import { BaseStyledProps } from "../../styled";
|
|
3
2
|
import { TextVariants } from "../../../styles/theme";
|
|
4
3
|
declare type FontFamilies = "Inter|ExtraLight" | "Inter|Light" | "Inter|Regular" | "Inter|Medium" | "Inter|SemiBold" | "Inter|Bold" | "Inter|ExtraBold" | "Alpha|Medium";
|
|
5
|
-
|
|
4
|
+
declare type WhiteSpace = "normal" | "nowrap" | "pre" | "pre-line" | "pre-wrap";
|
|
5
|
+
export interface TextProps extends BaseStyledProps {
|
|
6
6
|
fontFamily?: string;
|
|
7
7
|
ff?: FontFamilies;
|
|
8
8
|
fontSize?: number | string | TextVariants;
|
|
9
9
|
variant?: TextVariants;
|
|
10
10
|
textAlign?: string;
|
|
11
|
-
textTransform?: string;
|
|
12
|
-
color?: string;
|
|
13
|
-
fontWeight?: string;
|
|
14
|
-
mt?: number | string;
|
|
15
|
-
mb?: number | string;
|
|
16
|
-
ml?: number | string;
|
|
17
|
-
mr?: number | string;
|
|
18
|
-
lineHeight?: string;
|
|
19
|
-
bracket?: boolean;
|
|
20
|
-
children: React.ReactNode;
|
|
21
|
-
}
|
|
22
|
-
export interface BaseTextProps extends SpaceProps, LayoutProps {
|
|
23
|
-
fontFamily?: string;
|
|
24
|
-
ff?: FontFamilies;
|
|
25
|
-
fontSize?: number | string | TextVariants;
|
|
26
|
-
variant?: TextVariants;
|
|
27
|
-
textAlign?: string;
|
|
28
|
-
color?: string;
|
|
29
11
|
fontWeight?: string;
|
|
30
12
|
lineHeight?: string;
|
|
31
13
|
textTransform?: string;
|
|
32
14
|
textOverflow?: string;
|
|
15
|
+
uppercase?: boolean;
|
|
16
|
+
whiteSpace?: WhiteSpace;
|
|
33
17
|
}
|
|
34
|
-
declare const Text: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme,
|
|
18
|
+
declare const Text: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, TextProps, keyof TextProps>;
|
|
35
19
|
export default Text;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { fontSize, fontWeight, textAlign,
|
|
1
|
+
import baseStyled from "../../styled";
|
|
2
|
+
import { compose, fontSize, fontWeight, textAlign, lineHeight, letterSpacing, system, } from "styled-system";
|
|
3
3
|
import fontFamily from "../../../styles/styled/fontFamily";
|
|
4
4
|
import { textVariantStyle } from "./styles";
|
|
5
5
|
const uppercase = system({
|
|
@@ -8,25 +8,16 @@ const uppercase = system({
|
|
|
8
8
|
transform: (value) => (value ? "uppercase" : "none"),
|
|
9
9
|
},
|
|
10
10
|
});
|
|
11
|
-
const Text =
|
|
11
|
+
const Text = baseStyled.span.attrs(({ variant = "body", fontSize, color }) => ({
|
|
12
12
|
fontSize: fontSize ? fontSize : variant,
|
|
13
|
-
color: color || "
|
|
13
|
+
color: color || "neutral.c100",
|
|
14
14
|
})) `
|
|
15
15
|
font-weight: 500;
|
|
16
|
+
white-space: ${(props) => { var _a; return (_a = props.whiteSpace) !== null && _a !== void 0 ? _a : "normal"; }};
|
|
16
17
|
${(p) => textVariantStyle[p.variant || "body"]}
|
|
17
|
-
${uppercase
|
|
18
|
-
${lineHeight};
|
|
19
|
-
${fontFamily};
|
|
20
|
-
${fontSize};
|
|
21
|
-
${textAlign};
|
|
22
|
-
${color};
|
|
23
|
-
${fontWeight};
|
|
24
|
-
${space};
|
|
25
|
-
${letterSpacing};
|
|
26
|
-
${layout}
|
|
27
|
-
${system({
|
|
18
|
+
${compose(uppercase, lineHeight, fontFamily, fontSize, textAlign, fontWeight, letterSpacing, system({
|
|
28
19
|
textOverflow: true,
|
|
29
|
-
})}
|
|
20
|
+
}))}
|
|
30
21
|
${(p) => (p.textTransform ? `text-transform: ${p.textTransform};` : "")}
|
|
31
22
|
`;
|
|
32
23
|
export default Text;
|
|
@@ -3,6 +3,7 @@ import { TextVariants } from "../../../styles/theme";
|
|
|
3
3
|
export declare const fontStyles: import("styled-components").FlattenInterpolation<import("styled-components").ThemedStyledProps<GlobalStyleProps, import("styled-components").DefaultTheme>>;
|
|
4
4
|
export declare const textVariantStyle: Record<TextVariants, {
|
|
5
5
|
fontFamily: string;
|
|
6
|
-
lineHeight?: string;
|
|
6
|
+
lineHeight?: string | number;
|
|
7
7
|
fontWeight?: number;
|
|
8
|
+
"text-transform"?: string;
|
|
8
9
|
}>;
|
|
@@ -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 {
|
|
@@ -57,39 +59,48 @@ export const textVariantStyle = {
|
|
|
57
59
|
h1: {
|
|
58
60
|
fontFamily: "Alpha",
|
|
59
61
|
fontWeight: 500,
|
|
62
|
+
"text-transform": "uppercase",
|
|
60
63
|
},
|
|
61
64
|
h2: {
|
|
62
65
|
fontFamily: "Alpha",
|
|
63
66
|
fontWeight: 500,
|
|
67
|
+
"text-transform": "uppercase",
|
|
64
68
|
},
|
|
65
69
|
h3: {
|
|
66
70
|
fontFamily: "Alpha",
|
|
67
71
|
fontWeight: 500,
|
|
72
|
+
"text-transform": "uppercase",
|
|
68
73
|
},
|
|
69
74
|
h4: {
|
|
70
|
-
fontFamily: "
|
|
75
|
+
fontFamily: "Alpha",
|
|
71
76
|
fontWeight: 500,
|
|
77
|
+
"text-transform": "uppercase",
|
|
72
78
|
},
|
|
73
79
|
h5: {
|
|
74
80
|
fontFamily: "Alpha",
|
|
75
81
|
fontWeight: 500,
|
|
82
|
+
"text-transform": "uppercase",
|
|
76
83
|
},
|
|
77
84
|
large: {
|
|
78
85
|
fontFamily: "Inter",
|
|
79
86
|
},
|
|
87
|
+
largeLineHeight: {
|
|
88
|
+
fontFamily: "Inter",
|
|
89
|
+
lineHeight: 1.7,
|
|
90
|
+
},
|
|
80
91
|
body: {
|
|
81
92
|
fontFamily: "Inter",
|
|
82
93
|
},
|
|
83
94
|
bodyLineHeight: {
|
|
84
95
|
fontFamily: "Inter",
|
|
85
|
-
lineHeight:
|
|
96
|
+
lineHeight: 1.7,
|
|
86
97
|
},
|
|
87
98
|
paragraph: {
|
|
88
99
|
fontFamily: "Inter",
|
|
89
100
|
},
|
|
90
101
|
paragraphLineHeight: {
|
|
91
102
|
fontFamily: "Inter",
|
|
92
|
-
lineHeight:
|
|
103
|
+
lineHeight: 1.7,
|
|
93
104
|
},
|
|
94
105
|
small: {
|
|
95
106
|
fontFamily: "Inter",
|
|
@@ -97,14 +108,15 @@ export const textVariantStyle = {
|
|
|
97
108
|
extraSmall: {
|
|
98
109
|
fontFamily: "Inter",
|
|
99
110
|
},
|
|
100
|
-
subtitle: {
|
|
101
|
-
fontFamily: "Inter",
|
|
102
|
-
fontWeight: 600,
|
|
103
|
-
},
|
|
104
111
|
tiny: {
|
|
105
112
|
fontFamily: "Inter",
|
|
106
113
|
},
|
|
107
114
|
micro: {
|
|
108
115
|
fontFamily: "Inter",
|
|
109
116
|
},
|
|
117
|
+
subtitle: {
|
|
118
|
+
fontFamily: "Inter",
|
|
119
|
+
fontWeight: 600,
|
|
120
|
+
"text-transform": "uppercase",
|
|
121
|
+
},
|
|
110
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, { variant: "tiny", color: "
|
|
20
|
-
React.createElement(Text, { variant: "h5", color: "
|
|
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,12 +1,16 @@
|
|
|
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
|
}
|
|
@@ -18,13 +22,17 @@ export interface ButtonProps extends BaseProps {
|
|
|
18
22
|
children?: React.ReactNode;
|
|
19
23
|
onClick: (event?: React.SyntheticEvent<HTMLButtonElement>) => void;
|
|
20
24
|
iconSize?: number;
|
|
25
|
+
style?: React.CSSProperties;
|
|
21
26
|
}
|
|
27
|
+
export declare const ButtonUnstyled: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
|
|
22
28
|
export declare const Base: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
|
|
23
|
-
|
|
24
|
-
color: string;
|
|
29
|
+
fontFamily: string;
|
|
25
30
|
fontSize: number;
|
|
26
|
-
} & BaseProps, "
|
|
27
|
-
declare const Button:
|
|
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
|
+
};
|
|
28
36
|
export declare type ExpandButtonProps = React.PropsWithChildren<{
|
|
29
37
|
onToggle?: (arg0: boolean) => void;
|
|
30
38
|
onClick?: (arg0: React.SyntheticEvent<HTMLButtonElement>) => void;
|