@ledgerhq/native-ui 0.7.2 → 0.7.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.
|
@@ -14,5 +14,7 @@ export declare type BaseModalProps = {
|
|
|
14
14
|
description?: string;
|
|
15
15
|
subtitle?: string;
|
|
16
16
|
children?: React.ReactNode;
|
|
17
|
+
noCloseButton?: boolean;
|
|
17
18
|
} & Partial<ModalProps>;
|
|
18
|
-
export
|
|
19
|
+
export declare function ModalHeader({ Icon, iconColor, title, description, subtitle, }: Pick<BaseModalProps, "Icon" | "iconColor" | "title" | "description" | "subtitle">): React.ReactElement;
|
|
20
|
+
export default function BaseModal({ isOpen, onClose, noCloseButton, containerStyle, modalStyle, preventBackdropClick, Icon, iconColor, title, description, subtitle, children, ...rest }: BaseModalProps): React.ReactElement;
|
|
@@ -29,11 +29,6 @@ const ContentContainer = styled.View `
|
|
|
29
29
|
flex-shrink: 1;
|
|
30
30
|
flex-grow: 1;
|
|
31
31
|
`;
|
|
32
|
-
const HeaderContainer = styled.View `
|
|
33
|
-
display: flex;
|
|
34
|
-
align-items: center;
|
|
35
|
-
margin-bottom: ${(p) => p.theme.space[7]}px;
|
|
36
|
-
`;
|
|
37
32
|
const CloseContainer = styled.View `
|
|
38
33
|
display: flex;
|
|
39
34
|
align-items: flex-end;
|
|
@@ -54,8 +49,15 @@ const defaultModalStyle = {
|
|
|
54
49
|
flex: 1,
|
|
55
50
|
margin: 16,
|
|
56
51
|
};
|
|
52
|
+
export function ModalHeader({ Icon, iconColor, title, description, subtitle, }) {
|
|
53
|
+
return (React.createElement(Flex, { alignItems: "center", mb: 7 },
|
|
54
|
+
Icon && (React.createElement(Flex, { mb: 7 }, React.isValidElement(Icon) ? (Icon) : (React.createElement(BoxedIcon, { size: 64, Icon: Icon, iconSize: 24, iconColor: iconColor })))),
|
|
55
|
+
subtitle && React.createElement(StyledSubtitle, { textAlign: "center" }, subtitle),
|
|
56
|
+
title && React.createElement(StyledTitle, { textAlign: "center" }, title),
|
|
57
|
+
description && (React.createElement(Text, { variant: "body", color: "neutral.c70", textAlign: "center", mt: 6 }, description))));
|
|
58
|
+
}
|
|
57
59
|
export default function BaseModal(_a) {
|
|
58
|
-
var { isOpen, onClose = () => { }, containerStyle = {}, modalStyle = {}, preventBackdropClick, Icon, iconColor, title, description, subtitle, children } = _a, rest = __rest(_a, ["isOpen", "onClose", "containerStyle", "modalStyle", "preventBackdropClick", "Icon", "iconColor", "title", "description", "subtitle", "children"]);
|
|
60
|
+
var { isOpen, onClose = () => { }, noCloseButton, containerStyle = {}, modalStyle = {}, preventBackdropClick, Icon, iconColor, title, description, subtitle, children } = _a, rest = __rest(_a, ["isOpen", "onClose", "noCloseButton", "containerStyle", "modalStyle", "preventBackdropClick", "Icon", "iconColor", "title", "description", "subtitle", "children"]);
|
|
59
61
|
const backDropProps = preventBackdropClick
|
|
60
62
|
? {}
|
|
61
63
|
: {
|
|
@@ -65,12 +67,7 @@ export default function BaseModal(_a) {
|
|
|
65
67
|
};
|
|
66
68
|
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] }),
|
|
67
69
|
React.createElement(Container, { style: containerStyle },
|
|
68
|
-
React.createElement(CloseContainer, null,
|
|
69
|
-
|
|
70
|
-
React.createElement(HeaderContainer, null,
|
|
71
|
-
Icon && (React.createElement(Flex, { mb: 7 }, React.isValidElement(Icon) ? (Icon) : (React.createElement(BoxedIcon, { size: 64, Icon: Icon, iconSize: 24, iconColor: iconColor })))),
|
|
72
|
-
subtitle && React.createElement(StyledSubtitle, { textAlign: "center" }, subtitle),
|
|
73
|
-
title && React.createElement(StyledTitle, { textAlign: "center" }, title),
|
|
74
|
-
description && (React.createElement(Text, { variant: "body", color: "neutral.c70", textAlign: "center", mt: 6 }, description))),
|
|
70
|
+
React.createElement(CloseContainer, null, !noCloseButton && React.createElement(Link, { Icon: CloseMedium, onPress: onClose })),
|
|
71
|
+
React.createElement(ModalHeader, { Icon: Icon, iconColor: iconColor, title: title, description: description, subtitle: subtitle }),
|
|
75
72
|
React.createElement(ContentContainer, null, children))));
|
|
76
73
|
}
|