@ledgerhq/native-ui 0.7.10 → 0.7.13
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.
|
@@ -10,10 +10,10 @@ const ElementContainer = styled(Flex).attrs({
|
|
|
10
10
|
function Element(props) {
|
|
11
11
|
const { first, value, selected, disabled, onPress, children, Icon, renderRight: RenderRight, } = props;
|
|
12
12
|
return (React.createElement(TouchableOpacity, { onPress: onPress, disabled: disabled },
|
|
13
|
-
React.createElement(ElementContainer, { p: 6, mt: first ? 0 : 4, backgroundColor: selected ? "primary.c20" : "
|
|
13
|
+
React.createElement(ElementContainer, { p: 6, mt: first ? 0 : 4, backgroundColor: selected ? "primary.c20" : "transparent", border: "1px solid", borderColor: selected ? "primary.c50" : "neutral.c40", borderRadius: 1, flexDirection: "row", alignItems: "center" },
|
|
14
14
|
Icon && (React.createElement(Flex, { mr: 6, flexShrink: 0 },
|
|
15
|
-
React.createElement(Icon, { size: 24, color: disabled ? "neutral.c50" : "neutral.c100" }))),
|
|
16
|
-
React.createElement(Text, { variant: "large", flex: 1, color: disabled ? "neutral.c50" : "neutral.c100" }, children || value),
|
|
15
|
+
React.createElement(Icon, { size: 24, color: disabled ? "neutral.c50" : selected ? "primary.c90" : "neutral.c100" }))),
|
|
16
|
+
React.createElement(Text, { variant: "large", flex: 1, color: disabled ? "neutral.c50" : selected ? "primary.c90" : "neutral.c100" }, children || value),
|
|
17
17
|
RenderRight && (React.createElement(Flex, { pl: 6, flexShrink: 0 }, React.isValidElement(RenderRight) ? RenderRight : React.createElement(RenderRight, Object.assign({}, props)))))));
|
|
18
18
|
}
|
|
19
19
|
function SelectableList({ currentValue, onChange, children }) {
|
|
@@ -20,6 +20,9 @@ import { BoxedIcon } from "../../../Icon";
|
|
|
20
20
|
import { Flex } from "../../index";
|
|
21
21
|
import { space } from "styled-system";
|
|
22
22
|
const { width, height } = sizes;
|
|
23
|
+
const SafeContainer = styled.SafeAreaView `
|
|
24
|
+
background-color: ${(p) => p.theme.colors.background.main};
|
|
25
|
+
`;
|
|
23
26
|
const Container = styled.View `
|
|
24
27
|
background-color: ${(p) => p.theme.colors.background.main};
|
|
25
28
|
width: 100%;
|
|
@@ -75,10 +78,11 @@ export default function BaseModal(_a) {
|
|
|
75
78
|
onSwipeComplete: onClose,
|
|
76
79
|
};
|
|
77
80
|
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] }),
|
|
78
|
-
React.createElement(
|
|
79
|
-
|
|
80
|
-
React.createElement(
|
|
81
|
-
React.createElement(
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
React.createElement(SafeContainer, null,
|
|
82
|
+
React.createElement(Container, { style: containerStyle },
|
|
83
|
+
!noCloseButton && (React.createElement(CloseContainer, null,
|
|
84
|
+
React.createElement(ClosePressableExtendedBounds, { onPress: onClose },
|
|
85
|
+
React.createElement(Link, { Icon: CloseMedium, onPress: onClose })))),
|
|
86
|
+
React.createElement(ModalHeader, { Icon: Icon, iconColor: iconColor, title: title, description: description, subtitle: subtitle }),
|
|
87
|
+
React.createElement(ContentContainer, null, children)))));
|
|
84
88
|
}
|
|
@@ -15,6 +15,8 @@ export declare type ButtonProps = TouchableOpacityProps & BaseStyledProps & {
|
|
|
15
15
|
disabled?: boolean;
|
|
16
16
|
pressed?: boolean;
|
|
17
17
|
children?: React.ReactNode;
|
|
18
|
+
pending?: boolean;
|
|
19
|
+
displayContentWhenPending?: boolean;
|
|
18
20
|
};
|
|
19
21
|
export declare const Base: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, {
|
|
20
22
|
iconButton?: boolean | undefined;
|
|
@@ -45,7 +45,7 @@ const Container = styled.View `
|
|
|
45
45
|
opacity: ${(p) => (p.hide ? 0 : 1)};
|
|
46
46
|
`;
|
|
47
47
|
const SpinnerContainer = styled.View `
|
|
48
|
-
position: absolute;
|
|
48
|
+
position: ${(p) => (p.displayContentWhenPending ? "relative" : "absolute")};
|
|
49
49
|
top: 0;
|
|
50
50
|
left: 0;
|
|
51
51
|
right: 0;
|
|
@@ -55,20 +55,26 @@ const SpinnerContainer = styled.View `
|
|
|
55
55
|
justify-content: center;
|
|
56
56
|
`;
|
|
57
57
|
const ButtonContainer = (props) => {
|
|
58
|
-
const { Icon, iconPosition = "right", children, hide = false, size = "medium", iconName } = props;
|
|
58
|
+
const { Icon, iconPosition = "right", children, hide = false, size = "medium", iconName, pending, displayContentWhenPending, } = props;
|
|
59
59
|
const theme = useTheme();
|
|
60
60
|
const { text } = getButtonColorStyle(theme.colors, props);
|
|
61
61
|
const IconNode = useMemo(() => (iconName && React.createElement(IconComponent, { name: iconName, size: ctaIconSize[size], color: text.color })) ||
|
|
62
62
|
(Icon && React.createElement(Icon, { size: ctaIconSize[size], color: text.color })), [iconName, size, Icon, text.color]);
|
|
63
|
+
const textColor = useMemo(() => (pending ? theme.colors.neutral.c50 : text.color), [pending, theme.colors.neutral.c50, text.color]);
|
|
63
64
|
return (React.createElement(Container, { hide: hide },
|
|
64
|
-
iconPosition === "right" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color:
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
iconPosition === "right" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: textColor }, children)) : null,
|
|
66
|
+
pending && displayContentWhenPending ? (React.createElement(IconContainer, { iconPosition: iconPosition },
|
|
67
|
+
React.createElement(SpinnerContainer, { displayContentWhenPending: true },
|
|
68
|
+
React.createElement(ActivityIndicator, { color: theme.colors.neutral.c50, animating: true })))) : IconNode ? (React.createElement(IconContainer, { iconButton: !children, iconPosition: iconPosition }, IconNode)) : null,
|
|
69
|
+
iconPosition === "left" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: textColor }, children)) : null));
|
|
67
70
|
};
|
|
68
71
|
const Button = (props) => {
|
|
69
|
-
const { Icon, children, type = "default", iconName } = props;
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
const { Icon, children, type = "default", iconName, disabled = false, pending = false, displayContentWhenPending = false, } = props;
|
|
73
|
+
const theme = useTheme();
|
|
74
|
+
return (React.createElement(Base, Object.assign({}, props, { type: type, iconButton: (!!Icon || !!iconName) && !children, activeOpacity: 0.5, disabled: disabled || pending }),
|
|
75
|
+
React.createElement(ButtonContainer, Object.assign({}, props, { type: type, hide: pending && !displayContentWhenPending })),
|
|
76
|
+
pending && !displayContentWhenPending ? (React.createElement(SpinnerContainer, { displayContentWhenPending: displayContentWhenPending },
|
|
77
|
+
React.createElement(ActivityIndicator, { color: theme.colors.neutral.c50, animating: true }))) : null));
|
|
72
78
|
};
|
|
73
79
|
export const PromisableButton = (props) => {
|
|
74
80
|
const { Icon, children, onPress, type = "main", disabled = false, iconName } = props;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "Ledger Live -
|
|
3
|
+
"version": "0.7.13",
|
|
4
|
+
"description": "Ledger Live - React Native UI",
|
|
5
5
|
"repository": "https://github.com/LedgerHQ/ui",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Ledger Live Team <team-live@ledger.fr>",
|