@ledgerhq/lumen-ui-rnative 0.1.64 → 0.1.65

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 (136) hide show
  1. package/dist/module/lib/Components/core/CardButton/CardButton.js +2 -0
  2. package/dist/module/lib/Components/core/CardButton/CardButton.js.map +1 -1
  3. package/dist/module/lib/Components/core/CardButton/CardButton.mdx +4 -0
  4. package/dist/module/lib/Components/core/CardButton/CardButton.stories.js +1 -0
  5. package/dist/module/lib/Components/core/CardButton/CardButton.stories.js.map +1 -1
  6. package/dist/module/lib/Components/core/Link/Link.figma.js +2 -1
  7. package/dist/module/lib/Components/core/Link/Link.figma.js.map +1 -1
  8. package/dist/module/lib/Components/core/Link/Link.js +5 -3
  9. package/dist/module/lib/Components/core/Link/Link.js.map +1 -1
  10. package/dist/module/lib/Components/core/Link/Link.mdx +3 -2
  11. package/dist/module/lib/Components/core/Link/Link.stories.js +4 -1
  12. package/dist/module/lib/Components/core/Link/Link.stories.js.map +1 -1
  13. package/dist/module/lib/Components/core/Link/Link.test.js +2 -2
  14. package/dist/module/lib/Components/core/Link/Link.test.js.map +1 -1
  15. package/dist/module/lib/Components/core/Stepper/Stepper.js +76 -30
  16. package/dist/module/lib/Components/core/Stepper/Stepper.js.map +1 -1
  17. package/dist/module/lib/Components/core/Stepper/Stepper.mdx +37 -16
  18. package/dist/module/lib/Components/core/Stepper/Stepper.stories.js +102 -2
  19. package/dist/module/lib/Components/core/Stepper/Stepper.stories.js.map +1 -1
  20. package/dist/module/lib/Components/core/Stepper/Stepper.test.js +32 -1
  21. package/dist/module/lib/Components/core/Stepper/Stepper.test.js.map +1 -1
  22. package/dist/module/lib/Components/core/Timeline/Timeline.figma.js +83 -0
  23. package/dist/module/lib/Components/core/Timeline/Timeline.figma.js.map +1 -0
  24. package/dist/module/lib/Components/core/Timeline/Timeline.js +464 -0
  25. package/dist/module/lib/Components/core/Timeline/Timeline.js.map +1 -0
  26. package/dist/module/lib/Components/core/Timeline/Timeline.mdx +49 -0
  27. package/dist/module/lib/Components/core/Timeline/Timeline.stories.js +289 -0
  28. package/dist/module/lib/Components/core/Timeline/Timeline.stories.js.map +1 -0
  29. package/dist/module/lib/Components/core/Timeline/Timeline.test.js +234 -0
  30. package/dist/module/lib/Components/core/Timeline/Timeline.test.js.map +1 -0
  31. package/dist/module/lib/Components/core/Timeline/index.js +5 -0
  32. package/dist/module/lib/Components/core/Timeline/index.js.map +1 -0
  33. package/dist/module/lib/Components/core/Timeline/types.js +4 -0
  34. package/dist/module/lib/Components/core/Timeline/types.js.map +1 -0
  35. package/dist/module/lib/Components/core/Toast/Toast.figma.js +39 -0
  36. package/dist/module/lib/Components/core/Toast/Toast.figma.js.map +1 -0
  37. package/dist/module/lib/Components/core/Toast/Toast.js +138 -0
  38. package/dist/module/lib/Components/core/Toast/Toast.js.map +1 -0
  39. package/dist/module/lib/Components/core/Toast/Toast.mdx +203 -0
  40. package/dist/module/lib/Components/core/Toast/Toast.stories.js +238 -0
  41. package/dist/module/lib/Components/core/Toast/Toast.stories.js.map +1 -0
  42. package/dist/module/lib/Components/core/Toast/Toast.test.js +203 -0
  43. package/dist/module/lib/Components/core/Toast/Toast.test.js.map +1 -0
  44. package/dist/module/lib/Components/core/Toast/Toaster.js +147 -0
  45. package/dist/module/lib/Components/core/Toast/Toaster.js.map +1 -0
  46. package/dist/module/lib/Components/core/Toast/Toaster.test.js +732 -0
  47. package/dist/module/lib/Components/core/Toast/Toaster.test.js.map +1 -0
  48. package/dist/module/lib/Components/core/Toast/hooks/useToastAccessibility.js +70 -0
  49. package/dist/module/lib/Components/core/Toast/hooks/useToastAccessibility.js.map +1 -0
  50. package/dist/module/lib/Components/core/Toast/hooks/useToastCollapse.js +33 -0
  51. package/dist/module/lib/Components/core/Toast/hooks/useToastCollapse.js.map +1 -0
  52. package/dist/module/lib/Components/core/Toast/hooks/useToastGesture.js +224 -0
  53. package/dist/module/lib/Components/core/Toast/hooks/useToastGesture.js.map +1 -0
  54. package/dist/module/lib/Components/core/Toast/hooks/useToastMotion.js +82 -0
  55. package/dist/module/lib/Components/core/Toast/hooks/useToastMotion.js.map +1 -0
  56. package/dist/module/lib/Components/core/Toast/hooks/useToastViewportStyles.js +21 -0
  57. package/dist/module/lib/Components/core/Toast/hooks/useToastViewportStyles.js.map +1 -0
  58. package/dist/module/lib/Components/core/Toast/index.js +7 -0
  59. package/dist/module/lib/Components/core/Toast/index.js.map +1 -0
  60. package/dist/module/lib/Components/core/Toast/types.js +4 -0
  61. package/dist/module/lib/Components/core/Toast/types.js.map +1 -0
  62. package/dist/module/lib/Components/core/index.js +2 -0
  63. package/dist/module/lib/Components/core/index.js.map +1 -1
  64. package/dist/typescript/src/lib/Components/core/CardButton/CardButton.d.ts +2 -0
  65. package/dist/typescript/src/lib/Components/core/CardButton/CardButton.d.ts.map +1 -1
  66. package/dist/typescript/src/lib/Components/core/Link/Link.d.ts +1 -1
  67. package/dist/typescript/src/lib/Components/core/Link/Link.d.ts.map +1 -1
  68. package/dist/typescript/src/lib/Components/core/Link/types.d.ts +1 -1
  69. package/dist/typescript/src/lib/Components/core/Link/types.d.ts.map +1 -1
  70. package/dist/typescript/src/lib/Components/core/Stepper/Stepper.d.ts +4 -3
  71. package/dist/typescript/src/lib/Components/core/Stepper/Stepper.d.ts.map +1 -1
  72. package/dist/typescript/src/lib/Components/core/Stepper/types.d.ts +12 -2
  73. package/dist/typescript/src/lib/Components/core/Stepper/types.d.ts.map +1 -1
  74. package/dist/typescript/src/lib/Components/core/Timeline/Timeline.d.ts +56 -0
  75. package/dist/typescript/src/lib/Components/core/Timeline/Timeline.d.ts.map +1 -0
  76. package/dist/typescript/src/lib/Components/core/Timeline/index.d.ts +3 -0
  77. package/dist/typescript/src/lib/Components/core/Timeline/index.d.ts.map +1 -0
  78. package/dist/typescript/src/lib/Components/core/Timeline/types.d.ts +109 -0
  79. package/dist/typescript/src/lib/Components/core/Timeline/types.d.ts.map +1 -0
  80. package/dist/typescript/src/lib/Components/core/Toast/Toast.d.ts +24 -0
  81. package/dist/typescript/src/lib/Components/core/Toast/Toast.d.ts.map +1 -0
  82. package/dist/typescript/src/lib/Components/core/Toast/Toaster.d.ts +35 -0
  83. package/dist/typescript/src/lib/Components/core/Toast/Toaster.d.ts.map +1 -0
  84. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastAccessibility.d.ts +17 -0
  85. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastAccessibility.d.ts.map +1 -0
  86. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastCollapse.d.ts +19 -0
  87. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastCollapse.d.ts.map +1 -0
  88. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastGesture.d.ts +14 -0
  89. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastGesture.d.ts.map +1 -0
  90. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastMotion.d.ts +15 -0
  91. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastMotion.d.ts.map +1 -0
  92. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastViewportStyles.d.ts +21 -0
  93. package/dist/typescript/src/lib/Components/core/Toast/hooks/useToastViewportStyles.d.ts.map +1 -0
  94. package/dist/typescript/src/lib/Components/core/Toast/index.d.ts +5 -0
  95. package/dist/typescript/src/lib/Components/core/Toast/index.d.ts.map +1 -0
  96. package/dist/typescript/src/lib/Components/core/Toast/types.d.ts +75 -0
  97. package/dist/typescript/src/lib/Components/core/Toast/types.d.ts.map +1 -0
  98. package/dist/typescript/src/lib/Components/core/index.d.ts +2 -0
  99. package/dist/typescript/src/lib/Components/core/index.d.ts.map +1 -1
  100. package/package.json +3 -3
  101. package/src/lib/Components/core/CardButton/CardButton.mdx +4 -0
  102. package/src/lib/Components/core/CardButton/CardButton.stories.tsx +1 -0
  103. package/src/lib/Components/core/CardButton/CardButton.tsx +2 -0
  104. package/src/lib/Components/core/Link/Link.figma.tsx +1 -0
  105. package/src/lib/Components/core/Link/Link.mdx +3 -2
  106. package/src/lib/Components/core/Link/Link.stories.tsx +3 -2
  107. package/src/lib/Components/core/Link/Link.test.tsx +2 -0
  108. package/src/lib/Components/core/Link/Link.tsx +3 -1
  109. package/src/lib/Components/core/Link/types.ts +1 -1
  110. package/src/lib/Components/core/Stepper/Stepper.mdx +37 -16
  111. package/src/lib/Components/core/Stepper/Stepper.stories.tsx +50 -2
  112. package/src/lib/Components/core/Stepper/Stepper.test.tsx +29 -1
  113. package/src/lib/Components/core/Stepper/Stepper.tsx +73 -32
  114. package/src/lib/Components/core/Stepper/types.ts +12 -2
  115. package/src/lib/Components/core/Timeline/Timeline.figma.tsx +79 -0
  116. package/src/lib/Components/core/Timeline/Timeline.mdx +49 -0
  117. package/src/lib/Components/core/Timeline/Timeline.stories.tsx +250 -0
  118. package/src/lib/Components/core/Timeline/Timeline.test.tsx +275 -0
  119. package/src/lib/Components/core/Timeline/Timeline.tsx +576 -0
  120. package/src/lib/Components/core/Timeline/index.ts +2 -0
  121. package/src/lib/Components/core/Timeline/types.ts +124 -0
  122. package/src/lib/Components/core/Toast/Toast.figma.tsx +36 -0
  123. package/src/lib/Components/core/Toast/Toast.mdx +203 -0
  124. package/src/lib/Components/core/Toast/Toast.stories.tsx +260 -0
  125. package/src/lib/Components/core/Toast/Toast.test.tsx +181 -0
  126. package/src/lib/Components/core/Toast/Toast.tsx +163 -0
  127. package/src/lib/Components/core/Toast/Toaster.test.tsx +687 -0
  128. package/src/lib/Components/core/Toast/Toaster.tsx +157 -0
  129. package/src/lib/Components/core/Toast/hooks/useToastAccessibility.ts +82 -0
  130. package/src/lib/Components/core/Toast/hooks/useToastCollapse.ts +38 -0
  131. package/src/lib/Components/core/Toast/hooks/useToastGesture.ts +83 -0
  132. package/src/lib/Components/core/Toast/hooks/useToastMotion.ts +71 -0
  133. package/src/lib/Components/core/Toast/hooks/useToastViewportStyles.ts +45 -0
  134. package/src/lib/Components/core/Toast/index.ts +4 -0
  135. package/src/lib/Components/core/Toast/types.ts +94 -0
  136. package/src/lib/Components/core/index.ts +2 -0
@@ -19,7 +19,7 @@ const meta = {
19
19
  argTypes: {
20
20
  appearance: {
21
21
  control: 'select',
22
- options: ['base', 'accent'],
22
+ options: ['base', 'accent', 'gray'],
23
23
  description: 'The visual style appearance of the link',
24
24
  },
25
25
  size: {
@@ -55,7 +55,7 @@ const meta = {
55
55
 
56
56
  export default meta;
57
57
  type Story = StoryObj<typeof Link>;
58
- type LinkAppearance = 'base' | 'accent';
58
+ type LinkAppearance = 'base' | 'accent' | 'gray';
59
59
 
60
60
  export const Base: Story = {
61
61
  args: {
@@ -158,6 +158,7 @@ export const AppearanceShowcase: Story = {
158
158
  const appearances: { name: string; appearance: LinkAppearance }[] = [
159
159
  { name: 'Base', appearance: 'base' },
160
160
  { name: 'Accent', appearance: 'accent' },
161
+ { name: 'Gray', appearance: 'gray' },
161
162
  ];
162
163
 
163
164
  return (
@@ -74,6 +74,7 @@ describe('Link Component', () => {
74
74
  it.each([
75
75
  ['base', colors.text.base],
76
76
  ['accent', colors.text.interactive],
77
+ ['gray', colors.text.muted],
77
78
  ])(
78
79
  'should apply %s appearance with correct text color',
79
80
  (appearance, expectedColor) => {
@@ -142,6 +143,7 @@ describe('Link Component', () => {
142
143
  it.each([
143
144
  ['base', colors.text.base, colors.text.basePressed],
144
145
  ['accent', colors.text.interactive, colors.text.interactivePressed],
146
+ ['gray', colors.text.muted, colors.text.mutedPressed],
145
147
  ])(
146
148
  'should apply the %s pressed color while pressed',
147
149
  (appearance, restingColor, pressedColor) => {
@@ -46,11 +46,13 @@ const useStyles = ({ appearance, size, underline, pressed }: StyleParams) => {
46
46
  const textColors: Record<Appearance, string> = {
47
47
  base: t.colors.text.base,
48
48
  accent: t.colors.text.interactive,
49
+ gray: t.colors.text.muted,
49
50
  };
50
51
 
51
52
  const pressedTextColors: Record<Appearance, string> = {
52
53
  base: t.colors.text.basePressed,
53
54
  accent: t.colors.text.interactivePressed,
55
+ gray: t.colors.text.mutedPressed,
54
56
  };
55
57
 
56
58
  const color = pressed
@@ -87,7 +89,7 @@ const useStyles = ({ appearance, size, underline, pressed }: StyleParams) => {
87
89
  };
88
90
 
89
91
  /**
90
- * A customizable link component that supports base and accent color appearances, optional underline, sizes, icons, and external link handling.
92
+ * A customizable link component that supports multiple color appearances, optional underline, sizes, icons, and external link handling.
91
93
  * Opens URLs using React Native's Linking API.
92
94
  *
93
95
  * Rendered as a `Text`, so it can be nested inside a paragraph of text and flows
@@ -9,7 +9,7 @@ export type LinkProps = {
9
9
  * The visual style of the link.
10
10
  * @default base
11
11
  */
12
- appearance?: 'base' | 'accent';
12
+ appearance?: 'base' | 'accent' | 'gray';
13
13
  /**
14
14
  * The size variant of the link.
15
15
  * @default md
@@ -1,4 +1,4 @@
1
- import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
1
+ import { Meta, Canvas, Controls, Source } from '@storybook/addon-docs/blocks';
2
2
  import { CustomTabs, Tab } from '../../../../../.storybook/components';
3
3
  import * as StepperStories from './Stepper.stories';
4
4
  import { Box } from '../../primitives/Box';
@@ -25,11 +25,12 @@ The Stepper component provides visual feedback for multi-step processes and work
25
25
  ## 🎯 Anatomy
26
26
 
27
27
  The Stepper consists of:
28
- - **Track Circle**: A muted circular background showing the full progress path
29
- - **Progress Arc**: A colored arc that fills clockwise from the top, representing completed progress
28
+
29
+ - **Track**: One muted segment per step, separated by gaps
30
+ - **Progress**: Completed steps filled with color, sweeping clockwise from the top
30
31
  - **Label**: Centered text showing "current/total" steps (e.g., "2/4")
31
32
 
32
- The progress arc starts at the top (12 o'clock position) and fills clockwise. When at 0% progress, a small dot appears at the top instead of an empty arc.
33
+ The gap between the first and last segments is centered at the top (12 o'clock). At 0 progress, no segment is filled.
33
34
 
34
35
  ---
35
36
 
@@ -37,22 +38,35 @@ The progress arc starts at the top (12 o'clock position) and fills clockwise. Wh
37
38
 
38
39
  **Default label**: The default label is "currentStep/totalSteps" (e.g., "2/4").
39
40
 
40
-
41
41
  ### Step Ranges
42
- - **`totalSteps`** must be between **2** and **9**
42
+
43
+ - **`totalSteps`** must be between **2** and **8**
43
44
  - **`currentStep`** must be between **0** and **`totalSteps`**
44
- - Use `currentStep={0}` to show the initial state (minimal dot before starting)
45
45
 
46
- > ⚠️ Using more than **9** total steps or exceeding the valid range may cause the UI to break and text to be truncated inside the circular indicator.
46
+ > ⚠️ Using more than **8** total steps or exceeding the valid range may cause the UI to break and text to be truncated inside the circular indicator.
47
47
 
48
48
  > ⚠️ Values outside valid ranges are automatically clamped: **`currentStep`** is kept between **0** and **`totalSteps`**.
49
49
 
50
- ## 🎨 Disabled State
50
+ ## 🎨 Appearance
51
51
 
52
- The Stepper supports a disabled state that changes the progress arc to a muted appearance:
52
+ The Stepper supports two appearances for the progress: `accent` (default) and `success`.
53
53
 
54
- <Canvas of={StepperStories.DisabledShowcase} />
54
+ <Canvas of={StepperStories.AppearanceShowcase} />
55
+
56
+ ## 📐 Sizes
57
+
58
+ The Stepper comes in two sizes:
59
+
60
+ - **`md`** (default): 48×48px
61
+ - **`lg`**: 72×72px
62
+
63
+ <Canvas of={StepperStories.SizeShowcase} />
64
+
65
+ ## Disabled State
55
66
 
67
+ The Stepper supports a disabled state that changes the progress to a muted appearance:
68
+
69
+ <Canvas of={StepperStories.DisabledShowcase} />
56
70
 
57
71
  ## Custom Labels
58
72
 
@@ -60,7 +74,7 @@ By default, the stepper displays "currentStep/totalSteps" (e.g., "2/4"). You can
60
74
 
61
75
  <Canvas of={StepperStories.WithCustomLabel} />
62
76
 
63
- > ⚠️ **Note**: The label and step counts are automatically truncated if they overflow the circular indicator. Keep custom labels short to ensure readability within the 48px circle.
77
+ > ⚠️ **Note**: The label and step counts are automatically truncated if they overflow the circular indicator. Keep custom labels short to ensure readability within the circle.
64
78
 
65
79
  ---
66
80
 
@@ -102,6 +116,14 @@ function OnboardingFlow() {
102
116
  }
103
117
  ```
104
118
 
119
+ ### Appearance
120
+
121
+ <Source of={StepperStories.AppearanceShowcase} />
122
+
123
+ ### Sizes
124
+
125
+ <Source of={StepperStories.SizeShowcase} />
126
+
105
127
  ### With Disabled State
106
128
 
107
129
  Control the visual state based on step completion:
@@ -130,10 +152,10 @@ import { Stepper } from '@ledgerhq/lumen-ui-rnative';
130
152
  function LocalizedStepper() {
131
153
  const currentStep = 3;
132
154
  const totalSteps = 5;
133
-
155
+
134
156
  return (
135
- <Stepper
136
- currentStep={currentStep}
157
+ <Stepper
158
+ currentStep={currentStep}
137
159
  totalSteps={totalSteps}
138
160
  label={`Étape ${currentStep} sur ${totalSteps}`}
139
161
  />
@@ -141,6 +163,5 @@ function LocalizedStepper() {
141
163
  }
142
164
  ```
143
165
 
144
-
145
166
  </Tab>
146
167
  </CustomTabs>
@@ -13,6 +13,8 @@ const meta = {
13
13
  argTypes: {
14
14
  currentStep: { control: 'number' },
15
15
  totalSteps: { control: 'number' },
16
+ appearance: { control: 'select', options: ['accent', 'success'] },
17
+ size: { control: 'select', options: ['md', 'lg'] },
16
18
  disabled: { control: 'boolean' },
17
19
  },
18
20
  } satisfies Meta<typeof Stepper>;
@@ -28,6 +30,52 @@ export const Base: Story = {
28
30
  render: (args) => <Stepper {...args} />,
29
31
  };
30
32
 
33
+ export const AppearanceShowcase: Story = {
34
+ args: {
35
+ currentStep: 2,
36
+ totalSteps: 4,
37
+ },
38
+ render: () => (
39
+ <Box lx={{ flexDirection: 'row', gap: 's32', alignItems: 'center' }}>
40
+ <Box lx={{ alignItems: 'center', gap: 's8' }}>
41
+ <Text typography='body3' lx={{ color: 'muted' }}>
42
+ Accent
43
+ </Text>
44
+ <Stepper currentStep={2} totalSteps={4} appearance='accent' />
45
+ </Box>
46
+ <Box lx={{ alignItems: 'center', gap: 's8' }}>
47
+ <Text typography='body3' lx={{ color: 'muted' }}>
48
+ Success
49
+ </Text>
50
+ <Stepper currentStep={4} totalSteps={4} appearance='success' />
51
+ </Box>
52
+ </Box>
53
+ ),
54
+ };
55
+
56
+ export const SizeShowcase: Story = {
57
+ args: {
58
+ currentStep: 2,
59
+ totalSteps: 4,
60
+ },
61
+ render: () => (
62
+ <Box lx={{ flexDirection: 'row', gap: 's32', alignItems: 'center' }}>
63
+ <Box lx={{ alignItems: 'center', gap: 's8' }}>
64
+ <Text typography='body3' lx={{ color: 'muted' }}>
65
+ Medium (md)
66
+ </Text>
67
+ <Stepper currentStep={2} totalSteps={4} size='md' />
68
+ </Box>
69
+ <Box lx={{ alignItems: 'center', gap: 's8' }}>
70
+ <Text typography='body3' lx={{ color: 'muted' }}>
71
+ Large (lg)
72
+ </Text>
73
+ <Stepper currentStep={2} totalSteps={4} size='lg' />
74
+ </Box>
75
+ </Box>
76
+ ),
77
+ };
78
+
31
79
  export const DisabledShowcase: Story = {
32
80
  args: {
33
81
  currentStep: 2,
@@ -49,9 +97,9 @@ export const DisabledShowcase: Story = {
49
97
  </Box>
50
98
  <Box lx={{ alignItems: 'center', gap: 's8' }}>
51
99
  <Text typography='body3' lx={{ color: 'muted' }}>
52
- Unstarted (0/9)
100
+ Unstarted (0/8)
53
101
  </Text>
54
- <Stepper currentStep={0} totalSteps={9} />
102
+ <Stepper currentStep={0} totalSteps={8} />
55
103
  </Box>
56
104
  </Box>
57
105
  ),
@@ -80,7 +80,7 @@ describe('Stepper Component', () => {
80
80
  expect(stepper).toBeTruthy();
81
81
  });
82
82
 
83
- it('should handle currentStep <= 0 (minimal dot)', async () => {
83
+ it('should handle currentStep <= 0', async () => {
84
84
  const { findByLabelText } = render(
85
85
  <TestWrapper>
86
86
  <Stepper currentStep={0} totalSteps={4} />
@@ -110,6 +110,34 @@ describe('Stepper Component', () => {
110
110
  expect(getByText('/4')).toBeTruthy();
111
111
  });
112
112
 
113
+ it('should render md size by default', () => {
114
+ const { getByTestId } = render(
115
+ <TestWrapper>
116
+ <Stepper currentStep={2} totalSteps={4} testID='stepper' />
117
+ </TestWrapper>,
118
+ );
119
+ const style = getByTestId('stepper').props.style;
120
+ const flatStyle = Array.isArray(style)
121
+ ? Object.assign({}, ...style)
122
+ : style;
123
+ expect(flatStyle.width).toBe(48);
124
+ expect(flatStyle.height).toBe(48);
125
+ });
126
+
127
+ it('should render lg size', () => {
128
+ const { getByTestId } = render(
129
+ <TestWrapper>
130
+ <Stepper currentStep={2} totalSteps={4} size='lg' testID='stepper' />
131
+ </TestWrapper>,
132
+ );
133
+ const style = getByTestId('stepper').props.style;
134
+ const flatStyle = Array.isArray(style)
135
+ ? Object.assign({}, ...style)
136
+ : style;
137
+ expect(flatStyle.width).toBe(72);
138
+ expect(flatStyle.height).toBe(72);
139
+ });
140
+
113
141
  it('should apply custom lx props', () => {
114
142
  const { getByTestId } = render(
115
143
  <TestWrapper>
@@ -2,14 +2,14 @@ import {
2
2
  getStepperCalculations,
3
3
  useDisabledContext,
4
4
  } from '@ledgerhq/lumen-utils-shared';
5
- import { useEffect } from 'react';
5
+ import { useEffect, useId } from 'react';
6
6
  import Animated, {
7
7
  cancelAnimation,
8
8
  useAnimatedProps,
9
9
  useSharedValue,
10
10
  withTiming,
11
11
  } from 'react-native-reanimated';
12
- import Svg, { Circle } from 'react-native-svg';
12
+ import Svg, { Circle, Defs, Mask } from 'react-native-svg';
13
13
  import { useCommonTranslation } from '../../../../i18n';
14
14
  import { useTheme } from '../../../../styles';
15
15
  import { useTimingConfig } from '../../animations/useTimingConfig';
@@ -17,8 +17,10 @@ import { Box } from '../../primitives/Box';
17
17
  import { Text } from '../../primitives/Text';
18
18
  import type { StepperProps } from './types';
19
19
 
20
- const SIZE = 48;
21
- const STROKE_WIDTH = 4;
20
+ const SIZES = {
21
+ md: { px: 48, strokeWidth: 4, token: 's48', typography: 'body2' },
22
+ lg: { px: 72, strokeWidth: 6, token: 's72', typography: 'heading4' },
23
+ } as const;
22
24
 
23
25
  const AnimatedCircle = Animated.createAnimatedComponent(Circle);
24
26
 
@@ -50,16 +52,19 @@ const useAnimatedProgress = ({
50
52
 
51
53
  /**
52
54
  * A circular stepper component showing progress as current step out of total steps.
53
- * Renders a track arc with a progress arc and a center label.
55
+ * Renders a segmented track with progress and a center label.
54
56
  *
55
57
  * @see [Figma – Stepper](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=11977-94&m=dev)
56
58
  *
57
59
  * @example
58
60
  * <Stepper currentStep={1} totalSteps={4} />
59
- * <Stepper currentStep={0} totalSteps={9} disabled /> // Shows minimal dot, disabled style
61
+ * <Stepper currentStep={0} totalSteps={8} disabled /> // Empty progress, disabled style
62
+ * <Stepper currentStep={2} totalSteps={4} size="lg" />
60
63
  */
61
64
  export const Stepper = ({
62
65
  lx = {},
66
+ appearance = 'accent',
67
+ size = 'md',
63
68
  currentStep,
64
69
  totalSteps,
65
70
  disabled: disabledProp = false,
@@ -71,25 +76,42 @@ export const Stepper = ({
71
76
  consumerName: 'Stepper',
72
77
  mergeWith: { disabled: disabledProp },
73
78
  });
79
+ const maskId = useId();
74
80
  const { t } = useCommonTranslation();
75
81
  const { theme } = useTheme();
82
+ const {
83
+ px: diameter,
84
+ strokeWidth,
85
+ token: sizeToken,
86
+ typography,
87
+ } = SIZES[size];
76
88
 
77
89
  const {
78
90
  displayLabel,
79
91
  r,
80
92
  cx,
81
93
  cy,
82
- trackDashArray,
83
94
  progressDashArray,
95
+ progressMaskDashArray,
84
96
  progressDashOffset,
97
+ dashPatternOffset,
85
98
  } = getStepperCalculations({
86
99
  currentStep,
87
100
  totalSteps,
88
- size: SIZE,
101
+ size: diameter,
89
102
  label,
90
- strokeWidth: STROKE_WIDTH,
103
+ strokeWidth,
91
104
  });
92
105
 
106
+ const activeColor =
107
+ appearance === 'success'
108
+ ? theme.colors.border.success
109
+ : theme.colors.border.active;
110
+
111
+ const progressColor = disabled
112
+ ? theme.colors.border.mutedSubtleHover
113
+ : activeColor;
114
+
93
115
  const animatedProgress = useAnimatedProgress({
94
116
  progressDashOffset,
95
117
  });
@@ -112,8 +134,8 @@ export const Stepper = ({
112
134
  })
113
135
  }
114
136
  lx={{
115
- width: 's48',
116
- height: 's48',
137
+ width: sizeToken,
138
+ height: sizeToken,
117
139
  flexShrink: 0,
118
140
  alignItems: 'center',
119
141
  justifyContent: 'center',
@@ -123,10 +145,10 @@ export const Stepper = ({
123
145
  {...props}
124
146
  >
125
147
  <Svg
126
- width={SIZE}
127
- height={SIZE}
128
- viewBox={`0 0 ${SIZE} ${SIZE}`}
129
- style={{ transform: [{ rotate: '135deg' }] }}
148
+ width={diameter}
149
+ height={diameter}
150
+ viewBox={`0 0 ${diameter} ${diameter}`}
151
+ style={{ transform: [{ rotate: '-90deg' }] }}
130
152
  >
131
153
  <Circle
132
154
  cx={cx}
@@ -135,24 +157,42 @@ export const Stepper = ({
135
157
  fill='none'
136
158
  stroke={theme.colors.border.mutedSubtle}
137
159
  strokeLinecap='round'
138
- strokeWidth={STROKE_WIDTH}
139
- strokeDasharray={trackDashArray}
140
- strokeDashoffset={0}
160
+ strokeWidth={strokeWidth}
161
+ strokeDasharray={progressDashArray}
162
+ strokeDashoffset={dashPatternOffset}
141
163
  />
142
- <AnimatedCircle
164
+ <Defs>
165
+ <Mask
166
+ id={maskId}
167
+ maskUnits='userSpaceOnUse'
168
+ x={0}
169
+ y={0}
170
+ width={diameter}
171
+ height={diameter}
172
+ >
173
+ <AnimatedCircle
174
+ cx={cx}
175
+ cy={cy}
176
+ r={r}
177
+ fill='none'
178
+ stroke='white'
179
+ strokeWidth={strokeWidth}
180
+ strokeDasharray={progressMaskDashArray}
181
+ animatedProps={animatedProgress}
182
+ />
183
+ </Mask>
184
+ </Defs>
185
+ <Circle
143
186
  cx={cx}
144
187
  cy={cy}
145
188
  r={r}
146
189
  fill='none'
147
- stroke={
148
- disabled
149
- ? theme.colors.border.mutedSubtleHover
150
- : theme.colors.border.active
151
- }
190
+ stroke={progressColor}
152
191
  strokeLinecap='round'
153
- strokeWidth={STROKE_WIDTH}
192
+ strokeWidth={strokeWidth}
154
193
  strokeDasharray={progressDashArray}
155
- animatedProps={animatedProgress}
194
+ strokeDashoffset={dashPatternOffset}
195
+ mask={`url(#${maskId})`}
156
196
  />
157
197
  </Svg>
158
198
  <Box
@@ -169,24 +209,25 @@ export const Stepper = ({
169
209
  >
170
210
  {label ? (
171
211
  <Text
172
- typography='body2SemiBold'
173
- lx={{ color: 'base' }}
212
+ typography={typography}
213
+ lx={{ color: disabled ? 'disabled' : 'base' }}
174
214
  maxFontSizeMultiplier={1.4}
215
+ numberOfLines={1}
175
216
  >
176
217
  {label}
177
218
  </Text>
178
219
  ) : (
179
220
  <>
180
221
  <Text
181
- typography='body1SemiBold'
182
- lx={{ color: 'base' }}
222
+ typography={typography}
223
+ lx={{ color: disabled ? 'disabled' : 'base' }}
183
224
  maxFontSizeMultiplier={1.4}
184
225
  >
185
226
  {Math.min(Math.max(currentStep, 0), totalSteps)}
186
227
  </Text>
187
228
  <Text
188
- typography='body2SemiBold'
189
- lx={{ color: 'muted' }}
229
+ typography={typography}
230
+ lx={{ color: disabled ? 'disabled' : 'muted' }}
190
231
  maxFontSizeMultiplier={1.4}
191
232
  >
192
233
  /{totalSteps}
@@ -2,7 +2,17 @@ import type { StyledViewProps } from '../../../../styles';
2
2
 
3
3
  export type StepperProps = {
4
4
  /**
5
- * Current step number (1-based). Use 0 or negative to show minimal dot (before starting).
5
+ * The visual style of the stepper's segments.
6
+ * @default accent
7
+ */
8
+ appearance?: 'accent' | 'success';
9
+ /**
10
+ * The overall dimensions of the stepper.
11
+ * @default md
12
+ */
13
+ size?: 'md' | 'lg';
14
+ /**
15
+ * Current step number (1-based).
6
16
  */
7
17
  currentStep: number;
8
18
  /**
@@ -10,7 +20,7 @@ export type StepperProps = {
10
20
  */
11
21
  totalSteps: number;
12
22
  /**
13
- * Whether the stepper is disabled. Changes the progress arc to a muted style.
23
+ * Whether the stepper is disabled. Changes the progress to a muted style.
14
24
  * @default false
15
25
  */
16
26
  disabled?: boolean;
@@ -0,0 +1,79 @@
1
+ import figma from '@figma/code-connect';
2
+ import { Text } from '../../primitives';
3
+ import { Tag } from '../Tag';
4
+ import {
5
+ Timeline,
6
+ TimelineItem,
7
+ TimelineItemBody,
8
+ TimelineItemCaption,
9
+ TimelineItemDescription,
10
+ TimelineItemHeader,
11
+ TimelineItemLeading,
12
+ TimelineItemLeadingRow,
13
+ TimelineItemTitle,
14
+ TimelineItemTrailing,
15
+ } from './Timeline';
16
+
17
+ figma.connect(
18
+ Timeline,
19
+ 'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=21769-4775',
20
+ {
21
+ imports: [
22
+ "import { Timeline, TimelineItem, TimelineItemHeader, TimelineItemLeading, TimelineItemCaption, TimelineItemLeadingRow, TimelineItemTitle, TimelineItemDescription, TimelineItemTrailing, TimelineItemBody } from '@ledgerhq/lumen-ui-rnative'",
23
+ "import { Tag, Text } from '@ledgerhq/lumen-ui-rnative'",
24
+ ],
25
+ props: {
26
+ item: figma.enum('type', {
27
+ display: (
28
+ <TimelineItem>
29
+ <TimelineItemHeader>
30
+ <TimelineItemLeading>
31
+ <TimelineItemCaption>12 Mar 2024</TimelineItemCaption>
32
+ <TimelineItemLeadingRow>
33
+ <TimelineItemTitle>Payment confirmed</TimelineItemTitle>
34
+ <Tag appearance='success' label='Confirmed' size='sm' />
35
+ </TimelineItemLeadingRow>
36
+ <TimelineItemDescription>
37
+ Confirmed on device
38
+ </TimelineItemDescription>
39
+ </TimelineItemLeading>
40
+ <TimelineItemTrailing>
41
+ <Text typography='body2SemiBold'>0.42 ETH</Text>
42
+ </TimelineItemTrailing>
43
+ </TimelineItemHeader>
44
+ <TimelineItemBody>
45
+ <Text typography='body3' lx={{ color: 'muted' }}>
46
+ Viewed in Ledger Live.
47
+ </Text>
48
+ </TimelineItemBody>
49
+ </TimelineItem>
50
+ ),
51
+ progress: (
52
+ <TimelineItem status='idle'>
53
+ <TimelineItemHeader>
54
+ <TimelineItemLeading>
55
+ <TimelineItemCaption>12 Mar 2024</TimelineItemCaption>
56
+ <TimelineItemLeadingRow>
57
+ <TimelineItemTitle>Payment confirmed</TimelineItemTitle>
58
+ <Tag appearance='success' label='Confirmed' size='sm' />
59
+ </TimelineItemLeadingRow>
60
+ <TimelineItemDescription>
61
+ Confirmed on device
62
+ </TimelineItemDescription>
63
+ </TimelineItemLeading>
64
+ <TimelineItemTrailing>
65
+ <Text typography='body2SemiBold'>0.42 ETH</Text>
66
+ </TimelineItemTrailing>
67
+ </TimelineItemHeader>
68
+ <TimelineItemBody>
69
+ <Text typography='body3' lx={{ color: 'muted' }}>
70
+ Viewed in Ledger Live.
71
+ </Text>
72
+ </TimelineItemBody>
73
+ </TimelineItem>
74
+ ),
75
+ }),
76
+ },
77
+ example: (props) => <Timeline>{props.item}</Timeline>,
78
+ },
79
+ );
@@ -0,0 +1,49 @@
1
+ import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
2
+ import * as TimelineStories from './Timeline.stories';
3
+
4
+ <Meta title='Core/Timeline' of={TimelineStories} />
5
+
6
+ # Timeline
7
+
8
+ ## Introduction
9
+
10
+ Timeline lays out a vertical sequence of events. Each item is a display: the parent passes `status` for the indicator and title tone.
11
+
12
+ > View in [Figma](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=21938-58196).
13
+
14
+ ## Anatomy
15
+
16
+ <Canvas of={TimelineStories.Base} />
17
+
18
+ ## Properties
19
+
20
+ <Canvas of={TimelineStories.Base} />
21
+ <Controls of={TimelineStories.Base} />
22
+
23
+ ### Informative timeline
24
+
25
+ Omit `status`. Each item uses the filled dot and a base title. Use this for a log of events.
26
+
27
+ <Canvas of={TimelineStories.WithInformative} />
28
+
29
+ ### Progress timeline
30
+
31
+ Set `status` on each item. `success`, `error`, `pending`, and `loading` use their icon and a base title. `idle` uses an empty circle and a muted title.
32
+
33
+ <Canvas of={TimelineStories.StatusShowcase} />
34
+
35
+ ### Collapse
36
+
37
+ Timeline does not collapse an item. To show and hide `TimelineItemBody`, build it in the parent: keep the open state there, put a chevron in `TimelineItemTrailing`, and render the body only while that state is open.
38
+
39
+ <Canvas of={TimelineStories.WithCollapse} />
40
+
41
+ ### Narrow width
42
+
43
+ Caption, title, and description truncate when the row runs out of room.
44
+
45
+ <Canvas of={TimelineStories.ResponsivenessShowcase} />
46
+
47
+ ## Accessibility
48
+
49
+ Timeline is a display. The title carries the meaning of the item. Status icons are decorative, except the loading indicator, which exposes its own label.