@ledgerhq/native-ui 0.14.0 → 0.15.0-next.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.
@@ -7,5 +7,5 @@ type Props = {
7
7
  onPress?: () => void;
8
8
  onDismiss?: () => void;
9
9
  };
10
- declare const CardA: ({ variant, backgroundImage, tag, description, onPress, onDismiss, }: Props) => React.ReactElement;
11
- export default CardA;
10
+ declare const FullBackgroundCard: ({ variant, backgroundImage, tag, description, onPress, onDismiss, }: Props) => React.ReactElement;
11
+ export default FullBackgroundCard;
@@ -8,7 +8,7 @@ import ShadowGradient from "./ShadowGradient";
8
8
  const ImageContent = styled(Image) `
9
9
  border-radius: 8px;
10
10
  `;
11
- const CardA = ({ variant, backgroundImage, tag, description, onPress, onDismiss, }) => {
11
+ const FullBackgroundCard = ({ variant, backgroundImage, tag, description, onPress, onDismiss, }) => {
12
12
  const { colors } = useTheme();
13
13
  const backgroundVariants = useMemo(() => ({
14
14
  purple: colors.primary.c80,
@@ -28,9 +28,9 @@ const CardA = ({ variant, backgroundImage, tag, description, onPress, onDismiss,
28
28
  React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between", mb: 3 },
29
29
  React.createElement(Flex, { bg: "neutral.c100a01", borderRadius: 6, px: 3, py: "6px", maxWidth: "80%" },
30
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 },
31
+ React.createElement(TouchableOpacity, { onPress: onDismiss, style: { top: -8, right: -8 } },
32
+ React.createElement(Flex, { bg: "neutral.c30", p: "6px", borderRadius: 24 },
33
33
  React.createElement(Icon, { name: "Close", size: 12, color: "neutral.c100" })))),
34
34
  description ? (React.createElement(Text, { variant: "h4", fontWeight: "semiBold", color: "neutral.c100", numberOfLines: 3, height: "84px", lineHeight: "28px" }, highlight(description, "h4"))) : null))));
35
35
  };
36
- export default CardA;
36
+ export default FullBackgroundCard;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ import { TouchableOpacityProps } from "react-native";
3
+ export type CardProps = TouchableOpacityProps & {
4
+ tag?: string;
5
+ title?: string;
6
+ imageUrl?: string;
7
+ onClickCard?: () => void;
8
+ };
9
+ declare const InformativeCard: (props: CardProps) => React.ReactElement;
10
+ export default InformativeCard;
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { TouchableOpacity, Image } from "react-native";
3
+ import styled from "styled-components/native";
4
+ import Text from "../../Text";
5
+ import Flex from "../../Layout/Flex";
6
+ const Base = styled(TouchableOpacity) ``;
7
+ const ImageContent = styled(Image) `
8
+ border-radius: 8px;
9
+ `;
10
+ const CardContainer = (props) => {
11
+ const { imageUrl, title, tag } = props;
12
+ return (React.createElement(Flex, { flexDirection: "row" },
13
+ React.createElement(Flex, { justifyContent: "space-between", alignItems: "flex-start", py: 2, pr: 4, flex: 1 },
14
+ React.createElement(Text, { variant: "body", fontWeight: "medium", color: "neutral.c100", numberOfLines: 2 }, title),
15
+ React.createElement(Text, { variant: "paragraph", fontWeight: "medium", color: "neutral.c70", numberOfLines: 1, mt: 4 }, tag)),
16
+ React.createElement(Flex, { width: 100, height: 75 },
17
+ React.createElement(ImageContent, { source: {
18
+ uri: imageUrl,
19
+ }, style: { width: "100%", height: "100%" } }))));
20
+ };
21
+ const InformativeCard = (props) => {
22
+ return (React.createElement(Base, Object.assign({}, props, { activeOpacity: 0.5, onPress: props.onClickCard }),
23
+ React.createElement(CardContainer, Object.assign({}, props))));
24
+ };
25
+ export default InformativeCard;
@@ -0,0 +1,17 @@
1
+ /// <reference types="styled-components-react-native" />
2
+ import React from "react";
3
+ import { TouchableOpacityProps, TouchableOpacity } from "react-native";
4
+ export type CardProps = TouchableOpacityProps & {
5
+ tag?: string;
6
+ description?: string;
7
+ cta?: string;
8
+ link?: string;
9
+ time?: string;
10
+ title?: string;
11
+ onClickCard?: () => void;
12
+ showLinkCta: boolean;
13
+ viewed: boolean;
14
+ };
15
+ declare const NotificationCard: (props: CardProps) => React.ReactElement;
16
+ export declare const Base: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, {}, never>;
17
+ export default NotificationCard;
@@ -0,0 +1,36 @@
1
+ import React, { useMemo } from "react";
2
+ import { ExternalLinkMedium } from "@ledgerhq/icons-ui/native";
3
+ import Text from "../../Text";
4
+ import Flex from "../../Layout/Flex";
5
+ import Box from "../../Layout/Box";
6
+ import Link from "../../cta/Link";
7
+ import styled from "styled-components/native";
8
+ import { TouchableOpacity } from "react-native";
9
+ const Tag = ({ tag }) => (React.createElement(Flex, { bg: "neutral.c100a01", borderRadius: 6, px: 3, py: "3px", maxWidth: "75%" },
10
+ React.createElement(Text, { variant: "small", fontWeight: "semiBold", color: "neutral.c90", numberOfLines: 1 }, tag)));
11
+ const Timer = ({ time, viewed }) => (React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", ml: 2 },
12
+ React.createElement(Text, { variant: "small", fontWeight: "semiBold", color: "neutral.c90", numberOfLines: 1 }, time),
13
+ React.createElement(Box, { ml: 3, backgroundColor: viewed ? "transparent" : "error.c80", height: "8px", width: "8px", borderRadius: 24 })));
14
+ const NotificationCard = (props) => {
15
+ const { tag = "", time = "", title, description, cta, viewed, onClickCard, showLinkCta, link = "", } = props;
16
+ const ctaIcon = useMemo(() => {
17
+ const isDeepLink = link === null || link === void 0 ? void 0 : link.startsWith("ledgerlive:");
18
+ return link && isDeepLink ? undefined : () => React.createElement(ExternalLinkMedium, { color: "neutral.c100" });
19
+ }, [link]);
20
+ return (React.createElement(Base, { onPress: onClickCard, activeOpacity: link ? 0.5 : 1 },
21
+ React.createElement(Flex, { width: "100%", flexDirection: "column" },
22
+ React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between" },
23
+ React.createElement(Tag, { tag: tag }),
24
+ React.createElement(Timer, { time: time, viewed: viewed })),
25
+ React.createElement(Text, { variant: "large", fontWeight: "semiBold", color: "neutral.c100", numberOfLines: 1, mt: 4 }, title),
26
+ React.createElement(Text, { variant: "bodyLineHeight", fontWeight: "medium", color: "neutral.c70", numberOfLines: 3, mt: 2, mb: showLinkCta ? 4 : 0 }, description),
27
+ !!showLinkCta && (React.createElement(Flex, { alignItems: "flex-start" },
28
+ React.createElement(Link, { type: "main", size: "medium", iconPosition: "right", Icon: ctaIcon, onPress: onClickCard, numberOfLines: 1 },
29
+ React.createElement(StyledText, { variant: "bodyLineHeight", fontWeight: "semiBold", color: "neutral.c100", numberOfLines: 1 }, cta)))))));
30
+ };
31
+ export const Base = styled(TouchableOpacity) ``;
32
+ const StyledText = styled(Text) `
33
+ text-decoration: underline;
34
+ text-decoration-color: ${(p) => p.theme.colors.neutral.c100};
35
+ `;
36
+ export default NotificationCard;
@@ -28,5 +28,5 @@ export declare const ImageContainer: import("styled-components").StyledComponent
28
28
  export declare const ImageContent: import("styled-components").StyledComponent<typeof Image, import("styled-components").DefaultTheme, {}, never>;
29
29
  export declare const CloseContainer: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, {}, never>;
30
30
  export declare const CloseButton: (props: CardProps) => JSX.Element;
31
- declare const CardB: (props: CardProps) => React.ReactElement;
32
- export default CardB;
31
+ declare const SideImageCard: (props: CardProps) => React.ReactElement;
32
+ export default SideImageCard;
@@ -57,8 +57,8 @@ const CardContainer = (props) => {
57
57
  React.createElement(TextComponent, Object.assign({}, props)),
58
58
  React.createElement(ImageComponent, { imageUrl: imageUrl, onPressDismiss: onPressDismiss })));
59
59
  };
60
- const CardB = (props) => {
60
+ const SideImageCard = (props) => {
61
61
  return (React.createElement(Base, Object.assign({}, props, { activeOpacity: 0.5 }),
62
62
  React.createElement(CardContainer, Object.assign({}, props))));
63
63
  };
64
- export default CardB;
64
+ export default SideImageCard;
@@ -1,2 +1,4 @@
1
- export { default as CardA } from "./CardA";
2
- export { default as CardB } from "./CardB";
1
+ export { default as FullBackgroundCard } from "./FullBackgroundCard";
2
+ export { default as SideImageCard } from "./SideImageCard";
3
+ export { default as NotificationCard } from "./NotificationCard";
4
+ export { default as InformativeCard } from "./InformativeCard";
@@ -1,2 +1,4 @@
1
- export { default as CardA } from "./CardA";
2
- export { default as CardB } from "./CardB";
1
+ export { default as FullBackgroundCard } from "./FullBackgroundCard";
2
+ export { default as SideImageCard } from "./SideImageCard";
3
+ export { default as NotificationCard } from "./NotificationCard";
4
+ export { default as InformativeCard } from "./InformativeCard";
@@ -40,6 +40,7 @@ const Container = styled(Flex) `
40
40
  padding: 20px 16px;
41
41
  `;
42
42
  export default function TimelineItem({ item, formatEstimatedTime, isFirstItem, isLastItem, setActiveIndex, index, }) {
43
+ var _a;
43
44
  /**
44
45
  * Having an initial value of null will prevent having "height: 0" before the
45
46
  * initial call of onLayout.
@@ -74,7 +75,7 @@ export default function TimelineItem({ item, formatEstimatedTime, isFirstItem, i
74
75
  ? "neutral.c80"
75
76
  : isLastItem
76
77
  ? "success.c100"
77
- : "primary.c90" }, item.title),
78
+ : "primary.c90" }, item.status === "completed" ? (_a = item.doneTitle) !== null && _a !== void 0 ? _a : item.title : item.title),
78
79
  (item === null || item === void 0 ? void 0 : item.estimatedTime) && item.status === "active" && (React.createElement(Tag, null, formatEstimatedTime
79
80
  ? formatEstimatedTime(item.estimatedTime)
80
81
  : `${item.estimatedTime / 60} min`))),
@@ -8,6 +8,7 @@ export declare enum ItemStatus {
8
8
  export type Item = {
9
9
  status: ItemStatus;
10
10
  title: string;
11
+ doneTitle?: string;
11
12
  estimatedTime?: number;
12
13
  renderBody?: (isDisplayed?: boolean) => ReactNode;
13
14
  };
@@ -82,7 +82,7 @@ export default function BaseModal(_a) {
82
82
  onBackButtonPress: onClose,
83
83
  onSwipeComplete: onClose,
84
84
  };
85
- return (React.createElement(ReactNativeModal, Object.assign({}, rest, backDropProps, { isVisible: isOpen, deviceWidth: width, deviceHeight: height, useNativeDriver: true, useNativeDriverForBackdrop: true, hideModalContentWhileAnimating: true, onModalHide: onClose, style: [defaultModalStyle, modalStyle] }),
85
+ return (React.createElement(ReactNativeModal, Object.assign({}, backDropProps, rest, { isVisible: isOpen, deviceWidth: width, deviceHeight: height, useNativeDriver: true, useNativeDriverForBackdrop: true, hideModalContentWhileAnimating: true, onModalHide: onClose, style: [defaultModalStyle, modalStyle] }),
86
86
  React.createElement(SafeContainer, { style: safeContainerStyle },
87
87
  React.createElement(Container, { style: containerStyle },
88
88
  !noCloseButton && React.createElement(ModalHeaderCloseButton, { onClose: onClose }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/native-ui",
3
- "version": "0.14.0",
3
+ "version": "0.15.0-next.0",
4
4
  "description": "Ledger Live - Mobile UI",
5
5
  "repository": {
6
6
  "type": "git",
@@ -43,7 +43,7 @@
43
43
  "styled-system": "^5.1.5",
44
44
  "victory-native": "^35.5.5",
45
45
  "@ledgerhq/crypto-icons-ui": "^0.2.1",
46
- "@ledgerhq/icons-ui": "^0.3.3",
46
+ "@ledgerhq/icons-ui": "^0.3.4-next.0",
47
47
  "@ledgerhq/ui-shared": "^0.1.10"
48
48
  },
49
49
  "peerDependencies": {