@ledgerhq/native-ui 0.18.1 → 0.19.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.
- package/lib/components/Cards/FullBackgroundCard/index.js +3 -3
- package/lib/components/Cards/NotificationCard/index.js +2 -2
- package/lib/components/Form/Input/BaseInput/index.js +2 -2
- package/lib/components/Layout/List/TipList/index.js +1 -1
- package/lib/components/Layout/List/VerticalStepper/StepperItem.js +1 -1
- package/lib/components/Layout/List/VerticalTimeline/TimelineIndicator.js +11 -10
- package/lib/components/Layout/List/VerticalTimeline/TimelineItem.js +3 -3
- package/lib/components/Layout/List/VerticalTimeline/index.d.ts +3 -1
- package/lib/components/Layout/List/VerticalTimeline/index.js +3 -3
- package/lib/components/Navigation/Stepper/index.js +2 -2
- package/lib/components/cta/Button/getButtonStyle.js +7 -7
- package/lib/components/message/Alert/index.d.ts +16 -10
- package/lib/components/message/Alert/index.js +49 -28
- package/lib/components/message/Notification/index.js +3 -3
- package/lib/components/tags/Tag/index.js +1 -1
- package/package.json +4 -5
|
@@ -12,8 +12,8 @@ const FullBackgroundCard = ({ variant, backgroundImage, tag, description, onPres
|
|
|
12
12
|
const { colors } = useTheme();
|
|
13
13
|
const backgroundVariants = useMemo(() => ({
|
|
14
14
|
purple: colors.primary.c80,
|
|
15
|
-
red: colors.error.
|
|
16
|
-
}), [colors.primary.c80, colors.error.
|
|
15
|
+
red: colors.error.c30,
|
|
16
|
+
}), [colors.primary.c80, colors.error.c30]);
|
|
17
17
|
const backgroundVariantColor = variant && backgroundVariants[variant]
|
|
18
18
|
? backgroundVariants[variant]
|
|
19
19
|
: backgroundVariants.purple;
|
|
@@ -26,7 +26,7 @@ const FullBackgroundCard = ({ variant, backgroundImage, tag, description, onPres
|
|
|
26
26
|
React.createElement(ShadowGradient, { color: colors.neutral.c00 }))) : (React.createElement(ColoredGradient, { color: backgroundVariantColor, opacityColor: colors.neutral.c20 })),
|
|
27
27
|
React.createElement(Flex, { p: 6 },
|
|
28
28
|
React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between", mb: 3 },
|
|
29
|
-
React.createElement(Flex, { bg: "
|
|
29
|
+
React.createElement(Flex, { bg: "opacityDefault.c10", borderRadius: 6, px: 3, py: "6px", maxWidth: "80%" },
|
|
30
30
|
React.createElement(Text, { variant: "small", fontWeight: "semiBold", color: "neutral.c90", numberOfLines: 1 }, tag)),
|
|
31
31
|
React.createElement(TouchableOpacity, { onPress: onDismiss, style: { top: -8, right: -8 } },
|
|
32
32
|
React.createElement(Flex, { bg: "neutral.c30", p: "6px", borderRadius: 24 },
|
|
@@ -6,11 +6,11 @@ import Box from "../../Layout/Box";
|
|
|
6
6
|
import Link from "../../cta/Link";
|
|
7
7
|
import styled from "styled-components/native";
|
|
8
8
|
import { TouchableOpacity } from "react-native";
|
|
9
|
-
const Tag = ({ tag }) => (React.createElement(Flex, { bg: "
|
|
9
|
+
const Tag = ({ tag }) => (React.createElement(Flex, { bg: "opacityDefault.c10", borderRadius: 6, px: 3, py: "3px", maxWidth: "75%" },
|
|
10
10
|
React.createElement(Text, { variant: "small", fontWeight: "semiBold", color: "neutral.c90", numberOfLines: 1 }, tag)));
|
|
11
11
|
const Timer = ({ time, viewed }) => (React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", ml: 2 },
|
|
12
12
|
React.createElement(Text, { variant: "small", fontWeight: "semiBold", color: "neutral.c90", numberOfLines: 1 }, time),
|
|
13
|
-
React.createElement(Box, { ml: 3, backgroundColor: viewed ? "transparent" : "error.
|
|
13
|
+
React.createElement(Box, { ml: 3, backgroundColor: viewed ? "transparent" : "error.c40", height: "8px", width: "8px", borderRadius: 24 })));
|
|
14
14
|
const NotificationCard = (props) => {
|
|
15
15
|
const { tag = "", time = "", title, description, cta, viewed, onClickCard, showLinkCta, link = "", } = props;
|
|
16
16
|
const ctaIcon = useMemo(() => {
|
|
@@ -38,7 +38,7 @@ const InputContainer = styled.View `
|
|
|
38
38
|
${(p) => p.error &&
|
|
39
39
|
!p.disabled &&
|
|
40
40
|
css `
|
|
41
|
-
border: 1px solid ${p.theme.colors.error.
|
|
41
|
+
border: 1px solid ${p.theme.colors.error.c50};
|
|
42
42
|
`};
|
|
43
43
|
|
|
44
44
|
${(p) => p.disabled &&
|
|
@@ -62,7 +62,7 @@ const BaseInput = styled.TextInput.attrs((p) => ({
|
|
|
62
62
|
padding-right: 20px;
|
|
63
63
|
`;
|
|
64
64
|
const InputErrorContainer = styled(Text) `
|
|
65
|
-
color: ${(p) => p.theme.colors.error.
|
|
65
|
+
color: ${(p) => p.theme.colors.error.c50};
|
|
66
66
|
margin-left: 12px;
|
|
67
67
|
`;
|
|
68
68
|
export const InputRenderLeftContainer = styled(FlexBox).attrs(() => ({
|
|
@@ -15,6 +15,6 @@ import Check from "@ledgerhq/icons-ui/native/CheckAloneMedium";
|
|
|
15
15
|
import Close from "@ledgerhq/icons-ui/native/CloseMedium";
|
|
16
16
|
export default function TipList(_a) {
|
|
17
17
|
var { items } = _a, props = __rest(_a, ["items"]);
|
|
18
|
-
const tipItems = useMemo(() => items.map((item) => (Object.assign(Object.assign({}, item), { bullet: item.isPositive ? (React.createElement(Check, { size: 20, color: "success.
|
|
18
|
+
const tipItems = useMemo(() => items.map((item) => (Object.assign(Object.assign({}, item), { bullet: item.isPositive ? (React.createElement(Check, { size: 20, color: "success.c50" })) : (React.createElement(Close, { size: 20, color: "error.c50" })) }))), [items]);
|
|
19
19
|
return React.createElement(List, Object.assign({ items: tipItems }, props));
|
|
20
20
|
}
|
|
@@ -43,7 +43,7 @@ export default function StepperItem({ item, progress, nested, isLastItem, setAct
|
|
|
43
43
|
React.createElement(Container, { nested: nested, status: item.status, isLastItem: isLastItem },
|
|
44
44
|
React.createElement(Flex, { px: nested ? 0 : 4, py: nested ? 4 : 7, flexDirection: nested ? "row-reverse" : "row", justifyContent: nested ? "space-between" : "flex-start" },
|
|
45
45
|
React.createElement(Flex, { width: "28px", alignItems: "center" },
|
|
46
|
-
item.status === "completed" && React.createElement(CheckAloneMedium, { size: 20, color: "success.
|
|
46
|
+
item.status === "completed" && React.createElement(CheckAloneMedium, { size: 20, color: "success.c50" }),
|
|
47
47
|
item.status === "active" && (React.createElement(ProgressLoader, { progress: progress, infinite: !progress, radius: 10, strokeWidth: 2 }))),
|
|
48
48
|
React.createElement(Flex, { flex: 1, ml: nested ? 0 : 4, mr: nested ? 0 : 2 },
|
|
49
49
|
React.createElement(Flex, { pb: item.status === "active" && item.renderBody ? 4 : undefined },
|
|
@@ -27,7 +27,7 @@ const linesWidth = 2;
|
|
|
27
27
|
const linesLength = 5000;
|
|
28
28
|
const TopSegmentSvg = ({ status, hidden, height }) => {
|
|
29
29
|
const theme = useTheme();
|
|
30
|
-
const strokeColor = status === "inactive" ? theme.colors.neutral.
|
|
30
|
+
const strokeColor = status === "inactive" ? theme.colors.neutral.c40 : theme.colors.primary.c80;
|
|
31
31
|
const strokeDashArray = status === "inactive" ? `${dashLength}` : undefined;
|
|
32
32
|
return (React.createElement(Flex, { height: height, width: "100%", overflow: "hidden" },
|
|
33
33
|
React.createElement(Flex, { style: StyleSheet.absoluteFillObject, alignItems: "center" },
|
|
@@ -37,7 +37,7 @@ const TopSegmentSvg = ({ status, hidden, height }) => {
|
|
|
37
37
|
const topSegmentDefaultHeight = Platform.OS === "android" ? 23 : 21; // difference due to how borders are drawn in android
|
|
38
38
|
const BottomSegmentSvg = ({ status, hidden }) => {
|
|
39
39
|
const theme = useTheme();
|
|
40
|
-
const strokeColor = status === "completed" ? theme.colors.primary.c80 : theme.colors.neutral.
|
|
40
|
+
const strokeColor = status === "completed" ? theme.colors.primary.c80 : theme.colors.neutral.c40;
|
|
41
41
|
const strokeDashArray = status === "completed" ? undefined : `${dashLength}`;
|
|
42
42
|
return (React.createElement(Flex, { flex: 1, width: "100%", style: { transform: [{ scaleY: -1 }] }, overflow: "hidden" },
|
|
43
43
|
React.createElement(Flex, { style: StyleSheet.absoluteFillObject, alignItems: "center" },
|
|
@@ -45,23 +45,24 @@ const BottomSegmentSvg = ({ status, hidden }) => {
|
|
|
45
45
|
React.createElement(Line, { x1: "0", y1: "0", x2: "0", y2: "100%", strokeWidth: hidden ? 0 : 2 * linesWidth, stroke: strokeColor, strokeDasharray: strokeDashArray, strokeDashoffset: `${dashLength}` })))));
|
|
46
46
|
};
|
|
47
47
|
const getIconBackground = (theme, status, isLastItem) => {
|
|
48
|
-
if (
|
|
48
|
+
if (isLastItem) {
|
|
49
|
+
if (status === "inactive")
|
|
50
|
+
return theme.colors.success.c10;
|
|
49
51
|
return "transparent";
|
|
50
52
|
}
|
|
51
|
-
else if (isLastItem) {
|
|
52
|
-
return theme.colors.success.c10;
|
|
53
|
-
}
|
|
54
53
|
else if (status === "active") {
|
|
55
54
|
return theme.colors.neutral.c40;
|
|
56
55
|
}
|
|
57
|
-
|
|
56
|
+
else {
|
|
57
|
+
return "transparent";
|
|
58
|
+
}
|
|
58
59
|
};
|
|
59
60
|
const getIconBorder = (theme, status, isLastItem) => {
|
|
60
61
|
if (isLastItem) {
|
|
61
|
-
return theme.colors.success.
|
|
62
|
+
return theme.colors.success.c70;
|
|
62
63
|
}
|
|
63
64
|
else if (status === "inactive") {
|
|
64
|
-
return theme.colors.neutral.
|
|
65
|
+
return theme.colors.neutral.c40;
|
|
65
66
|
}
|
|
66
67
|
return theme.colors.primary.c80;
|
|
67
68
|
};
|
|
@@ -79,7 +80,7 @@ export default function TimelineIndicator(_a) {
|
|
|
79
80
|
const { colors } = useTheme();
|
|
80
81
|
return (React.createElement(Flex, Object.assign({ flexDirection: "column", alignItems: "center" }, props),
|
|
81
82
|
React.createElement(TopSegmentSvg, { status: status, hidden: isFirstItem, height: PixelRatio.roundToNearestPixel(topHeight || topSegmentDefaultHeight) }),
|
|
82
|
-
React.createElement(CenterCircle, { status: status, isLastItem: isLastItem }, status === "completed" && (React.createElement(CircledCheckSolidMedium, { color: isLastItem ? colors.success.
|
|
83
|
+
React.createElement(CenterCircle, { status: status, isLastItem: isLastItem }, status === "completed" && (React.createElement(CircledCheckSolidMedium, { color: isLastItem ? colors.success.c70 : colors.primary.c80, size: 20 }))),
|
|
83
84
|
React.createElement(BottomSegmentSvg, { status: status, hidden: isLastItem })));
|
|
84
85
|
}
|
|
85
86
|
TimelineIndicator.topSegmentDefaultHeight = topSegmentDefaultHeight;
|
|
@@ -20,7 +20,7 @@ const getContainerBorder = (theme, status, isLastItem) => {
|
|
|
20
20
|
return "transparent";
|
|
21
21
|
}
|
|
22
22
|
else if (isLastItem && status === "active") {
|
|
23
|
-
return theme.colors.success.
|
|
23
|
+
return theme.colors.success.c50;
|
|
24
24
|
}
|
|
25
25
|
else if (status === "active") {
|
|
26
26
|
return theme.colors.neutral.c40;
|
|
@@ -69,8 +69,8 @@ export default function TimelineItem({ item, formatEstimatedTime, isFirstItem, i
|
|
|
69
69
|
: undefined }),
|
|
70
70
|
React.createElement(Container, { status: item.status, isLastItem: isLastItem, mt: withExtraMarginOnActiveStep && !isFirstItem && item.status === "active" ? 4 : 0, mb: withExtraMarginOnActiveStep && !isLastItem && item.status === "active" ? 4 : 0 },
|
|
71
71
|
React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between" },
|
|
72
|
-
React.createElement(Text, { variant: "body", fontWeight: "semiBold", flexShrink: 1, color: item.status === "completed" && isLastItem
|
|
73
|
-
? "success.
|
|
72
|
+
React.createElement(Text, { variant: "body", fontWeight: status === "active" ? "semiBold" : "medium", flexShrink: 1, color: item.status === "completed" && isLastItem
|
|
73
|
+
? "success.c40"
|
|
74
74
|
: item.status === "active"
|
|
75
75
|
? "primary.c80"
|
|
76
76
|
: "neutral.c70" }, item.status === "completed" ? (_a = item.doneTitle) !== null && _a !== void 0 ? _a : item.title : item.title),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
3
|
import { BaseTextProps } from "../../../Text";
|
|
3
4
|
import { BaseStyledProps } from "src/components/styled";
|
|
4
5
|
import { Item } from "../types";
|
|
@@ -12,8 +13,9 @@ export type Props = BaseStyledProps & {
|
|
|
12
13
|
* Defaults to true.
|
|
13
14
|
* */
|
|
14
15
|
autoScroll?: boolean;
|
|
16
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
15
17
|
};
|
|
16
|
-
declare function VerticalTimeline({ steps, formatEstimatedTime, setActiveIndex, header, autoScroll, ...props }: Props): JSX.Element;
|
|
18
|
+
declare function VerticalTimeline({ steps, formatEstimatedTime, setActiveIndex, header, autoScroll, contentContainerStyle, ...props }: Props): JSX.Element;
|
|
17
19
|
declare namespace VerticalTimeline {
|
|
18
20
|
var BodyText: React.FC<BaseTextProps>;
|
|
19
21
|
var SubtitleText: React.FC<BaseTextProps>;
|
|
@@ -10,13 +10,13 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
return t;
|
|
11
11
|
};
|
|
12
12
|
import React, { useRef, useCallback } from "react";
|
|
13
|
-
import { ScrollView, View } from "react-native";
|
|
13
|
+
import { ScrollView, View, } from "react-native";
|
|
14
14
|
import TimelineItem from "./TimelineItem";
|
|
15
15
|
import Flex from "../../Flex";
|
|
16
16
|
import Text from "../../../Text";
|
|
17
17
|
import { ItemStatus } from "../types";
|
|
18
18
|
export default function VerticalTimeline(_a) {
|
|
19
|
-
var { steps, formatEstimatedTime, setActiveIndex, header, autoScroll = true } = _a, props = __rest(_a, ["steps", "formatEstimatedTime", "setActiveIndex", "header", "autoScroll"]);
|
|
19
|
+
var { steps, formatEstimatedTime, setActiveIndex, header, autoScroll = true, contentContainerStyle } = _a, props = __rest(_a, ["steps", "formatEstimatedTime", "setActiveIndex", "header", "autoScroll", "contentContainerStyle"]);
|
|
20
20
|
const scrollViewRef = useRef(null);
|
|
21
21
|
const stepsContainerLayout = useRef();
|
|
22
22
|
const onStepsContainerLayout = useCallback((evt) => {
|
|
@@ -28,7 +28,7 @@ export default function VerticalTimeline(_a) {
|
|
|
28
28
|
const { layout } = evt.nativeEvent;
|
|
29
29
|
scrollViewRef.current.scrollTo({ x: 0, y: stepsContainerLayout.current.y + layout.y });
|
|
30
30
|
}, []);
|
|
31
|
-
return (React.createElement(ScrollView, { ref: scrollViewRef, onLayout: onStepsContainerLayout },
|
|
31
|
+
return (React.createElement(ScrollView, { ref: scrollViewRef, onLayout: onStepsContainerLayout, contentContainerStyle: contentContainerStyle },
|
|
32
32
|
header,
|
|
33
33
|
React.createElement(Flex, Object.assign({}, props, { onLayout: onStepsContainerLayout, flexDirection: "column" }), steps === null || steps === void 0 ? void 0 : steps.map((step, index) => (React.createElement(View, { onLayout: autoScroll && step.status === "active" ? onActiveStepLayout : undefined },
|
|
34
34
|
React.createElement(TimelineItem, { key: step.title, item: step, formatEstimatedTime: formatEstimatedTime, isFirstItem: index === 0, isLastItem: index === steps.length - 1, setActiveIndex: setActiveIndex, index: index })))))));
|
|
@@ -91,7 +91,7 @@ const PendingText = styled(Text) `
|
|
|
91
91
|
color: ${(p) => p.theme.colors.neutral.c70};
|
|
92
92
|
`;
|
|
93
93
|
const ErroredText = styled(Text) `
|
|
94
|
-
color: ${(p) => p.theme.colors.error.
|
|
94
|
+
color: ${(p) => p.theme.colors.error.c50};
|
|
95
95
|
`;
|
|
96
96
|
function Step({ state, label, showLeftSeparator, showRightSeparator, }) {
|
|
97
97
|
const labelText = useMemo(() => {
|
|
@@ -116,7 +116,7 @@ function Step({ state, label, showLeftSeparator, showRightSeparator, }) {
|
|
|
116
116
|
React.createElement(StepIcon.Current, null)));
|
|
117
117
|
case "ERRORED":
|
|
118
118
|
return (React.createElement(StepIcon.Background, { backgroundColor: "warning.c30" },
|
|
119
|
-
React.createElement(StepIcon.Errored, { color: colors.error.
|
|
119
|
+
React.createElement(StepIcon.Errored, { color: colors.error.c50 })));
|
|
120
120
|
case "PENDING":
|
|
121
121
|
return (React.createElement(StepIcon.Background, null,
|
|
122
122
|
React.createElement(StepIcon.Pending, null)));
|
|
@@ -13,21 +13,21 @@ export function getButtonColors(colors) {
|
|
|
13
13
|
main: {
|
|
14
14
|
primaryColor: colors.neutral.c00,
|
|
15
15
|
secondaryColor: colors.neutral.c100,
|
|
16
|
-
pressedColor: colors.
|
|
17
|
-
pressedOutlineColor: colors.
|
|
16
|
+
pressedColor: colors.opacityDefault.c60,
|
|
17
|
+
pressedOutlineColor: colors.opacityDefault.c10,
|
|
18
18
|
},
|
|
19
19
|
shade: {
|
|
20
20
|
primaryColor: colors.neutral.c00,
|
|
21
21
|
secondaryColor: colors.neutral.c100,
|
|
22
22
|
tertiaryColor: colors.neutral.c40,
|
|
23
|
-
pressedColor: colors.
|
|
24
|
-
pressedOutlineColor: colors.
|
|
23
|
+
pressedColor: colors.opacityDefault.c60,
|
|
24
|
+
pressedOutlineColor: colors.opacityDefault.c10,
|
|
25
25
|
},
|
|
26
26
|
error: {
|
|
27
27
|
primaryColor: colors.neutral.c00,
|
|
28
|
-
secondaryColor: colors.error.
|
|
29
|
-
pressedColor: colors.error.
|
|
30
|
-
pressedOutlineColor: colors.error.
|
|
28
|
+
secondaryColor: colors.error.c50,
|
|
29
|
+
pressedColor: colors.error.c50a07,
|
|
30
|
+
pressedOutlineColor: colors.error.c50a025,
|
|
31
31
|
},
|
|
32
32
|
color: {
|
|
33
33
|
primaryColor: colors.neutral.c00,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="styled-components-react-native" />
|
|
1
2
|
import React from "react";
|
|
2
|
-
type AlertType = "info" | "warning" | "error";
|
|
3
|
+
type AlertType = "info" | "secondary" | "success" | "warning" | "error";
|
|
3
4
|
export type IconProps = {
|
|
4
5
|
size?: number;
|
|
5
6
|
color?: string;
|
|
@@ -15,13 +16,18 @@ export interface AlertProps {
|
|
|
15
16
|
title?: React.ReactNode;
|
|
16
17
|
showIcon?: boolean;
|
|
17
18
|
children?: React.ReactNode;
|
|
18
|
-
/**
|
|
19
|
-
* Alternative to using the `children` prop in order to render something using the value of `textColor`
|
|
20
|
-
* that is passed as a parameter.
|
|
21
|
-
*/
|
|
22
|
-
renderContent?: ({ textColor }: {
|
|
23
|
-
textColor: string;
|
|
24
|
-
}) => React.ReactNode | null;
|
|
25
19
|
}
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
declare function Alert({ type, Icon, title, showIcon, children }: AlertProps): JSX.Element;
|
|
21
|
+
declare namespace Alert {
|
|
22
|
+
var BodyText: import("styled-components").StyledComponent<({ children, bracket, textAlign, ...props }: import("../../Text").BaseTextProps) => JSX.Element, import("styled-components").DefaultTheme, {
|
|
23
|
+
flexShrink: 1;
|
|
24
|
+
variant: "bodyLineHeight";
|
|
25
|
+
fontWeight: "semiBold";
|
|
26
|
+
}, "fontWeight" | "variant" | "flexShrink">;
|
|
27
|
+
var UnderlinedText: import("styled-components").StyledComponent<({ children, bracket, textAlign, ...props }: import("../../Text").BaseTextProps) => JSX.Element, import("styled-components").DefaultTheme, {
|
|
28
|
+
flexShrink: 1;
|
|
29
|
+
variant: "bodyLineHeight";
|
|
30
|
+
fontWeight: "semiBold";
|
|
31
|
+
}, "fontWeight" | "variant" | "flexShrink">;
|
|
32
|
+
}
|
|
33
|
+
export default Alert;
|
|
@@ -1,51 +1,72 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled, { useTheme } from "styled-components/native";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
3
|
+
import InfoAltFillMedium from "@ledgerhq/icons-ui/native/InfoAltFillMedium";
|
|
4
|
+
import CircledCheckSolidMedium from "@ledgerhq/icons-ui/native/CircledCheckSolidMedium";
|
|
5
|
+
import WarningSolidMedium from "@ledgerhq/icons-ui/native/WarningSolidMedium";
|
|
6
|
+
import CircledCrossSolidMedium from "@ledgerhq/icons-ui/native/CircledCrossSolidMedium";
|
|
6
7
|
import Text from "../../Text";
|
|
7
|
-
import { getColor } from "../../../styles";
|
|
8
8
|
import FlexBox from "../../Layout/Flex";
|
|
9
|
+
import { getColor } from "../../../styles";
|
|
9
10
|
const icons = {
|
|
10
|
-
info:
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
info: InfoAltFillMedium,
|
|
12
|
+
secondary: InfoAltFillMedium,
|
|
13
|
+
success: CircledCheckSolidMedium,
|
|
14
|
+
warning: WarningSolidMedium,
|
|
15
|
+
error: CircledCrossSolidMedium,
|
|
13
16
|
};
|
|
14
17
|
const alertColors = {
|
|
15
18
|
info: {
|
|
16
|
-
backgroundColor: "primary.
|
|
17
|
-
|
|
19
|
+
backgroundColor: "primary.c10",
|
|
20
|
+
iconColor: "primary.c80",
|
|
21
|
+
},
|
|
22
|
+
secondary: {
|
|
23
|
+
backgroundColor: "opacityDefault.c05",
|
|
24
|
+
iconColor: "neutral.c80",
|
|
25
|
+
},
|
|
26
|
+
success: {
|
|
27
|
+
backgroundColor: "success.c10",
|
|
28
|
+
iconColor: "success.c50",
|
|
18
29
|
},
|
|
19
30
|
warning: {
|
|
20
|
-
backgroundColor: "warning.
|
|
21
|
-
|
|
31
|
+
backgroundColor: "warning.c10",
|
|
32
|
+
iconColor: "warning.c70",
|
|
22
33
|
},
|
|
23
34
|
error: {
|
|
24
|
-
backgroundColor: "error.
|
|
25
|
-
|
|
35
|
+
backgroundColor: "error.c10",
|
|
36
|
+
iconColor: "error.c50",
|
|
26
37
|
},
|
|
27
38
|
};
|
|
28
|
-
const StyledIconContainer = styled.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
`;
|
|
39
|
+
const StyledIconContainer = styled(FlexBox).attrs({
|
|
40
|
+
mr: 4,
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
}) ``;
|
|
33
43
|
const StyledAlertContainer = styled(FlexBox).attrs((p) => ({
|
|
34
44
|
backgroundColor: alertColors[p.type || "info"].backgroundColor,
|
|
45
|
+
p: 6,
|
|
35
46
|
})) `
|
|
36
47
|
width: 100%;
|
|
37
|
-
border-radius: ${(p) => `${p.theme.radii[
|
|
38
|
-
padding: 16px;
|
|
48
|
+
border-radius: ${(p) => `${p.theme.radii[2]}px`};
|
|
39
49
|
flex-direction: row;
|
|
40
|
-
align-items:
|
|
50
|
+
align-items: flex-start;
|
|
51
|
+
`;
|
|
52
|
+
const AlertBodyText = styled(Text).attrs({
|
|
53
|
+
flexShrink: 1,
|
|
54
|
+
variant: "bodyLineHeight",
|
|
55
|
+
fontWeight: "semiBold",
|
|
56
|
+
}) ``;
|
|
57
|
+
const AlertUnderlinedText = styled(AlertBodyText) `
|
|
58
|
+
text-decoration-line: underline;
|
|
41
59
|
`;
|
|
42
|
-
|
|
60
|
+
function Alert({ type = "info", Icon, title, showIcon = true, children }) {
|
|
43
61
|
const theme = useTheme();
|
|
44
|
-
const textColor =
|
|
45
|
-
const
|
|
62
|
+
const textColor = "neutral.c100";
|
|
63
|
+
const IconComponent = Icon !== null && Icon !== void 0 ? Icon : icons[type];
|
|
46
64
|
return (React.createElement(StyledAlertContainer, { type: type },
|
|
47
|
-
showIcon && !!icons[type] && (React.createElement(StyledIconContainer, null,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
65
|
+
showIcon && !!icons[type] && (React.createElement(StyledIconContainer, null,
|
|
66
|
+
React.createElement(IconComponent, { size: 20, color: getColor(theme, alertColors[type || "info"].iconColor) }))),
|
|
67
|
+
title ? (React.createElement(Text, { color: textColor, flexShrink: 1, variant: "bodyLineHeight", fontWeight: "semiBold" }, title)) : null,
|
|
68
|
+
children));
|
|
51
69
|
}
|
|
70
|
+
Alert.BodyText = AlertBodyText;
|
|
71
|
+
Alert.UnderlinedText = AlertUnderlinedText;
|
|
72
|
+
export default Alert;
|
|
@@ -14,17 +14,17 @@ const variantProps = {
|
|
|
14
14
|
padding: 6,
|
|
15
15
|
},
|
|
16
16
|
success: {
|
|
17
|
-
bg: "success.
|
|
17
|
+
bg: "success.c50",
|
|
18
18
|
color: "neutral.c00",
|
|
19
19
|
padding: 6,
|
|
20
20
|
},
|
|
21
21
|
warning: {
|
|
22
|
-
bg: "warning.
|
|
22
|
+
bg: "warning.c50",
|
|
23
23
|
color: "neutral.c00",
|
|
24
24
|
padding: 6,
|
|
25
25
|
},
|
|
26
26
|
error: {
|
|
27
|
-
bg: "error.
|
|
27
|
+
bg: "error.c50",
|
|
28
28
|
color: "neutral.c00",
|
|
29
29
|
padding: 6,
|
|
30
30
|
},
|
|
@@ -16,7 +16,7 @@ import { Box } from "../../Layout";
|
|
|
16
16
|
const typeColor = {
|
|
17
17
|
color: "primary.c80",
|
|
18
18
|
shade: "neutral.c30",
|
|
19
|
-
warning: "warning.
|
|
19
|
+
warning: "warning.c50",
|
|
20
20
|
};
|
|
21
21
|
export default function Tag(_a) {
|
|
22
22
|
var { type = "shade", size = "small", color, textColor, uppercase, Icon, children, numberOfLines, ellipsizeMode } = _a, props = __rest(_a, ["type", "size", "color", "textColor", "uppercase", "Icon", "children", "numberOfLines", "ellipsizeMode"]);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0-next.0",
|
|
4
4
|
"description": "Ledger Live - Mobile UI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"rn-range-slider": "2.1.1",
|
|
47
47
|
"styled-system": "^5.1.5",
|
|
48
48
|
"victory-native": "^35.5.5",
|
|
49
|
-
"@ledgerhq/crypto-icons-ui": "^0.
|
|
49
|
+
"@ledgerhq/crypto-icons-ui": "^0.3.0-next.0",
|
|
50
50
|
"@ledgerhq/icons-ui": "^0.4.0",
|
|
51
|
-
"@ledgerhq/ui-shared": "^0.
|
|
51
|
+
"@ledgerhq/ui-shared": "^0.2.0-next.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@types/react": "*",
|
|
@@ -143,13 +143,12 @@
|
|
|
143
143
|
"react-native-safe-area-context": "^4.5.0",
|
|
144
144
|
"react-native-web": "~0.18.12",
|
|
145
145
|
"regenerator-runtime": "^0.13.9",
|
|
146
|
-
"rimraf": "^4.1
|
|
146
|
+
"rimraf": "^4.4.1",
|
|
147
147
|
"styled-components": "^5.3.3",
|
|
148
148
|
"stylelint": "^14.9.1",
|
|
149
149
|
"stylelint-config-recommended": "^8.0.0",
|
|
150
150
|
"stylelint-config-styled-components": "^0.1.1",
|
|
151
151
|
"stylelint-processor-styled-components": "^1.10.0",
|
|
152
|
-
"typescript": "^4.9.5",
|
|
153
152
|
"util": "^0.12.5",
|
|
154
153
|
"victory": "^35.5.5",
|
|
155
154
|
"webpack": "^5.76.1",
|