@ledgerhq/lumen-ui-rnative 0.0.71 → 0.0.73
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/preview-head.html +1 -0
- package/dist/package.json +3 -3
- package/dist/src/i18n/locales/de.json +3 -0
- package/dist/src/i18n/locales/en.json +3 -0
- package/dist/src/i18n/locales/es.json +3 -0
- package/dist/src/i18n/locales/fr.json +3 -0
- package/dist/src/i18n/locales/ja.json +3 -0
- package/dist/src/i18n/locales/ko.json +3 -0
- package/dist/src/i18n/locales/pt.json +3 -0
- package/dist/src/i18n/locales/ru.json +3 -0
- package/dist/src/i18n/locales/th.json +3 -0
- package/dist/src/i18n/locales/tr.json +3 -0
- package/dist/src/i18n/locales/zh.json +3 -0
- package/dist/src/lib/Components/BottomSheet/BottomSheet.stories.d.ts +4 -0
- package/dist/src/lib/Components/BottomSheet/BottomSheet.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/BottomSheet/BottomSheet.stories.js +4 -0
- package/dist/src/lib/Components/Icon/Icon.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/Icon.js +1 -0
- package/dist/src/lib/Components/Icon/Icon.stories.js +1 -1
- package/dist/src/lib/Components/Icon/types.d.ts +1 -1
- package/dist/src/lib/Components/Icon/types.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/InteractiveIcon.js +10 -2
- package/dist/src/lib/Components/InteractiveIcon/types.d.ts +17 -0
- package/dist/src/lib/Components/InteractiveIcon/types.d.ts.map +1 -1
- package/dist/src/lib/Components/InteractiveIcon/types.js +24 -1
- package/dist/src/lib/Components/Skeleton/Skeleton.d.ts +21 -0
- package/dist/src/lib/Components/Skeleton/Skeleton.d.ts.map +1 -0
- package/dist/src/lib/Components/Skeleton/Skeleton.js +81 -0
- package/dist/src/lib/Components/Skeleton/Skeleton.stories.d.ts +11 -0
- package/dist/src/lib/Components/Skeleton/Skeleton.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Skeleton/Skeleton.stories.js +49 -0
- package/dist/src/lib/Components/Skeleton/index.d.ts +3 -0
- package/dist/src/lib/Components/Skeleton/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Skeleton/index.js +2 -0
- package/dist/src/lib/Components/Skeleton/types.d.ts +10 -0
- package/dist/src/lib/Components/Skeleton/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Skeleton/types.js +1 -0
- package/dist/src/lib/Components/Stepper/Stepper.d.ts +16 -0
- package/dist/src/lib/Components/Stepper/Stepper.d.ts.map +1 -0
- package/dist/src/lib/Components/Stepper/Stepper.js +74 -0
- package/dist/src/lib/Components/Stepper/Stepper.stories.d.ts +9 -0
- package/dist/src/lib/Components/Stepper/Stepper.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Stepper/Stepper.stories.js +35 -0
- package/dist/src/lib/Components/Stepper/index.d.ts +3 -0
- package/dist/src/lib/Components/Stepper/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Stepper/index.js +2 -0
- package/dist/src/lib/Components/Stepper/types.d.ts +21 -0
- package/dist/src/lib/Components/Stepper/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Stepper/types.js +1 -0
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.js +0 -2
- package/dist/src/lib/Components/index.d.ts +3 -0
- package/dist/src/lib/Components/index.d.ts.map +1 -1
- package/dist/src/lib/Components/index.js +3 -0
- package/package.json +3 -3
- package/src/i18n/locales/de.json +3 -0
- package/src/i18n/locales/en.json +3 -0
- package/src/i18n/locales/es.json +3 -0
- package/src/i18n/locales/fr.json +3 -0
- package/src/i18n/locales/ja.json +3 -0
- package/src/i18n/locales/ko.json +3 -0
- package/src/i18n/locales/pt.json +3 -0
- package/src/i18n/locales/ru.json +3 -0
- package/src/i18n/locales/th.json +3 -0
- package/src/i18n/locales/tr.json +3 -0
- package/src/i18n/locales/zh.json +3 -0
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +4 -0
- package/src/lib/Components/Icon/Icon.stories.tsx +1 -1
- package/src/lib/Components/Icon/Icon.test.tsx +1 -1
- package/src/lib/Components/Icon/Icon.tsx +1 -0
- package/src/lib/Components/Icon/types.ts +1 -1
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.tsx +15 -2
- package/src/lib/Components/InteractiveIcon/types.ts +47 -0
- package/src/lib/Components/Skeleton/Skeleton.mdx +200 -0
- package/src/lib/Components/Skeleton/Skeleton.stories.tsx +89 -0
- package/src/lib/Components/Skeleton/Skeleton.test.tsx +54 -0
- package/src/lib/Components/Skeleton/Skeleton.tsx +137 -0
- package/src/lib/Components/Skeleton/index.ts +2 -0
- package/src/lib/Components/Skeleton/types.ts +10 -0
- package/src/lib/Components/Stepper/Stepper.mdx +217 -0
- package/src/lib/Components/Stepper/Stepper.stories.tsx +62 -0
- package/src/lib/Components/Stepper/Stepper.test.tsx +132 -0
- package/src/lib/Components/Stepper/Stepper.tsx +159 -0
- package/src/lib/Components/Stepper/index.ts +2 -0
- package/src/lib/Components/Stepper/types.ts +21 -0
- package/src/lib/Components/Utility/Gradient/LinearGradient/LinearGradient.stories.tsx +0 -2
- package/src/lib/Components/index.ts +3 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { getStepperCalculations } from '@ledgerhq/lumen-utils-shared';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
import { Animated, Easing } from 'react-native';
|
|
4
|
+
import Svg, { Circle } from 'react-native-svg';
|
|
5
|
+
import { useCommonTranslation } from '../../../i18n';
|
|
6
|
+
import { useTheme } from '../../../styles';
|
|
7
|
+
import { Box } from '../Utility/Box';
|
|
8
|
+
import { Text } from '../Utility/Text';
|
|
9
|
+
import { StepperProps } from './types';
|
|
10
|
+
|
|
11
|
+
const SIZE = 48;
|
|
12
|
+
const STROKE_WIDTH = 4;
|
|
13
|
+
|
|
14
|
+
const AnimatedCircle = Animated.createAnimatedComponent(Circle);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A circular stepper component showing progress as current step out of total steps.
|
|
18
|
+
* Renders a track arc with a progress arc and a center label.
|
|
19
|
+
*
|
|
20
|
+
* @see [Figma – Stepper](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=11977-94&m=dev)
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* <Stepper currentStep={1} totalSteps={4} />
|
|
24
|
+
* <Stepper currentStep={0} totalSteps={9} disabled /> // Shows minimal dot, disabled style
|
|
25
|
+
*/
|
|
26
|
+
export const Stepper = ({
|
|
27
|
+
lx = {},
|
|
28
|
+
currentStep,
|
|
29
|
+
totalSteps,
|
|
30
|
+
disabled = false,
|
|
31
|
+
label,
|
|
32
|
+
ref,
|
|
33
|
+
...props
|
|
34
|
+
}: StepperProps) => {
|
|
35
|
+
const { t } = useCommonTranslation();
|
|
36
|
+
const { theme } = useTheme();
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
displayLabel,
|
|
40
|
+
r,
|
|
41
|
+
cx,
|
|
42
|
+
cy,
|
|
43
|
+
trackDashArray,
|
|
44
|
+
progressDashArray,
|
|
45
|
+
progressDashOffset,
|
|
46
|
+
} = getStepperCalculations({
|
|
47
|
+
currentStep,
|
|
48
|
+
totalSteps,
|
|
49
|
+
size: SIZE,
|
|
50
|
+
label,
|
|
51
|
+
strokeWidth: STROKE_WIDTH,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const animatedOffset = useRef(new Animated.Value(progressDashOffset)).current;
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
const animation = Animated.timing(animatedOffset, {
|
|
58
|
+
toValue: progressDashOffset,
|
|
59
|
+
duration: 300,
|
|
60
|
+
easing: Easing.inOut(Easing.ease),
|
|
61
|
+
useNativeDriver: false,
|
|
62
|
+
});
|
|
63
|
+
animation.start();
|
|
64
|
+
return () => animation.stop();
|
|
65
|
+
}, [progressDashOffset, animatedOffset]);
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<Box
|
|
69
|
+
ref={ref}
|
|
70
|
+
accessibilityRole='progressbar'
|
|
71
|
+
accessibilityValue={{
|
|
72
|
+
now: currentStep,
|
|
73
|
+
min: 1,
|
|
74
|
+
max: totalSteps,
|
|
75
|
+
text: displayLabel,
|
|
76
|
+
}}
|
|
77
|
+
accessibilityLabel={
|
|
78
|
+
label ??
|
|
79
|
+
t('components.stepper.progressAriaLabel', {
|
|
80
|
+
currentStep: Math.min(Math.max(currentStep, 0), totalSteps),
|
|
81
|
+
totalSteps,
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
lx={{
|
|
85
|
+
width: 's48',
|
|
86
|
+
height: 's48',
|
|
87
|
+
flexShrink: 0,
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
justifyContent: 'center',
|
|
90
|
+
borderRadius: 'full',
|
|
91
|
+
...lx,
|
|
92
|
+
}}
|
|
93
|
+
{...props}
|
|
94
|
+
>
|
|
95
|
+
<Svg
|
|
96
|
+
width={SIZE}
|
|
97
|
+
height={SIZE}
|
|
98
|
+
viewBox={`0 0 ${SIZE} ${SIZE}`}
|
|
99
|
+
style={{ transform: [{ rotate: '135deg' }] }}
|
|
100
|
+
>
|
|
101
|
+
<Circle
|
|
102
|
+
cx={cx}
|
|
103
|
+
cy={cy}
|
|
104
|
+
r={r}
|
|
105
|
+
fill='none'
|
|
106
|
+
stroke={theme.colors.border.mutedSubtle}
|
|
107
|
+
strokeLinecap='round'
|
|
108
|
+
strokeWidth={STROKE_WIDTH}
|
|
109
|
+
strokeDasharray={trackDashArray}
|
|
110
|
+
strokeDashoffset={0}
|
|
111
|
+
/>
|
|
112
|
+
<AnimatedCircle
|
|
113
|
+
cx={cx}
|
|
114
|
+
cy={cy}
|
|
115
|
+
r={r}
|
|
116
|
+
fill='none'
|
|
117
|
+
stroke={
|
|
118
|
+
disabled
|
|
119
|
+
? theme.colors.border.mutedSubtleHover
|
|
120
|
+
: theme.colors.border.active
|
|
121
|
+
}
|
|
122
|
+
strokeLinecap='round'
|
|
123
|
+
strokeWidth={STROKE_WIDTH}
|
|
124
|
+
strokeDasharray={progressDashArray}
|
|
125
|
+
strokeDashoffset={animatedOffset}
|
|
126
|
+
/>
|
|
127
|
+
</Svg>
|
|
128
|
+
<Box
|
|
129
|
+
lx={{
|
|
130
|
+
position: 'absolute',
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
justifyContent: 'center',
|
|
133
|
+
flexDirection: 'row',
|
|
134
|
+
top: 's0',
|
|
135
|
+
left: 's0',
|
|
136
|
+
right: 's0',
|
|
137
|
+
bottom: 's0',
|
|
138
|
+
}}
|
|
139
|
+
>
|
|
140
|
+
{label ? (
|
|
141
|
+
<Text typography='body2SemiBold' lx={{ color: 'base' }}>
|
|
142
|
+
{label}
|
|
143
|
+
</Text>
|
|
144
|
+
) : (
|
|
145
|
+
<>
|
|
146
|
+
<Text typography='body1SemiBold' lx={{ color: 'base' }}>
|
|
147
|
+
{Math.min(Math.max(currentStep, 0), totalSteps)}
|
|
148
|
+
</Text>
|
|
149
|
+
<Text typography='body2SemiBold' lx={{ color: 'muted' }}>
|
|
150
|
+
/{totalSteps}
|
|
151
|
+
</Text>
|
|
152
|
+
</>
|
|
153
|
+
)}
|
|
154
|
+
</Box>
|
|
155
|
+
</Box>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
Stepper.displayName = 'Stepper';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StyledViewProps } from '../../../styles';
|
|
2
|
+
|
|
3
|
+
export type StepperProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Current step number (1-based). Use 0 or negative to show minimal dot (before starting).
|
|
6
|
+
*/
|
|
7
|
+
currentStep: number;
|
|
8
|
+
/**
|
|
9
|
+
* Total number of steps.
|
|
10
|
+
*/
|
|
11
|
+
totalSteps: number;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the stepper is disabled. Changes the progress arc to a muted style.
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Optional custom label. Defaults to "{currentStep}/{totalSteps}".
|
|
19
|
+
*/
|
|
20
|
+
label?: string;
|
|
21
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
@@ -17,7 +17,10 @@ export * from './NavBar';
|
|
|
17
17
|
export * from './PageIndicator';
|
|
18
18
|
export * from './SearchInput';
|
|
19
19
|
export * from './Select';
|
|
20
|
+
export * from './Skeleton';
|
|
21
|
+
export * from './Spinner';
|
|
20
22
|
export * from './Spot';
|
|
23
|
+
export * from './Stepper';
|
|
21
24
|
export * from './Subheader';
|
|
22
25
|
export * from './Switch';
|
|
23
26
|
export * from './TabBar';
|