@ledgerhq/lumen-ui-rnative 0.1.21 → 0.1.23

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 (99) hide show
  1. package/dist/module/lib/Components/ListItem/ListItem.js +57 -27
  2. package/dist/module/lib/Components/ListItem/ListItem.js.map +1 -1
  3. package/dist/module/lib/Components/ListItem/ListItem.mdx +15 -7
  4. package/dist/module/lib/Components/ListItem/ListItem.stories.js +497 -283
  5. package/dist/module/lib/Components/ListItem/ListItem.stories.js.map +1 -1
  6. package/dist/module/lib/Components/ListItem/ListItem.test.js +153 -0
  7. package/dist/module/lib/Components/ListItem/ListItem.test.js.map +1 -0
  8. package/dist/module/lib/Components/{TriggerButton/TriggerButton.js → MediaButton/MediaButton.js} +13 -10
  9. package/dist/module/lib/Components/MediaButton/MediaButton.js.map +1 -0
  10. package/{src/lib/Components/TriggerButton/TriggerButton.mdx → dist/module/lib/Components/MediaButton/MediaButton.mdx} +10 -10
  11. package/dist/module/lib/Components/{TriggerButton/TriggerButton.stories.js → MediaButton/MediaButton.stories.js} +18 -18
  12. package/dist/module/lib/Components/MediaButton/MediaButton.stories.js.map +1 -0
  13. package/dist/module/lib/Components/{TriggerButton/TriggerButton.test.js → MediaButton/MediaButton.test.js} +14 -14
  14. package/dist/module/lib/Components/MediaButton/MediaButton.test.js.map +1 -0
  15. package/dist/module/lib/Components/MediaButton/index.js +5 -0
  16. package/dist/module/lib/Components/MediaButton/index.js.map +1 -0
  17. package/dist/module/lib/Components/MediaButton/types.js.map +1 -0
  18. package/dist/module/lib/Components/NavBar/NavBar.js +0 -2
  19. package/dist/module/lib/Components/NavBar/NavBar.js.map +1 -1
  20. package/dist/module/lib/Components/OptionList/OptionList.figma.js +28 -0
  21. package/dist/module/lib/Components/OptionList/OptionList.figma.js.map +1 -0
  22. package/dist/module/lib/Components/OptionList/OptionList.js +452 -0
  23. package/dist/module/lib/Components/OptionList/OptionList.js.map +1 -0
  24. package/dist/module/lib/Components/OptionList/OptionList.mdx +304 -0
  25. package/dist/module/lib/Components/OptionList/OptionList.stories.js +735 -0
  26. package/dist/module/lib/Components/OptionList/OptionList.stories.js.map +1 -0
  27. package/dist/module/lib/Components/OptionList/OptionList.test.js +443 -0
  28. package/dist/module/lib/Components/OptionList/OptionList.test.js.map +1 -0
  29. package/dist/module/lib/Components/OptionList/index.js +5 -0
  30. package/dist/module/lib/Components/OptionList/index.js.map +1 -0
  31. package/dist/module/lib/Components/OptionList/types.js +4 -0
  32. package/dist/module/lib/Components/OptionList/types.js.map +1 -0
  33. package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.js +36 -0
  34. package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.js.map +1 -0
  35. package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.test.js +84 -0
  36. package/dist/module/lib/Components/OptionList/useOptionList/useOptionListItems.test.js.map +1 -0
  37. package/dist/module/lib/Components/index.js +2 -1
  38. package/dist/module/lib/Components/index.js.map +1 -1
  39. package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts +8 -8
  40. package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts.map +1 -1
  41. package/dist/typescript/src/lib/Components/ListItem/types.d.ts +11 -7
  42. package/dist/typescript/src/lib/Components/ListItem/types.d.ts.map +1 -1
  43. package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts +23 -0
  44. package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts.map +1 -0
  45. package/dist/typescript/src/lib/Components/MediaButton/index.d.ts +3 -0
  46. package/dist/typescript/src/lib/Components/MediaButton/index.d.ts.map +1 -0
  47. package/dist/typescript/src/lib/Components/{TriggerButton → MediaButton}/types.d.ts +10 -5
  48. package/dist/typescript/src/lib/Components/MediaButton/types.d.ts.map +1 -0
  49. package/dist/typescript/src/lib/Components/OptionList/OptionList.d.ts +12 -0
  50. package/dist/typescript/src/lib/Components/OptionList/OptionList.d.ts.map +1 -0
  51. package/dist/typescript/src/lib/Components/OptionList/OptionList.figma.d.ts +2 -0
  52. package/dist/typescript/src/lib/Components/OptionList/OptionList.figma.d.ts.map +1 -0
  53. package/dist/typescript/src/lib/Components/OptionList/index.d.ts +3 -0
  54. package/dist/typescript/src/lib/Components/OptionList/index.d.ts.map +1 -0
  55. package/dist/typescript/src/lib/Components/OptionList/types.d.ts +97 -0
  56. package/dist/typescript/src/lib/Components/OptionList/types.d.ts.map +1 -0
  57. package/dist/typescript/src/lib/Components/OptionList/useOptionList/useOptionListItems.d.ts +12 -0
  58. package/dist/typescript/src/lib/Components/OptionList/useOptionList/useOptionListItems.d.ts.map +1 -0
  59. package/dist/typescript/src/lib/Components/index.d.ts +2 -1
  60. package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
  61. package/dist/typescript/src/styles/types/theme.types.d.ts +7 -6
  62. package/dist/typescript/src/styles/types/theme.types.d.ts.map +1 -1
  63. package/package.json +1 -1
  64. package/src/lib/Components/ListItem/ListItem.mdx +15 -7
  65. package/src/lib/Components/ListItem/ListItem.stories.tsx +354 -220
  66. package/src/lib/Components/ListItem/ListItem.test.tsx +152 -0
  67. package/src/lib/Components/ListItem/ListItem.tsx +63 -28
  68. package/src/lib/Components/ListItem/types.ts +11 -8
  69. package/{dist/module/lib/Components/TriggerButton/TriggerButton.mdx → src/lib/Components/MediaButton/MediaButton.mdx} +10 -10
  70. package/src/lib/Components/{TriggerButton/TriggerButton.stories.tsx → MediaButton/MediaButton.stories.tsx} +28 -28
  71. package/src/lib/Components/{TriggerButton/TriggerButton.test.tsx → MediaButton/MediaButton.test.tsx} +22 -22
  72. package/src/lib/Components/{TriggerButton/TriggerButton.tsx → MediaButton/MediaButton.tsx} +27 -21
  73. package/src/lib/Components/MediaButton/index.ts +2 -0
  74. package/src/lib/Components/{TriggerButton → MediaButton}/types.ts +10 -5
  75. package/src/lib/Components/NavBar/NavBar.tsx +0 -3
  76. package/src/lib/Components/OptionList/OptionList.figma.tsx +37 -0
  77. package/src/lib/Components/OptionList/OptionList.mdx +304 -0
  78. package/src/lib/Components/OptionList/OptionList.stories.tsx +755 -0
  79. package/src/lib/Components/OptionList/OptionList.test.tsx +412 -0
  80. package/src/lib/Components/OptionList/OptionList.tsx +532 -0
  81. package/src/lib/Components/OptionList/index.ts +2 -0
  82. package/src/lib/Components/OptionList/types.ts +115 -0
  83. package/src/lib/Components/OptionList/useOptionList/useOptionListItems.test.ts +73 -0
  84. package/src/lib/Components/OptionList/useOptionList/useOptionListItems.ts +49 -0
  85. package/src/lib/Components/index.ts +2 -1
  86. package/src/styles/types/theme.types.ts +8 -6
  87. package/dist/module/lib/Components/TriggerButton/TriggerButton.js.map +0 -1
  88. package/dist/module/lib/Components/TriggerButton/TriggerButton.stories.js.map +0 -1
  89. package/dist/module/lib/Components/TriggerButton/TriggerButton.test.js.map +0 -1
  90. package/dist/module/lib/Components/TriggerButton/index.js +0 -5
  91. package/dist/module/lib/Components/TriggerButton/index.js.map +0 -1
  92. package/dist/module/lib/Components/TriggerButton/types.js.map +0 -1
  93. package/dist/typescript/src/lib/Components/TriggerButton/TriggerButton.d.ts +0 -23
  94. package/dist/typescript/src/lib/Components/TriggerButton/TriggerButton.d.ts.map +0 -1
  95. package/dist/typescript/src/lib/Components/TriggerButton/index.d.ts +0 -3
  96. package/dist/typescript/src/lib/Components/TriggerButton/index.d.ts.map +0 -1
  97. package/dist/typescript/src/lib/Components/TriggerButton/types.d.ts.map +0 -1
  98. package/src/lib/Components/TriggerButton/index.ts +0 -2
  99. /package/dist/module/lib/Components/{TriggerButton → MediaButton}/types.js +0 -0
@@ -0,0 +1,152 @@
1
+ import { describe, it, expect, jest } from '@jest/globals';
2
+ import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
3
+ import { render, fireEvent, screen } from '@testing-library/react-native';
4
+ import { Text as RNText } from 'react-native';
5
+
6
+ import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
7
+ import {
8
+ ListItem,
9
+ ListItemLeading,
10
+ ListItemContent,
11
+ ListItemContentRow,
12
+ ListItemTitle,
13
+ ListItemDescription,
14
+ ListItemTrailing,
15
+ } from './ListItem';
16
+ import { ListItemProps } from './types';
17
+
18
+ const TestWrapper = ({ children }: { children: React.ReactNode }) => (
19
+ <ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
20
+ {children}
21
+ </ThemeProvider>
22
+ );
23
+
24
+ const renderListItem = (props: Partial<ListItemProps> = {}) =>
25
+ render(
26
+ <TestWrapper>
27
+ <ListItem testID='list-item' {...props}>
28
+ <ListItemLeading testID='leading'>
29
+ <ListItemContent>
30
+ <ListItemTitle>Title</ListItemTitle>
31
+ <ListItemDescription>Description</ListItemDescription>
32
+ </ListItemContent>
33
+ </ListItemLeading>
34
+ <ListItemTrailing testID='trailing'>
35
+ <RNText>Trailing</RNText>
36
+ </ListItemTrailing>
37
+ </ListItem>
38
+ </TestWrapper>,
39
+ );
40
+
41
+ describe('ListItem', () => {
42
+ it('renders all sub-components', () => {
43
+ renderListItem();
44
+
45
+ expect(screen.getByText('Title')).toBeTruthy();
46
+ expect(screen.getByText('Description')).toBeTruthy();
47
+ expect(screen.getByText('Trailing')).toBeTruthy();
48
+ });
49
+
50
+ it('forwards testID', () => {
51
+ renderListItem();
52
+
53
+ expect(screen.getByTestId('list-item')).toBeTruthy();
54
+ expect(screen.getByTestId('leading')).toBeTruthy();
55
+ expect(screen.getByTestId('trailing')).toBeTruthy();
56
+ });
57
+
58
+ describe('density', () => {
59
+ it('defaults to expanded height', () => {
60
+ renderListItem();
61
+ const inner = screen.getByTestId('list-item-content');
62
+ expect(inner.props.style).toEqual(
63
+ expect.objectContaining({ height: 64 }),
64
+ );
65
+ });
66
+
67
+ it('applies expanded height explicitly', () => {
68
+ renderListItem({ density: 'expanded' });
69
+ const inner = screen.getByTestId('list-item-content');
70
+ expect(inner.props.style).toEqual(
71
+ expect.objectContaining({ height: 64 }),
72
+ );
73
+ });
74
+
75
+ it('applies compact height', () => {
76
+ renderListItem({ density: 'compact' });
77
+ const inner = screen.getByTestId('list-item-content');
78
+ expect(inner.props.style).toEqual(
79
+ expect.objectContaining({ height: 40 }),
80
+ );
81
+ });
82
+ });
83
+
84
+ describe('onPress', () => {
85
+ it('triggers onPress on press', () => {
86
+ const onPress = jest.fn();
87
+ renderListItem({ onPress });
88
+
89
+ fireEvent.press(screen.getByTestId('list-item'));
90
+ expect(onPress).toHaveBeenCalledTimes(1);
91
+ });
92
+ });
93
+
94
+ describe('onLongPress', () => {
95
+ it('triggers onLongPress on long press', () => {
96
+ const onLongPress = jest.fn();
97
+ renderListItem({ onLongPress });
98
+
99
+ fireEvent(screen.getByTestId('list-item'), 'longPress');
100
+ expect(onLongPress).toHaveBeenCalledTimes(1);
101
+ });
102
+
103
+ it('does not trigger onLongPress when disabled', () => {
104
+ const onLongPress = jest.fn();
105
+ renderListItem({ onLongPress, disabled: true });
106
+
107
+ fireEvent(screen.getByTestId('list-item'), 'longPress');
108
+ expect(onLongPress).not.toHaveBeenCalled();
109
+ });
110
+ });
111
+
112
+ describe('disabled', () => {
113
+ it('sets disabled accessibility state', () => {
114
+ renderListItem({ disabled: true });
115
+ const item = screen.getByTestId('list-item');
116
+ expect(item.props.accessibilityState?.disabled).toBe(true);
117
+ });
118
+
119
+ it('does not trigger onPress when disabled', () => {
120
+ const onPress = jest.fn();
121
+ renderListItem({ onPress, disabled: true });
122
+
123
+ fireEvent.press(screen.getByTestId('list-item'));
124
+ expect(onPress).not.toHaveBeenCalled();
125
+ });
126
+ });
127
+
128
+ describe('ListItemContentRow', () => {
129
+ it('renders title alongside additional content in a row', () => {
130
+ render(
131
+ <TestWrapper>
132
+ <ListItem>
133
+ <ListItemLeading>
134
+ <ListItemContent>
135
+ <ListItemContentRow testID='content-row'>
136
+ <ListItemTitle>Bitcoin</ListItemTitle>
137
+ <RNText>Tag</RNText>
138
+ </ListItemContentRow>
139
+ <ListItemDescription>BTC</ListItemDescription>
140
+ </ListItemContent>
141
+ </ListItemLeading>
142
+ </ListItem>
143
+ </TestWrapper>,
144
+ );
145
+
146
+ expect(screen.getByTestId('content-row')).toBeTruthy();
147
+ expect(screen.getByText('Bitcoin')).toBeTruthy();
148
+ expect(screen.getByText('Tag')).toBeTruthy();
149
+ expect(screen.getByText('BTC')).toBeTruthy();
150
+ });
151
+ });
152
+ });
@@ -1,18 +1,19 @@
1
1
  import {
2
2
  createSafeContext,
3
+ type Density,
3
4
  DisabledProvider,
4
5
  useDisabledContext,
5
6
  } from '@ledgerhq/lumen-utils-shared';
6
7
  import { ElementRef, ReactNode, Ref } from 'react';
7
- import { StyleSheet, View } from 'react-native';
8
+ import { StyleSheet, View, ViewStyle } from 'react-native';
8
9
  import { useStyleSheet } from '../../../styles';
9
10
  import { Box, Pressable, Text } from '../Utility';
10
11
  import {
12
+ ListItemProps,
11
13
  ListItemContentProps,
12
14
  ListItemContentRowProps,
13
15
  ListItemDescriptionProps,
14
16
  ListItemLeadingProps,
15
- ListItemProps,
16
17
  ListItemTitleProps,
17
18
  ListItemTrailingProps,
18
19
  } from './types';
@@ -22,27 +23,32 @@ const [ListItemTrailingProvider, useListItemTrailingContext] =
22
23
  isInTrailing: false,
23
24
  });
24
25
 
25
- const useRootStyles = ({ pressed }: { pressed: boolean }) => {
26
+ const useRootStyles = ({
27
+ pressed,
28
+ density,
29
+ }: {
30
+ pressed: boolean;
31
+ density: Density;
32
+ }) => {
26
33
  return useStyleSheet(
27
34
  (t) => ({
28
35
  container: StyleSheet.flatten([
29
36
  {
30
37
  flexDirection: 'row',
31
38
  alignItems: 'center',
32
- height: t.sizes.s64,
39
+ height: density === 'compact' ? t.sizes.s40 : t.sizes.s64,
33
40
  width: t.sizes.full,
34
41
  gap: t.spacings.s16,
35
42
  borderRadius: t.borderRadius.md,
36
43
  backgroundColor: 'transparent',
37
44
  paddingHorizontal: t.spacings.s8,
38
- paddingVertical: t.spacings.s12,
39
45
  },
40
46
  pressed && {
41
47
  backgroundColor: t.colors.bg.baseTransparentPressed,
42
48
  },
43
49
  ]),
44
50
  }),
45
- [pressed],
51
+ [pressed, density],
46
52
  );
47
53
  };
48
54
 
@@ -86,29 +92,56 @@ export const ListItem = ({
86
92
  lx = {},
87
93
  style,
88
94
  disabled: disabledProp = false,
95
+ density = 'expanded',
96
+ onPress,
97
+ onLongPress,
89
98
  ref,
90
- ...pressableProps
99
+ ...props
91
100
  }: ListItemProps) => {
92
101
  const disabled = useDisabledContext({
93
102
  consumerName: 'ListItem',
94
103
  mergeWith: { disabled: disabledProp },
95
104
  });
96
105
 
106
+ const isInteractive = !!onPress || !!onLongPress;
107
+
108
+ if (isInteractive) {
109
+ return (
110
+ <DisabledProvider value={{ disabled }}>
111
+ <Pressable
112
+ ref={ref}
113
+ lx={lx}
114
+ style={style as ViewStyle}
115
+ disabled={disabled}
116
+ onPress={onPress}
117
+ onLongPress={onLongPress}
118
+ accessibilityRole='button'
119
+ accessibilityState={{ disabled }}
120
+ {...props}
121
+ >
122
+ {({ pressed }) => (
123
+ <ListItemInner pressed={pressed} density={density}>
124
+ {children}
125
+ </ListItemInner>
126
+ )}
127
+ </Pressable>
128
+ </DisabledProvider>
129
+ );
130
+ }
131
+
97
132
  return (
98
133
  <DisabledProvider value={{ disabled }}>
99
- <Pressable
134
+ <Box
100
135
  ref={ref}
101
136
  lx={lx}
102
137
  style={style}
103
- disabled={disabled}
104
- accessibilityRole='button'
105
138
  accessibilityState={{ disabled }}
106
- {...pressableProps}
139
+ {...props}
107
140
  >
108
- {({ pressed }) => (
109
- <ListItemInner pressed={pressed}>{children}</ListItemInner>
110
- )}
111
- </Pressable>
141
+ <ListItemInner pressed={false} density={density}>
142
+ {children}
143
+ </ListItemInner>
144
+ </Box>
112
145
  </DisabledProvider>
113
146
  );
114
147
  };
@@ -118,12 +151,14 @@ export const ListItem = ({
118
151
  */
119
152
  const ListItemInner = ({
120
153
  pressed,
154
+ density,
121
155
  children,
122
156
  }: {
123
157
  pressed: boolean;
158
+ density: Density;
124
159
  children: ReactNode;
125
160
  }) => {
126
- const styles = useRootStyles({ pressed });
161
+ const styles = useRootStyles({ pressed, density });
127
162
  return (
128
163
  <View style={styles.container} testID='list-item-content'>
129
164
  {children}
@@ -140,7 +175,7 @@ export const ListItemLeading = ({
140
175
  lx = {},
141
176
  style,
142
177
  ref,
143
- ...viewProps
178
+ ...props
144
179
  }: ListItemLeadingProps & { ref?: Ref<View> }) => {
145
180
  const styles = useStyleSheet(
146
181
  (t) => ({
@@ -160,7 +195,7 @@ export const ListItemLeading = ({
160
195
  ref={ref}
161
196
  lx={lx}
162
197
  style={StyleSheet.flatten([styles.leading, style])}
163
- {...viewProps}
198
+ {...props}
164
199
  >
165
200
  {children}
166
201
  </Box>
@@ -175,7 +210,7 @@ export const ListItemContent = ({
175
210
  lx = {},
176
211
  style,
177
212
  ref,
178
- ...viewProps
213
+ ...props
179
214
  }: ListItemContentProps & { ref?: Ref<View> }) => {
180
215
  const { isInTrailing } = useListItemTrailingContext({
181
216
  consumerName: 'ListItemContent',
@@ -199,7 +234,7 @@ export const ListItemContent = ({
199
234
  ref={ref}
200
235
  lx={lx}
201
236
  style={StyleSheet.flatten([styles.content, style])}
202
- {...viewProps}
237
+ {...props}
203
238
  >
204
239
  {children}
205
240
  </Box>
@@ -215,7 +250,7 @@ export const ListItemContentRow = ({
215
250
  lx = {},
216
251
  style,
217
252
  ref,
218
- ...viewProps
253
+ ...props
219
254
  }: ListItemContentRowProps & { ref?: Ref<View> }) => {
220
255
  const styles = useStyleSheet(
221
256
  (t) => ({
@@ -234,7 +269,7 @@ export const ListItemContentRow = ({
234
269
  ref={ref}
235
270
  lx={lx}
236
271
  style={StyleSheet.flatten([styles.row, style])}
237
- {...viewProps}
272
+ {...props}
238
273
  >
239
274
  {children}
240
275
  </Box>
@@ -249,7 +284,7 @@ export const ListItemTitle = ({
249
284
  lx = {},
250
285
  style,
251
286
  ref,
252
- ...textProps
287
+ ...props
253
288
  }: ListItemTitleProps & { ref?: Ref<ElementRef<typeof Text>> }) => {
254
289
  const disabled = useDisabledContext({
255
290
  consumerName: 'ListItemTitle',
@@ -283,7 +318,7 @@ export const ListItemTitle = ({
283
318
  numberOfLines={1}
284
319
  ellipsizeMode='tail'
285
320
  allowFontScaling={false}
286
- {...textProps}
321
+ {...props}
287
322
  >
288
323
  {children}
289
324
  </Text>
@@ -299,7 +334,7 @@ export const ListItemDescription = ({
299
334
  lx = {},
300
335
  style,
301
336
  ref,
302
- ...textProps
337
+ ...props
303
338
  }: ListItemDescriptionProps & { ref?: Ref<ElementRef<typeof Text>> }) => {
304
339
  const disabled = useDisabledContext({
305
340
  consumerName: 'ListItemDescription',
@@ -333,7 +368,7 @@ export const ListItemDescription = ({
333
368
  numberOfLines={1}
334
369
  ellipsizeMode='tail'
335
370
  allowFontScaling={false}
336
- {...textProps}
371
+ {...props}
337
372
  >
338
373
  {children}
339
374
  </Text>
@@ -349,7 +384,7 @@ export const ListItemTrailing = ({
349
384
  lx = {},
350
385
  style,
351
386
  ref,
352
- ...viewProps
387
+ ...props
353
388
  }: ListItemTrailingProps & { ref?: Ref<View> }) => {
354
389
  const styles = useStyleSheet(
355
390
  () => ({
@@ -367,7 +402,7 @@ export const ListItemTrailing = ({
367
402
  ref={ref}
368
403
  lx={lx}
369
404
  style={StyleSheet.flatten([styles.trailing, style])}
370
- {...viewProps}
405
+ {...props}
371
406
  >
372
407
  {children}
373
408
  </Box>
@@ -1,16 +1,10 @@
1
+ import type { Density } from '@ledgerhq/lumen-utils-shared';
1
2
  import {
2
3
  StyledPressableProps,
3
4
  StyledTextProps,
4
5
  StyledViewProps,
5
6
  } from '../../../styles';
6
7
 
7
- /**
8
- * Context value for passing state to sub-components
9
- */
10
- export type ListItemContextValue = {
11
- disabled?: boolean;
12
- };
13
-
14
8
  /**
15
9
  * Props for the ListItem root component
16
10
  */
@@ -19,6 +13,11 @@ export type ListItemProps = {
19
13
  * The content of the list item (ListItemLeading, ListItemTrailing)
20
14
  */
21
15
  children: React.ReactNode;
16
+ /**
17
+ * The density of the list item.
18
+ * @default 'expanded'
19
+ */
20
+ density?: Density;
22
21
  /**
23
22
  * Whether the list item is disabled.
24
23
  */
@@ -27,7 +26,11 @@ export type ListItemProps = {
27
26
  * Callback function when the list item is pressed.
28
27
  */
29
28
  onPress?: StyledPressableProps['onPress'];
30
- } & Omit<StyledPressableProps, 'disabled' | 'children'>;
29
+ /**
30
+ * Callback function when the list item is long pressed.
31
+ */
32
+ onLongPress?: StyledPressableProps['onLongPress'];
33
+ } & Omit<StyledViewProps, 'disabled' | 'children'>;
31
34
 
32
35
  /**
33
36
  * Props for the ListItemLeading component
@@ -1,17 +1,17 @@
1
1
  import { CustomTabs, Tab } from '../../../../.storybook/components';
2
2
  import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
3
- import * as TriggerButtonStories from './TriggerButton.stories';
3
+ import * as MediaButtonStories from './MediaButton.stories';
4
4
 
5
- <Meta title='Action/TriggerButton' of={TriggerButtonStories} />
5
+ <Meta title='Action/MediaButton' of={MediaButtonStories} />
6
6
 
7
7
  <CustomTabs>
8
8
  <Tab label="Overview ">
9
9
 
10
- # TriggerButton
10
+ # MediaButton
11
11
 
12
12
  ## Introduction
13
13
 
14
- A specialized trigger button designed exclusively for select and dropdown patterns. It displays a label with an optional leading icon and a permanent trailing chevron indicator.
14
+ A specialized media button designed exclusively for select and dropdown patterns. It displays a label with an optional leading icon and a permanent trailing chevron indicator.
15
15
 
16
16
  > View in [Figma](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=6389-45680&m=dev).
17
17
 
@@ -19,18 +19,18 @@ A specialized trigger button designed exclusively for select and dropdown patter
19
19
 
20
20
  ## Properties
21
21
 
22
- <Canvas of={TriggerButtonStories.Base} />
23
- <Controls of={TriggerButtonStories.Base} />
22
+ <Canvas of={MediaButtonStories.Base} />
23
+ <Controls of={MediaButtonStories.Base} />
24
24
 
25
25
  ## Appearance
26
26
 
27
27
  Three appearances are available: `gray` (default), `transparent`, and `no-background`.
28
28
 
29
- <Canvas of={TriggerButtonStories.AppearanceShowcase} />
29
+ <Canvas of={MediaButtonStories.AppearanceShowcase} />
30
30
 
31
31
  ## Sizes
32
32
 
33
- <Canvas of={TriggerButtonStories.SizeShowcase} />
33
+ <Canvas of={MediaButtonStories.SizeShowcase} />
34
34
 
35
35
  ## Icon Types
36
36
 
@@ -39,6 +39,6 @@ The `iconType` prop controls the padding scheme based on the leading icon's shap
39
39
  - **`flat`**: Standard padding for interface icons (line icons without background).
40
40
  - **`rounded`**: Tighter left padding for circular icons with their own background (e.g., crypto icons).
41
41
 
42
- <Canvas of={TriggerButtonStories.IconTypeShowcase} />
42
+ <Canvas of={MediaButtonStories.IconTypeShowcase} />
43
43
  </Tab>
44
- </CustomTabs>
44
+ </CustomTabs>
@@ -2,11 +2,11 @@ import { CryptoIcon } from '@ledgerhq/crypto-icons';
2
2
  import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
3
3
  import { Settings, Star } from '../../Symbols';
4
4
  import { Box } from '../Utility';
5
- import { TriggerButton } from './TriggerButton';
5
+ import { MediaButton } from './MediaButton';
6
6
 
7
- const meta: Meta<typeof TriggerButton> = {
8
- component: TriggerButton,
9
- title: 'Action/TriggerButton',
7
+ const meta: Meta<typeof MediaButton> = {
8
+ component: MediaButton,
9
+ title: 'Action/MediaButton',
10
10
  parameters: {
11
11
  layout: 'centered',
12
12
  docs: {
@@ -20,21 +20,21 @@ const meta: Meta<typeof TriggerButton> = {
20
20
  };
21
21
 
22
22
  export default meta;
23
- type Story = StoryObj<typeof TriggerButton>;
23
+ type Story = StoryObj<typeof MediaButton>;
24
24
 
25
25
  export const Base: Story = {
26
26
  args: {
27
27
  children: 'All accounts',
28
28
  appearance: 'gray',
29
29
  },
30
- render: (args) => <TriggerButton {...args} />,
30
+ render: (args) => <MediaButton {...args} />,
31
31
  parameters: {
32
32
  docs: {
33
33
  source: {
34
34
  code: `
35
- <TriggerButton appearance="gray">
35
+ <MediaButton appearance="gray">
36
36
  All accounts
37
- </TriggerButton>
37
+ </MediaButton>
38
38
  `,
39
39
  },
40
40
  },
@@ -44,12 +44,12 @@ export const Base: Story = {
44
44
  export const SizeShowcase: Story = {
45
45
  render: () => (
46
46
  <Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's16' }}>
47
- <TriggerButton size='sm' icon={<Star size={20} />} iconType='flat'>
47
+ <MediaButton size='sm' icon={<Star size={20} />} iconType='flat'>
48
48
  Small
49
- </TriggerButton>
50
- <TriggerButton size='md' icon={<Star size={20} />} iconType='flat'>
49
+ </MediaButton>
50
+ <MediaButton size='md' icon={<Star size={20} />} iconType='flat'>
51
51
  Medium
52
- </TriggerButton>
52
+ </MediaButton>
53
53
  </Box>
54
54
  ),
55
55
  };
@@ -58,42 +58,42 @@ export const IconTypeShowcase: Story = {
58
58
  render: () => (
59
59
  <Box lx={{ flexDirection: 'column', gap: 's16' }}>
60
60
  <Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's16' }}>
61
- <TriggerButton
61
+ <MediaButton
62
62
  icon={<Settings size={20} />}
63
63
  iconType='flat'
64
64
  appearance='gray'
65
65
  >
66
66
  Flat icon (md)
67
- </TriggerButton>
68
- <TriggerButton
67
+ </MediaButton>
68
+ <MediaButton
69
69
  icon={<CryptoIcon ledgerId='bitcoin' ticker='BTC' size='32px' />}
70
70
  iconType='rounded'
71
71
  appearance='gray'
72
72
  >
73
73
  Rounded icon (md)
74
- </TriggerButton>
75
- <TriggerButton appearance='gray'>No icon (md)</TriggerButton>
74
+ </MediaButton>
75
+ <MediaButton appearance='gray'>No icon (md)</MediaButton>
76
76
  </Box>
77
77
  <Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's16' }}>
78
- <TriggerButton
78
+ <MediaButton
79
79
  icon={<Settings size={20} />}
80
80
  iconType='flat'
81
81
  appearance='gray'
82
82
  size='sm'
83
83
  >
84
84
  Flat icon (sm)
85
- </TriggerButton>
86
- <TriggerButton
85
+ </MediaButton>
86
+ <MediaButton
87
87
  icon={<CryptoIcon ledgerId='bitcoin' ticker='BTC' size='24px' />}
88
88
  iconType='rounded'
89
89
  appearance='gray'
90
90
  size='sm'
91
91
  >
92
92
  Rounded icon (sm)
93
- </TriggerButton>
94
- <TriggerButton appearance='gray' size='sm'>
93
+ </MediaButton>
94
+ <MediaButton appearance='gray' size='sm'>
95
95
  No icon (sm)
96
- </TriggerButton>
96
+ </MediaButton>
97
97
  </Box>
98
98
  </Box>
99
99
  ),
@@ -109,21 +109,21 @@ export const AppearanceShowcase: Story = {
109
109
  key={appearance}
110
110
  lx={{ flexDirection: 'row', alignItems: 'center', gap: 's16' }}
111
111
  >
112
- <TriggerButton appearance={appearance}>{appearance}</TriggerButton>
113
- <TriggerButton
112
+ <MediaButton appearance={appearance}>{appearance}</MediaButton>
113
+ <MediaButton
114
114
  appearance={appearance}
115
115
  icon={<Settings size={20} />}
116
116
  iconType='flat'
117
117
  >
118
118
  {appearance}
119
- </TriggerButton>
120
- <TriggerButton
119
+ </MediaButton>
120
+ <MediaButton
121
121
  appearance={appearance}
122
122
  icon={<CryptoIcon ledgerId='bitcoin' ticker='BTC' size='32px' />}
123
123
  iconType='rounded'
124
124
  >
125
125
  {appearance}
126
- </TriggerButton>
126
+ </MediaButton>
127
127
  </Box>
128
128
  ))}
129
129
  </Box>