@ledgerhq/native-ui 0.21.0 → 0.22.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/BannerCard/index.d.ts +1 -0
- package/lib/components/Cards/BannerCard/index.js +2 -2
- package/lib/components/Layout/List/VerticalStepper/StepperItem.js +2 -2
- package/lib/components/Layout/List/VerticalTimeline/TimelineIndicator.js +2 -2
- package/lib/components/Loader/InfiniteLoader/index.d.ts +1 -1
- package/lib/components/Loader/InfiniteLoader/index.js +2 -2
- package/lib/components/ProgressBar/index.d.ts +6 -1
- package/lib/components/ProgressBar/index.js +4 -4
- package/lib/components/Text/getTextStyle.js +1 -1
- package/lib/components/cta/QuickAction/QuickActionButton/index.d.ts +7 -1
- package/lib/components/cta/QuickAction/QuickActionButton/index.js +10 -6
- package/lib/components/cta/QuickAction/QuickActionList/index.d.ts +4 -2
- package/lib/components/cta/QuickAction/QuickActionList/index.js +2 -2
- package/lib/components/cta/QuickAction/index.d.ts +2 -2
- package/package.json +6 -6
|
@@ -37,9 +37,9 @@ export const CloseButton = ({ onPressDismiss }) => {
|
|
|
37
37
|
React.createElement(CloseMedium, { size: 14, color: colors.neutral.c100 })));
|
|
38
38
|
};
|
|
39
39
|
const CardContainer = (props) => {
|
|
40
|
-
const { onPressDismiss, LeftElement, title, typeOfRightIcon } = props;
|
|
40
|
+
const { onPressDismiss, LeftElement, hideLeftElementContainer, title, typeOfRightIcon } = props;
|
|
41
41
|
return (React.createElement(Container, Object.assign({}, props),
|
|
42
|
-
React.createElement(Flex, { borderRadius: 50, height: 40, width: 40, alignItems: "center", justifyContent: "center", bg: "opacityDefault.c05" }, LeftElement),
|
|
42
|
+
hideLeftElementContainer ? (React.createElement(Flex, { borderRadius: 50, height: 40, width: 40, alignItems: "center", justifyContent: "center", bg: "opacityDefault.c05" }, LeftElement)) : (LeftElement),
|
|
43
43
|
React.createElement(Text, { mx: 4, variant: "large", fontWeight: "medium", numberOfLines: 3, maxWidth: "70%", color: "neutral.c100" }, title),
|
|
44
44
|
typeOfRightIcon === "close" ? (React.createElement(CloseButton, { onPressDismiss: onPressDismiss })) : (React.createElement(ChevronContainer, null,
|
|
45
45
|
React.createElement(ChevronRightMedium, { size: 24 })))));
|
|
@@ -46,8 +46,8 @@ export default function StepperItem({ item, progress, nested, isLastItem, onTapI
|
|
|
46
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
|
-
React.createElement(Flex, { pb: item.status === "active" && item.renderBody ?
|
|
50
|
-
React.createElement(Text, { variant: "body", color: item.status === "active" || nested ? "neutral.c100" : "neutral.c80" }, item.status === "completed" ? (_a = item.doneTitle) !== null && _a !== void 0 ? _a : item.title : item.title)),
|
|
49
|
+
React.createElement(Flex, { pb: item.status === "active" && item.renderBody ? 3 : undefined },
|
|
50
|
+
React.createElement(Text, Object.assign({}, (nested ? { variant: "body" } : { variant: "large", fontWeight: "semiBold" }), { color: item.status === "active" || nested ? "neutral.c100" : "neutral.c80" }), item.status === "completed" ? (_a = item.doneTitle) !== null && _a !== void 0 ? _a : item.title : item.title)),
|
|
51
51
|
React.createElement(Animated.ScrollView, { style: animatedStyle, showsVerticalScrollIndicator: false },
|
|
52
52
|
React.createElement(Animated.View, { onLayout: handleLayout }, item.renderBody && item.status === "active" ? item.renderBody(true) : null))))))));
|
|
53
53
|
}
|
|
@@ -32,7 +32,7 @@ const TopSegmentSvg = ({ status, hidden, height }) => {
|
|
|
32
32
|
return (React.createElement(Flex, { height: height, width: "100%", overflow: "hidden" },
|
|
33
33
|
React.createElement(Flex, { style: StyleSheet.absoluteFillObject, alignItems: "center" },
|
|
34
34
|
React.createElement(Svg, { height: linesLength, width: linesWidth, viewBox: `0 0 ${linesWidth} ${linesLength}`, preserveAspectRatio: "xMinYMin slice" },
|
|
35
|
-
React.createElement(Line, { x1: "0", y1: "0", x2: "0", y2: "100", strokeWidth: hidden ? 0 : 2 * linesWidth, stroke: strokeColor, strokeDasharray: strokeDashArray })))));
|
|
35
|
+
React.createElement(Line, { key: status + " " + hidden, x1: "0", y1: "0", x2: "0", y2: "100", strokeWidth: hidden ? 0 : 2 * linesWidth, stroke: strokeColor, strokeDasharray: strokeDashArray })))));
|
|
36
36
|
};
|
|
37
37
|
const topSegmentDefaultHeight = Platform.OS === "android" ? 23 : 21; // difference due to how borders are drawn in android
|
|
38
38
|
const BottomSegmentSvg = ({ status, hidden }) => {
|
|
@@ -42,7 +42,7 @@ const BottomSegmentSvg = ({ status, hidden }) => {
|
|
|
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" },
|
|
44
44
|
React.createElement(Svg, { height: 2 * Dimensions.get("screen").height, width: linesWidth, viewBox: `0 0 ${linesWidth} ${linesLength}`, preserveAspectRatio: "xMinYMin slice" },
|
|
45
|
-
React.createElement(Line, { x1: "0", y1: "0", x2: "0", y2: "100%", strokeWidth: hidden ? 0 : 2 * linesWidth, stroke: strokeColor, strokeDasharray: strokeDashArray, strokeDashoffset: `${dashLength}` })))));
|
|
45
|
+
React.createElement(Line, { key: status + " " + hidden, 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
48
|
if (isLastItem) {
|
|
@@ -6,5 +6,5 @@ declare const Loader: import("styled-components").StyledComponent<typeof Svg, im
|
|
|
6
6
|
export type Props = React.ComponentProps<typeof Loader> & {
|
|
7
7
|
color?: string;
|
|
8
8
|
};
|
|
9
|
-
export default function InfiniteLoader({ size, color, ...extraProps }: Props): JSX.Element;
|
|
9
|
+
export default function InfiniteLoader({ size, color, mock, ...extraProps }: Props): JSX.Element;
|
|
10
10
|
export {};
|
|
@@ -24,7 +24,7 @@ const Loader = styled(Svg).attrs((props) => (Object.assign({}, strokeSystem(prop
|
|
|
24
24
|
${size}
|
|
25
25
|
`;
|
|
26
26
|
export default function InfiniteLoader(_a) {
|
|
27
|
-
var { size = 38, color = "primary.c50" } = _a, extraProps = __rest(_a, ["size", "color"]);
|
|
27
|
+
var { size = 38, color = "primary.c50", mock = false } = _a, extraProps = __rest(_a, ["size", "color", "mock"]);
|
|
28
28
|
const rotation = useSharedValue(0);
|
|
29
29
|
const animatedStyles = useAnimatedStyle(() => {
|
|
30
30
|
return {
|
|
@@ -39,7 +39,7 @@ export default function InfiniteLoader(_a) {
|
|
|
39
39
|
rotation.value = withRepeat(withTiming(360, {
|
|
40
40
|
duration: 1000,
|
|
41
41
|
easing: Easing.linear,
|
|
42
|
-
}), -1);
|
|
42
|
+
}), mock ? 1 : -1);
|
|
43
43
|
return () => cancelAnimation(rotation);
|
|
44
44
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
45
45
|
}, []);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FlexBoxProps } from "../Layout/Flex";
|
|
3
|
+
import { BaseStyledProps } from "../styled";
|
|
3
4
|
export interface Props extends FlexBoxProps {
|
|
4
5
|
/**
|
|
5
6
|
* The index of the active step.
|
|
@@ -9,7 +10,11 @@ export interface Props extends FlexBoxProps {
|
|
|
9
10
|
* The total number of steps.
|
|
10
11
|
*/
|
|
11
12
|
length: number;
|
|
13
|
+
/**
|
|
14
|
+
* Style props for the bar element.
|
|
15
|
+
*/
|
|
16
|
+
activeBarProps?: BaseStyledProps;
|
|
12
17
|
}
|
|
13
|
-
declare function ProgressBar({ index, length, ...props }: Props): JSX.Element;
|
|
18
|
+
declare function ProgressBar({ index, length, activeBarProps, ...props }: Props): JSX.Element;
|
|
14
19
|
declare const _default: React.MemoExoticComponent<typeof ProgressBar>;
|
|
15
20
|
export default _default;
|
|
@@ -13,8 +13,8 @@ import React from "react";
|
|
|
13
13
|
import styled from "styled-components/native";
|
|
14
14
|
import Flex from "../Layout/Flex";
|
|
15
15
|
import Animated, { useDerivedValue, useAnimatedStyle, withTiming } from "react-native-reanimated";
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
import Box from "../Layout/Box";
|
|
17
|
+
const ActiveBar = styled(Box) `
|
|
18
18
|
position: absolute;
|
|
19
19
|
height: 100%;
|
|
20
20
|
top: 0;
|
|
@@ -22,12 +22,12 @@ const ActiveBar = styled.View `
|
|
|
22
22
|
`;
|
|
23
23
|
const AnimatedBar = Animated.createAnimatedComponent(ActiveBar);
|
|
24
24
|
function ProgressBar(_a) {
|
|
25
|
-
var { index, length } = _a, props = __rest(_a, ["index", "length"]);
|
|
25
|
+
var { index, length, activeBarProps } = _a, props = __rest(_a, ["index", "length", "activeBarProps"]);
|
|
26
26
|
const width = useDerivedValue(() => Math.round((index / (length - 1)) * 100), [index, length]);
|
|
27
27
|
const animatedStyles = useAnimatedStyle(() => ({
|
|
28
28
|
width: withTiming(`${width.value}%`),
|
|
29
29
|
}));
|
|
30
30
|
return (React.createElement(Flex, Object.assign({ height: 4, width: "100%", backgroundColor: "neutral.c20", position: "relative" }, props),
|
|
31
|
-
React.createElement(AnimatedBar, { style: [animatedStyles] })));
|
|
31
|
+
React.createElement(AnimatedBar, Object.assign({ style: [animatedStyles], bg: "neutral.c100" }, activeBarProps))));
|
|
32
32
|
}
|
|
33
33
|
export default React.memo(ProgressBar);
|
|
@@ -2,13 +2,19 @@ import React from "react";
|
|
|
2
2
|
import { TouchableOpacity, TouchableOpacityProps } from "react-native";
|
|
3
3
|
import { IconType } from "src/components/Icon/type";
|
|
4
4
|
import { BaseStyledProps } from "../../../styled";
|
|
5
|
+
import { TextVariants } from "../../../../styles/theme";
|
|
6
|
+
type Variant = "small" | "large";
|
|
5
7
|
export type QuickActionButtonProps = TouchableOpacityProps & BaseStyledProps & {
|
|
6
8
|
Icon: IconType;
|
|
7
9
|
disabled?: boolean;
|
|
8
10
|
onPressWhenDisabled?: TouchableOpacityProps["onPress"];
|
|
11
|
+
textVariant?: TextVariants;
|
|
12
|
+
variant?: Variant;
|
|
9
13
|
};
|
|
14
|
+
export declare const StyledText: import("styled-components").StyledComponent<({ children, bracket, textAlign, testID, ...props }: import("../../../Text").BaseTextProps) => JSX.Element, import("styled-components").DefaultTheme, {}, never>;
|
|
10
15
|
export declare const Base: import("styled-components").StyledComponent<typeof TouchableOpacity, import("styled-components").DefaultTheme, TouchableOpacityProps & {
|
|
11
16
|
visuallyDisabled?: boolean | undefined;
|
|
17
|
+
variant: Variant;
|
|
12
18
|
}, never>;
|
|
13
|
-
declare const QuickActionButton: ({ Icon, children, disabled, onPress, onPressWhenDisabled, ...otherProps }: QuickActionButtonProps) => React.ReactElement;
|
|
19
|
+
declare const QuickActionButton: ({ Icon, children, disabled, onPress, onPressWhenDisabled, textVariant, variant, ...otherProps }: QuickActionButtonProps) => React.ReactElement;
|
|
14
20
|
export default QuickActionButton;
|
|
@@ -13,22 +13,26 @@ import React from "react";
|
|
|
13
13
|
import { TouchableOpacity } from "react-native";
|
|
14
14
|
import Text from "../../../Text";
|
|
15
15
|
import baseStyled from "../../../styled";
|
|
16
|
+
export const StyledText = baseStyled(Text) `
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
max-width: 100%;
|
|
19
|
+
`;
|
|
16
20
|
export const Base = baseStyled(TouchableOpacity) `
|
|
17
|
-
height:
|
|
21
|
+
height: ${({ variant }) => (variant === "small" ? 59 : 80)}px;
|
|
18
22
|
flex-direction: column;
|
|
19
23
|
text-align: center;
|
|
20
24
|
align-items: center;
|
|
21
25
|
justify-content: center;
|
|
22
26
|
border-radius: ${(p) => p.theme.radii[2]}px;
|
|
23
|
-
padding:
|
|
27
|
+
padding: ${({ theme, variant }) => variant === "small" ? `${theme.space[3]}px ${theme.space[2]}px` : `0 ${theme.space[6]}px`};
|
|
24
28
|
${({ visuallyDisabled, theme }) => visuallyDisabled
|
|
25
29
|
? `border: 1px solid ${theme.colors.neutral.c30};`
|
|
26
30
|
: `background-color: ${theme.colors.neutral.c20};`}
|
|
27
31
|
`;
|
|
28
32
|
const QuickActionButton = (_a) => {
|
|
29
|
-
var { Icon, children, disabled, onPress, onPressWhenDisabled } = _a, otherProps = __rest(_a, ["Icon", "children", "disabled", "onPress", "onPressWhenDisabled"]);
|
|
30
|
-
return (React.createElement(Base, Object.assign({ disabled: onPressWhenDisabled ? false : disabled, onPress: disabled ? onPressWhenDisabled : onPress, visuallyDisabled: disabled }, otherProps),
|
|
31
|
-
React.createElement(Icon, { size: 24, color: disabled ? "neutral.c50" : "neutral.c100" }),
|
|
32
|
-
React.createElement(
|
|
33
|
+
var { Icon, children, disabled, onPress, onPressWhenDisabled, textVariant = "body", variant = "large" } = _a, otherProps = __rest(_a, ["Icon", "children", "disabled", "onPress", "onPressWhenDisabled", "textVariant", "variant"]);
|
|
34
|
+
return (React.createElement(Base, Object.assign({ disabled: onPressWhenDisabled ? false : disabled, onPress: disabled ? onPressWhenDisabled : onPress, visuallyDisabled: disabled, variant: variant }, otherProps),
|
|
35
|
+
React.createElement(Icon, { size: variant === "small" ? 20 : 24, color: disabled ? "neutral.c50" : "neutral.c100" }),
|
|
36
|
+
React.createElement(StyledText, { numberOfLines: 1, variant: textVariant, fontWeight: "semiBold", color: disabled ? "neutral.c50" : "neutral.c100", mt: 2 }, children)));
|
|
33
37
|
};
|
|
34
38
|
export default QuickActionButton;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { FlatListProps } from "react-native";
|
|
3
3
|
import { QuickActionButtonProps } from "../QuickActionButton";
|
|
4
|
-
export type QuickActionListProps = Omit<FlatListProps<QuickActionButtonProps>, "renderItem"
|
|
5
|
-
|
|
4
|
+
export type QuickActionListProps = Omit<FlatListProps<QuickActionButtonProps>, "renderItem"> & {
|
|
5
|
+
id: string;
|
|
6
|
+
};
|
|
7
|
+
declare const QuickActionList: ({ numColumns, data, id, ...otherProps }: QuickActionListProps) => React.ReactElement;
|
|
6
8
|
export default QuickActionList;
|
|
@@ -13,10 +13,10 @@ import React, { useCallback } from "react";
|
|
|
13
13
|
import { FlatList } from "react-native";
|
|
14
14
|
import QuickActionButton from "../QuickActionButton";
|
|
15
15
|
const QuickActionList = (_a) => {
|
|
16
|
-
var { numColumns = 3, data } = _a, otherProps = __rest(_a, ["numColumns", "data"]);
|
|
16
|
+
var { numColumns = 3, data, id } = _a, otherProps = __rest(_a, ["numColumns", "data", "id"]);
|
|
17
17
|
const renderItem = useCallback(({ item, index }) => {
|
|
18
18
|
return (React.createElement(QuickActionButton, Object.assign({}, item, { flex: 1, mr: (index + 1) % numColumns > 0 && data && index !== data.length - 1 ? 4 : 0, mb: (data === null || data === void 0 ? void 0 : data.length) && index + numColumns < data.length ? 4 : 0 })));
|
|
19
19
|
}, []);
|
|
20
|
-
return (React.createElement(FlatList, Object.assign({}, otherProps, { data: data, horizontal: false, renderItem: renderItem, numColumns: numColumns, style: { width: "100%" } })));
|
|
20
|
+
return (React.createElement(FlatList, Object.assign({}, otherProps, { data: data, keyExtractor: (_item, index) => `${id}${index}`, horizontal: false, renderItem: renderItem, numColumns: numColumns, style: { width: "100%" } })));
|
|
21
21
|
};
|
|
22
22
|
export default QuickActionList;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { default as QuickActionList } from "./QuickActionList";
|
|
2
|
-
export { default as QuickActionButton } from "./QuickActionButton";
|
|
1
|
+
export { default as QuickActionList, type QuickActionListProps } from "./QuickActionList";
|
|
2
|
+
export { default as QuickActionButton, type QuickActionButtonProps } from "./QuickActionButton";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/native-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0-next.0",
|
|
4
4
|
"description": "Ledger Live - Mobile UI",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"styled-system": "^5.1.5",
|
|
48
48
|
"victory-native": "^35.5.5",
|
|
49
49
|
"@ledgerhq/crypto-icons-ui": "^0.5.1",
|
|
50
|
-
"@ledgerhq/icons-ui": "^0.6.
|
|
50
|
+
"@ledgerhq/icons-ui": "^0.6.1",
|
|
51
51
|
"@ledgerhq/ui-shared": "^0.2.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"@babel/plugin-transform-template-literals": "^7.18.9",
|
|
73
73
|
"@babel/preset-env": "^7.15.8",
|
|
74
74
|
"@babel/runtime": "^7.17.2",
|
|
75
|
-
"@emotion/core": "^
|
|
76
|
-
"@emotion/native": "^
|
|
75
|
+
"@emotion/core": "^11.0.0",
|
|
76
|
+
"@emotion/native": "^11.0.0",
|
|
77
77
|
"@expo/metro-config": "^0.7.1",
|
|
78
78
|
"@expo/webpack-config": "^18.0.1",
|
|
79
79
|
"@react-native-async-storage/async-storage": "1.17.12",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"@svgr/plugin-jsx": "^5.5.0",
|
|
99
99
|
"@svgr/plugin-svgo": "^5.5.0",
|
|
100
100
|
"@types/hoist-non-react-statics": "^3.3.1",
|
|
101
|
-
"@types/node": "^
|
|
101
|
+
"@types/node": "^18.0.0",
|
|
102
102
|
"@types/prop-types": "^15.7.5",
|
|
103
103
|
"@types/react": "^17.0.53",
|
|
104
104
|
"@types/react-native": "0.71.5",
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
"rimraf": "^4.4.1",
|
|
145
145
|
"styled-components": "^5.3.3",
|
|
146
146
|
"stylelint": "^14.9.1",
|
|
147
|
-
"stylelint-config-recommended": "^
|
|
147
|
+
"stylelint-config-recommended": "^13.0.0",
|
|
148
148
|
"stylelint-config-styled-components": "^0.1.1",
|
|
149
149
|
"stylelint-processor-styled-components": "^1.10.0",
|
|
150
150
|
"util": "^0.12.5",
|