@ledgerhq/lumen-ui-rnative 0.0.70 → 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.
Files changed (80) hide show
  1. package/.storybook/preview.tsx +4 -0
  2. package/dist/package.json +4 -4
  3. package/dist/src/index.d.ts +1 -0
  4. package/dist/src/index.d.ts.map +1 -1
  5. package/dist/src/index.js +1 -0
  6. package/dist/src/lib/Animations/Pulse/Pulse.d.ts +3 -0
  7. package/dist/src/lib/Animations/Pulse/Pulse.d.ts.map +1 -0
  8. package/dist/src/lib/Animations/Pulse/Pulse.js +46 -0
  9. package/dist/src/lib/Animations/Pulse/Pulse.stories.d.ts +9 -0
  10. package/dist/src/lib/Animations/Pulse/Pulse.stories.d.ts.map +1 -0
  11. package/dist/src/lib/Animations/Pulse/Pulse.stories.js +38 -0
  12. package/dist/src/lib/Animations/Pulse/index.d.ts +3 -0
  13. package/dist/src/lib/Animations/Pulse/index.d.ts.map +1 -0
  14. package/dist/src/lib/Animations/Pulse/index.js +2 -0
  15. package/dist/src/lib/Animations/Pulse/types.d.ts +18 -0
  16. package/dist/src/lib/Animations/Pulse/types.d.ts.map +1 -0
  17. package/dist/src/lib/Animations/Pulse/types.js +1 -0
  18. package/dist/src/lib/Animations/Spin/Spin.d.ts +3 -0
  19. package/dist/src/lib/Animations/Spin/Spin.d.ts.map +1 -0
  20. package/dist/src/lib/Animations/Spin/Spin.js +23 -0
  21. package/dist/src/lib/Animations/Spin/Spin.stories.d.ts +9 -0
  22. package/dist/src/lib/Animations/Spin/Spin.stories.d.ts.map +1 -0
  23. package/dist/src/lib/Animations/Spin/Spin.stories.js +27 -0
  24. package/dist/src/lib/Animations/Spin/index.d.ts +3 -0
  25. package/dist/src/lib/Animations/Spin/index.d.ts.map +1 -0
  26. package/dist/src/lib/Animations/Spin/index.js +2 -0
  27. package/dist/src/lib/Animations/Spin/types.d.ts +14 -0
  28. package/dist/src/lib/Animations/Spin/types.d.ts.map +1 -0
  29. package/dist/src/lib/Animations/Spin/types.js +1 -0
  30. package/dist/src/lib/Animations/index.d.ts +4 -0
  31. package/dist/src/lib/Animations/index.d.ts.map +1 -0
  32. package/dist/src/lib/Animations/index.js +3 -0
  33. package/dist/src/lib/Animations/types.d.ts +2 -0
  34. package/dist/src/lib/Animations/types.d.ts.map +1 -0
  35. package/dist/src/lib/Animations/types.js +1 -0
  36. package/dist/src/lib/Components/AmountDisplay/AmountDisplay.d.ts +5 -7
  37. package/dist/src/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
  38. package/dist/src/lib/Components/AmountDisplay/AmountDisplay.js +7 -6
  39. package/dist/src/lib/Components/AmountDisplay/AmountDisplay.stories.d.ts +1 -0
  40. package/dist/src/lib/Components/AmountDisplay/AmountDisplay.stories.d.ts.map +1 -1
  41. package/dist/src/lib/Components/AmountDisplay/AmountDisplay.stories.js +5 -0
  42. package/dist/src/lib/Components/AmountDisplay/types.d.ts +7 -1
  43. package/dist/src/lib/Components/AmountDisplay/types.d.ts.map +1 -1
  44. package/dist/src/lib/Components/Spinner/Spinner.d.ts.map +1 -1
  45. package/dist/src/lib/Components/Spinner/Spinner.js +2 -23
  46. package/dist/src/lib/Components/TabBar/TabBar.d.ts +1 -0
  47. package/dist/src/lib/Components/TabBar/TabBar.d.ts.map +1 -1
  48. package/dist/src/lib/Components/TabBar/TabBar.js +2 -1
  49. package/dist/src/lib/Components/TabBar/index.d.ts +1 -1
  50. package/dist/src/lib/Components/TabBar/index.d.ts.map +1 -1
  51. package/dist/src/lib/Components/TabBar/index.js +1 -1
  52. package/dist/src/lib/Components/TileButton/TileButton.d.ts +4 -3
  53. package/dist/src/lib/Components/TileButton/TileButton.d.ts.map +1 -1
  54. package/dist/src/lib/Components/TileButton/TileButton.js +3 -4
  55. package/dist/src/styles/types/factories.types.d.ts +1 -1
  56. package/dist/src/styles/types/factories.types.d.ts.map +1 -1
  57. package/package.json +4 -4
  58. package/src/index.ts +1 -0
  59. package/src/lib/Animations/Pulse/Pulse.mdx +86 -0
  60. package/src/lib/Animations/Pulse/Pulse.stories.tsx +90 -0
  61. package/src/lib/Animations/Pulse/Pulse.tsx +55 -0
  62. package/src/lib/Animations/Pulse/index.ts +2 -0
  63. package/src/lib/Animations/Pulse/types.ts +18 -0
  64. package/src/lib/Animations/Spin/Spin.mdx +85 -0
  65. package/src/lib/Animations/Spin/Spin.stories.tsx +72 -0
  66. package/src/lib/Animations/Spin/Spin.tsx +34 -0
  67. package/src/lib/Animations/Spin/index.ts +2 -0
  68. package/src/lib/Animations/Spin/types.ts +14 -0
  69. package/src/lib/Animations/index.ts +3 -0
  70. package/src/lib/Animations/types.ts +11 -0
  71. package/src/lib/Components/AmountDisplay/AmountDisplay.mdx +6 -0
  72. package/src/lib/Components/AmountDisplay/AmountDisplay.stories.tsx +12 -0
  73. package/src/lib/Components/AmountDisplay/AmountDisplay.test.tsx +13 -0
  74. package/src/lib/Components/AmountDisplay/AmountDisplay.tsx +39 -35
  75. package/src/lib/Components/AmountDisplay/types.ts +7 -1
  76. package/src/lib/Components/Spinner/Spinner.tsx +3 -35
  77. package/src/lib/Components/TabBar/TabBar.tsx +2 -1
  78. package/src/lib/Components/TabBar/index.ts +1 -1
  79. package/src/lib/Components/TileButton/TileButton.tsx +35 -44
  80. package/src/styles/types/factories.types.ts +1 -1
@@ -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 { RuntimeConstants } from '../../utils';
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
- <SpinAnimation>
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
- </SpinAnimation>
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: t.sizes.s56,
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 React, { FC, PropsWithChildren } from 'react';
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 = React.forwardRef<
78
- React.ElementRef<typeof Pressable>,
79
- TileButtonProps
80
- >(
81
- (
82
- {
83
- lx,
84
- style,
85
- icon: IconProp,
86
- children,
87
- disabled = false,
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
- return (
97
- <Pressable
98
- ref={ref}
99
- lx={lx}
100
- style={StyleSheet.flatten([style, rootStyles.root])}
101
- disabled={disabled}
102
- accessibilityRole='button'
103
- accessibilityState={{ disabled }}
104
- {...props}
105
- >
106
- {({ pressed }) => (
107
- <TileButtonContent
108
- disabled={disabled}
109
- pressed={pressed}
110
- isFull={isFull}
111
- IconProp={IconProp}
112
- numberOfLines={numberOfLines}
113
- >
114
- {children}
115
- </TileButtonContent>
116
- )}
117
- </Pressable>
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;
@@ -1,4 +1,4 @@
1
- import { ComponentPropsWithRef } from 'react';
1
+ import type { ComponentPropsWithRef } from 'react';
2
2
  import {
3
3
  PressableProps,
4
4
  PressableStateCallbackType,