@ledgerhq/native-ui 0.46.0-nightly.0 → 0.46.0-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.
- package/lib/components/Layout/List/VerticalTimeline/TimelineIndicator.d.ts +2 -1
- package/lib/components/Layout/List/VerticalTimeline/TimelineIndicator.d.ts.map +1 -1
- package/lib/components/Layout/List/VerticalTimeline/TimelineIndicator.js +8 -8
- package/lib/components/Layout/List/VerticalTimeline/TimelineItem.d.ts +7 -2
- package/lib/components/Layout/List/VerticalTimeline/TimelineItem.d.ts.map +1 -1
- package/lib/components/Layout/List/VerticalTimeline/TimelineItem.js +8 -7
- package/lib/components/Layout/List/VerticalTimeline/index.d.ts +5 -4
- package/lib/components/Layout/List/VerticalTimeline/index.d.ts.map +1 -1
- package/lib/components/Layout/List/VerticalTimeline/index.js +2 -2
- package/lib/pre-ldls/components/Input/Input.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -5,9 +5,10 @@ export type Props = FlexProps & {
|
|
|
5
5
|
status: ItemStatus;
|
|
6
6
|
isFirstItem?: boolean;
|
|
7
7
|
isLastItem?: boolean;
|
|
8
|
+
isNeutral?: boolean;
|
|
8
9
|
topHeight?: number;
|
|
9
10
|
};
|
|
10
|
-
declare function TimelineIndicator({ status, isFirstItem, isLastItem, topHeight, ...props }: Props): React.JSX.Element;
|
|
11
|
+
declare function TimelineIndicator({ status, isFirstItem, isLastItem, isNeutral, topHeight, ...props }: Props): React.JSX.Element;
|
|
11
12
|
declare namespace TimelineIndicator {
|
|
12
13
|
var topSegmentDefaultHeight: number;
|
|
13
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimelineIndicator.d.ts","sourceRoot":"","sources":["../../../../../src/components/Layout/List/VerticalTimeline/TimelineIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAa,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"TimelineIndicator.d.ts","sourceRoot":"","sources":["../../../../../src/components/Layout/List/VerticalTimeline/TimelineIndicator.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAa,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAyHtC,MAAM,MAAM,KAAK,GAAG,SAAS,GAAG;IAC9B,MAAM,EAAE,UAAU,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,iBAAwB,iBAAiB,CAAC,EACxC,MAAM,EACN,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,qBAqBP;kBA5BuB,iBAAiB;;;eAAjB,iBAAiB"}
|
|
@@ -33,8 +33,8 @@ const BottomSegmentSvg = ({ status, hidden }) => {
|
|
|
33
33
|
React.createElement(Svg, { height: 2 * Dimensions.get("screen").height, width: linesWidth, viewBox: `0 0 ${linesWidth} ${linesLength}`, preserveAspectRatio: "xMinYMin slice" },
|
|
34
34
|
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}` })))));
|
|
35
35
|
};
|
|
36
|
-
const getIconBackground = (theme, status, isLastItem) => {
|
|
37
|
-
if (isLastItem) {
|
|
36
|
+
const getIconBackground = (theme, status, isLastItem, isNeutral) => {
|
|
37
|
+
if (isLastItem && !isNeutral) {
|
|
38
38
|
if (status === "inactive")
|
|
39
39
|
return theme.colors.success.c10;
|
|
40
40
|
return "transparent";
|
|
@@ -46,8 +46,8 @@ const getIconBackground = (theme, status, isLastItem) => {
|
|
|
46
46
|
return "transparent";
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
-
const getIconBorder = (theme, status, isLastItem) => {
|
|
50
|
-
if (isLastItem) {
|
|
49
|
+
const getIconBorder = (theme, status, isLastItem, isNeutral) => {
|
|
50
|
+
if (isLastItem && !isNeutral) {
|
|
51
51
|
return theme.colors.success.c70;
|
|
52
52
|
}
|
|
53
53
|
else if (status === "inactive") {
|
|
@@ -59,16 +59,16 @@ const CenterCircle = styled(Flex) `
|
|
|
59
59
|
border-radius: 9999px;
|
|
60
60
|
width: 16px;
|
|
61
61
|
height: 16px;
|
|
62
|
-
background: ${(p) => getIconBackground(p.theme, p.status, p.isLastItem)};
|
|
63
|
-
border: 2px solid ${(p) => getIconBorder(p.theme, p.status, p.isLastItem)};
|
|
62
|
+
background: ${(p) => getIconBackground(p.theme, p.status, p.isLastItem, p.isNeutral)};
|
|
63
|
+
border: 2px solid ${(p) => getIconBorder(p.theme, p.status, p.isLastItem, p.isNeutral)};
|
|
64
64
|
align-items: center;
|
|
65
65
|
justify-content: center;
|
|
66
66
|
`;
|
|
67
|
-
export default function TimelineIndicator({ status, isFirstItem, isLastItem, topHeight, ...props }) {
|
|
67
|
+
export default function TimelineIndicator({ status, isFirstItem, isLastItem, isNeutral, topHeight, ...props }) {
|
|
68
68
|
const { colors } = useTheme();
|
|
69
69
|
return (React.createElement(Flex, { flexDirection: "column", alignItems: "center", ...props },
|
|
70
70
|
React.createElement(TopSegmentSvg, { status: status, hidden: isFirstItem, height: PixelRatio.roundToNearestPixel(topHeight || topSegmentDefaultHeight) }),
|
|
71
|
-
React.createElement(CenterCircle, { status: status, isLastItem: isLastItem }, status === "completed" && (React.createElement(CircledCheckSolidMedium, { color: isLastItem ? colors.success.c70 : colors.primary.c80, size: 20 }))),
|
|
71
|
+
React.createElement(CenterCircle, { status: status, isLastItem: isLastItem, isNeutral: isNeutral }, status === "completed" && (React.createElement(CircledCheckSolidMedium, { color: isLastItem && !isNeutral ? colors.success.c70 : colors.primary.c80, size: 20 }))),
|
|
72
72
|
React.createElement(BottomSegmentSvg, { status: status, hidden: isLastItem })));
|
|
73
73
|
}
|
|
74
74
|
TimelineIndicator.topSegmentDefaultHeight = topSegmentDefaultHeight;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { ScrollView } from "react-native";
|
|
2
3
|
import { Item } from "../types";
|
|
4
|
+
export interface TimelineStep extends Item {
|
|
5
|
+
isNeutral?: boolean;
|
|
6
|
+
}
|
|
3
7
|
export type Props = {
|
|
4
|
-
item:
|
|
8
|
+
item: TimelineStep;
|
|
5
9
|
formatEstimatedTime?: (_: number) => string;
|
|
6
10
|
isFirstItem?: boolean;
|
|
7
11
|
isLastItem?: boolean;
|
|
8
12
|
setActiveIndex?: (_: number) => void;
|
|
9
13
|
index: number;
|
|
10
14
|
withExtraMarginOnActiveStep?: boolean;
|
|
15
|
+
parentScrollRef?: null | React.RefObject<ScrollView>;
|
|
11
16
|
};
|
|
12
|
-
export default function TimelineItem({ item, formatEstimatedTime, isFirstItem, isLastItem, setActiveIndex, index, withExtraMarginOnActiveStep, }: Props): React.JSX.Element;
|
|
17
|
+
export default function TimelineItem({ item, formatEstimatedTime, isFirstItem, isLastItem, setActiveIndex, index, withExtraMarginOnActiveStep, parentScrollRef, }: Props): React.JSX.Element;
|
|
13
18
|
//# sourceMappingURL=TimelineItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TimelineItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/Layout/List/VerticalTimeline/TimelineItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TimelineItem.d.ts","sourceRoot":"","sources":["../../../../../src/components/Layout/List/VerticalTimeline/TimelineItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAgC,UAAU,EAAE,MAAM,cAAc,CAAC;AAKxE,OAAO,EAAE,IAAI,EAAc,MAAM,UAAU,CAAC;AAM5C,MAAM,WAAW,YAAa,SAAQ,IAAI;IACxC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,MAAM,KAAK,GAAG;IAClB,IAAI,EAAE,YAAY,CAAC;IACnB,mBAAmB,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC,eAAe,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;CACtD,CAAC;AAoCF,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EACnC,IAAI,EACJ,mBAAmB,EACnB,WAAW,EACX,UAAU,EACV,cAAc,EACd,KAAK,EACL,2BAA2B,EAC3B,eAAsB,GACvB,EAAE,KAAK,qBA2FP"}
|
|
@@ -15,11 +15,11 @@ const getContainerBackground = (theme, status) => {
|
|
|
15
15
|
}
|
|
16
16
|
return "transparent";
|
|
17
17
|
};
|
|
18
|
-
const getContainerBorder = (theme, status, isLastItem) => {
|
|
18
|
+
const getContainerBorder = (theme, status, isLastItem, isNeutral) => {
|
|
19
19
|
if (status === "completed") {
|
|
20
20
|
return "transparent";
|
|
21
21
|
}
|
|
22
|
-
else if (isLastItem && status === "active") {
|
|
22
|
+
else if (isLastItem && !isNeutral && status === "active") {
|
|
23
23
|
return theme.colors.success.c70;
|
|
24
24
|
}
|
|
25
25
|
else if (status === "active") {
|
|
@@ -31,11 +31,11 @@ const Container = styled(Flex) `
|
|
|
31
31
|
flex: 1;
|
|
32
32
|
border-radius: ${(p) => p.theme.radii[2]}px;
|
|
33
33
|
background: ${(p) => getContainerBackground(p.theme, p.status)};
|
|
34
|
-
border: 1px solid ${(p) => getContainerBorder(p.theme, p.status, p.isLastItem)};
|
|
34
|
+
border: 1px solid ${(p) => getContainerBorder(p.theme, p.status, p.isLastItem, p.isNeutral)};
|
|
35
35
|
padding: 20px 16px;
|
|
36
36
|
overflow: hidden;
|
|
37
37
|
`;
|
|
38
|
-
export default function TimelineItem({ item, formatEstimatedTime, isFirstItem, isLastItem, setActiveIndex, index, withExtraMarginOnActiveStep, }) {
|
|
38
|
+
export default function TimelineItem({ item, formatEstimatedTime, isFirstItem, isLastItem, setActiveIndex, index, withExtraMarginOnActiveStep, parentScrollRef = null, }) {
|
|
39
39
|
const theme = useTheme();
|
|
40
40
|
/**
|
|
41
41
|
* Having an initial value of null will prevent having "height: 0" before the
|
|
@@ -48,7 +48,8 @@ export default function TimelineItem({ item, formatEstimatedTime, isFirstItem, i
|
|
|
48
48
|
const sharedHeight = useSharedValue(null);
|
|
49
49
|
const handleLayout = useCallback(({ nativeEvent: { layout } }) => {
|
|
50
50
|
sharedHeight.value = withTiming(layout.height, { duration: 300 });
|
|
51
|
-
|
|
51
|
+
parentScrollRef?.current?.scrollToEnd({ animated: true });
|
|
52
|
+
}, [sharedHeight, parentScrollRef]);
|
|
52
53
|
const animatedStyle = useAnimatedStyle(() => ({
|
|
53
54
|
/**
|
|
54
55
|
* If it's null the component still renders normally at its full height
|
|
@@ -61,10 +62,10 @@ export default function TimelineItem({ item, formatEstimatedTime, isFirstItem, i
|
|
|
61
62
|
}, [setActiveIndex, index]);
|
|
62
63
|
return (React.createElement(Pressable, { onPress: handlePress },
|
|
63
64
|
React.createElement(Flex, { flexDirection: "row" },
|
|
64
|
-
React.createElement(TimelineIndicator, { status: item.status, isFirstItem: isFirstItem, isLastItem: isLastItem, mr: 4, topHeight: withExtraMarginOnActiveStep && !isFirstItem && item.status === "active"
|
|
65
|
+
React.createElement(TimelineIndicator, { status: item.status, isFirstItem: isFirstItem, isLastItem: isLastItem, isNeutral: item.isNeutral, mr: 4, topHeight: withExtraMarginOnActiveStep && !isFirstItem && item.status === "active"
|
|
65
66
|
? TimelineIndicator.topSegmentDefaultHeight + theme.space[4]
|
|
66
67
|
: undefined }),
|
|
67
|
-
React.createElement(Container, { status: item.status, isLastItem: isLastItem, mt: withExtraMarginOnActiveStep && !isFirstItem && item.status === "active" ? 4 : 0, mb: withExtraMarginOnActiveStep && !isLastItem && item.status === "active" ? 4 : 0 },
|
|
68
|
+
React.createElement(Container, { status: item.status, isLastItem: isLastItem, isNeutral: item.isNeutral, mt: withExtraMarginOnActiveStep && !isFirstItem && item.status === "active" ? 4 : 0, mb: withExtraMarginOnActiveStep && !isLastItem && item.status === "active" ? 4 : 0 },
|
|
68
69
|
item.status === "active" ? item.background : null,
|
|
69
70
|
React.createElement(Flex, { flexDirection: "row", justifyContent: "space-between" },
|
|
70
71
|
React.createElement(Text, { variant: "body", fontWeight: item.status === "active" ? "semiBold" : "medium", flexShrink: 1, color: item.status === "completed" && isLastItem
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
2
|
+
import { ScrollView, StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import { TimelineStep } from "./TimelineItem";
|
|
3
4
|
import { BaseTextProps } from "../../../Text";
|
|
4
5
|
import { BaseStyledProps } from "src/components/styled";
|
|
5
|
-
import { Item } from "../types";
|
|
6
6
|
export type Props = BaseStyledProps & {
|
|
7
|
-
steps?:
|
|
7
|
+
steps?: TimelineStep[];
|
|
8
8
|
formatEstimatedTime?: (_: number) => string;
|
|
9
9
|
setActiveIndex?: (arg0: number) => void;
|
|
10
10
|
header?: React.ReactNode;
|
|
@@ -14,8 +14,9 @@ export type Props = BaseStyledProps & {
|
|
|
14
14
|
* */
|
|
15
15
|
autoScroll?: boolean;
|
|
16
16
|
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
17
|
+
parentScrollRef?: null | React.RefObject<ScrollView>;
|
|
17
18
|
};
|
|
18
|
-
declare function VerticalTimeline({ steps, formatEstimatedTime, setActiveIndex, header, autoScroll, contentContainerStyle, ...props }: Props): React.JSX.Element;
|
|
19
|
+
declare function VerticalTimeline({ steps, formatEstimatedTime, setActiveIndex, header, autoScroll, contentContainerStyle, parentScrollRef, ...props }: Props): React.JSX.Element;
|
|
19
20
|
declare namespace VerticalTimeline {
|
|
20
21
|
var BodyText: React.FC<BaseTextProps>;
|
|
21
22
|
var SubtitleText: React.FC<BaseTextProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Layout/List/VerticalTimeline/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Layout/List/VerticalTimeline/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AACnD,OAAO,EAEL,UAAU,EAGV,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,OAAqB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAa,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAGxD,MAAM,MAAM,KAAK,GAAG,eAAe,GAAG;IACpC,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB,mBAAmB,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;SAGK;IACL,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qBAAqB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAI7C,eAAe,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;CACtD,CAAC;AAEF,iBAAwB,gBAAgB,CAAC,EACvC,KAAK,EACL,mBAAmB,EACnB,cAAc,EACd,MAAM,EACN,UAAiB,EACjB,qBAAqB,EACrB,eAAsB,EACtB,GAAG,KAAK,EACT,EAAE,KAAK,qBAuCP;kBAhDuB,gBAAgB;;;;;eAAhB,gBAAgB"}
|
|
@@ -4,7 +4,7 @@ import TimelineItem from "./TimelineItem";
|
|
|
4
4
|
import Flex from "../../Flex";
|
|
5
5
|
import Text from "../../../Text";
|
|
6
6
|
import { ItemStatus } from "../types";
|
|
7
|
-
export default function VerticalTimeline({ steps, formatEstimatedTime, setActiveIndex, header, autoScroll = true, contentContainerStyle, ...props }) {
|
|
7
|
+
export default function VerticalTimeline({ steps, formatEstimatedTime, setActiveIndex, header, autoScroll = true, contentContainerStyle, parentScrollRef = null, ...props }) {
|
|
8
8
|
const scrollViewRef = useRef(null);
|
|
9
9
|
const stepsContainerLayout = useRef();
|
|
10
10
|
const onStepsContainerLayout = useCallback((evt) => {
|
|
@@ -19,7 +19,7 @@ export default function VerticalTimeline({ steps, formatEstimatedTime, setActive
|
|
|
19
19
|
return (React.createElement(ScrollView, { ref: scrollViewRef, onLayout: onStepsContainerLayout, contentContainerStyle: contentContainerStyle },
|
|
20
20
|
header,
|
|
21
21
|
React.createElement(Flex, { ...props, onLayout: onStepsContainerLayout, flexDirection: "column" }, steps?.map((step, index) => (React.createElement(View, { onLayout: autoScroll && step.status === "active" ? onActiveStepLayout : undefined },
|
|
22
|
-
React.createElement(TimelineItem, { key: step.title, item: step, formatEstimatedTime: formatEstimatedTime, isFirstItem: index === 0, isLastItem: index === steps.length - 1, setActiveIndex: setActiveIndex, index: index })))))));
|
|
22
|
+
React.createElement(TimelineItem, { key: step.title, item: step, formatEstimatedTime: formatEstimatedTime, isFirstItem: index === 0, isLastItem: index === steps.length - 1, setActiveIndex: setActiveIndex, index: index, parentScrollRef: parentScrollRef })))))));
|
|
23
23
|
}
|
|
24
24
|
const SubtitleText = (props) => (React.createElement(Text, { variant: "body", fontWeight: "semiBold", color: "neutral.c100", mb: 3, ...props }));
|
|
25
25
|
const BodyText = (props) => (React.createElement(Text, { variant: "bodyLineHeight", fontWeight: "medium", color: "neutral.c80", ...props }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,
|
|
1
|
+
{"version":3,"file":"Input.d.ts","sourceRoot":"","sources":["../../../../src/pre-ldls/components/Input/Input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAAwB,SAAS,EAAiC,MAAM,cAAc,CAAC;AAI9F,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAyCF,eAAO,MAAM,KAAK;uBAtCE,SAAS,KAAK,WAAW;mCAsE5C,CAAC"}
|