@ledgerhq/native-ui 0.3.0 → 0.6.1
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 +13 -23
- package/assets/fonts/.DS_Store +0 -0
- package/assets/fonts/alpha/.DS_Store +0 -0
- package/assets/logos/LedgerLiveAltRegular.d.ts +0 -1
- package/assets/logos/LedgerLiveRegular.d.ts +0 -1
- package/components/Carousel/index.d.ts +45 -0
- package/components/Carousel/index.js +76 -0
- package/components/Form/Checkbox/index.d.ts +2 -2
- package/components/Form/Checkbox/index.js +5 -5
- package/components/Form/Input/BaseInput/index.d.ts +83 -5
- package/components/Form/Input/BaseInput/index.js +16 -16
- package/components/Form/Input/LegendInput/index.d.ts +14 -3
- package/components/Form/Input/LegendInput/index.js +4 -3
- package/components/Form/Input/NumberInput/index.d.ts +16 -5
- package/components/Form/Input/NumberInput/index.js +6 -9
- package/components/Form/Input/QrCodeInput/index.d.ts +15 -4
- package/components/Form/Input/QrCodeInput/index.js +5 -4
- package/components/Form/Input/SearchInput/index.d.ts +13 -2
- package/components/Form/Input/SearchInput/index.js +4 -3
- package/components/Form/SelectableList.d.ts +12 -3
- package/components/Form/SelectableList.js +9 -8
- package/components/Form/Slider/components.js +6 -6
- package/components/Form/Slider/index.d.ts +0 -1
- package/components/Form/Slider/index.native.d.ts +0 -1
- package/components/Form/Slider/index.native.js +2 -2
- package/components/Form/Switch/index.d.ts +0 -1
- package/components/Form/Switch/index.js +4 -4
- package/components/Form/Toggle/index.d.ts +0 -1
- package/components/Form/index.d.ts +1 -0
- package/components/Form/index.js +1 -0
- package/components/Icon/BoxedIcon.d.ts +48 -0
- package/components/Icon/BoxedIcon.js +87 -0
- package/components/Icon/IconBox/index.d.ts +2 -4
- package/components/Icon/IconBox/index.js +2 -3
- package/components/Icon/index.d.ts +1 -0
- package/components/Icon/index.js +1 -0
- package/components/Icon/type.d.ts +7 -0
- package/components/Icon/type.js +1 -0
- package/components/Layout/Box/index.d.ts +11 -0
- package/components/Layout/Box/index.js +3 -0
- package/components/Layout/Flex/index.d.ts +11 -12
- package/components/Layout/Flex/index.js +2 -8
- package/components/Layout/List/IconBoxList/index.d.ts +10 -0
- package/components/Layout/List/IconBoxList/index.js +19 -0
- package/components/Layout/List/List/index.d.ts +13 -0
- package/components/Layout/List/List/index.js +29 -0
- package/components/Layout/List/NumberedList/index.d.ts +9 -0
- package/components/Layout/List/NumberedList/index.js +20 -0
- package/components/Layout/List/TipList/index.d.ts +9 -0
- package/components/Layout/List/TipList/index.js +20 -0
- package/components/Layout/List/index.d.ts +4 -0
- package/components/Layout/List/index.js +4 -0
- package/components/Layout/Modals/BaseModal/index.js +4 -4
- package/components/Layout/ScrollContainerHeader/Header.d.ts +0 -1
- package/components/Layout/ScrollContainerHeader/Header.js +1 -1
- package/components/Layout/index.d.ts +4 -0
- package/components/Layout/index.js +4 -0
- package/components/Loader/InfiniteLoader/index.d.ts +9 -0
- package/components/Loader/InfiniteLoader/index.js +62 -0
- package/components/Loader/ProgressLoader/index.d.ts +11 -0
- package/components/Loader/ProgressLoader/index.js +24 -0
- package/components/Loader/index.d.ts +2 -11
- package/components/Loader/index.js +2 -24
- package/components/Navigation/FlowStepper/index.d.ts +70 -0
- package/components/Navigation/FlowStepper/index.js +38 -0
- package/components/Navigation/SlideIndicator/index.js +15 -8
- package/components/Navigation/Stepper/index.js +12 -12
- package/components/Navigation/index.d.ts +1 -0
- package/components/Navigation/index.js +1 -0
- package/components/ProgressBar/index.d.ts +15 -0
- package/components/ProgressBar/index.js +33 -0
- package/components/Tabs/Chip/index.d.ts +5 -0
- package/components/Tabs/Chip/index.js +20 -0
- package/components/Tabs/Graph/index.d.ts +5 -0
- package/components/Tabs/Graph/index.js +21 -0
- package/components/Tabs/TemplateTabs/index.d.ts +29 -0
- package/components/Tabs/TemplateTabs/index.js +14 -0
- package/components/Tabs/index.d.ts +2 -0
- package/components/Tabs/index.js +2 -0
- package/components/Text/getTextStyle.d.ts +1 -0
- package/components/Text/getTextStyle.js +5 -0
- package/components/Text/index.d.ts +6 -8
- package/components/Text/index.js +17 -10
- package/components/chart/index.d.ts +0 -1
- package/components/chart/index.js +6 -6
- package/components/cta/Button/getButtonStyle.js +12 -12
- package/components/cta/Button/index.d.ts +4 -15
- package/components/cta/Button/index.js +13 -14
- package/components/cta/Link/getLinkStyle.js +8 -8
- package/components/index.d.ts +5 -2
- package/components/index.js +6 -2
- package/components/message/Alert/index.d.ts +0 -1
- package/components/message/Alert/index.js +7 -7
- package/components/{drawer → message}/Notification/index.d.ts +5 -4
- package/components/message/Notification/index.js +35 -0
- package/components/message/index.d.ts +1 -0
- package/components/message/index.js +1 -0
- package/components/styled.d.ts +15 -0
- package/components/styled.js +12 -0
- package/components/tags/Badge/index.js +7 -7
- package/components/transitions/Fade.d.ts +5 -0
- package/components/transitions/Fade.js +32 -0
- package/components/transitions/Slide.d.ts +11 -0
- package/components/transitions/Slide.js +49 -0
- package/components/transitions/Transition.d.ts +49 -0
- package/components/transitions/Transition.js +42 -0
- package/components/transitions/index.d.ts +4 -0
- package/components/transitions/index.js +4 -0
- package/components/transitions/types.d.ts +21 -0
- package/components/transitions/types.js +1 -0
- package/icons/Close.js +1 -1
- package/package.json +6 -8
- package/styles/StyleProvider.js +1 -1
- package/styles/theme.d.ts +4 -1
- package/styles/theme.js +3 -3
- package/components/Navigation/ToggleGroup/index.d.ts +0 -15
- package/components/Navigation/ToggleGroup/index.js +0 -25
- package/components/drawer/Notification/index.js +0 -37
- package/components/drawer/index.d.ts +0 -1
- package/components/drawer/index.js +0 -1
|
@@ -1,21 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TextProps } from "react-native";
|
|
3
|
-
import { FontSizeProps, TextAlignProps,
|
|
2
|
+
import { TextProps, TextStyle } from "react-native";
|
|
3
|
+
import { FontSizeProps, TextAlignProps, LineHeightProps } from "styled-system";
|
|
4
|
+
import { BaseStyledProps } from "../styled";
|
|
4
5
|
import { FontWeightTypes } from "./getTextStyle";
|
|
5
6
|
import { TextVariants } from "../../styles/theme";
|
|
6
|
-
export interface BaseTextProps extends TextProps, FontSizeProps, TextAlignProps,
|
|
7
|
+
export interface BaseTextProps extends TextProps, BaseStyledProps, FontSizeProps, TextAlignProps, LineHeightProps {
|
|
7
8
|
variant?: TextVariants;
|
|
8
9
|
fontWeight?: FontWeightTypes;
|
|
9
10
|
fontFamily?: string;
|
|
10
11
|
fontSize?: number | string | TextVariants;
|
|
11
12
|
color?: string;
|
|
12
|
-
mt?: number | string;
|
|
13
|
-
mb?: number | string;
|
|
14
|
-
ml?: number | string;
|
|
15
|
-
mr?: number | string;
|
|
16
|
-
paddingTop?: number;
|
|
17
13
|
lineHeight?: number;
|
|
18
14
|
bracket?: boolean;
|
|
15
|
+
textTransform?: TextStyle["textTransform"];
|
|
16
|
+
uppercase?: boolean;
|
|
19
17
|
children: React.ReactNode;
|
|
20
18
|
}
|
|
21
19
|
declare const Text: ({ children, bracket, ...props }: BaseTextProps) => JSX.Element;
|
package/components/Text/index.js
CHANGED
|
@@ -11,25 +11,32 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
import React from "react";
|
|
13
13
|
import styled, { useTheme } from "styled-components/native";
|
|
14
|
-
import { fontSize, textAlign,
|
|
14
|
+
import { compose, fontSize, textAlign, lineHeight, system, } from "styled-system";
|
|
15
|
+
import baseStyled from "../styled";
|
|
15
16
|
import BracketRight from "../../icons/BracketLeft";
|
|
16
17
|
import BracketLeft from "../../icons/BracketRight";
|
|
17
18
|
import { getColor } from "../../styles";
|
|
18
19
|
import { getTextStyle } from "./getTextStyle";
|
|
19
|
-
const
|
|
20
|
+
const uppercase = system({
|
|
21
|
+
uppercase: {
|
|
22
|
+
property: "textTransform",
|
|
23
|
+
transform: (value) => (value ? "uppercase" : "none"),
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const textTransform = system({
|
|
27
|
+
textTransform: {
|
|
28
|
+
property: "textTransform",
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
const Base = baseStyled.Text.attrs((p) => {
|
|
20
32
|
var _a;
|
|
21
33
|
return ({
|
|
22
34
|
fontSize: p.fontSize ? p.fontSize : (_a = p.variant) !== null && _a !== void 0 ? _a : "paragraph",
|
|
23
|
-
color: p.color || "
|
|
35
|
+
color: p.color || "neutral.c100",
|
|
24
36
|
});
|
|
25
37
|
}) `
|
|
26
38
|
${(p) => getTextStyle(p)}
|
|
27
|
-
${lineHeight}
|
|
28
|
-
${fontSize};
|
|
29
|
-
${textAlign};
|
|
30
|
-
${color};
|
|
31
|
-
${space};
|
|
32
|
-
${border};
|
|
39
|
+
${compose(lineHeight, fontSize, textAlign, uppercase, textTransform)}
|
|
33
40
|
justify-content: center;
|
|
34
41
|
align-items: center;
|
|
35
42
|
`;
|
|
@@ -39,7 +46,7 @@ const T = styled.View `
|
|
|
39
46
|
align-items: center;
|
|
40
47
|
`;
|
|
41
48
|
const BracketText = (_a) => {
|
|
42
|
-
var { children, color = "
|
|
49
|
+
var { children, color = "neutral.c100", lineHeight } = _a, props = __rest(_a, ["children", "color", "lineHeight"]);
|
|
43
50
|
const size = lineHeight || getTextStyle(props).lineHeight;
|
|
44
51
|
const theme = useTheme();
|
|
45
52
|
const c = theme ? getColor(theme, color) : "transparent";
|
|
@@ -6,7 +6,7 @@ import { VictoryLine, VictoryChart, VictoryAxis, VictoryArea, VictoryScatter, }
|
|
|
6
6
|
import { hex } from "../../styles/helpers";
|
|
7
7
|
import Flex from "../Layout/Flex";
|
|
8
8
|
const Container = styled(Flex) `
|
|
9
|
-
background-color: ${(p) => p.theme.colors.
|
|
9
|
+
background-color: ${(p) => p.theme.colors.background.main};
|
|
10
10
|
`;
|
|
11
11
|
const sortByDate = (a, b) => {
|
|
12
12
|
if (a.date.getTime() < b.date.getTime())
|
|
@@ -22,7 +22,7 @@ const Chart = ({ data, color, tickFormat = "MMM", valueKey = "value", height = 1
|
|
|
22
22
|
React.createElement(VictoryChart, { scale: { x: "time" }, height: height, domainPadding: { x: [0, 5], y: [30, 10] } },
|
|
23
23
|
React.createElement(VictoryAxis, { dependentAxis: true, crossAxis: true, style: {
|
|
24
24
|
grid: {
|
|
25
|
-
stroke: theme.colors.
|
|
25
|
+
stroke: theme.colors.neutral.c40,
|
|
26
26
|
strokeDasharray: "4 4",
|
|
27
27
|
},
|
|
28
28
|
axisLabel: { display: "none" },
|
|
@@ -32,11 +32,11 @@ const Chart = ({ data, color, tickFormat = "MMM", valueKey = "value", height = 1
|
|
|
32
32
|
} }),
|
|
33
33
|
React.createElement(VictoryAxis, { crossAxis: false, tickFormat: (timestamp) => moment(timestamp).format(tickFormat), style: {
|
|
34
34
|
axis: {
|
|
35
|
-
stroke: theme.colors.
|
|
35
|
+
stroke: theme.colors.neutral.c40,
|
|
36
36
|
strokeDasharray: "4 4",
|
|
37
37
|
},
|
|
38
38
|
tickLabels: {
|
|
39
|
-
fill: theme.colors.
|
|
39
|
+
fill: theme.colors.neutral.c80,
|
|
40
40
|
fontSize: 12,
|
|
41
41
|
lineHeight: 14.52,
|
|
42
42
|
},
|
|
@@ -45,14 +45,14 @@ const Chart = ({ data, color, tickFormat = "MMM", valueKey = "value", height = 1
|
|
|
45
45
|
React.createElement(Defs, null,
|
|
46
46
|
React.createElement(LinearGradient, { id: "chartGradient", x1: "0.5", x2: "0.5", y1: "0", y2: "1" },
|
|
47
47
|
React.createElement(Stop, { stopColor: hex(color), stopOpacity: "0.11" }),
|
|
48
|
-
React.createElement(Stop, { offset: "1", stopColor: hex(theme.colors.
|
|
48
|
+
React.createElement(Stop, { offset: "1", stopColor: hex(theme.colors.neutral.c00), stopOpacity: "0" }))),
|
|
49
49
|
React.createElement(VictoryArea, { data: sortData, interpolation: "monotoneX", sortKey: "date", x: "date", y: valueKey, style: { data: { fill: `url(#chartGradient)` } }, standalone: false }),
|
|
50
50
|
React.createElement(VictoryLine, { data: sortData, interpolation: "monotoneX", x: "date", y: valueKey, style: { data: { stroke: color } } }),
|
|
51
51
|
React.createElement(VictoryScatter, { style: {
|
|
52
52
|
data: {
|
|
53
53
|
stroke: color,
|
|
54
54
|
strokeWidth: 3,
|
|
55
|
-
fill: theme.colors.
|
|
55
|
+
fill: theme.colors.background.main,
|
|
56
56
|
},
|
|
57
57
|
}, size: 5, data: [sortData[sortData.length - 1]], x: "date", y: valueKey }))));
|
|
58
58
|
};
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
export function getButtonColors(colors) {
|
|
2
2
|
return {
|
|
3
3
|
default: {
|
|
4
|
-
primaryColor: colors.
|
|
4
|
+
primaryColor: colors.neutral.c100,
|
|
5
5
|
secondaryColor: "rgba(0,0,0,0)",
|
|
6
6
|
},
|
|
7
7
|
disabled: {
|
|
8
|
-
primaryColor: colors.
|
|
9
|
-
secondaryColor: colors.
|
|
8
|
+
primaryColor: colors.neutral.c50,
|
|
9
|
+
secondaryColor: colors.neutral.c30,
|
|
10
10
|
},
|
|
11
11
|
main: {
|
|
12
|
-
primaryColor: colors.
|
|
13
|
-
secondaryColor: colors.
|
|
12
|
+
primaryColor: colors.neutral.c00,
|
|
13
|
+
secondaryColor: colors.neutral.c100,
|
|
14
14
|
},
|
|
15
15
|
shade: {
|
|
16
|
-
primaryColor: colors.
|
|
17
|
-
secondaryColor: colors.
|
|
18
|
-
tertiaryColor: colors.
|
|
16
|
+
primaryColor: colors.neutral.c00,
|
|
17
|
+
secondaryColor: colors.neutral.c100,
|
|
18
|
+
tertiaryColor: colors.neutral.c40,
|
|
19
19
|
},
|
|
20
20
|
error: {
|
|
21
|
-
primaryColor: colors.
|
|
22
|
-
secondaryColor: colors.
|
|
21
|
+
primaryColor: colors.neutral.c00,
|
|
22
|
+
secondaryColor: colors.error.c100,
|
|
23
23
|
},
|
|
24
24
|
color: {
|
|
25
|
-
primaryColor: colors.
|
|
26
|
-
secondaryColor: colors.
|
|
25
|
+
primaryColor: colors.neutral.c00,
|
|
26
|
+
secondaryColor: colors.primary.c80,
|
|
27
27
|
},
|
|
28
28
|
};
|
|
29
29
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="styled-components-react-native" />
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { SpaceProps } from "styled-system";
|
|
4
3
|
import { TouchableOpacity, TouchableOpacityProps } from "react-native";
|
|
5
|
-
|
|
4
|
+
import { BaseStyledProps } from "../../styled";
|
|
5
|
+
export declare type ButtonProps = TouchableOpacityProps & BaseStyledProps & {
|
|
6
6
|
Icon?: React.ComponentType<{
|
|
7
7
|
size: number;
|
|
8
8
|
color: string;
|
|
@@ -17,19 +17,8 @@ export declare type ButtonProps = TouchableOpacityProps & SpaceProps & {
|
|
|
17
17
|
};
|
|
18
18
|
export declare const Base: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, {
|
|
19
19
|
iconButton?: boolean | undefined;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
size: number;
|
|
23
|
-
color: string;
|
|
24
|
-
}> | null | undefined;
|
|
25
|
-
type?: "default" | "main" | "shade" | "error" | "color" | undefined;
|
|
26
|
-
size?: "large" | "small" | "medium" | undefined;
|
|
27
|
-
iconPosition?: "left" | "right" | undefined;
|
|
28
|
-
outline?: boolean | undefined;
|
|
29
|
-
disabled?: boolean | undefined;
|
|
30
|
-
pressed?: boolean | undefined;
|
|
31
|
-
children?: React.ReactNode;
|
|
32
|
-
}, never>;
|
|
20
|
+
sizeVariant?: ButtonProps["size"];
|
|
21
|
+
} & Omit<ButtonProps, "size">, never>;
|
|
33
22
|
declare const Button: (props: ButtonProps) => React.ReactElement;
|
|
34
23
|
export declare const PromisableButton: (props: ButtonProps) => React.ReactElement;
|
|
35
24
|
export default Button;
|
|
@@ -9,11 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import React, { useCallback, useState } from "react";
|
|
11
11
|
import styled, { useTheme } from "styled-components/native";
|
|
12
|
-
import { color, border, space } from "styled-system";
|
|
13
12
|
import { ActivityIndicator, TouchableOpacity, } from "react-native";
|
|
14
13
|
import { buttonSizeStyle, getButtonColorStyle, } from "../../cta/Button/getButtonStyle";
|
|
15
14
|
import { ctaIconSize, ctaTextType } from "../../cta/getCtaStyle";
|
|
16
15
|
import Text from "../../Text";
|
|
16
|
+
import baseStyled from "../../styled";
|
|
17
17
|
const IconContainer = styled.View `
|
|
18
18
|
${(p) => p.iconButton
|
|
19
19
|
? ""
|
|
@@ -21,12 +21,11 @@ const IconContainer = styled.View `
|
|
|
21
21
|
? `margin-right: 10px;`
|
|
22
22
|
: `margin-left: 10px;`}
|
|
23
23
|
`;
|
|
24
|
-
export const Base =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
export const Base = baseStyled(TouchableOpacity).attrs((p) => (Object.assign(Object.assign({}, getButtonColorStyle(p.theme.colors, p).button), {
|
|
25
|
+
// Avoid conflict with styled-system's size property by nulling size and renaming it
|
|
26
|
+
size: undefined, sizeVariant: p.size }))) `
|
|
27
|
+
|
|
28
28
|
border-radius: ${(p) => p.theme.space[10]}px;
|
|
29
|
-
height: ${(p) => p.theme.space[10]}px;
|
|
30
29
|
padding: 0 ${(p) => p.theme.space[7]}px;
|
|
31
30
|
flex-direction: row;
|
|
32
31
|
border-style: solid;
|
|
@@ -36,7 +35,7 @@ export const Base = styled(TouchableOpacity).attrs((p) => (Object.assign({}, get
|
|
|
36
35
|
align-content: center;
|
|
37
36
|
overflow: hidden;
|
|
38
37
|
position: relative;
|
|
39
|
-
${(p) => buttonSizeStyle[p.
|
|
38
|
+
${(p) => buttonSizeStyle[p.sizeVariant || "medium"]}
|
|
40
39
|
|
|
41
40
|
${(p) => (p.iconButton ? `padding: 0; width: ${p.theme.space[10]}px;` : "")}
|
|
42
41
|
`;
|
|
@@ -69,12 +68,12 @@ const ButtonContainer = (props) => {
|
|
|
69
68
|
iconPosition === "left" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: text.color }, children)) : null));
|
|
70
69
|
};
|
|
71
70
|
const Button = (props) => {
|
|
72
|
-
const { Icon, children, type = "default"
|
|
73
|
-
return (React.createElement(Base, Object.assign({}, props, { type: type,
|
|
74
|
-
React.createElement(ButtonContainer, Object.assign({}, props, { type: type
|
|
71
|
+
const { Icon, children, type = "default" } = props;
|
|
72
|
+
return (React.createElement(Base, Object.assign({}, props, { type: type, iconButton: !!Icon && !children, activeOpacity: 0.5 }),
|
|
73
|
+
React.createElement(ButtonContainer, Object.assign({}, props, { type: type }))));
|
|
75
74
|
};
|
|
76
75
|
export const PromisableButton = (props) => {
|
|
77
|
-
const { Icon, children, onPress, type = "main",
|
|
76
|
+
const { Icon, children, onPress, type = "main", disabled = false } = props;
|
|
78
77
|
const [spinnerOn, setSpinnerOn] = useState(false);
|
|
79
78
|
const theme = useTheme();
|
|
80
79
|
const onPressHandler = useCallback((event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -88,9 +87,9 @@ export const PromisableButton = (props) => {
|
|
|
88
87
|
setSpinnerOn(false);
|
|
89
88
|
}
|
|
90
89
|
}), [onPress]);
|
|
91
|
-
return (React.createElement(Base, Object.assign({}, props, { type: type,
|
|
92
|
-
React.createElement(ButtonContainer, Object.assign({}, props, { type: type,
|
|
90
|
+
return (React.createElement(Base, Object.assign({}, props, { type: type, iconButton: !!Icon && !children, disabled: disabled || spinnerOn, onPress: onPressHandler }),
|
|
91
|
+
React.createElement(ButtonContainer, Object.assign({}, props, { type: type, hide: spinnerOn })),
|
|
93
92
|
React.createElement(SpinnerContainer, null,
|
|
94
|
-
React.createElement(ActivityIndicator, { color: theme.colors.
|
|
93
|
+
React.createElement(ActivityIndicator, { color: theme.colors.neutral.c50, animating: spinnerOn }))));
|
|
95
94
|
};
|
|
96
95
|
export default Button;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export function getLinkColors(colors) {
|
|
2
2
|
return {
|
|
3
3
|
default: {
|
|
4
|
-
disabled: colors.
|
|
5
|
-
main: colors.
|
|
6
|
-
color: colors.
|
|
7
|
-
shade: colors.
|
|
4
|
+
disabled: colors.neutral.c50,
|
|
5
|
+
main: colors.neutral.c100,
|
|
6
|
+
color: colors.primary.c80,
|
|
7
|
+
shade: colors.neutral.c70,
|
|
8
8
|
},
|
|
9
9
|
reversed: {
|
|
10
|
-
disabled: colors.
|
|
11
|
-
main: colors.
|
|
12
|
-
color: colors.
|
|
13
|
-
shade: colors.
|
|
10
|
+
disabled: colors.neutral.c80,
|
|
11
|
+
main: colors.neutral.c00,
|
|
12
|
+
color: colors.primary.c60,
|
|
13
|
+
shade: colors.neutral.c50,
|
|
14
14
|
},
|
|
15
15
|
};
|
|
16
16
|
}
|
package/components/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
export * from "./cta";
|
|
2
|
-
export * from "./drawer";
|
|
3
2
|
export * from "./Form";
|
|
4
3
|
export * from "./Icon";
|
|
5
4
|
export * from "./Layout";
|
|
6
|
-
export { default as Loader } from "./Loader";
|
|
7
5
|
export * from "./message";
|
|
8
6
|
export * from "./Navigation";
|
|
9
7
|
export * from "./tags";
|
|
10
8
|
export { default as Text } from "./Text";
|
|
9
|
+
export { default as Carousel } from "./Carousel";
|
|
10
|
+
export * from "./Tabs";
|
|
11
|
+
export * from "./Loader";
|
|
12
|
+
export { default as ProgressBar } from "./ProgressBar";
|
|
13
|
+
export * as Transitions from "./transitions";
|
package/components/index.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
export * from "./cta";
|
|
2
|
-
export * from "./drawer";
|
|
3
2
|
export * from "./Form";
|
|
4
3
|
export * from "./Icon";
|
|
5
4
|
export * from "./Layout";
|
|
6
|
-
export { default as Loader } from "./Loader";
|
|
7
5
|
export * from "./message";
|
|
8
6
|
export * from "./Navigation";
|
|
9
7
|
export * from "./tags";
|
|
10
8
|
export { default as Text } from "./Text";
|
|
9
|
+
export { default as Carousel } from "./Carousel";
|
|
10
|
+
export * from "./Tabs";
|
|
11
|
+
export * from "./Loader";
|
|
12
|
+
export { default as ProgressBar } from "./ProgressBar";
|
|
13
|
+
import * as Transitions_1 from "./transitions";
|
|
14
|
+
export { Transitions_1 as Transitions };
|
|
@@ -13,16 +13,16 @@ const icons = {
|
|
|
13
13
|
};
|
|
14
14
|
const alertColors = {
|
|
15
15
|
info: {
|
|
16
|
-
backgroundColor: "
|
|
17
|
-
color: "
|
|
16
|
+
backgroundColor: "primary.c20",
|
|
17
|
+
color: "primary.c90",
|
|
18
18
|
},
|
|
19
19
|
warning: {
|
|
20
|
-
backgroundColor: "
|
|
21
|
-
color: "
|
|
20
|
+
backgroundColor: "warning.c30",
|
|
21
|
+
color: "warning.c100",
|
|
22
22
|
},
|
|
23
23
|
error: {
|
|
24
|
-
backgroundColor: "
|
|
25
|
-
color: "
|
|
24
|
+
backgroundColor: "error.c30",
|
|
25
|
+
color: "error.c100",
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
const StyledIconContainer = styled.View `
|
|
@@ -44,5 +44,5 @@ export default function Alert({ type = "info", title, showIcon = true, }) {
|
|
|
44
44
|
const textColor = getColor(theme, alertColors[type || "info"].color);
|
|
45
45
|
return (React.createElement(StyledAlertContainer, { type: type },
|
|
46
46
|
showIcon && !!icons[type] && (React.createElement(StyledIconContainer, null, icons[type || "info"]({ size: 20, color: textColor }))),
|
|
47
|
-
React.createElement(Text, { color: textColor }, title)));
|
|
47
|
+
React.createElement(Text, { color: textColor, flexShrink: 1 }, title)));
|
|
48
48
|
}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TextProps, TouchableOpacityProps } from "react-native";
|
|
3
3
|
declare type Props = {
|
|
4
|
-
Icon
|
|
4
|
+
Icon?: React.ComponentType<{
|
|
5
5
|
size: number;
|
|
6
6
|
color?: string;
|
|
7
7
|
}>;
|
|
8
|
-
|
|
8
|
+
iconColor?: string;
|
|
9
9
|
variant?: "primary" | "secondary";
|
|
10
10
|
title: string;
|
|
11
11
|
subtitle?: string;
|
|
12
12
|
numberOfLines?: TextProps["numberOfLines"];
|
|
13
13
|
onClose?: TouchableOpacityProps["onPress"];
|
|
14
|
-
|
|
14
|
+
linkText?: string;
|
|
15
|
+
onLinkPress?: TouchableOpacityProps["onPress"];
|
|
15
16
|
};
|
|
16
|
-
export default function Notification({ Icon,
|
|
17
|
+
export default function Notification({ Icon, iconColor, variant, numberOfLines, title, subtitle, onClose, linkText, onLinkPress, }: Props): React.ReactElement;
|
|
17
18
|
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled, { useTheme } from "styled-components/native";
|
|
3
|
+
import FlexBox from "../../Layout/Flex";
|
|
4
|
+
import { TouchableOpacity, } from "react-native";
|
|
5
|
+
import Text from "../../Text";
|
|
6
|
+
import CloseMedium from "@ledgerhq/icons-ui/native/CloseMedium";
|
|
7
|
+
import { Flex } from "../../Layout";
|
|
8
|
+
const NotificationContainer = styled.View `
|
|
9
|
+
display: flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
align-items: center;
|
|
13
|
+
${(p) => p.variant === "primary" &&
|
|
14
|
+
`
|
|
15
|
+
padding: 16px;
|
|
16
|
+
`}
|
|
17
|
+
background-color: ${(p) => p.variant === "primary" ? p.theme.colors.primary.c90 : "transparent"};
|
|
18
|
+
border-radius: ${(p) => `${p.theme.radii[1]}px`};
|
|
19
|
+
`;
|
|
20
|
+
export default function Notification({ Icon, iconColor, variant = "primary", numberOfLines, title, subtitle, onClose, linkText, onLinkPress, }) {
|
|
21
|
+
const { colors } = useTheme();
|
|
22
|
+
const textColor = variant === "primary" ? colors.neutral.c00 : colors.neutral.c100;
|
|
23
|
+
return (React.createElement(NotificationContainer, { variant: variant },
|
|
24
|
+
Icon && (React.createElement(FlexBox, { mr: 16 },
|
|
25
|
+
React.createElement(Icon, { size: 20, color: iconColor || textColor }))),
|
|
26
|
+
React.createElement(FlexBox, { flexShrink: 1 },
|
|
27
|
+
React.createElement(Text, { variant: "body", fontWeight: "medium", color: textColor, numberOfLines: numberOfLines }, title),
|
|
28
|
+
!!subtitle && (React.createElement(Text, { variant: "body", fontWeight: "medium", color: variant === "primary" ? colors.neutral.c00 : colors.neutral.c80, mt: 2 }, subtitle)),
|
|
29
|
+
linkText && onLinkPress && (React.createElement(Flex, { mt: 3 },
|
|
30
|
+
React.createElement(TouchableOpacity, { onPress: onLinkPress },
|
|
31
|
+
React.createElement(Text, { variant: "body", fontWeight: "semiBold", color: textColor }, linkText))))),
|
|
32
|
+
onClose && (React.createElement(FlexBox, { marginLeft: "auto", pl: 16 },
|
|
33
|
+
React.createElement(TouchableOpacity, { onPress: onClose },
|
|
34
|
+
React.createElement(CloseMedium, { size: 14, color: textColor }))))));
|
|
35
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="styled-components-react-native" />
|
|
2
|
+
import { ReactNativeStyledInterface, DefaultTheme } from "styled-components/native";
|
|
3
|
+
import { FlexboxProps, SpaceProps, PositionProps, ColorProps, LayoutProps, OverflowProps, BorderProps, BackgroundProps } from "styled-system";
|
|
4
|
+
import { InterpolationFunction } from "styled-components";
|
|
5
|
+
export declare type BaseStyledProps = SpaceProps & FlexboxProps & PositionProps & ColorProps & LayoutProps & OverflowProps & BorderProps & BackgroundProps & {
|
|
6
|
+
columnGap?: string | number;
|
|
7
|
+
rowGap?: string | number;
|
|
8
|
+
color?: string;
|
|
9
|
+
display?: string;
|
|
10
|
+
position?: string;
|
|
11
|
+
maxHeight?: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const baseStyles: InterpolationFunction<unknown>;
|
|
14
|
+
declare const _default: ReactNativeStyledInterface<DefaultTheme>;
|
|
15
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from "styled-components/native";
|
|
2
|
+
import { compose, flexbox, space, position, color, layout, overflow, border, background, } from "styled-system";
|
|
3
|
+
export const baseStyles = compose(flexbox, space, position, color, layout, overflow, border, background);
|
|
4
|
+
const proxyStyled = new Proxy(styled, {
|
|
5
|
+
apply(target, thisArg, argumentsList) {
|
|
6
|
+
return styled(target.apply(thisArg, argumentsList)(baseStyles));
|
|
7
|
+
},
|
|
8
|
+
get(target, property) {
|
|
9
|
+
return styled(target[property].apply(styled, [baseStyles]));
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
export default proxyStyled;
|
|
@@ -4,22 +4,22 @@ import Text from "../../Text";
|
|
|
4
4
|
const badgesStyle = {
|
|
5
5
|
main: {
|
|
6
6
|
default: {
|
|
7
|
-
color: "
|
|
7
|
+
color: "neutral.c80",
|
|
8
8
|
borderWidth: 1,
|
|
9
|
-
borderColor: "
|
|
9
|
+
borderColor: "neutral.c40",
|
|
10
10
|
},
|
|
11
11
|
active: {
|
|
12
|
-
color: "
|
|
13
|
-
backgroundColor: "
|
|
12
|
+
color: "neutral.c00",
|
|
13
|
+
backgroundColor: "neutral.c100",
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
primary: {
|
|
17
17
|
default: {
|
|
18
|
-
color: "
|
|
18
|
+
color: "primary.c90",
|
|
19
19
|
},
|
|
20
20
|
active: {
|
|
21
|
-
color: "
|
|
22
|
-
backgroundColor: "
|
|
21
|
+
color: "primary.c90",
|
|
22
|
+
backgroundColor: "primary.c20",
|
|
23
23
|
},
|
|
24
24
|
},
|
|
25
25
|
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useRef, useMemo, useEffect } from "react";
|
|
2
|
+
import { Animated } from "react-native";
|
|
3
|
+
/**
|
|
4
|
+
* A fade-in / fade-out transition changing the opacity of its children based on their status.
|
|
5
|
+
*/
|
|
6
|
+
export function Fade({ status, duration, style, children }) {
|
|
7
|
+
const fadeAnim = useRef(new Animated.Value(status === "entered" ? 1 : 0)).current;
|
|
8
|
+
const fadeIn = useMemo(() => Animated.timing(fadeAnim, {
|
|
9
|
+
toValue: 1,
|
|
10
|
+
duration,
|
|
11
|
+
useNativeDriver: true,
|
|
12
|
+
}), [duration, fadeAnim]);
|
|
13
|
+
const fadeOut = useMemo(() => Animated.timing(fadeAnim, {
|
|
14
|
+
toValue: 0,
|
|
15
|
+
duration,
|
|
16
|
+
useNativeDriver: true,
|
|
17
|
+
}), [duration, fadeAnim]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (status === "entering") {
|
|
20
|
+
fadeIn.start();
|
|
21
|
+
}
|
|
22
|
+
if (status === "exiting") {
|
|
23
|
+
fadeOut.start();
|
|
24
|
+
}
|
|
25
|
+
}, [fadeIn, fadeOut, status]);
|
|
26
|
+
return (React.createElement(Animated.View, { style: [
|
|
27
|
+
{
|
|
28
|
+
opacity: fadeAnim,
|
|
29
|
+
},
|
|
30
|
+
style,
|
|
31
|
+
] }, children));
|
|
32
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TransitionProps } from "./types";
|
|
2
|
+
export interface SlideProps extends TransitionProps {
|
|
3
|
+
/**
|
|
4
|
+
* The direction of the slide animation.
|
|
5
|
+
*/
|
|
6
|
+
direction?: "left" | "right";
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* A slide left/right transition translating its children based on their status and a given direction.
|
|
10
|
+
*/
|
|
11
|
+
export declare function Slide({ status, duration, style, direction, children, }: SlideProps): JSX.Element;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useState, useRef, useEffect, useMemo } from "react";
|
|
2
|
+
import { Animated, Platform, Dimensions } from "react-native";
|
|
3
|
+
const WEB = Platform.OS === "web";
|
|
4
|
+
/**
|
|
5
|
+
* A slide left/right transition translating its children based on their status and a given direction.
|
|
6
|
+
*/
|
|
7
|
+
export function Slide({ status, duration, style, direction = "left", children, }) {
|
|
8
|
+
const [width, setWidth] = useState(Dimensions.get("window").width);
|
|
9
|
+
const styleRef = useRef(new Animated.Value(0)).current;
|
|
10
|
+
const previousStatus = useRef(null);
|
|
11
|
+
useEffect(() => () => {
|
|
12
|
+
previousStatus.current = status;
|
|
13
|
+
}, [status]);
|
|
14
|
+
const animateIn = useMemo(() => Animated.timing(styleRef, {
|
|
15
|
+
toValue: 0,
|
|
16
|
+
duration,
|
|
17
|
+
useNativeDriver: true,
|
|
18
|
+
}), [duration, styleRef]);
|
|
19
|
+
const animateOut = useMemo(() => Animated.timing(styleRef, {
|
|
20
|
+
toValue: direction === "left" ? -1 : 1,
|
|
21
|
+
duration,
|
|
22
|
+
useNativeDriver: true,
|
|
23
|
+
}), [direction, duration, styleRef]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
if (status === "entering") {
|
|
26
|
+
if (previousStatus.current !== "exiting") {
|
|
27
|
+
styleRef.setValue(direction === "left" ? 1 : -1);
|
|
28
|
+
}
|
|
29
|
+
animateIn.start();
|
|
30
|
+
}
|
|
31
|
+
if (status === "exiting") {
|
|
32
|
+
animateOut.start();
|
|
33
|
+
}
|
|
34
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
+
}, [status]);
|
|
36
|
+
return (React.createElement(Animated.View, { style: [
|
|
37
|
+
{
|
|
38
|
+
transform: [
|
|
39
|
+
{
|
|
40
|
+
translateX: styleRef.interpolate({
|
|
41
|
+
inputRange: [-1, 1],
|
|
42
|
+
outputRange: WEB ? ["-100%", "100%"] : [-width, width],
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
style,
|
|
48
|
+
], onLayout: ({ nativeEvent }) => setWidth(nativeEvent.layout.width) }, children));
|
|
49
|
+
}
|