@ledgerhq/native-ui 0.20.2-nightly.0 → 0.20.2-nightly.2
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.
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { FlexBoxProps } from "../Layout/Flex";
|
|
3
3
|
import { IconOrElementType } from "./type";
|
|
4
4
|
export declare const DEFAULT_ICON_SIZE = 16;
|
|
5
|
+
export declare const DEFAULT_BACKGROUND_COLOR = "neutral.c40";
|
|
5
6
|
export type IconBadgeProps = FlexBoxProps & {
|
|
6
7
|
/**
|
|
7
8
|
* Component that takes `{size?: number; color?: string}` as props.
|
|
@@ -16,6 +17,10 @@ export type IconBadgeProps = FlexBoxProps & {
|
|
|
16
17
|
* Icon color, will be applied to the component provided in the `Icon` prop
|
|
17
18
|
*/
|
|
18
19
|
iconColor?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Background color, will define the color of the round background part of the badge
|
|
22
|
+
*/
|
|
23
|
+
backgroundColor?: string;
|
|
19
24
|
};
|
|
20
|
-
declare const IconBadge: ({ Icon, iconSize, iconColor, ...rest }: IconBadgeProps) => JSX.Element;
|
|
25
|
+
declare const IconBadge: ({ Icon, iconSize, backgroundColor, iconColor, ...rest }: IconBadgeProps) => JSX.Element;
|
|
21
26
|
export default IconBadge;
|
|
@@ -12,10 +12,11 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
import React from "react";
|
|
13
13
|
import Flex from "../Layout/Flex";
|
|
14
14
|
export const DEFAULT_ICON_SIZE = 16;
|
|
15
|
+
export const DEFAULT_BACKGROUND_COLOR = "neutral.c40";
|
|
15
16
|
const BORDER_RADIUS = 999999;
|
|
16
17
|
const IconBadge = (_a) => {
|
|
17
|
-
var { Icon, iconSize = DEFAULT_ICON_SIZE, iconColor } = _a, rest = __rest(_a, ["Icon", "iconSize", "iconColor"]);
|
|
18
|
-
return (React.createElement(Flex, Object.assign({ height: iconSize * 2, width: iconSize * 2, backgroundColor:
|
|
18
|
+
var { Icon, iconSize = DEFAULT_ICON_SIZE, backgroundColor = DEFAULT_BACKGROUND_COLOR, iconColor } = _a, rest = __rest(_a, ["Icon", "iconSize", "backgroundColor", "iconColor"]);
|
|
19
|
+
return (React.createElement(Flex, Object.assign({ height: iconSize * 2, width: iconSize * 2, backgroundColor: backgroundColor, borderRadius: BORDER_RADIUS, alignItems: "center", justifyContent: "center" }, rest), React.isValidElement(Icon) ? (Icon) : (
|
|
19
20
|
/* @ts-expect-error TS 5 can't seem to be able to prove this is a react comopnent here */
|
|
20
21
|
React.createElement(Icon, { size: iconSize, color: iconColor }))));
|
|
21
22
|
};
|
|
@@ -15,7 +15,7 @@ export type ButtonProps = TouchableOpacityProps & BaseStyledProps & {
|
|
|
15
15
|
children?: React.ReactNode;
|
|
16
16
|
pending?: boolean;
|
|
17
17
|
displayContentWhenPending?: boolean;
|
|
18
|
-
|
|
18
|
+
buttonTestId?: string;
|
|
19
19
|
};
|
|
20
20
|
export declare const Base: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, {
|
|
21
21
|
iconButton?: boolean | undefined;
|
|
@@ -55,14 +55,14 @@ 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, pending, displayContentWhenPending, } = props;
|
|
58
|
+
const { Icon, iconPosition = "right", children, hide = false, size = "medium", iconName, pending, displayContentWhenPending, buttonTestId, } = 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
63
|
const textColor = useMemo(() => (pending ? theme.colors.neutral.c50 : text.color), [pending, theme.colors.neutral.c50, text.color]);
|
|
64
64
|
return (React.createElement(Container, { hide: hide },
|
|
65
|
-
iconPosition === "right" && children ? (React.createElement(Text, { variant: ctaTextType[size], fontWeight: "semiBold", color: textColor }, children)) : null,
|
|
65
|
+
iconPosition === "right" && children ? (React.createElement(Text, { testID: buttonTestId, variant: ctaTextType[size], fontWeight: "semiBold", color: textColor }, children)) : null,
|
|
66
66
|
pending && displayContentWhenPending ? (React.createElement(IconContainer, { iconPosition: iconPosition },
|
|
67
67
|
React.createElement(SpinnerContainer, { displayContentWhenPending: true },
|
|
68
68
|
React.createElement(ActivityIndicator, { color: theme.colors.neutral.c50, animating: true })))) : IconNode ? (React.createElement(IconContainer, { iconButton: !children, iconPosition: iconPosition }, IconNode)) : null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.20.2-nightly.
|
|
3
|
+
"version": "0.20.2-nightly.2",
|
|
4
4
|
"description": "Ledger Live - Mobile UI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -46,7 +46,7 @@
|
|
|
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.4.0-nightly.
|
|
49
|
+
"@ledgerhq/crypto-icons-ui": "^0.4.0-nightly.1",
|
|
50
50
|
"@ledgerhq/icons-ui": "^0.4.1",
|
|
51
51
|
"@ledgerhq/ui-shared": "^0.2.0"
|
|
52
52
|
},
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"styled-components": "^5.3.3"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
|
-
"@babel/core": "^7.
|
|
64
|
+
"@babel/core": "^7.22.8",
|
|
65
65
|
"@babel/generator": "^7.17.2",
|
|
66
66
|
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
|
67
67
|
"@babel/plugin-proposal-export-namespace-from": "^7.16.0",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@emotion/native": "^10.0.27",
|
|
77
77
|
"@expo/metro-config": "^0.7.1",
|
|
78
78
|
"@expo/webpack-config": "^18.0.1",
|
|
79
|
-
"@react-native-async-storage/async-storage": "1.17.
|
|
79
|
+
"@react-native-async-storage/async-storage": "1.17.12",
|
|
80
80
|
"@react-native-community/cli-server-api": "^7.0.3",
|
|
81
81
|
"@react-native-community/datetimepicker": "6.7.3",
|
|
82
82
|
"@react-native-community/slider": "^4.4.2",
|