@ledgerhq/lumen-ui-rnative 0.1.36 → 0.1.37

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 (159) hide show
  1. package/dist/module/lib/Animations/Pulse/Pulse.mdx +1 -1
  2. package/dist/module/lib/Animations/Spin/Spin.mdx +1 -1
  3. package/dist/module/lib/Components/AddressInput/AddressInput.mdx +1 -1
  4. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.js +68 -39
  5. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.js.map +1 -1
  6. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.mdx +7 -1
  7. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.stories.js +24 -0
  8. package/dist/module/lib/Components/AmountDisplay/AmountDisplay.stories.js.map +1 -1
  9. package/dist/module/lib/Components/AmountDisplay/types.js.map +1 -1
  10. package/dist/module/lib/Components/AmountInput/AmountInput.mdx +1 -1
  11. package/dist/module/lib/Components/Avatar/Avatar.mdx +1 -1
  12. package/dist/module/lib/Components/Banner/Banner.mdx +1 -1
  13. package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +1 -1
  14. package/dist/module/lib/Components/Button/Button.mdx +1 -1
  15. package/dist/module/lib/Components/Card/Card.stories.js +4 -9
  16. package/dist/module/lib/Components/Card/Card.stories.js.map +1 -1
  17. package/dist/module/lib/Components/CardButton/CardButton.mdx +1 -1
  18. package/dist/module/lib/Components/Checkbox/Checkbox.mdx +1 -1
  19. package/dist/module/lib/Components/Divider/Divider.mdx +1 -1
  20. package/dist/module/lib/Components/DotIcon/DotIcon.js +44 -23
  21. package/dist/module/lib/Components/DotIcon/DotIcon.js.map +1 -1
  22. package/dist/module/lib/Components/DotIcon/DotIcon.mdx +92 -0
  23. package/dist/module/lib/Components/DotIcon/DotIcon.stories.js +47 -0
  24. package/dist/module/lib/Components/DotIcon/DotIcon.stories.js.map +1 -1
  25. package/dist/module/lib/Components/DotSymbol/DotSymbol.js +52 -30
  26. package/dist/module/lib/Components/DotSymbol/DotSymbol.js.map +1 -1
  27. package/dist/module/lib/Components/DotSymbol/DotSymbol.mdx +79 -2
  28. package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js +41 -0
  29. package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js.map +1 -1
  30. package/dist/module/lib/Components/IconButton/IconButton.mdx +1 -1
  31. package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.mdx +1 -1
  32. package/dist/module/lib/Components/Link/Link.mdx +1 -1
  33. package/dist/module/lib/Components/MediaBanner/MediaBanner.mdx +1 -1
  34. package/dist/module/lib/Components/MediaButton/MediaButton.js +17 -17
  35. package/dist/module/lib/Components/MediaButton/MediaButton.js.map +1 -1
  36. package/dist/module/lib/Components/MediaButton/MediaButton.mdx +3 -3
  37. package/dist/module/lib/Components/MediaButton/MediaButton.stories.js +17 -17
  38. package/dist/module/lib/Components/MediaButton/MediaButton.stories.js.map +1 -1
  39. package/dist/module/lib/Components/MediaButton/MediaButton.test.js +4 -4
  40. package/dist/module/lib/Components/MediaButton/MediaButton.test.js.map +1 -1
  41. package/dist/module/lib/Components/MediaImage/MediaImage.js +20 -4
  42. package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
  43. package/dist/module/lib/Components/MediaImage/MediaImage.stories.js +35 -0
  44. package/dist/module/lib/Components/MediaImage/MediaImage.stories.js.map +1 -1
  45. package/dist/module/lib/Components/NavBar/CoinCapsule.js +2 -2
  46. package/dist/module/lib/Components/NavBar/CoinCapsule.js.map +1 -1
  47. package/dist/module/lib/Components/NavBar/NavBar.js +2 -2
  48. package/dist/module/lib/Components/NavBar/NavBar.js.map +1 -1
  49. package/dist/module/lib/Components/NavBar/NavBar.mdx +2 -2
  50. package/dist/module/lib/Components/NavBar/NavBar.stories.js +1 -1
  51. package/dist/module/lib/Components/NavBar/NavBar.stories.js.map +1 -1
  52. package/dist/module/lib/Components/NavBar/NavBar.test.js +3 -3
  53. package/dist/module/lib/Components/NavBar/NavBar.test.js.map +1 -1
  54. package/dist/module/lib/Components/OptionList/OptionList.stories.js +4 -4
  55. package/dist/module/lib/Components/OptionList/OptionList.stories.js.map +1 -1
  56. package/dist/module/lib/Components/PageIndicator/PageIndicator.js +13 -8
  57. package/dist/module/lib/Components/PageIndicator/PageIndicator.js.map +1 -1
  58. package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js +58 -0
  59. package/dist/module/lib/Components/PageIndicator/PageIndicator.test.js.map +1 -1
  60. package/dist/module/lib/Components/SearchInput/SearchInput.mdx +1 -1
  61. package/dist/module/lib/Components/SegmentedControl/SegmentedControl.mdx +1 -1
  62. package/dist/module/lib/Components/Select/Select.mdx +1 -1
  63. package/dist/module/lib/Components/Spinner/Spinner.mdx +1 -1
  64. package/dist/module/lib/Components/Spot/Spot.mdx +1 -1
  65. package/dist/module/lib/Components/Stepper/Stepper.mdx +1 -1
  66. package/dist/module/lib/Components/Subheader/Subheader.mdx +1 -1
  67. package/dist/module/lib/Components/Switch/Switch.mdx +1 -1
  68. package/dist/module/lib/Components/TabBar/TabBar.mdx +1 -1
  69. package/dist/module/lib/Components/TextInput/TextInput.mdx +1 -1
  70. package/dist/module/lib/Components/Tile/Tile.mdx +1 -1
  71. package/dist/module/lib/Components/Tooltip/Tooltip.mdx +1 -1
  72. package/dist/typescript/src/lib/Components/AmountDisplay/AmountDisplay.d.ts +1 -1
  73. package/dist/typescript/src/lib/Components/AmountDisplay/AmountDisplay.d.ts.map +1 -1
  74. package/dist/typescript/src/lib/Components/AmountDisplay/index.d.ts +1 -1
  75. package/dist/typescript/src/lib/Components/AmountDisplay/index.d.ts.map +1 -1
  76. package/dist/typescript/src/lib/Components/AmountDisplay/types.d.ts +10 -3
  77. package/dist/typescript/src/lib/Components/AmountDisplay/types.d.ts.map +1 -1
  78. package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts +1 -1
  79. package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts.map +1 -1
  80. package/dist/typescript/src/lib/Components/DotIcon/types.d.ts +6 -0
  81. package/dist/typescript/src/lib/Components/DotIcon/types.d.ts.map +1 -1
  82. package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts +1 -1
  83. package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts.map +1 -1
  84. package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts +6 -0
  85. package/dist/typescript/src/lib/Components/DotSymbol/types.d.ts.map +1 -1
  86. package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts +3 -3
  87. package/dist/typescript/src/lib/Components/MediaButton/MediaButton.d.ts.map +1 -1
  88. package/dist/typescript/src/lib/Components/MediaButton/types.d.ts +6 -6
  89. package/dist/typescript/src/lib/Components/MediaButton/types.d.ts.map +1 -1
  90. package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts +1 -1
  91. package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
  92. package/dist/typescript/src/lib/Components/MediaImage/types.d.ts +6 -0
  93. package/dist/typescript/src/lib/Components/MediaImage/types.d.ts.map +1 -1
  94. package/dist/typescript/src/lib/Components/NavBar/CoinCapsule.d.ts +1 -1
  95. package/dist/typescript/src/lib/Components/NavBar/CoinCapsule.d.ts.map +1 -1
  96. package/dist/typescript/src/lib/Components/NavBar/NavBar.d.ts +1 -1
  97. package/dist/typescript/src/lib/Components/NavBar/NavBar.d.ts.map +1 -1
  98. package/dist/typescript/src/lib/Components/NavBar/types.d.ts +3 -3
  99. package/dist/typescript/src/lib/Components/NavBar/types.d.ts.map +1 -1
  100. package/dist/typescript/src/lib/Components/PageIndicator/PageIndicator.d.ts.map +1 -1
  101. package/package.json +3 -3
  102. package/src/lib/Animations/Pulse/Pulse.mdx +1 -1
  103. package/src/lib/Animations/Spin/Spin.mdx +1 -1
  104. package/src/lib/Components/AddressInput/AddressInput.mdx +1 -1
  105. package/src/lib/Components/AmountDisplay/AmountDisplay.mdx +7 -1
  106. package/src/lib/Components/AmountDisplay/AmountDisplay.stories.tsx +18 -0
  107. package/src/lib/Components/AmountDisplay/AmountDisplay.tsx +71 -40
  108. package/src/lib/Components/AmountDisplay/index.ts +5 -1
  109. package/src/lib/Components/AmountDisplay/types.ts +12 -3
  110. package/src/lib/Components/AmountInput/AmountInput.mdx +1 -1
  111. package/src/lib/Components/Avatar/Avatar.mdx +1 -1
  112. package/src/lib/Components/Banner/Banner.mdx +1 -1
  113. package/src/lib/Components/BottomSheet/BottomSheet.mdx +1 -1
  114. package/src/lib/Components/Button/Button.mdx +1 -1
  115. package/src/lib/Components/Card/Card.stories.tsx +1 -3
  116. package/src/lib/Components/CardButton/CardButton.mdx +1 -1
  117. package/src/lib/Components/Checkbox/Checkbox.mdx +1 -1
  118. package/src/lib/Components/Divider/Divider.mdx +1 -1
  119. package/src/lib/Components/DotIcon/DotIcon.mdx +92 -0
  120. package/src/lib/Components/DotIcon/DotIcon.stories.tsx +35 -0
  121. package/src/lib/Components/DotIcon/DotIcon.tsx +31 -14
  122. package/src/lib/Components/DotIcon/types.ts +6 -0
  123. package/src/lib/Components/DotSymbol/DotSymbol.mdx +79 -2
  124. package/src/lib/Components/DotSymbol/DotSymbol.stories.tsx +17 -0
  125. package/src/lib/Components/DotSymbol/DotSymbol.tsx +42 -24
  126. package/src/lib/Components/DotSymbol/types.ts +6 -0
  127. package/src/lib/Components/IconButton/IconButton.mdx +1 -1
  128. package/src/lib/Components/InteractiveIcon/InteractiveIcon.mdx +1 -1
  129. package/src/lib/Components/Link/Link.mdx +1 -1
  130. package/src/lib/Components/MediaBanner/MediaBanner.mdx +1 -1
  131. package/src/lib/Components/MediaButton/MediaButton.mdx +3 -3
  132. package/src/lib/Components/MediaButton/MediaButton.stories.tsx +29 -15
  133. package/src/lib/Components/MediaButton/MediaButton.test.tsx +4 -4
  134. package/src/lib/Components/MediaButton/MediaButton.tsx +33 -20
  135. package/src/lib/Components/MediaButton/types.ts +6 -6
  136. package/src/lib/Components/MediaImage/MediaImage.stories.tsx +18 -0
  137. package/src/lib/Components/MediaImage/MediaImage.tsx +12 -2
  138. package/src/lib/Components/MediaImage/types.ts +6 -0
  139. package/src/lib/Components/NavBar/CoinCapsule.tsx +2 -2
  140. package/src/lib/Components/NavBar/NavBar.mdx +2 -2
  141. package/src/lib/Components/NavBar/NavBar.stories.tsx +3 -1
  142. package/src/lib/Components/NavBar/NavBar.test.tsx +3 -3
  143. package/src/lib/Components/NavBar/NavBar.tsx +2 -2
  144. package/src/lib/Components/NavBar/types.ts +3 -3
  145. package/src/lib/Components/OptionList/OptionList.stories.tsx +4 -4
  146. package/src/lib/Components/PageIndicator/PageIndicator.test.tsx +78 -0
  147. package/src/lib/Components/PageIndicator/PageIndicator.tsx +15 -7
  148. package/src/lib/Components/SearchInput/SearchInput.mdx +1 -1
  149. package/src/lib/Components/SegmentedControl/SegmentedControl.mdx +1 -1
  150. package/src/lib/Components/Select/Select.mdx +1 -1
  151. package/src/lib/Components/Spinner/Spinner.mdx +1 -1
  152. package/src/lib/Components/Spot/Spot.mdx +1 -1
  153. package/src/lib/Components/Stepper/Stepper.mdx +1 -1
  154. package/src/lib/Components/Subheader/Subheader.mdx +1 -1
  155. package/src/lib/Components/Switch/Switch.mdx +1 -1
  156. package/src/lib/Components/TabBar/TabBar.mdx +1 -1
  157. package/src/lib/Components/TextInput/TextInput.mdx +1 -1
  158. package/src/lib/Components/Tile/Tile.mdx +1 -1
  159. package/src/lib/Components/Tooltip/Tooltip.mdx +1 -1
@@ -4,14 +4,17 @@ import { CustomTabs, Tab } from '../../../../.storybook/components';
4
4
 
5
5
  <Meta title='Communication/DotSymbol' of={DotSymbolStories} />
6
6
 
7
+ # DotSymbol
8
+
7
9
  <CustomTabs>
8
10
  <Tab label="Overview">
9
- # DotSymbol
10
11
 
11
12
  ## Introduction
12
13
 
13
14
  DotSymbol positions a small image indicator at a configurable corner of a child element such as MediaImage or Spot. It is commonly used to show a network badge or secondary icon overlapping a primary symbol.
14
15
 
16
+ > View in [Figma](https://www.figma.com/design/zSkvGGiqcnhywp2l3HTHxA/1.-Symbol-Library?node-id=8602-380&m=dev).
17
+
15
18
  ## Anatomy
16
19
 
17
20
  <Canvas of={DotSymbolStories.Base} />
@@ -46,9 +49,83 @@ The dot size is driven by the parent MediaImage or Spot size via the mapping hel
46
49
 
47
50
  <Canvas of={DotSymbolStories.SizeShowcase} />
48
51
 
52
+ ### Disabled
53
+
54
+ Only set `disabled` on `DotSymbol`. The state is propagated to the child via context. Passing it to both stacks the opacity overlay.
55
+
56
+ <Canvas of={DotSymbolStories.DisabledShowcase} />
57
+
49
58
  ## Accessibility
50
59
 
51
60
  - Always provide a meaningful `alt` prop on the DotSymbol so the indicator image is announced by screen readers.
52
61
  - The child element should carry its own accessibility label independently.
62
+
63
+ </Tab>
64
+ <Tab label="Implementation">
65
+
66
+ ## Setup
67
+
68
+ Install and set up the library with our [Setup Guide →](?path=/docs/getting-started-setup--docs).
69
+
70
+ ### Basic Usage
71
+
72
+ ```tsx
73
+ import { DotSymbol, MediaImage } from '@ledgerhq/lumen-ui-rnative';
74
+
75
+ function MyComponent() {
76
+ return (
77
+ <DotSymbol src='https://example.com/btc.png' alt='Bitcoin network'>
78
+ <MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
79
+ </DotSymbol>
80
+ );
81
+ }
82
+ ```
83
+
84
+ ### Pin Placement
85
+
86
+ Position the dot at any of the four corners of the child:
87
+
88
+ ```tsx
89
+ <DotSymbol src='https://example.com/btc.png' alt='Bitcoin' pin='top-end'>
90
+ <MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
91
+ </DotSymbol>
92
+ ```
93
+
94
+ ### Shapes
95
+
96
+ Use `shape='square'` to match a square child element:
97
+
98
+ ```tsx
99
+ <DotSymbol src='https://example.com/btc.png' alt='Bitcoin' shape='square'>
100
+ <MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} shape='square' />
101
+ </DotSymbol>
102
+ ```
103
+
104
+ ### Sizing
105
+
106
+ The dot size is driven by the parent's size via the mapping helpers:
107
+
108
+ ```tsx
109
+ import { DotSymbol, mediaImageDotSizeMap, MediaImage } from '@ledgerhq/lumen-ui-rnative';
110
+
111
+ <DotSymbol
112
+ src='https://example.com/btc.png'
113
+ alt='Bitcoin'
114
+ size={mediaImageDotSizeMap[48]}
115
+ >
116
+ <MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
117
+ </DotSymbol>;
118
+ ```
119
+
120
+ ### Disabled State
121
+
122
+ Only set `disabled` on `DotSymbol`. The state is propagated to the child via context. Passing it to both stacks the opacity overlay.
123
+
124
+ ```tsx
125
+ <DotSymbol src='https://example.com/btc.png' alt='Bitcoin' disabled>
126
+ <MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
127
+ </DotSymbol>
128
+ ```
129
+
53
130
  </Tab>
54
- </CustomTabs>
131
+ </CustomTabs>
@@ -92,6 +92,23 @@ export const ShapeShowcase: Story = {
92
92
  ),
93
93
  };
94
94
 
95
+ export const DisabledShowcase: Story = {
96
+ args: { src: dotSrc, alt: 'Disabled showcase' },
97
+ render: () => (
98
+ <Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's32' }}>
99
+ <DotSymbol src={dotSrc} pin='bottom-end' disabled>
100
+ <MediaImage src={parentSrc} size={48} shape='circle' />
101
+ </DotSymbol>
102
+ <DotSymbol src={dotSrc} pin='bottom-end' shape='square' disabled>
103
+ <MediaImage src={parentSrc} size={48} shape='square' />
104
+ </DotSymbol>
105
+ <DotSymbol src={dotSrc} pin='bottom-end' disabled>
106
+ <Spot appearance='icon' icon={CoinAlert} />
107
+ </DotSymbol>
108
+ </Box>
109
+ ),
110
+ };
111
+
95
112
  export const SizeShowcase: Story = {
96
113
  args: { src: dotSrc, alt: 'Size showcase' },
97
114
  render: () => (
@@ -1,5 +1,9 @@
1
+ import {
2
+ DisabledProvider,
3
+ useDisabledContext,
4
+ } from '@ledgerhq/lumen-utils-shared';
1
5
  import { useEffect, useState } from 'react';
2
- import { Image, StyleSheet } from 'react-native';
6
+ import { Image } from 'react-native';
3
7
  import { useStyleSheet } from '../../../styles';
4
8
  import type { MediaImageSize } from '../MediaImage';
5
9
  import type { SpotSize } from '../Spot';
@@ -65,10 +69,12 @@ const useStyles = ({
65
69
  size,
66
70
  shape,
67
71
  pin,
72
+ disabled,
68
73
  }: {
69
74
  size: DotSymbolSize;
70
75
  shape: 'square' | 'circle';
71
76
  pin: DotSymbolPin;
77
+ disabled: boolean;
72
78
  }) => {
73
79
  return useStyleSheet(
74
80
  (t) => {
@@ -78,6 +84,10 @@ const useStyles = ({
78
84
  const pinOffset = getPinOffset(pin, size);
79
85
 
80
86
  return {
87
+ root: {
88
+ position: 'relative',
89
+ ...(disabled && { opacity: 0.3 }),
90
+ },
81
91
  dot: {
82
92
  position: 'absolute',
83
93
  zIndex: 10,
@@ -96,7 +106,7 @@ const useStyles = ({
96
106
  },
97
107
  };
98
108
  },
99
- [size, shape, pin],
109
+ [size, shape, pin, disabled],
100
110
  );
101
111
  };
102
112
 
@@ -118,42 +128,50 @@ export const DotSymbol = ({
118
128
  pin = 'bottom-end',
119
129
  size = 20,
120
130
  shape = 'circle',
131
+ disabled: disabledProp = false,
121
132
  lx = {},
122
133
  style,
123
134
  ref,
124
135
  ...rest
125
136
  }: DotSymbolProps) => {
126
- const styles = useStyles({ size, shape, pin });
127
137
  const [error, setError] = useState(false);
138
+ const disabled = useDisabledContext({
139
+ consumerName: 'DotSymbol',
140
+ mergeWith: { disabled: disabledProp },
141
+ });
142
+ const styles = useStyles({ size, shape, pin, disabled });
128
143
 
129
144
  useEffect(() => {
130
145
  setError(false);
131
146
  }, [src]);
132
147
 
133
148
  return (
134
- <Box
135
- ref={ref}
136
- lx={lx}
137
- style={StyleSheet.flatten([{ position: 'relative' }, style])}
138
- accessibilityRole='image'
139
- accessibilityLabel={alt}
140
- {...rest}
141
- >
142
- <Box style={{ alignSelf: 'flex-start', position: 'relative' }}>
143
- {children}
144
- <Box style={styles.dot}>
145
- {!error && (
146
- <Image
147
- source={{ uri: src }}
148
- style={styles.image}
149
- accessible={false}
150
- onError={() => setError(true)}
151
- testID='dot-symbol-img'
152
- />
153
- )}
149
+ <DisabledProvider value={{ disabled: false }}>
150
+ <Box
151
+ ref={ref}
152
+ lx={lx}
153
+ style={[styles.root, style]}
154
+ accessibilityRole='image'
155
+ accessibilityLabel={alt}
156
+ accessibilityState={{ disabled }}
157
+ {...rest}
158
+ >
159
+ <Box style={{ alignSelf: 'flex-start', position: 'relative' }}>
160
+ {children}
161
+ <Box style={styles.dot}>
162
+ {!error && (
163
+ <Image
164
+ source={{ uri: src }}
165
+ style={styles.image}
166
+ accessible={false}
167
+ onError={() => setError(true)}
168
+ testID='dot-symbol-img'
169
+ />
170
+ )}
171
+ </Box>
154
172
  </Box>
155
173
  </Box>
156
- </Box>
174
+ </DisabledProvider>
157
175
  );
158
176
  };
159
177
 
@@ -33,6 +33,12 @@ export type DotSymbolProps = {
33
33
  * @default 'circle'
34
34
  */
35
35
  shape?: 'square' | 'circle';
36
+ /**
37
+ * Shows a disabled appearance.
38
+ * @optional
39
+ * @default false
40
+ */
41
+ disabled?: boolean;
36
42
  /**
37
43
  * The wrapped component (e.g. MediaImage or Spot).
38
44
  */
@@ -8,7 +8,7 @@ import { Box } from '../Utility';
8
8
 
9
9
  <Meta title='Action/IconButton' of={IconButtonStories} />
10
10
 
11
- # 🔘 IconButton
11
+ # IconButton
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -8,7 +8,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
8
8
 
9
9
  <Meta title='Components/InteractiveIcon' of={InteractiveIconStories} />
10
10
 
11
- # 🎯 InteractiveIcon
11
+ # InteractiveIcon
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -8,7 +8,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
8
8
 
9
9
  <Meta title='Components/Link' of={LinkStories} />
10
10
 
11
- # 🔗 Link
11
+ # Link
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -12,7 +12,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
12
12
 
13
13
  <Meta title='Components/MediaBanner' of={MediaBannerStories} />
14
14
 
15
- # 🖼️ MediaBanner
15
+ # MediaBanner
16
16
 
17
17
  <CustomTabs>
18
18
  <Tab label="Overview">
@@ -32,13 +32,13 @@ Three appearances are available: `gray` (default), `transparent`, and `no-backgr
32
32
 
33
33
  <Canvas of={MediaButtonStories.SizeShowcase} />
34
34
 
35
- ## Icon Types
35
+ ## Leading Content Shapes
36
36
 
37
- The `iconType` prop controls the padding scheme based on the leading icon's shape:
37
+ The `leadingContentShape` prop controls the padding scheme based on the leading content's shape:
38
38
 
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={MediaButtonStories.IconTypeShowcase} />
42
+ <Canvas of={MediaButtonStories.LeadingContentShapeShowcase} />
43
43
  </Tab>
44
44
  </CustomTabs>
@@ -44,30 +44,40 @@ export const Base: Story = {
44
44
  export const SizeShowcase: Story = {
45
45
  render: () => (
46
46
  <Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's16' }}>
47
- <MediaButton size='sm' icon={<Star size={20} />} iconType='flat'>
47
+ <MediaButton
48
+ size='sm'
49
+ leadingContent={<Star size={20} />}
50
+ leadingContentShape='flat'
51
+ >
48
52
  Small
49
53
  </MediaButton>
50
- <MediaButton size='md' icon={<Star size={20} />} iconType='flat'>
54
+ <MediaButton
55
+ size='md'
56
+ leadingContent={<Star size={20} />}
57
+ leadingContentShape='flat'
58
+ >
51
59
  Medium
52
60
  </MediaButton>
53
61
  </Box>
54
62
  ),
55
63
  };
56
64
 
57
- export const IconTypeShowcase: Story = {
65
+ export const LeadingContentShapeShowcase: Story = {
58
66
  render: () => (
59
67
  <Box lx={{ flexDirection: 'column', gap: 's16' }}>
60
68
  <Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's16' }}>
61
69
  <MediaButton
62
- icon={<Settings size={20} />}
63
- iconType='flat'
70
+ leadingContent={<Settings size={20} />}
71
+ leadingContentShape='flat'
64
72
  appearance='gray'
65
73
  >
66
74
  Flat icon (md)
67
75
  </MediaButton>
68
76
  <MediaButton
69
- icon={<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={32} />}
70
- iconType='rounded'
77
+ leadingContent={
78
+ <CryptoIcon ledgerId='bitcoin' ticker='BTC' size={32} />
79
+ }
80
+ leadingContentShape='rounded'
71
81
  appearance='gray'
72
82
  >
73
83
  Rounded icon (md)
@@ -76,16 +86,18 @@ export const IconTypeShowcase: Story = {
76
86
  </Box>
77
87
  <Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's16' }}>
78
88
  <MediaButton
79
- icon={<Settings size={20} />}
80
- iconType='flat'
89
+ leadingContent={<Settings size={20} />}
90
+ leadingContentShape='flat'
81
91
  appearance='gray'
82
92
  size='sm'
83
93
  >
84
94
  Flat icon (sm)
85
95
  </MediaButton>
86
96
  <MediaButton
87
- icon={<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={24} />}
88
- iconType='rounded'
97
+ leadingContent={
98
+ <CryptoIcon ledgerId='bitcoin' ticker='BTC' size={24} />
99
+ }
100
+ leadingContentShape='rounded'
89
101
  appearance='gray'
90
102
  size='sm'
91
103
  >
@@ -112,15 +124,17 @@ export const AppearanceShowcase: Story = {
112
124
  <MediaButton appearance={appearance}>{appearance}</MediaButton>
113
125
  <MediaButton
114
126
  appearance={appearance}
115
- icon={<Settings size={20} />}
116
- iconType='flat'
127
+ leadingContent={<Settings size={20} />}
128
+ leadingContentShape='flat'
117
129
  >
118
130
  {appearance}
119
131
  </MediaButton>
120
132
  <MediaButton
121
133
  appearance={appearance}
122
- icon={<CryptoIcon ledgerId='bitcoin' ticker='BTC' size={32} />}
123
- iconType='rounded'
134
+ leadingContent={
135
+ <CryptoIcon ledgerId='bitcoin' ticker='BTC' size={32} />
136
+ }
137
+ leadingContentShape='rounded'
124
138
  >
125
139
  {appearance}
126
140
  </MediaButton>
@@ -64,8 +64,8 @@ describe('MediaButton', () => {
64
64
  renderWithProvider(
65
65
  <MediaButton
66
66
  testID='trigger'
67
- icon={<Settings size={20} testID='icon' />}
68
- iconType='flat'
67
+ leadingContent={<Settings size={20} testID='icon' />}
68
+ leadingContentShape='flat'
69
69
  >
70
70
  Network
71
71
  </MediaButton>,
@@ -78,8 +78,8 @@ describe('MediaButton', () => {
78
78
  renderWithProvider(
79
79
  <MediaButton
80
80
  testID='trigger'
81
- icon={<View testID='crypto-icon' />}
82
- iconType='rounded'
81
+ leadingContent={<View testID='crypto-icon' />}
82
+ leadingContentShape='rounded'
83
83
  >
84
84
  Bitcoin
85
85
  </MediaButton>,
@@ -7,20 +7,20 @@ import type { MediaButtonProps } from './types';
7
7
 
8
8
  type Appearance = NonNullable<MediaButtonProps['appearance']>;
9
9
  type Size = NonNullable<MediaButtonProps['size']>;
10
- type IconType = 'flat' | 'rounded' | 'none';
10
+ type LeadingContentShape = 'flat' | 'rounded' | 'none';
11
11
 
12
12
  const useStyles = ({
13
13
  appearance,
14
14
  size,
15
15
  disabled,
16
16
  pressed,
17
- iconType,
17
+ leadingContentShape,
18
18
  }: {
19
19
  appearance: Appearance;
20
20
  size: Size;
21
21
  disabled: boolean;
22
22
  pressed: boolean;
23
- iconType: IconType;
23
+ leadingContentShape: LeadingContentShape;
24
24
  }) => {
25
25
  return useStyleSheet(
26
26
  (t) => {
@@ -45,7 +45,10 @@ const useStyles = ({
45
45
  paddingRight: number;
46
46
  };
47
47
 
48
- const paddingMap: Record<Size, Record<IconType, PaddingStyle>> = {
48
+ const paddingMap: Record<
49
+ Size,
50
+ Record<LeadingContentShape, PaddingStyle>
51
+ > = {
49
52
  md: {
50
53
  flat: {
51
54
  paddingTop: t.spacings.s12,
@@ -97,7 +100,7 @@ const useStyles = ({
97
100
  backgroundColor: bgColors[appearance],
98
101
  gap: t.spacings.s8,
99
102
  },
100
- paddingMap[size][iconType],
103
+ paddingMap[size][leadingContentShape],
101
104
  pressed && { backgroundColor: pressedBgColors[appearance] },
102
105
  disabled && { backgroundColor: t.colors.bg.disabled },
103
106
  appearance === 'no-background' &&
@@ -115,7 +118,7 @@ const useStyles = ({
115
118
  alignItems: 'center',
116
119
  gap: t.spacings.s2,
117
120
  },
118
- icon: {
121
+ leadingContent: {
119
122
  flexShrink: 0,
120
123
  },
121
124
  chevron: {
@@ -124,13 +127,13 @@ const useStyles = ({
124
127
  },
125
128
  };
126
129
  },
127
- [appearance, size, disabled, pressed, iconType],
130
+ [appearance, size, disabled, pressed, leadingContentShape],
128
131
  );
129
132
  };
130
133
 
131
134
  /**
132
135
  * Media button for select/dropdown components. Displays a label with an optional
133
- * leading icon and a trailing chevron indicator.
136
+ * leading content and a trailing chevron indicator.
134
137
  *
135
138
  * This component is intended to be used exclusively as the trigger inside a Select or
136
139
  * dropdown pattern. It should not be used as a standalone action button — use `Button`
@@ -142,7 +145,7 @@ const useStyles = ({
142
145
  * import { MediaButton } from '@ledgerhq/lumen-ui-rnative';
143
146
  * import { Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
144
147
  *
145
- * <MediaButton icon={<Settings size={20} />} iconType="flat">
148
+ * <MediaButton leadingContent={<Settings size={20} />} leadingContentShape="flat">
146
149
  * Network
147
150
  * </MediaButton>
148
151
  *
@@ -154,14 +157,16 @@ export const MediaButton = ({
154
157
  appearance = 'gray',
155
158
  size = 'md',
156
159
  disabled = false,
157
- icon,
158
- iconType = 'flat',
160
+ leadingContent,
161
+ leadingContentShape = 'flat',
159
162
  hideChevron = false,
160
163
  children: label,
161
164
  ref,
162
165
  ...props
163
166
  }: MediaButtonProps) => {
164
- const effectiveIconType: IconType = icon ? iconType : 'none';
167
+ const effectiveLeadingContentShape: LeadingContentShape = leadingContent
168
+ ? leadingContentShape
169
+ : 'none';
165
170
 
166
171
  return (
167
172
  <Pressable
@@ -179,8 +184,8 @@ export const MediaButton = ({
179
184
  size={size}
180
185
  disabled={disabled}
181
186
  pressed={pressed}
182
- iconType={effectiveIconType}
183
- icon={icon}
187
+ leadingContent={leadingContent}
188
+ leadingContentShape={effectiveLeadingContentShape}
184
189
  hideChevron={hideChevron}
185
190
  >
186
191
  {label}
@@ -195,8 +200,8 @@ type MediaButtonContentProps = PropsWithChildren<{
195
200
  size: Size;
196
201
  disabled: boolean;
197
202
  pressed: boolean;
198
- iconType: IconType;
199
- icon?: MediaButtonProps['icon'];
203
+ leadingContent?: MediaButtonProps['leadingContent'];
204
+ leadingContentShape: LeadingContentShape;
200
205
  hideChevron: boolean;
201
206
  }>;
202
207
 
@@ -205,16 +210,24 @@ const MediaButtonContent = ({
205
210
  size,
206
211
  disabled,
207
212
  pressed,
208
- iconType,
209
- icon,
213
+ leadingContent,
214
+ leadingContentShape,
210
215
  hideChevron,
211
216
  children,
212
217
  }: MediaButtonContentProps) => {
213
- const styles = useStyles({ appearance, size, disabled, pressed, iconType });
218
+ const styles = useStyles({
219
+ appearance,
220
+ size,
221
+ disabled,
222
+ pressed,
223
+ leadingContentShape,
224
+ });
214
225
 
215
226
  return (
216
227
  <View style={styles.container} testID='button-trigger-content'>
217
- {icon && <View style={styles.icon}>{icon}</View>}
228
+ {leadingContent && (
229
+ <View style={styles.leadingContent}>{leadingContent}</View>
230
+ )}
218
231
  <View style={styles.labelWrapper}>
219
232
  <Text style={styles.label} numberOfLines={1} ellipsizeMode='tail'>
220
233
  {children}
@@ -13,19 +13,19 @@ export type MediaButtonProps = {
13
13
  */
14
14
  size?: 'sm' | 'md';
15
15
  /**
16
- * An optional pre-rendered icon element to display as leading content.
17
- * Consumer is responsible for sizing the icon.
16
+ * An optional leading content, usually a pre-rendered icon.
17
+ * Consumer is responsible for sizing the icon (typically 20px).
18
18
  */
19
- icon?: ReactNode;
19
+ leadingContent?: ReactNode;
20
20
  /**
21
- * Determines the padding scheme when an icon is present.
21
+ * Determines the padding scheme when `leadingContent` is present.
22
22
  * - `'flat'`: Standard padding for line/interface icons.
23
23
  * - `'rounded'`: Tighter left padding for circular icons with their own background (e.g., crypto icons).
24
24
  *
25
- * Only relevant when `icon` is provided.
25
+ * Only relevant when `leadingContent` is provided.
26
26
  * @default 'flat'
27
27
  */
28
- iconType?: 'flat' | 'rounded';
28
+ leadingContentShape?: 'flat' | 'rounded';
29
29
  /**
30
30
  * When true, hides the trailing chevron indicator.
31
31
  * @default false
@@ -86,3 +86,21 @@ export const LoadingShowcase: Story = {
86
86
  </Box>
87
87
  ),
88
88
  };
89
+
90
+ export const DisabledShowcase: Story = {
91
+ render: () => (
92
+ <Box lx={{ flexDirection: 'row', alignItems: 'flex-end', gap: 's16' }}>
93
+ <MediaImage src={exampleSrc} alt='Cardano' size={32} disabled />
94
+ <MediaImage src={exampleSrc} alt='Cardano' size={48} disabled />
95
+ <MediaImage
96
+ src={exampleSrc}
97
+ alt='Cardano'
98
+ size={48}
99
+ shape='circle'
100
+ disabled
101
+ />
102
+ <MediaImage fallback='Bitcoin' alt='Bitcoin' size={48} disabled />
103
+ <MediaImage alt='Empty' size={48} disabled />
104
+ </Box>
105
+ ),
106
+ };