@ledgerhq/lumen-ui-rnative 0.0.69 → 0.0.71
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/.storybook/mocks/blur.tsx +1 -2
- package/.storybook/preview.tsx +4 -0
- package/dist/package.json +4 -4
- package/dist/src/index.d.ts +1 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +1 -0
- package/dist/src/lib/Animations/Pulse/Pulse.d.ts +3 -0
- package/dist/src/lib/Animations/Pulse/Pulse.d.ts.map +1 -0
- package/dist/src/lib/Animations/Pulse/Pulse.js +46 -0
- package/dist/src/lib/Animations/Pulse/Pulse.stories.d.ts +9 -0
- package/dist/src/lib/Animations/Pulse/Pulse.stories.d.ts.map +1 -0
- package/dist/src/lib/Animations/Pulse/Pulse.stories.js +38 -0
- package/dist/src/lib/Animations/Pulse/index.d.ts +3 -0
- package/dist/src/lib/Animations/Pulse/index.d.ts.map +1 -0
- package/dist/src/lib/Animations/Pulse/index.js +2 -0
- package/dist/src/lib/Animations/Pulse/types.d.ts +18 -0
- package/dist/src/lib/Animations/Pulse/types.d.ts.map +1 -0
- package/dist/src/lib/Animations/Pulse/types.js +1 -0
- package/dist/src/lib/Animations/Spin/Spin.d.ts +3 -0
- package/dist/src/lib/Animations/Spin/Spin.d.ts.map +1 -0
- package/dist/src/lib/Animations/Spin/Spin.js +23 -0
- package/dist/src/lib/Animations/Spin/Spin.stories.d.ts +9 -0
- package/dist/src/lib/Animations/Spin/Spin.stories.d.ts.map +1 -0
- package/dist/src/lib/Animations/Spin/Spin.stories.js +27 -0
- package/dist/src/lib/Animations/Spin/index.d.ts +3 -0
- package/dist/src/lib/Animations/Spin/index.d.ts.map +1 -0
- package/dist/src/lib/Animations/Spin/index.js +2 -0
- package/dist/src/lib/Animations/Spin/types.d.ts +14 -0
- package/dist/src/lib/Animations/Spin/types.d.ts.map +1 -0
- package/dist/src/lib/Animations/Spin/types.js +1 -0
- package/dist/src/lib/Animations/index.d.ts +4 -0
- package/dist/src/lib/Animations/index.d.ts.map +1 -0
- package/dist/src/lib/Animations/index.js +3 -0
- package/dist/src/lib/Animations/types.d.ts +2 -0
- package/dist/src/lib/Animations/types.d.ts.map +1 -0
- package/dist/src/lib/Animations/types.js +1 -0
- package/dist/src/lib/Components/AmountDisplay/AmountDisplay.d.ts +5 -7
- package/dist/src/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
- package/dist/src/lib/Components/AmountDisplay/AmountDisplay.js +7 -6
- package/dist/src/lib/Components/AmountDisplay/AmountDisplay.stories.d.ts +1 -0
- package/dist/src/lib/Components/AmountDisplay/AmountDisplay.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/AmountDisplay/AmountDisplay.stories.js +5 -0
- package/dist/src/lib/Components/AmountDisplay/types.d.ts +7 -1
- package/dist/src/lib/Components/AmountDisplay/types.d.ts.map +1 -1
- package/dist/src/lib/Components/CardButton/CardButton.js +3 -3
- package/dist/src/lib/Components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/src/lib/Components/Spinner/Spinner.js +2 -23
- package/dist/src/lib/Components/TabBar/TabBar.d.ts +1 -0
- package/dist/src/lib/Components/TabBar/TabBar.d.ts.map +1 -1
- package/dist/src/lib/Components/TabBar/TabBar.js +2 -1
- package/dist/src/lib/Components/TabBar/index.d.ts +1 -1
- package/dist/src/lib/Components/TabBar/index.d.ts.map +1 -1
- package/dist/src/lib/Components/TabBar/index.js +1 -1
- package/dist/src/lib/Components/TileButton/TileButton.d.ts +4 -3
- package/dist/src/lib/Components/TileButton/TileButton.d.ts.map +1 -1
- package/dist/src/lib/Components/TileButton/TileButton.js +3 -4
- package/dist/src/styles/types/factories.types.d.ts +1 -1
- package/dist/src/styles/types/factories.types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -0
- package/src/lib/Animations/Pulse/Pulse.mdx +86 -0
- package/src/lib/Animations/Pulse/Pulse.stories.tsx +90 -0
- package/src/lib/Animations/Pulse/Pulse.tsx +55 -0
- package/src/lib/Animations/Pulse/index.ts +2 -0
- package/src/lib/Animations/Pulse/types.ts +18 -0
- package/src/lib/Animations/Spin/Spin.mdx +85 -0
- package/src/lib/Animations/Spin/Spin.stories.tsx +72 -0
- package/src/lib/Animations/Spin/Spin.tsx +34 -0
- package/src/lib/Animations/Spin/index.ts +2 -0
- package/src/lib/Animations/Spin/types.ts +14 -0
- package/src/lib/Animations/index.ts +3 -0
- package/src/lib/Animations/types.ts +11 -0
- package/src/lib/Components/AmountDisplay/AmountDisplay.mdx +6 -0
- package/src/lib/Components/AmountDisplay/AmountDisplay.stories.tsx +12 -0
- package/src/lib/Components/AmountDisplay/AmountDisplay.test.tsx +13 -0
- package/src/lib/Components/AmountDisplay/AmountDisplay.tsx +39 -35
- package/src/lib/Components/AmountDisplay/types.ts +7 -1
- package/src/lib/Components/CardButton/CardButton.tsx +3 -3
- package/src/lib/Components/Spinner/Spinner.tsx +3 -35
- package/src/lib/Components/TabBar/TabBar.tsx +2 -1
- package/src/lib/Components/TabBar/index.ts +1 -1
- package/src/lib/Components/TileButton/TileButton.tsx +35 -44
- package/src/styles/types/factories.types.ts +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { View, Text, StyleSheet } from 'react-native';
|
|
1
|
+
import { View, Text } from 'react-native';
|
|
3
2
|
import { useStyleSheet } from '../../../styles';
|
|
4
|
-
import {
|
|
3
|
+
import { Pulse } from '../../Animations/Pulse';
|
|
4
|
+
import { Box } from '../Utility';
|
|
5
5
|
import { AmountDisplayProps } from './types';
|
|
6
6
|
|
|
7
7
|
const useStyles = () => {
|
|
@@ -71,39 +71,43 @@ const useStyles = () => {
|
|
|
71
71
|
* <AmountDisplay value={1234.56} formatter={usdFormatter} hidden={true} />
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
74
|
-
export const AmountDisplay =
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
export const AmountDisplay = ({
|
|
75
|
+
value,
|
|
76
|
+
formatter,
|
|
77
|
+
hidden = false,
|
|
78
|
+
loading = false,
|
|
79
|
+
...props
|
|
80
|
+
}: AmountDisplayProps) => {
|
|
81
|
+
const styles = useStyles();
|
|
82
|
+
const parts = formatter(value);
|
|
78
83
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
style={
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
return (
|
|
85
|
+
<Box {...props}>
|
|
86
|
+
<Pulse animate={loading}>
|
|
87
|
+
<View style={styles.container}>
|
|
88
|
+
{(parts.currencyPosition === undefined ||
|
|
89
|
+
parts.currencyPosition === 'start') && (
|
|
90
|
+
<Text style={[styles.currencyStartText, styles.spacingStart]}>
|
|
91
|
+
{parts.currencyText}
|
|
92
|
+
</Text>
|
|
93
|
+
)}
|
|
94
|
+
<Text style={styles.integerText}>
|
|
95
|
+
{hidden ? '••••' : parts.integerPart}
|
|
89
96
|
</Text>
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
{
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
);
|
|
106
|
-
},
|
|
107
|
-
);
|
|
97
|
+
{parts.decimalPart && !hidden && (
|
|
98
|
+
<Text style={styles.decimalText}>
|
|
99
|
+
{(parts.decimalSeparator || '.') + parts.decimalPart}
|
|
100
|
+
</Text>
|
|
101
|
+
)}
|
|
102
|
+
{parts.currencyPosition === 'end' && (
|
|
103
|
+
<Text style={[styles.currencyEndText, styles.spacingEnd]}>
|
|
104
|
+
{parts.currencyText}
|
|
105
|
+
</Text>
|
|
106
|
+
)}
|
|
107
|
+
</View>
|
|
108
|
+
</Pulse>
|
|
109
|
+
</Box>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
108
112
|
|
|
109
113
|
AmountDisplay.displayName = 'AmountDisplay';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ViewProps } from 'react-native';
|
|
2
|
+
import { StyledViewProps } from '../../../styles';
|
|
2
3
|
|
|
3
4
|
export type FormattedValue = {
|
|
4
5
|
/**
|
|
@@ -45,4 +46,9 @@ export type AmountDisplayProps = ViewProps & {
|
|
|
45
46
|
* @default false
|
|
46
47
|
*/
|
|
47
48
|
hidden?: boolean;
|
|
48
|
-
|
|
49
|
+
/**
|
|
50
|
+
* When true, applies a pulse animation to indicate the amount is being fetched or updated.
|
|
51
|
+
* @default false
|
|
52
|
+
*/
|
|
53
|
+
loading?: boolean;
|
|
54
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
@@ -67,7 +67,7 @@ const useStyles = ({
|
|
|
67
67
|
gap: t.spacings.s4,
|
|
68
68
|
},
|
|
69
69
|
title: StyleSheet.flatten([
|
|
70
|
-
t.typographies.
|
|
70
|
+
t.typographies.body2SemiBold,
|
|
71
71
|
{
|
|
72
72
|
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
73
73
|
minWidth: 0,
|
|
@@ -75,9 +75,9 @@ const useStyles = ({
|
|
|
75
75
|
},
|
|
76
76
|
]),
|
|
77
77
|
description: StyleSheet.flatten([
|
|
78
|
-
t.typographies.
|
|
78
|
+
t.typographies.body3,
|
|
79
79
|
{
|
|
80
|
-
color: disabled ? t.colors.text.disabled : t.colors.text.
|
|
80
|
+
color: disabled ? t.colors.text.disabled : t.colors.text.muted,
|
|
81
81
|
minWidth: 0,
|
|
82
82
|
},
|
|
83
83
|
]),
|
|
@@ -1,42 +1,10 @@
|
|
|
1
|
-
import { memo, useEffect, useRef, ReactNode } from 'react';
|
|
2
|
-
import { Animated, Easing } from 'react-native';
|
|
3
1
|
import Svg, { Path } from 'react-native-svg';
|
|
4
2
|
import { useCommonTranslation } from '../../../i18n';
|
|
5
3
|
import { LumenTextStyle, useResolveTextStyle, useTheme } from '../../../styles';
|
|
6
|
-
import {
|
|
4
|
+
import { Spin } from '../../Animations/Spin';
|
|
7
5
|
import { Box } from '../Utility';
|
|
8
6
|
import { SpinnerProps } from './types';
|
|
9
7
|
|
|
10
|
-
const SpinAnimation = memo(({ children }: { children: ReactNode }) => {
|
|
11
|
-
const spinValue = useRef(new Animated.Value(0)).current;
|
|
12
|
-
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
const animation = Animated.loop(
|
|
15
|
-
Animated.timing(spinValue, {
|
|
16
|
-
toValue: 1,
|
|
17
|
-
duration: 1000,
|
|
18
|
-
easing: Easing.linear,
|
|
19
|
-
useNativeDriver: RuntimeConstants.isNative,
|
|
20
|
-
}),
|
|
21
|
-
);
|
|
22
|
-
animation.start();
|
|
23
|
-
|
|
24
|
-
return () => animation.stop();
|
|
25
|
-
}, [spinValue]);
|
|
26
|
-
|
|
27
|
-
const spin = spinValue.interpolate({
|
|
28
|
-
inputRange: [0, 1],
|
|
29
|
-
outputRange: ['0deg', '360deg'],
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<Animated.View style={{ transform: [{ rotate: spin }] }}>
|
|
34
|
-
{children}
|
|
35
|
-
</Animated.View>
|
|
36
|
-
);
|
|
37
|
-
});
|
|
38
|
-
SpinAnimation.displayName = 'SpinAnimation';
|
|
39
|
-
|
|
40
8
|
/**
|
|
41
9
|
* A basic spinner component for loading states.
|
|
42
10
|
*
|
|
@@ -66,7 +34,7 @@ export const Spinner = ({
|
|
|
66
34
|
|
|
67
35
|
return (
|
|
68
36
|
<Box ref={ref} lx={{ flexShrink: 0, ...lx }} {...props}>
|
|
69
|
-
<
|
|
37
|
+
<Spin>
|
|
70
38
|
<Svg
|
|
71
39
|
width={size}
|
|
72
40
|
height={size}
|
|
@@ -81,7 +49,7 @@ export const Spinner = ({
|
|
|
81
49
|
strokeLinecap='round'
|
|
82
50
|
/>
|
|
83
51
|
</Svg>
|
|
84
|
-
</
|
|
52
|
+
</Spin>
|
|
85
53
|
</Box>
|
|
86
54
|
);
|
|
87
55
|
};
|
|
@@ -15,6 +15,7 @@ import { Box, Pressable } from '../Utility';
|
|
|
15
15
|
import { TabBarContextProvider, useTabBarContext } from './TabBarContext';
|
|
16
16
|
import { TabBarItemProps, TabBarProps } from './types';
|
|
17
17
|
|
|
18
|
+
export const TAB_BAR_HEIGHT = 56;
|
|
18
19
|
const PILL_INSET = 4;
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -239,7 +240,7 @@ const useStyles = () =>
|
|
|
239
240
|
useStyleSheet(
|
|
240
241
|
(t) => ({
|
|
241
242
|
container: {
|
|
242
|
-
height:
|
|
243
|
+
height: TAB_BAR_HEIGHT,
|
|
243
244
|
flexDirection: 'row',
|
|
244
245
|
justifyContent: 'center',
|
|
245
246
|
padding: t.spacings.s4,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { TabBar, TabBarItem } from './TabBar';
|
|
1
|
+
export { TabBar, TabBarItem, TAB_BAR_HEIGHT } from './TabBar';
|
|
2
2
|
export type { TabBarProps, TabBarItemProps } from './types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isTextChildren } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
-
import
|
|
2
|
+
import { FC, PropsWithChildren } from 'react';
|
|
3
3
|
import { StyleSheet, View } from 'react-native';
|
|
4
4
|
import { useStyleSheet } from '../../../styles';
|
|
5
5
|
import { IconSize } from '../Icon';
|
|
@@ -74,50 +74,41 @@ const useStyles = ({
|
|
|
74
74
|
* Settings
|
|
75
75
|
* </TileButton>
|
|
76
76
|
*/
|
|
77
|
-
export const TileButton =
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
isFull = false,
|
|
89
|
-
numberOfLines = 2,
|
|
90
|
-
...props
|
|
91
|
-
},
|
|
92
|
-
ref,
|
|
93
|
-
) => {
|
|
94
|
-
const rootStyles = useRootStyles({ isFull });
|
|
77
|
+
export const TileButton = ({
|
|
78
|
+
lx,
|
|
79
|
+
style,
|
|
80
|
+
icon: IconProp,
|
|
81
|
+
children,
|
|
82
|
+
disabled = false,
|
|
83
|
+
isFull = false,
|
|
84
|
+
numberOfLines = 2,
|
|
85
|
+
...props
|
|
86
|
+
}: TileButtonProps) => {
|
|
87
|
+
const rootStyles = useRootStyles({ isFull });
|
|
95
88
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
},
|
|
120
|
-
);
|
|
89
|
+
return (
|
|
90
|
+
<Pressable
|
|
91
|
+
lx={lx}
|
|
92
|
+
style={StyleSheet.flatten([style, rootStyles.root])}
|
|
93
|
+
disabled={disabled}
|
|
94
|
+
accessibilityRole='button'
|
|
95
|
+
accessibilityState={{ disabled }}
|
|
96
|
+
{...props}
|
|
97
|
+
>
|
|
98
|
+
{({ pressed }) => (
|
|
99
|
+
<TileButtonContent
|
|
100
|
+
disabled={disabled}
|
|
101
|
+
pressed={pressed}
|
|
102
|
+
isFull={isFull}
|
|
103
|
+
IconProp={IconProp}
|
|
104
|
+
numberOfLines={numberOfLines}
|
|
105
|
+
>
|
|
106
|
+
{children}
|
|
107
|
+
</TileButtonContent>
|
|
108
|
+
)}
|
|
109
|
+
</Pressable>
|
|
110
|
+
);
|
|
111
|
+
};
|
|
121
112
|
|
|
122
113
|
type TileButtonContentProps = PropsWithChildren<{
|
|
123
114
|
disabled: boolean;
|