@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
@@ -8,6 +8,7 @@ import Animated, {
8
8
  withTiming,
9
9
  } from 'react-native-reanimated';
10
10
  import { useCommonTranslation } from '../../../i18n';
11
+ import type { LumenTypographyTokenName } from '../../../styles';
11
12
  import { useStyleSheet } from '../../../styles';
12
13
  import { Pulse } from '../../Animations/Pulse';
13
14
  import { useTimingConfig } from '../../Animations/useTimingConfig';
@@ -15,38 +16,66 @@ import { RuntimeConstants } from '../../utils';
15
16
  import { Box } from '../Utility';
16
17
  import type {
17
18
  AmountDisplayProps,
19
+ AmountDisplaySize,
18
20
  DigitStripListProps,
19
21
  DigitStripProps,
22
+ DigitWidths,
20
23
  } from './types';
21
24
  import { DIGITS } from './types';
22
25
 
23
- const INTEGER_DIGIT_WIDTHS = {
24
- 0: 25,
25
- 1: 15.5,
26
- 2: 23.5,
27
- 3: 24.5,
28
- 4: 25.5,
29
- 5: 23.5,
30
- 6: 25,
31
- 7: 22,
32
- 8: 24.5,
33
- 9: 24.5,
26
+ const TYPOGRAPHY_WIDTHS = {
27
+ heading1SemiBold: {
28
+ 0: 25,
29
+ 1: 15.5,
30
+ 2: 23.5,
31
+ 3: 24.5,
32
+ 4: 25.5,
33
+ 5: 23.5,
34
+ 6: 25,
35
+ 7: 22,
36
+ 8: 24.5,
37
+ 9: 24.5,
38
+ },
39
+ heading2SemiBold: {
40
+ 0: 17.5,
41
+ 1: 11,
42
+ 2: 16.5,
43
+ 3: 17,
44
+ 4: 18,
45
+ 5: 16,
46
+ 6: 17.5,
47
+ 7: 15,
48
+ 8: 17,
49
+ 9: 17,
50
+ },
51
+ heading4SemiBold: {
52
+ 0: 13,
53
+ 1: 8.5,
54
+ 2: 12.5,
55
+ 3: 12.5,
56
+ 4: 13,
57
+ 5: 12,
58
+ 6: 12.5,
59
+ 7: 11.5,
60
+ 8: 12.5,
61
+ 9: 12.5,
62
+ },
63
+ } as const satisfies Partial<Record<LumenTypographyTokenName, DigitWidths>>;
64
+
65
+ type MeasuredTypography = keyof typeof TYPOGRAPHY_WIDTHS;
66
+
67
+ type SizeTypographyConfig = {
68
+ integer: MeasuredTypography;
69
+ decimal: MeasuredTypography;
34
70
  };
35
71
 
36
- const DECIMAL_DIGIT_WIDTHS = {
37
- 0: 17.5,
38
- 1: 11,
39
- 2: 16.5,
40
- 3: 17,
41
- 4: 18,
42
- 5: 16,
43
- 6: 17.5,
44
- 7: 15,
45
- 8: 17,
46
- 9: 17,
72
+ const SIZE_TYPOGRAPHY: Record<AmountDisplaySize, SizeTypographyConfig> = {
73
+ md: { integer: 'heading1SemiBold', decimal: 'heading2SemiBold' },
74
+ sm: { integer: 'heading2SemiBold', decimal: 'heading4SemiBold' },
47
75
  };
48
76
 
49
- const useStyles = () => {
77
+ const useStyles = (size: AmountDisplaySize) => {
78
+ const typography = SIZE_TYPOGRAPHY[size];
50
79
  return useStyleSheet(
51
80
  (t) => ({
52
81
  container: {
@@ -61,19 +90,19 @@ const useStyles = () => {
61
90
  paddingBottom: t.spacings.s2,
62
91
  },
63
92
  integerText: {
64
- ...t.typographies.heading1SemiBold,
93
+ ...t.typographies[typography.integer],
65
94
  color: t.colors.text.base,
66
95
  },
67
96
  decimalText: {
68
- ...t.typographies.heading2SemiBold,
97
+ ...t.typographies[typography.decimal],
69
98
  color: t.colors.text.muted,
70
99
  },
71
100
  currencyStartText: {
72
- ...t.typographies.heading1SemiBold,
101
+ ...t.typographies[typography.integer],
73
102
  color: t.colors.text.base,
74
103
  },
75
104
  currencyEndText: {
76
- ...t.typographies.heading2SemiBold,
105
+ ...t.typographies[typography.decimal],
77
106
  color: t.colors.text.muted,
78
107
  },
79
108
  spacingStart: {
@@ -83,7 +112,7 @@ const useStyles = () => {
83
112
  marginLeft: t.spacings.s4,
84
113
  },
85
114
  }),
86
- [],
115
+ [typography],
87
116
  );
88
117
  };
89
118
 
@@ -136,10 +165,8 @@ const useAnimatedDigitStrip = ({
136
165
  };
137
166
 
138
167
  const DigitStrip = memo(
139
- ({ value, textStyle, animate, type }: DigitStripProps) => {
140
- const targetWidth = (
141
- type === 'integer' ? INTEGER_DIGIT_WIDTHS : DECIMAL_DIGIT_WIDTHS
142
- )[value];
168
+ ({ value, textStyle, animate, widths }: DigitStripProps) => {
169
+ const targetWidth = widths[value];
143
170
  const lineHeight = textStyle.lineHeight;
144
171
  const width = useSharedValue<number>(targetWidth);
145
172
  const { animatedStyle } = useAnimatedDigitStrip({
@@ -176,7 +203,7 @@ const DigitStrip = memo(
176
203
  DigitStrip.displayName = 'DigitStrip';
177
204
 
178
205
  const DigitStripList = memo(
179
- ({ items, textStyle, animate, type }: DigitStripListProps) => {
206
+ ({ items, textStyle, animate, widths }: DigitStripListProps) => {
180
207
  return items.map((item, index) => {
181
208
  const key = items.length - index;
182
209
  if (item.type === 'separator') {
@@ -192,7 +219,7 @@ const DigitStripList = memo(
192
219
  value={Number(item.value) as DigitStripProps['value']}
193
220
  animate={animate}
194
221
  textStyle={textStyle}
195
- type={type}
222
+ widths={widths}
196
223
  />
197
224
  );
198
225
  });
@@ -233,15 +260,16 @@ DigitStripList.displayName = 'DigitStripList';
233
260
  * <AmountDisplay value={1234.56} formatter={usdFormatter} hidden={true} />
234
261
  * ```
235
262
  */
236
- export const AmountDisplay = ({
263
+ export function AmountDisplay({
237
264
  value,
238
265
  formatter,
239
266
  hidden = false,
240
267
  loading = false,
241
268
  animate = true,
269
+ size = 'md',
242
270
  ...props
243
- }: AmountDisplayProps) => {
244
- const styles = useStyles();
271
+ }: AmountDisplayProps) {
272
+ const styles = useStyles(size);
245
273
  const { t } = useCommonTranslation();
246
274
  const parts = formatter(value);
247
275
  const splitDigits = useSplitText(parts);
@@ -250,6 +278,9 @@ export const AmountDisplay = ({
250
278
  hidden,
251
279
  t('components.amountDisplay.amountHiddenAriaLabel'),
252
280
  );
281
+ const typography = SIZE_TYPOGRAPHY[size];
282
+ const integerWidths = TYPOGRAPHY_WIDTHS[typography.integer];
283
+ const decimalWidths = TYPOGRAPHY_WIDTHS[typography.decimal];
253
284
 
254
285
  return (
255
286
  <Box
@@ -281,7 +312,7 @@ export const AmountDisplay = ({
281
312
  items={splitDigits.integerPart}
282
313
  textStyle={styles.integerText}
283
314
  animate={animate}
284
- type='integer'
315
+ widths={integerWidths}
285
316
  />
286
317
  )}
287
318
  </View>
@@ -296,7 +327,7 @@ export const AmountDisplay = ({
296
327
  items={splitDigits.decimalPart}
297
328
  textStyle={styles.decimalText}
298
329
  animate={animate}
299
- type='decimal'
330
+ widths={decimalWidths}
300
331
  />
301
332
  )}
302
333
  {parts.currencyPosition === 'end' && (
@@ -312,4 +343,4 @@ export const AmountDisplay = ({
312
343
  </Pulse>
313
344
  </Box>
314
345
  );
315
- };
346
+ }
@@ -1,2 +1,6 @@
1
1
  export { AmountDisplay } from './AmountDisplay';
2
- export type { AmountDisplayProps, FormattedValue } from './types';
2
+ export type {
3
+ AmountDisplayProps,
4
+ AmountDisplaySize,
5
+ FormattedValue,
6
+ } from './types';
@@ -6,13 +6,17 @@ export type { FormattedValue };
6
6
 
7
7
  export const DIGITS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] as const;
8
8
 
9
- type IntegerDigit = (typeof DIGITS)[number];
9
+ type Digit = (typeof DIGITS)[number];
10
+
11
+ export type AmountDisplaySize = 'sm' | 'md';
12
+
13
+ export type DigitWidths = Record<Digit, number>;
10
14
 
11
15
  export type DigitStripProps = {
12
- value: IntegerDigit;
16
+ value: Digit;
13
17
  animate: boolean;
14
18
  textStyle: TextStyle & { lineHeight: number };
15
- type: 'integer' | 'decimal';
19
+ widths: DigitWidths;
16
20
  };
17
21
 
18
22
  export type DigitStripListProps = {
@@ -48,4 +52,9 @@ export type AmountDisplayProps = ViewProps & {
48
52
  * @default true
49
53
  */
50
54
  animate?: boolean;
55
+ /**
56
+ * The size variant of the amount display.
57
+ * @default 'md'
58
+ */
59
+ size?: AmountDisplaySize;
51
60
  } & Omit<StyledViewProps, 'children'>;
@@ -7,7 +7,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
7
7
 
8
8
  <Meta title='Input/AmountInput' of={AmountInputStories} />
9
9
 
10
- # 💰 AmountInput
10
+ # AmountInput
11
11
 
12
12
  <CustomTabs>
13
13
  <Tab label="Overview">
@@ -8,7 +8,7 @@ import { Box } from '../Utility';
8
8
 
9
9
  <Meta title='Communication/Avatar' of={AvatarStories} />
10
10
 
11
- # 👤 Avatar
11
+ # Avatar
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/Banner' of={BannerStories} />
10
10
 
11
- # 🃏 Banner
11
+ # Banner
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -8,7 +8,7 @@ import { Box } from '../Utility';
8
8
 
9
9
  <Meta title="Components/BottomSheet" of={BottomSheetStories} />
10
10
 
11
- # 📋 BottomSheet
11
+ # BottomSheet
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -8,7 +8,7 @@ import { Box } from '../Utility';
8
8
 
9
9
  <Meta title='Action/Button' of={ButtonStories} />
10
10
 
11
- # 🔘 Button
11
+ # Button
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview ">
@@ -196,9 +196,7 @@ export const StatesShowcase: Story = {
196
196
  <Card {...args} lx={{ width: 's320' }} disabled>
197
197
  <CardHeader>
198
198
  <CardLeading>
199
- <Box lx={{ opacity: 0.3 }}>
200
- <CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
201
- </Box>
199
+ <CryptoIcon ledgerId='bitcoin' ticker='BTC' size={48} />
202
200
  <CardContent>
203
201
  <CardContentTitle>Disabled</CardContentTitle>
204
202
  <CardContentDescription>Non-interactive</CardContentDescription>
@@ -8,7 +8,7 @@ import { Box } from '../Utility';
8
8
 
9
9
  <Meta title='Action/CardButton' of={CardButtonStories} />
10
10
 
11
- # 🃏 CardButton
11
+ # CardButton
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/Checkbox" of={CheckboxStories} />
10
10
 
11
- # ☑️ Checkbox
11
+ # Checkbox
12
12
 
13
13
  <CustomTabs>
14
14
  <Tab label="Overview">
@@ -9,7 +9,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
9
9
 
10
10
  <Meta title='Layout/Divider' of={DividerStories} />
11
11
 
12
- # Divider
12
+ # Divider
13
13
 
14
14
  <CustomTabs>
15
15
  <Tab label="Overview ">
@@ -1,13 +1,18 @@
1
1
  import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
2
2
  import * as DotIconStories from './DotIcon.stories';
3
+ import { CustomTabs, Tab } from '../../../../.storybook/components';
3
4
 
4
5
  <Meta title='Communication/DotIcon' of={DotIconStories} />
5
6
 
6
7
  # DotIcon
7
8
 
9
+ <CustomTabs>
10
+ <Tab label="Overview">
11
+
8
12
  ## Introduction
9
13
 
10
14
  DotIcon positions a small icon indicator at a configurable corner of a child element such as MediaImage or Spot. The dot background uses a semantic color (`success`, `muted`, or `error`) to convey meaning at a glance.
15
+
11
16
  > View in [Figma](https://www.figma.com/design/zSkvGGiqcnhywp2l3HTHxA/1.-Symbol-Library?node-id=6159-1866).
12
17
 
13
18
  ## Anatomy
@@ -50,7 +55,94 @@ The dot size is driven by the parent MediaImage or Spot size via the mapping hel
50
55
 
51
56
  <Canvas of={DotIconStories.SizeShowcase} />
52
57
 
58
+ ### Disabled
59
+
60
+ Only set `disabled` on `DotIcon`. The state is propagated to the child via context. Passing it to both stacks the opacity overlay.
61
+
62
+ <Canvas of={DotIconStories.DisabledShowcase} />
63
+
53
64
  ## Accessibility
54
65
 
55
66
  - The icon is purely decorative; the child element should carry its own accessibility label.
56
67
  - Pair semantic appearances with meaningful icons so the state can be understood without relying on color alone.
68
+
69
+ </Tab>
70
+ <Tab label="Implementation">
71
+
72
+ ## Setup
73
+
74
+ Install and set up the library with our [Setup Guide →](?path=/docs/getting-started-setup--docs).
75
+
76
+ ### Basic Usage
77
+
78
+ ```tsx
79
+ import { DotIcon, MediaImage } from '@ledgerhq/lumen-ui-rnative';
80
+ import { ArrowDown } from '@ledgerhq/lumen-ui-rnative/symbols';
81
+
82
+ function MyComponent() {
83
+ return (
84
+ <DotIcon appearance='success' icon={ArrowDown}>
85
+ <MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
86
+ </DotIcon>
87
+ );
88
+ }
89
+ ```
90
+
91
+ ### Pin Placement
92
+
93
+ Position the dot at any of the four corners of the child:
94
+
95
+ ```tsx
96
+ <DotIcon appearance='success' icon={ArrowDown} pin='top-end'>
97
+ <MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
98
+ </DotIcon>
99
+ ```
100
+
101
+ ### Shapes
102
+
103
+ Use `shape='square'` to match a square child element:
104
+
105
+ ```tsx
106
+ <DotIcon appearance='muted' icon={ArrowDown} shape='square'>
107
+ <MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} shape='square' />
108
+ </DotIcon>
109
+ ```
110
+
111
+ ### Appearances
112
+
113
+ Pick a semantic color via `appearance`:
114
+
115
+ ```tsx
116
+ <DotIcon appearance='success' icon={ArrowDown}>...</DotIcon>
117
+ <DotIcon appearance='muted' icon={ArrowUp}>...</DotIcon>
118
+ <DotIcon appearance='error' icon={Close}>...</DotIcon>
119
+ ```
120
+
121
+ ### Sizing
122
+
123
+ The dot size is driven by the parent's size via the mapping helpers:
124
+
125
+ ```tsx
126
+ import { DotIcon, mediaImageDotIconSizeMap, MediaImage } from '@ledgerhq/lumen-ui-rnative';
127
+
128
+ <DotIcon
129
+ appearance='success'
130
+ icon={ArrowDown}
131
+ size={mediaImageDotIconSizeMap[48]}
132
+ >
133
+ <MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
134
+ </DotIcon>;
135
+ ```
136
+
137
+ ### Disabled State
138
+
139
+ Only set `disabled` on `DotIcon`. The state is propagated to the child via context. Passing it to both stacks the opacity overlay.
140
+
141
+ ```tsx
142
+ <DotIcon appearance='success' icon={ArrowDown} disabled>
143
+ <MediaImage src='https://example.com/ada.png' alt='Cardano' size={48} />
144
+ </DotIcon>
145
+ ```
146
+
147
+ </Tab>
148
+ </CustomTabs>
@@ -113,6 +113,41 @@ export const AppearanceShowcase: Story = {
113
113
  ),
114
114
  };
115
115
 
116
+ export const DisabledShowcase: Story = {
117
+ args: { appearance: 'success', icon: ArrowDown },
118
+ render: () => (
119
+ <Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's32' }}>
120
+ <DotIcon
121
+ appearance='success'
122
+ icon={ArrowDown}
123
+ size={mediaImageDotIconSizeMap[48]}
124
+ pin='bottom-end'
125
+ disabled
126
+ >
127
+ <MediaImage src={parentSrc} size={48} shape='circle' />
128
+ </DotIcon>
129
+ <DotIcon
130
+ appearance='muted'
131
+ icon={ArrowUp}
132
+ size={mediaImageDotIconSizeMap[48]}
133
+ pin='bottom-end'
134
+ disabled
135
+ >
136
+ <MediaImage src={parentSrc} size={48} shape='circle' />
137
+ </DotIcon>
138
+ <DotIcon
139
+ appearance='error'
140
+ icon={Close}
141
+ size={mediaImageDotIconSizeMap[48]}
142
+ pin='bottom-end'
143
+ disabled
144
+ >
145
+ <MediaImage src={parentSrc} size={48} shape='circle' />
146
+ </DotIcon>
147
+ </Box>
148
+ ),
149
+ };
150
+
116
151
  export const SizeShowcase: Story = {
117
152
  args: { appearance: 'muted', icon: Link },
118
153
  render: () => (
@@ -1,4 +1,7 @@
1
- import { StyleSheet } from 'react-native';
1
+ import {
2
+ DisabledProvider,
3
+ useDisabledContext,
4
+ } from '@ledgerhq/lumen-utils-shared';
2
5
  import { useStyleSheet } from '../../../styles';
3
6
  import type { IconSize } from '../Icon';
4
7
  import { Box } from '../Utility';
@@ -63,11 +66,13 @@ const useStyles = ({
63
66
  shape,
64
67
  pin,
65
68
  appearance,
69
+ disabled,
66
70
  }: {
67
71
  size: DotIconSize;
68
72
  shape: 'square' | 'circle';
69
73
  pin: DotIconPin;
70
74
  appearance: DotIconAppearance;
75
+ disabled: boolean;
71
76
  }) => {
72
77
  return useStyleSheet(
73
78
  (t) => {
@@ -77,6 +82,10 @@ const useStyles = ({
77
82
  const pinOffset = getPinOffset(pin);
78
83
 
79
84
  return {
85
+ root: {
86
+ position: 'relative',
87
+ ...(disabled && { opacity: 0.3 }),
88
+ },
80
89
  dot: {
81
90
  position: 'absolute',
82
91
  zIndex: 10,
@@ -96,7 +105,7 @@ const useStyles = ({
96
105
  },
97
106
  };
98
107
  },
99
- [size, shape, pin, appearance],
108
+ [size, shape, pin, appearance, disabled],
100
109
  );
101
110
  };
102
111
 
@@ -119,27 +128,35 @@ export const DotIcon = ({
119
128
  pin = 'bottom-end',
120
129
  size = 20,
121
130
  shape = 'circle',
131
+ disabled: disabledProp = false,
122
132
  lx = {},
123
133
  style,
124
134
  ref,
125
135
  ...rest
126
136
  }: DotIconProps) => {
127
- const styles = useStyles({ size, shape, pin, appearance });
137
+ const disabled = useDisabledContext({
138
+ consumerName: 'DotIcon',
139
+ mergeWith: { disabled: disabledProp },
140
+ });
141
+ const styles = useStyles({ size, shape, pin, appearance, disabled });
128
142
 
129
143
  return (
130
- <Box
131
- ref={ref}
132
- lx={lx}
133
- style={StyleSheet.flatten([{ position: 'relative' }, style])}
134
- {...rest}
135
- >
136
- <Box style={{ alignSelf: 'flex-start', position: 'relative' }}>
137
- {children}
138
- <Box testID='dot-icon-dot' style={styles.dot}>
139
- <Icon size={dotIconSizeMap[size]} style={styles.icon} />
144
+ <DisabledProvider value={{ disabled: false }}>
145
+ <Box
146
+ ref={ref}
147
+ lx={lx}
148
+ style={[styles.root, style]}
149
+ accessibilityState={{ disabled }}
150
+ {...rest}
151
+ >
152
+ <Box style={{ alignSelf: 'flex-start', position: 'relative' }}>
153
+ {children}
154
+ <Box testID='dot-icon-dot' style={styles.dot}>
155
+ <Icon size={dotIconSizeMap[size]} style={styles.icon} />
156
+ </Box>
140
157
  </Box>
141
158
  </Box>
142
- </Box>
159
+ </DisabledProvider>
143
160
  );
144
161
  };
145
162
 
@@ -37,6 +37,12 @@ export type DotIconProps = {
37
37
  * @default 'circle'
38
38
  */
39
39
  shape?: 'square' | 'circle';
40
+ /**
41
+ * Shows a disabled appearance.
42
+ * @optional
43
+ * @default false
44
+ */
45
+ disabled?: boolean;
40
46
  /**
41
47
  * The wrapped component (e.g. MediaImage or Spot).
42
48
  */