@ledgerhq/native-ui 0.12.2-nightly.1 → 0.13.0-nightly.3
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/lib/components/Cards/CardA/ColoredGradient.d.ts +8 -0
- package/lib/components/Cards/CardA/ColoredGradient.js +18 -0
- package/lib/components/Cards/CardA/ShadowGradient.d.ts +6 -0
- package/lib/components/Cards/CardA/ShadowGradient.js +17 -0
- package/lib/components/Cards/CardA/index.d.ts +11 -0
- package/lib/components/Cards/CardA/index.js +36 -0
- package/lib/components/Cards/CardB/index.d.ts +32 -0
- package/lib/components/Cards/CardB/index.js +64 -0
- package/lib/components/Cards/helper.d.ts +4 -0
- package/lib/components/Cards/helper.js +20 -0
- package/lib/components/Cards/index.d.ts +2 -0
- package/lib/components/Cards/index.js +2 -0
- package/lib/components/cta/Link/index.d.ts +1 -0
- package/lib/components/cta/Link/index.js +3 -3
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.js +1 -0
- package/package.json +3 -4
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Svg from "react-native-svg";
|
|
3
|
+
export type Props = {
|
|
4
|
+
color: string;
|
|
5
|
+
opacityColor: string;
|
|
6
|
+
style?: React.ComponentProps<typeof Svg>["style"];
|
|
7
|
+
};
|
|
8
|
+
export default function Gradient({ color, opacityColor, style }: Props): JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Svg, { LinearGradient, Defs, Stop, Rect } from "react-native-svg";
|
|
3
|
+
import styled from "styled-components/native";
|
|
4
|
+
const StyledSVG = styled(Svg) `
|
|
5
|
+
position: absolute;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
`;
|
|
10
|
+
export default function Gradient({ color, opacityColor, style }) {
|
|
11
|
+
return (React.createElement(StyledSVG, { style: style },
|
|
12
|
+
React.createElement(Defs, null,
|
|
13
|
+
React.createElement(LinearGradient, { id: "myGradient", x1: "0%", y1: "0%", x2: "100%", y2: "100%", gradientUnits: "userSpaceOnUse" },
|
|
14
|
+
React.createElement(Stop, { key: "0%", offset: "40%", stopOpacity: 1, stopColor: color }),
|
|
15
|
+
React.createElement(Stop, { key: "100%", offset: "100%", stopOpacity: 0, stopColor: color }))),
|
|
16
|
+
React.createElement(Rect, { rx: 8, x: "0", y: "0", width: "100%", height: "100%", opacity: 1, fill: "url(#myGradient)" }),
|
|
17
|
+
React.createElement(Rect, { rx: 8, x: "0", y: "0", width: "100%", height: "100%", opacity: 0.6, fill: opacityColor })));
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Svg, { LinearGradient, Defs, Stop, Rect } from "react-native-svg";
|
|
3
|
+
import styled from "styled-components/native";
|
|
4
|
+
const StyledSVG = styled(Svg) `
|
|
5
|
+
position: absolute;
|
|
6
|
+
bottom: 0;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
`;
|
|
10
|
+
export default function Gradient({ color }) {
|
|
11
|
+
return (React.createElement(StyledSVG, null,
|
|
12
|
+
React.createElement(Defs, null,
|
|
13
|
+
React.createElement(LinearGradient, { id: "myGradient", x1: "0%", y1: "100%", x2: "100%", y2: "0%", gradientUnits: "userSpaceOnUse" },
|
|
14
|
+
React.createElement(Stop, { key: "0%", offset: "0%", stopOpacity: 0.8, stopColor: color }),
|
|
15
|
+
React.createElement(Stop, { key: "100%", offset: "100%", stopOpacity: 0.25, stopColor: color }))),
|
|
16
|
+
React.createElement(Rect, { rx: 8, x: "0", y: "0", width: "100%", height: "100%", opacity: 1, fill: "url(#myGradient)" })));
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
type Props = {
|
|
3
|
+
variant?: "purple" | "red";
|
|
4
|
+
backgroundImage?: string;
|
|
5
|
+
tag?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
onPress?: () => void;
|
|
8
|
+
onDismiss?: () => void;
|
|
9
|
+
};
|
|
10
|
+
declare const CardA: ({ variant, backgroundImage, tag, description, onPress, onDismiss, }: Props) => React.ReactElement;
|
|
11
|
+
export default CardA;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import { TouchableOpacity, Image } from "react-native";
|
|
3
|
+
import styled, { useTheme } from "styled-components/native";
|
|
4
|
+
import { Flex, Text, Icon } from "../../index";
|
|
5
|
+
import { highlight } from "../helper";
|
|
6
|
+
import ColoredGradient from "./ColoredGradient";
|
|
7
|
+
import ShadowGradient from "./ShadowGradient";
|
|
8
|
+
const ImageContent = styled(Image) `
|
|
9
|
+
border-radius: 8px;
|
|
10
|
+
`;
|
|
11
|
+
const CardA = ({ variant, backgroundImage, tag, description, onPress, onDismiss, }) => {
|
|
12
|
+
const { colors } = useTheme();
|
|
13
|
+
const backgroundVariants = useMemo(() => ({
|
|
14
|
+
purple: colors.primary.c80,
|
|
15
|
+
red: colors.error.c60,
|
|
16
|
+
}), [colors.primary.c80, colors.error.c60]);
|
|
17
|
+
const backgroundVariantColor = variant && backgroundVariants[variant]
|
|
18
|
+
? backgroundVariants[variant]
|
|
19
|
+
: backgroundVariants.purple;
|
|
20
|
+
return (React.createElement(Flex, { borderRadius: 8 },
|
|
21
|
+
React.createElement(TouchableOpacity, { activeOpacity: 0.5, onPress: onPress },
|
|
22
|
+
backgroundImage ? (React.createElement(React.Fragment, null,
|
|
23
|
+
React.createElement(ImageContent, { source: {
|
|
24
|
+
uri: backgroundImage,
|
|
25
|
+
}, style: { width: "100%", height: "100%", position: "absolute" } }),
|
|
26
|
+
React.createElement(ShadowGradient, { color: colors.neutral.c00 }))) : (React.createElement(ColoredGradient, { color: backgroundVariantColor, opacityColor: colors.neutral.c20 })),
|
|
27
|
+
React.createElement(Flex, { p: 6 },
|
|
28
|
+
React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between", mb: 3 },
|
|
29
|
+
React.createElement(Flex, { bg: "neutral.c100a01", borderRadius: 6, px: 3, py: "6px", maxWidth: "80%" },
|
|
30
|
+
React.createElement(Text, { variant: "small", fontWeight: "semiBold", color: "neutral.c90", numberOfLines: 1 }, tag)),
|
|
31
|
+
React.createElement(TouchableOpacity, { onPress: onDismiss },
|
|
32
|
+
React.createElement(Flex, { bg: "neutral.c30", top: -8, right: -8, p: "6px", borderRadius: 24 },
|
|
33
|
+
React.createElement(Icon, { name: "Close", size: 12, color: "neutral.c100" })))),
|
|
34
|
+
description ? (React.createElement(Text, { variant: "h4", fontWeight: "semiBold", color: "neutral.c100", numberOfLines: 3, height: "84px", lineHeight: "28px" }, highlight(description, "h4"))) : null))));
|
|
35
|
+
};
|
|
36
|
+
export default CardA;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="styled-components-react-native" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { TouchableOpacityProps, TouchableOpacity, Image } from "react-native";
|
|
4
|
+
export type CardProps = TouchableOpacityProps & {
|
|
5
|
+
tag?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
cta?: string;
|
|
8
|
+
imageUrl?: string;
|
|
9
|
+
onPressDismiss?: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare const Base: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, {}, never>;
|
|
12
|
+
export declare const Container: import("styled-components").StyledComponent<typeof import("react-native").View, import("styled-components").DefaultTheme, 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>>> & import("styled-system").BorderProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Border<import("styled-system").TLengthStyledSystem>> & import("styled-system").BackgroundProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Background<import("styled-system").TLengthStyledSystem>> & {
|
|
13
|
+
columnGap?: string | number | undefined;
|
|
14
|
+
rowGap?: string | number | undefined;
|
|
15
|
+
color?: string | undefined;
|
|
16
|
+
display?: string | undefined;
|
|
17
|
+
position?: string | undefined;
|
|
18
|
+
maxHeight?: string | number | undefined;
|
|
19
|
+
}, never>;
|
|
20
|
+
export declare const ImageContainer: import("styled-components").StyledComponent<typeof import("react-native").View, import("styled-components").DefaultTheme, 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>>> & import("styled-system").BorderProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Border<import("styled-system").TLengthStyledSystem>> & import("styled-system").BackgroundProps<Required<import("styled-system").Theme<import("styled-system").TLengthStyledSystem>>, import("csstype").Property.Background<import("styled-system").TLengthStyledSystem>> & {
|
|
21
|
+
columnGap?: string | number | undefined;
|
|
22
|
+
rowGap?: string | number | undefined;
|
|
23
|
+
color?: string | undefined;
|
|
24
|
+
display?: string | undefined;
|
|
25
|
+
position?: string | undefined;
|
|
26
|
+
maxHeight?: string | number | undefined;
|
|
27
|
+
}, never>;
|
|
28
|
+
export declare const ImageContent: import("styled-components").StyledComponent<typeof Image, import("styled-components").DefaultTheme, {}, never>;
|
|
29
|
+
export declare const CloseContainer: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, {}, never>;
|
|
30
|
+
export declare const CloseButton: (props: CardProps) => JSX.Element;
|
|
31
|
+
declare const CardB: (props: CardProps) => React.ReactElement;
|
|
32
|
+
export default CardB;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ArrowRightMedium, CloseMedium } from "@ledgerhq/icons-ui/native";
|
|
3
|
+
import { TouchableOpacity, Image } from "react-native";
|
|
4
|
+
import styled, { useTheme } from "styled-components/native";
|
|
5
|
+
import Text from "../../Text";
|
|
6
|
+
import Flex from "../../Layout/Flex";
|
|
7
|
+
import Link from "../../cta/Link";
|
|
8
|
+
import { highlight } from "../helper";
|
|
9
|
+
export const Base = styled(TouchableOpacity) `
|
|
10
|
+
border-radius: 8px;
|
|
11
|
+
`;
|
|
12
|
+
export const Container = styled(Flex) `
|
|
13
|
+
background: ${(p) => p.theme.colors.neutral.c20};
|
|
14
|
+
flex-direction: row;
|
|
15
|
+
border-radius: 8px;
|
|
16
|
+
`;
|
|
17
|
+
export const ImageContainer = styled(Flex) `
|
|
18
|
+
border-top-right-radius: 8px;
|
|
19
|
+
border-bottom-right-radius: 8px;
|
|
20
|
+
position: relative;
|
|
21
|
+
`;
|
|
22
|
+
export const ImageContent = styled(Image) `
|
|
23
|
+
border-top-right-radius: 8px;
|
|
24
|
+
border-bottom-right-radius: 8px;
|
|
25
|
+
opacity: 0.6;
|
|
26
|
+
`;
|
|
27
|
+
export const CloseContainer = styled(TouchableOpacity) `
|
|
28
|
+
background-color: ${(p) => p.theme.colors.neutral.c30};
|
|
29
|
+
position: absolute;
|
|
30
|
+
right: 8px;
|
|
31
|
+
top: 8px;
|
|
32
|
+
border-radius: 50;
|
|
33
|
+
height: 24px;
|
|
34
|
+
width: 24px;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
`;
|
|
39
|
+
export const CloseButton = (props) => {
|
|
40
|
+
const { colors } = useTheme();
|
|
41
|
+
return (React.createElement(CloseContainer, { onPress: props.onPressDismiss },
|
|
42
|
+
React.createElement(CloseMedium, { size: 14, color: colors.neutral.c100 })));
|
|
43
|
+
};
|
|
44
|
+
const ImageComponent = (props) => (React.createElement(ImageContainer, { width: props.imageUrl ? 115 : 0 },
|
|
45
|
+
React.createElement(ImageContent, { source: {
|
|
46
|
+
uri: props.imageUrl,
|
|
47
|
+
}, style: { width: "100%", height: "100%" } }),
|
|
48
|
+
React.createElement(CloseButton, { onPressDismiss: props.onPressDismiss })));
|
|
49
|
+
const TextComponent = (props) => (React.createElement(Flex, { justifyContent: "space-between", alignItems: "flex-start", p: "12px", flex: 1 },
|
|
50
|
+
React.createElement(Text, { variant: "small", fontWeight: "semiBold", color: "neutral.c70", uppercase: true, numberOfLines: 1, maxWidth: "80%" }, props.tag),
|
|
51
|
+
props.title && (React.createElement(Text, { variant: "large", numberOfLines: 3, fontWeight: "semiBold", color: "neutral.c100", lineHeight: "18.2px" }, highlight(props.title, "large"))),
|
|
52
|
+
React.createElement(Link, { type: "main", size: "medium", iconPosition: "right", Icon: () => React.createElement(ArrowRightMedium, { color: "primary.c80" }), onPress: props.onPress, numberOfLines: 1 },
|
|
53
|
+
React.createElement(Text, { variant: "paragraph", fontWeight: "semiBold", color: "primary.c80", numberOfLines: 1 }, props.cta))));
|
|
54
|
+
const CardContainer = (props) => {
|
|
55
|
+
const { imageUrl, onPressDismiss } = props;
|
|
56
|
+
return (React.createElement(Container, { height: 125 },
|
|
57
|
+
React.createElement(TextComponent, Object.assign({}, props)),
|
|
58
|
+
React.createElement(ImageComponent, { imageUrl: imageUrl, onPressDismiss: onPressDismiss })));
|
|
59
|
+
};
|
|
60
|
+
const CardB = (props) => {
|
|
61
|
+
return (React.createElement(Base, Object.assign({}, props, { activeOpacity: 0.5 }),
|
|
62
|
+
React.createElement(CardContainer, Object.assign({}, props))));
|
|
63
|
+
};
|
|
64
|
+
export default CardB;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Text } from "../../index";
|
|
3
|
+
function highlight(text, variant) {
|
|
4
|
+
const textSplitted = text
|
|
5
|
+
.replace(/</g, "<")
|
|
6
|
+
.replace(/>/g, ">")
|
|
7
|
+
.split(/<bold>(.*?)<\/bold>/g);
|
|
8
|
+
const elems = [];
|
|
9
|
+
textSplitted.forEach((w, index) => {
|
|
10
|
+
if (index % 2 !== 0) {
|
|
11
|
+
const word = w.replace(/<bold>(.*?)<\/bold>/g, "$1");
|
|
12
|
+
elems.push(React.createElement(Text, { key: "highlighted_" + index, variant: variant, fontWeight: "semiBold", color: "primary.c80" }, word));
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
elems.push(w);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
return elems;
|
|
19
|
+
}
|
|
20
|
+
export { highlight };
|
|
@@ -12,6 +12,7 @@ export type LinkProps = TouchableOpacityProps & {
|
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
reversed?: boolean;
|
|
14
14
|
children?: React.ReactNode;
|
|
15
|
+
numberOfLines?: number;
|
|
15
16
|
};
|
|
16
17
|
export declare const Base: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, {}, never>;
|
|
17
18
|
declare const Link: (props: LinkProps) => React.ReactElement;
|
|
@@ -14,14 +14,14 @@ export const Base = styled(TouchableOpacity) `
|
|
|
14
14
|
justify-content: center;
|
|
15
15
|
`;
|
|
16
16
|
const LinkContainer = (props) => {
|
|
17
|
-
const { Icon, iconPosition = "right", children, size = "medium", reversed, type = "main", disabled, } = props;
|
|
17
|
+
const { Icon, iconPosition = "right", children, size = "medium", reversed, type = "main", disabled, numberOfLines, } = props;
|
|
18
18
|
const { colors } = useTheme();
|
|
19
19
|
const colorValue = getLinkColors(colors)[reversed ? "reversed" : "default"][disabled ? "disabled" : type];
|
|
20
20
|
return (React.createElement(React.Fragment, null,
|
|
21
|
-
iconPosition === "right" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: colorValue }, children)) : null,
|
|
21
|
+
iconPosition === "right" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: colorValue, numberOfLines: numberOfLines }, children)) : null,
|
|
22
22
|
Icon ? (React.createElement(IconContainer, { iconLink: !children, iconPosition: iconPosition },
|
|
23
23
|
React.createElement(Icon, { size: ctaIconSize[size], color: colorValue }))) : null,
|
|
24
|
-
iconPosition === "left" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: colorValue }, children)) : null));
|
|
24
|
+
iconPosition === "left" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: colorValue, numberOfLines: numberOfLines }, children)) : null));
|
|
25
25
|
};
|
|
26
26
|
const Link = (props) => {
|
|
27
27
|
const { type = "main", size = "medium" } = props;
|
package/lib/components/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0-nightly.3",
|
|
4
4
|
"description": "Ledger Live - Mobile UI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,11 +38,12 @@
|
|
|
38
38
|
"moment": "^2.29.1",
|
|
39
39
|
"react-native-animatable": "^1.3.3",
|
|
40
40
|
"react-native-modal": "^13.0.0",
|
|
41
|
+
"react-native-svg": "^12.1.1",
|
|
41
42
|
"rn-range-slider": "^2.1.1",
|
|
42
43
|
"styled-system": "^5.1.5",
|
|
43
44
|
"victory-native": "^35.5.5",
|
|
44
45
|
"@ledgerhq/crypto-icons-ui": "^0.2.1",
|
|
45
|
-
"@ledgerhq/icons-ui": "^0.3.1-nightly.
|
|
46
|
+
"@ledgerhq/icons-ui": "^0.3.1-nightly.3",
|
|
46
47
|
"@ledgerhq/ui-shared": "^0.1.10"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
@@ -53,7 +54,6 @@
|
|
|
53
54
|
"react": "^17.0.2",
|
|
54
55
|
"react-native": ">=0.64.0",
|
|
55
56
|
"react-native-reanimated": "~2.3.1",
|
|
56
|
-
"react-native-svg": "^12.1.1",
|
|
57
57
|
"styled-components": "^5.3.3"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
@@ -131,7 +131,6 @@
|
|
|
131
131
|
"react-native": "^0.68.5",
|
|
132
132
|
"react-native-gesture-handler": "^1.10.3",
|
|
133
133
|
"react-native-reanimated": "^2.8.0",
|
|
134
|
-
"react-native-svg": "^12.1.1",
|
|
135
134
|
"react-native-web": "~0.17.5",
|
|
136
135
|
"regenerator-runtime": "^0.13.9",
|
|
137
136
|
"rimraf": "^3.0.2",
|