@ledgerhq/lumen-ui-rnative 0.1.66 → 0.1.67

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/BottomSheet/BottomSheet.stories.js +6 -3
  2. package/dist/module/lib/Components/core/BottomSheet/BottomSheet.stories.js.map +1 -1
  3. package/dist/module/lib/Components/core/Card/Card.figma.js +0 -1
  4. package/dist/module/lib/Components/core/Card/Card.figma.js.map +1 -1
  5. package/dist/module/lib/Components/core/Card/Card.stories.js +0 -2
  6. package/dist/module/lib/Components/core/Card/Card.stories.js.map +1 -1
  7. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.figma.js +0 -1
  8. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.figma.js.map +1 -1
  9. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.js +1 -1
  10. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.mdx +4 -4
  11. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.stories.js +1 -9
  12. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.stories.js.map +1 -1
  13. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.test.js +0 -1
  14. package/dist/module/lib/Components/core/ContentBanner/ContentBanner.test.js.map +1 -1
  15. package/dist/module/lib/Components/core/DotSymbol/DotSymbol.stories.js +0 -5
  16. package/dist/module/lib/Components/core/DotSymbol/DotSymbol.stories.js.map +1 -1
  17. package/dist/module/lib/Components/core/ListItem/ListItem.figma.js +0 -1
  18. package/dist/module/lib/Components/core/ListItem/ListItem.figma.js.map +1 -1
  19. package/dist/module/lib/Components/core/ListItem/ListItem.js +1 -1
  20. package/dist/module/lib/Components/core/ListItem/ListItem.mdx +10 -10
  21. package/dist/module/lib/Components/core/ListItem/ListItem.stories.js +2 -29
  22. package/dist/module/lib/Components/core/ListItem/ListItem.stories.js.map +1 -1
  23. package/dist/module/lib/Components/core/SelectList/SelectList.mdx +1 -1
  24. package/dist/module/lib/Components/core/SelectList/SelectList.stories.js +0 -1
  25. package/dist/module/lib/Components/core/SelectList/SelectList.stories.js.map +1 -1
  26. package/dist/module/lib/Components/core/Spot/Spot.figma.js +31 -16
  27. package/dist/module/lib/Components/core/Spot/Spot.figma.js.map +1 -1
  28. package/dist/module/lib/Components/core/Spot/Spot.js +24 -146
  29. package/dist/module/lib/Components/core/Spot/Spot.js.map +1 -1
  30. package/dist/module/lib/Components/core/Spot/Spot.mdx +47 -108
  31. package/dist/module/lib/Components/core/Spot/Spot.stories.js +108 -215
  32. package/dist/module/lib/Components/core/Spot/Spot.stories.js.map +1 -1
  33. package/dist/module/lib/Components/core/Spot/Spot.test.js +61 -0
  34. package/dist/module/lib/Components/core/Spot/Spot.test.js.map +1 -0
  35. package/dist/module/lib/Components/core/Spot/SpotNumber.js +56 -0
  36. package/dist/module/lib/Components/core/Spot/SpotNumber.js.map +1 -0
  37. package/dist/module/lib/Components/core/Spot/SpotNumber.test.js +72 -0
  38. package/dist/module/lib/Components/core/Spot/SpotNumber.test.js.map +1 -0
  39. package/dist/module/lib/Components/core/Spot/index.js +1 -0
  40. package/dist/module/lib/Components/core/Spot/index.js.map +1 -1
  41. package/dist/module/lib/Components/core/Spot/useSpotStyles.js +93 -0
  42. package/dist/module/lib/Components/core/Spot/useSpotStyles.js.map +1 -0
  43. package/dist/module/lib/Components/core/ThemeProvider/ThemeProvider.test.js +0 -1
  44. package/dist/module/lib/Components/core/ThemeProvider/ThemeProvider.test.js.map +1 -1
  45. package/dist/module/lib/Components/core/Tile/Tile.figma.js +0 -1
  46. package/dist/module/lib/Components/core/Tile/Tile.figma.js.map +1 -1
  47. package/dist/module/lib/Components/core/Tile/Tile.js +3 -3
  48. package/dist/module/lib/Components/core/Tile/Tile.mdx +8 -8
  49. package/dist/module/lib/Components/core/Tile/Tile.stories.js +7 -25
  50. package/dist/module/lib/Components/core/Tile/Tile.stories.js.map +1 -1
  51. package/dist/module/lib/Components/symbols/icons/AiBubble.js +60 -0
  52. package/dist/module/lib/Components/symbols/icons/AiBubble.js.map +1 -0
  53. package/dist/module/lib/Components/symbols/icons/ArrowBottomLeft.js +49 -0
  54. package/dist/module/lib/Components/symbols/icons/ArrowBottomLeft.js.map +1 -0
  55. package/dist/module/lib/Components/symbols/icons/Bug.js +1 -1
  56. package/dist/module/lib/Components/symbols/icons/Bug.js.map +1 -1
  57. package/dist/module/lib/Components/symbols/icons/Hourglass.js +49 -0
  58. package/dist/module/lib/Components/symbols/icons/Hourglass.js.map +1 -0
  59. package/dist/module/lib/Components/symbols/icons/Repeat.js +49 -0
  60. package/dist/module/lib/Components/symbols/icons/Repeat.js.map +1 -0
  61. package/dist/module/lib/Components/symbols/icons/Robot.js +57 -0
  62. package/dist/module/lib/Components/symbols/icons/Robot.js.map +1 -0
  63. package/dist/module/lib/Components/symbols/icons/Switch.js +11 -5
  64. package/dist/module/lib/Components/symbols/icons/Switch.js.map +1 -1
  65. package/dist/module/lib/Components/symbols/icons/Wifi.js +52 -0
  66. package/dist/module/lib/Components/symbols/icons/Wifi.js.map +1 -0
  67. package/dist/module/lib/Components/symbols/index.js +6 -0
  68. package/dist/module/lib/Components/symbols/index.js.map +1 -1
  69. package/dist/typescript/src/lib/Components/core/ContentBanner/ContentBanner.d.ts +1 -1
  70. package/dist/typescript/src/lib/Components/core/ListItem/ListItem.d.ts +1 -1
  71. package/dist/typescript/src/lib/Components/core/Spot/Spot.d.ts +7 -25
  72. package/dist/typescript/src/lib/Components/core/Spot/Spot.d.ts.map +1 -1
  73. package/dist/typescript/src/lib/Components/core/Spot/SpotNumber.d.ts +16 -0
  74. package/dist/typescript/src/lib/Components/core/Spot/SpotNumber.d.ts.map +1 -0
  75. package/dist/typescript/src/lib/Components/core/Spot/index.d.ts +1 -0
  76. package/dist/typescript/src/lib/Components/core/Spot/index.d.ts.map +1 -1
  77. package/dist/typescript/src/lib/Components/core/Spot/types.d.ts +29 -29
  78. package/dist/typescript/src/lib/Components/core/Spot/types.d.ts.map +1 -1
  79. package/dist/typescript/src/lib/Components/core/Spot/useSpotStyles.d.ts +14 -0
  80. package/dist/typescript/src/lib/Components/core/Spot/useSpotStyles.d.ts.map +1 -0
  81. package/dist/typescript/src/lib/Components/core/Tile/Tile.d.ts +3 -3
  82. package/dist/typescript/src/lib/Components/symbols/icons/AiBubble.d.ts +35 -0
  83. package/dist/typescript/src/lib/Components/symbols/icons/AiBubble.d.ts.map +1 -0
  84. package/dist/typescript/src/lib/Components/symbols/icons/ArrowBottomLeft.d.ts +35 -0
  85. package/dist/typescript/src/lib/Components/symbols/icons/ArrowBottomLeft.d.ts.map +1 -0
  86. package/dist/typescript/src/lib/Components/symbols/icons/Hourglass.d.ts +35 -0
  87. package/dist/typescript/src/lib/Components/symbols/icons/Hourglass.d.ts.map +1 -0
  88. package/dist/typescript/src/lib/Components/symbols/icons/Repeat.d.ts +35 -0
  89. package/dist/typescript/src/lib/Components/symbols/icons/Repeat.d.ts.map +1 -0
  90. package/dist/typescript/src/lib/Components/symbols/icons/Robot.d.ts +35 -0
  91. package/dist/typescript/src/lib/Components/symbols/icons/Robot.d.ts.map +1 -0
  92. package/dist/typescript/src/lib/Components/symbols/icons/Switch.d.ts.map +1 -1
  93. package/dist/typescript/src/lib/Components/symbols/icons/Wifi.d.ts +35 -0
  94. package/dist/typescript/src/lib/Components/symbols/icons/Wifi.d.ts.map +1 -0
  95. package/dist/typescript/src/lib/Components/symbols/index.d.ts +6 -0
  96. package/dist/typescript/src/lib/Components/symbols/index.d.ts.map +1 -1
  97. package/package.json +2 -2
  98. package/src/lib/Components/core/BottomSheet/BottomSheet.stories.tsx +12 -4
  99. package/src/lib/Components/core/Card/Card.figma.tsx +1 -1
  100. package/src/lib/Components/core/Card/Card.stories.tsx +2 -2
  101. package/src/lib/Components/core/ContentBanner/ContentBanner.figma.tsx +1 -1
  102. package/src/lib/Components/core/ContentBanner/ContentBanner.mdx +4 -4
  103. package/src/lib/Components/core/ContentBanner/ContentBanner.stories.tsx +9 -9
  104. package/src/lib/Components/core/ContentBanner/ContentBanner.test.tsx +1 -1
  105. package/src/lib/Components/core/ContentBanner/ContentBanner.tsx +1 -1
  106. package/src/lib/Components/core/DotSymbol/DotSymbol.stories.tsx +5 -5
  107. package/src/lib/Components/core/ListItem/ListItem.figma.tsx +1 -1
  108. package/src/lib/Components/core/ListItem/ListItem.mdx +10 -10
  109. package/src/lib/Components/core/ListItem/ListItem.stories.tsx +29 -33
  110. package/src/lib/Components/core/ListItem/ListItem.tsx +1 -1
  111. package/src/lib/Components/core/SelectList/SelectList.mdx +1 -1
  112. package/src/lib/Components/core/SelectList/SelectList.stories.tsx +1 -1
  113. package/src/lib/Components/core/Spot/Spot.figma.tsx +42 -21
  114. package/src/lib/Components/core/Spot/Spot.mdx +47 -108
  115. package/src/lib/Components/core/Spot/Spot.stories.tsx +114 -175
  116. package/src/lib/Components/core/Spot/Spot.test.tsx +71 -0
  117. package/src/lib/Components/core/Spot/Spot.tsx +21 -163
  118. package/src/lib/Components/core/Spot/SpotNumber.test.tsx +93 -0
  119. package/src/lib/Components/core/Spot/SpotNumber.tsx +48 -0
  120. package/src/lib/Components/core/Spot/index.ts +1 -0
  121. package/src/lib/Components/core/Spot/types.ts +39 -41
  122. package/src/lib/Components/core/Spot/useSpotStyles.ts +119 -0
  123. package/src/lib/Components/core/ThemeProvider/ThemeProvider.test.tsx +1 -1
  124. package/src/lib/Components/core/Tile/Tile.figma.tsx +1 -1
  125. package/src/lib/Components/core/Tile/Tile.mdx +8 -8
  126. package/src/lib/Components/core/Tile/Tile.stories.tsx +32 -25
  127. package/src/lib/Components/core/Tile/Tile.tsx +3 -3
  128. package/src/lib/Components/symbols/icons/AiBubble.tsx +51 -0
  129. package/src/lib/Components/symbols/icons/ArrowBottomLeft.tsx +44 -0
  130. package/src/lib/Components/symbols/icons/Bug.tsx +1 -1
  131. package/src/lib/Components/symbols/icons/Hourglass.tsx +44 -0
  132. package/src/lib/Components/symbols/icons/Repeat.tsx +44 -0
  133. package/src/lib/Components/symbols/icons/Robot.tsx +44 -0
  134. package/src/lib/Components/symbols/icons/Switch.tsx +8 -1
  135. package/src/lib/Components/symbols/icons/Wifi.tsx +48 -0
  136. package/src/lib/Components/symbols/index.ts +6 -0
@@ -1,64 +1,48 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
2
+ import type { ComponentType } from 'react';
2
3
  import { Box, Text } from '../../primitives';
3
- import { Settings, Plus, Heart, Star } from '../../symbols';
4
- import type { IconProps } from '../../symbols/Icon';
4
+ import {
5
+ CheckmarkCircleFill,
6
+ DeleteCircleFill,
7
+ Heart,
8
+ InformationFill,
9
+ Settings,
10
+ Star,
11
+ WarningFill,
12
+ } from '../../symbols';
13
+ import type { IconSize } from '../../symbols/Icon';
14
+ import { DotSymbol, getDotSymbolProps } from '../DotSymbol';
15
+ import { Spinner } from '../Spinner';
5
16
  import { Spot } from './Spot';
6
- import type { SpotProps } from './types';
17
+ import { SpotNumber } from './SpotNumber';
18
+ import type { SpotAppearance } from './types';
7
19
 
8
20
  const meta = {
9
21
  component: Spot,
10
22
  id: 'rnative-spot',
11
23
  title: 'Core/Spot',
12
24
  parameters: {
25
+ layout: 'centered',
26
+ backgrounds: { default: 'light' },
13
27
  docs: {
14
28
  source: {
15
29
  language: 'tsx',
16
30
  format: true,
17
- type: 'code',
31
+ type: 'dynamic',
18
32
  },
19
33
  },
20
34
  },
21
35
  argTypes: {
22
- appearance: {
23
- control: 'select',
24
- options: [
25
- 'icon',
26
- 'bluetooth',
27
- 'check',
28
- 'error',
29
- 'warning',
30
- 'info',
31
- 'loader',
32
- 'number',
33
- ],
34
- description: 'The visual appearance and behavior of the spot',
35
- },
36
- size: {
37
- control: 'select',
38
- options: [32, 40, 48, 56, 72],
39
- description: 'The size of the spot',
40
- },
41
- disabled: {
42
- control: 'boolean',
43
- description: 'Whether the spot looks disabled',
44
- },
45
36
  icon: {
46
37
  control: 'select',
47
- description: 'Icon component to display (required for icon appearance)',
48
- options: ['None', 'Settings', 'Plus', 'Heart', 'Star'],
38
+ options: ['Settings', 'Heart', 'Star', 'CheckmarkCircleFill'],
49
39
  mapping: {
50
- None: undefined,
51
40
  Settings: Settings,
52
- Plus: Plus,
53
41
  Heart: Heart,
54
42
  Star: Star,
43
+ CheckmarkCircleFill: CheckmarkCircleFill,
55
44
  },
56
45
  },
57
- number: {
58
- control: 'select',
59
- options: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
60
- description: 'Number to display (required for number appearance)',
61
- },
62
46
  },
63
47
  } satisfies Meta<typeof Spot>;
64
48
 
@@ -67,43 +51,23 @@ type Story = StoryObj<typeof Spot>;
67
51
 
68
52
  export const Base: Story = {
69
53
  args: {
70
- appearance: 'icon',
71
54
  icon: Settings,
72
55
  },
73
- parameters: {
74
- docs: {
75
- source: {
76
- code: `
77
- <Spot
78
- appearance="icon"
79
- icon={Settings}
80
- />
81
- `,
82
- },
83
- },
84
- },
56
+ render: (args) => <Spot {...args} />,
85
57
  };
86
58
 
87
59
  export const AppearanceShowcase: Story = {
88
- args: {
89
- appearance: 'icon',
90
- icon: Settings,
91
- },
92
60
  render: () => {
93
61
  const appearances: {
94
62
  name: string;
95
- appearance: SpotProps['appearance'];
96
- icon?: React.ComponentType<IconProps>;
97
- number?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
63
+ appearance: SpotAppearance;
64
+ icon: ComponentType<{ size?: IconSize }>;
98
65
  }[] = [
99
- { name: 'Icon', appearance: 'icon', icon: Settings },
100
- { name: 'Bluetooth', appearance: 'bluetooth' },
101
- { name: 'Check', appearance: 'check' },
102
- { name: 'Error', appearance: 'error' },
103
- { name: 'Warning', appearance: 'warning' },
104
- { name: 'Info', appearance: 'info' },
105
- { name: 'Loader', appearance: 'loader' },
106
- { name: 'Number', appearance: 'number', number: 3 },
66
+ { name: 'Base', appearance: 'base', icon: Settings },
67
+ { name: 'Success', appearance: 'success', icon: CheckmarkCircleFill },
68
+ { name: 'Error', appearance: 'error', icon: DeleteCircleFill },
69
+ { name: 'Warning', appearance: 'warning', icon: WarningFill },
70
+ { name: 'Muted', appearance: 'muted', icon: InformationFill },
107
71
  ];
108
72
 
109
73
  return (
@@ -115,22 +79,16 @@ export const AppearanceShowcase: Story = {
115
79
  padding: 's8',
116
80
  }}
117
81
  >
118
- {appearances.map(({ name, appearance, icon, number }) => (
82
+ {appearances.map(({ name, appearance, icon }) => (
119
83
  <Box
120
- key={appearance}
121
- lx={{
122
- width: 's64',
123
- flexDirection: 'column',
124
- alignItems: 'center',
125
- gap: 's4',
126
- }}
84
+ key={name}
85
+ lx={{ alignItems: 'center', gap: 's4', width: 's64' }}
127
86
  >
128
- <Spot
129
- appearance={appearance as any}
130
- icon={icon}
131
- number={number as any}
132
- />
133
- <Text typography='body3' lx={{ color: 'muted' }}>
87
+ <Spot appearance={appearance} icon={icon} />
88
+ <Text
89
+ typography='body3'
90
+ lx={{ color: 'muted', textAlign: 'center' }}
91
+ >
134
92
  {name}
135
93
  </Text>
136
94
  </Box>
@@ -140,137 +98,118 @@ export const AppearanceShowcase: Story = {
140
98
  },
141
99
  };
142
100
 
143
- export const IconVariants: Story = {
144
- args: {
145
- appearance: 'icon',
146
- icon: Settings,
147
- },
101
+ export const FillShowcase: Story = {
148
102
  render: () => {
149
- const icons = [
150
- { name: 'Settings', component: Settings },
151
- { name: 'Plus', component: Plus },
152
- { name: 'Heart', component: Heart },
153
- { name: 'Star', component: Star },
103
+ const appearances: SpotAppearance[] = [
104
+ 'base',
105
+ 'success',
106
+ 'error',
107
+ 'warning',
108
+ 'muted',
109
+ 'decorative-blue',
110
+ 'decorative-pink',
111
+ 'decorative-purple',
112
+ 'decorative-green',
113
+ 'decorative-turquoise',
114
+ 'decorative-yellow',
115
+ 'decorative-orange',
116
+ 'decorative-red',
154
117
  ];
155
118
 
156
119
  return (
157
- <Box lx={{ flexDirection: 'row', gap: 's8', padding: 's8' }}>
158
- {icons.map(({ name, component: Icon }) => (
159
- <Spot key={name} appearance='icon' icon={Icon} />
120
+ <Box lx={{ gap: 's16', padding: 's8' }}>
121
+ {(['transparent', 'plain'] as const).map((fill) => (
122
+ <Box key={fill} lx={{ gap: 's8' }}>
123
+ <Text typography='body2SemiBold' lx={{ color: 'base' }}>
124
+ {fill}
125
+ </Text>
126
+ <Box lx={{ flexDirection: 'row', flexWrap: 'wrap', gap: 's12' }}>
127
+ {appearances.map((appearance) => (
128
+ <Spot
129
+ key={appearance}
130
+ appearance={appearance}
131
+ fill={fill}
132
+ icon={Settings}
133
+ />
134
+ ))}
135
+ </Box>
136
+ </Box>
160
137
  ))}
161
138
  </Box>
162
139
  );
163
140
  },
164
141
  };
165
142
 
166
- export const NumberVariants: Story = {
167
- args: {
168
- appearance: 'icon',
169
- icon: Settings,
143
+ export const SizeShowcase: Story = {
144
+ render: () => {
145
+ const sizes = [32, 40, 48, 56, 72] as const;
146
+
147
+ return (
148
+ <Box lx={{ gap: 's32', padding: 's16' }}>
149
+ {sizes.map((size) => (
150
+ <Box key={size} lx={{ gap: 's16' }}>
151
+ <Text typography='body2SemiBold'>{size}px</Text>
152
+ <Box
153
+ lx={{ flexDirection: 'row', gap: 's12', alignItems: 'center' }}
154
+ >
155
+ <Spot icon={Settings} size={size} />
156
+ <Spot appearance='muted' icon={InformationFill} size={size} />
157
+ <Spot
158
+ appearance='success'
159
+ fill='plain'
160
+ icon={Settings}
161
+ size={size}
162
+ />
163
+ </Box>
164
+ </Box>
165
+ ))}
166
+ </Box>
167
+ );
170
168
  },
169
+ };
170
+
171
+ export const WithSpinner: Story = {
171
172
  render: () => {
172
- const numbers = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] as const;
173
+ const sizes = [32, 40, 48, 56, 72] as const;
173
174
 
174
175
  return (
175
176
  <Box
176
177
  lx={{
177
178
  flexDirection: 'row',
178
- flexWrap: 'wrap',
179
- gap: 's8',
180
- padding: 's8',
179
+ alignItems: 'flex-end',
180
+ gap: 's16',
181
+ padding: 's16',
181
182
  }}
182
183
  >
183
- {numbers.map((num) => (
184
- <Spot key={num} appearance='number' number={num} />
184
+ {sizes.map((size) => (
185
+ <Spot key={size} icon={Spinner} size={size} />
185
186
  ))}
186
187
  </Box>
187
188
  );
188
189
  },
189
190
  };
190
191
 
191
- export const SizesShowcase: Story = {
192
- args: {
193
- appearance: 'icon',
194
- icon: Settings,
195
- },
192
+ export const WithDotSymbol: Story = {
196
193
  render: () => {
197
- const sizes = [32, 40, 48, 56, 72] as const;
198
-
199
194
  return (
200
- <Box lx={{ flexDirection: 'column', gap: 's32', padding: 's16' }}>
201
- {sizes.map((size) => (
202
- <Box key={size} lx={{ flexDirection: 'column', gap: 's16' }}>
203
- <Text typography='heading5SemiBold'>{size}px</Text>
204
- <Box lx={{ flexDirection: 'row', gap: 's12' }}>
205
- <Spot appearance='icon' icon={Settings} size={size} />
206
- <Spot appearance='info' size={size} />
207
- <Spot appearance='number' number={5} size={size} />
208
- </Box>
209
- </Box>
210
- ))}
195
+ <Box lx={{ padding: 's16' }}>
196
+ <DotSymbol
197
+ src='https://crypto-icons.ledger.com/BTC.png'
198
+ pin='bottom-end'
199
+ {...getDotSymbolProps('spot', 48)}
200
+ >
201
+ <Spot icon={Settings} />
202
+ </DotSymbol>
211
203
  </Box>
212
204
  );
213
205
  },
214
206
  };
215
207
 
216
- export const StatesShowcase: Story = {
217
- args: {
218
- appearance: 'icon',
219
- icon: Settings,
220
- },
208
+ export const WithNumber: Story = {
221
209
  render: () => {
222
210
  return (
223
- <Box lx={{ flexDirection: 'column', gap: 's16' }}>
224
- <Box lx={{ flexDirection: 'column', gap: 's8' }}>
225
- <Text typography='body2'>Default</Text>
226
- <Box lx={{ flexDirection: 'row', flexWrap: 'wrap', gap: 's16' }}>
227
- <Box
228
- lx={{
229
- width: 's64',
230
- flexDirection: 'column',
231
- alignItems: 'center',
232
- gap: 's4',
233
- }}
234
- >
235
- <Spot appearance='icon' icon={Settings} />
236
- </Box>
237
- <Box
238
- lx={{
239
- width: 's64',
240
- flexDirection: 'column',
241
- alignItems: 'center',
242
- gap: 's4',
243
- }}
244
- >
245
- <Spot appearance='bluetooth' />
246
- </Box>
247
- </Box>
248
- </Box>
249
- <Box lx={{ flexDirection: 'column', gap: 's8' }}>
250
- <Text typography='body2'>Disabled</Text>
251
- <Box lx={{ flexDirection: 'row', flexWrap: 'wrap', gap: 's16' }}>
252
- <Box
253
- lx={{
254
- width: 's64',
255
- flexDirection: 'column',
256
- alignItems: 'center',
257
- gap: 's4',
258
- }}
259
- >
260
- <Spot appearance='icon' icon={Settings} disabled />
261
- </Box>
262
- <Box
263
- lx={{
264
- width: 's64',
265
- flexDirection: 'column',
266
- alignItems: 'center',
267
- gap: 's4',
268
- }}
269
- >
270
- <Spot appearance='bluetooth' disabled />
271
- </Box>
272
- </Box>
273
- </Box>
211
+ <Box lx={{ padding: 's16' }}>
212
+ <SpotNumber value={9} />
274
213
  </Box>
275
214
  );
276
215
  },
@@ -0,0 +1,71 @@
1
+ import { describe, expect, it } from '@jest/globals';
2
+ import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
3
+ import { render, screen } from '@testing-library/react-native';
4
+ import type { ReactNode } from 'react';
5
+ import type { StyleProp, TextStyle } from 'react-native';
6
+ import { View } from 'react-native';
7
+ import type { IconSize } from '../../symbols/Icon';
8
+ import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
9
+ import { Spot } from './Spot';
10
+
11
+ const { colors } = ledgerLiveThemes.dark;
12
+
13
+ const TestWrapper = ({ children }: { children: ReactNode }) => (
14
+ <ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
15
+ {children}
16
+ </ThemeProvider>
17
+ );
18
+
19
+ const TestIcon = ({
20
+ style,
21
+ }: {
22
+ size?: IconSize;
23
+ style?: StyleProp<TextStyle>;
24
+ }) => <View testID='spot-icon' style={style} />;
25
+
26
+ describe('Spot', () => {
27
+ it('should paint only the icon when fill is transparent', () => {
28
+ render(
29
+ <TestWrapper>
30
+ <Spot appearance='success' icon={TestIcon} />
31
+ </TestWrapper>,
32
+ );
33
+
34
+ expect(
35
+ screen.getByTestId('spot-container').props.style.backgroundColor,
36
+ ).toBe(colors.bg.mutedTransparent);
37
+ expect(screen.getByTestId('spot-icon').props.style.color).toBe(
38
+ colors.text.success,
39
+ );
40
+ });
41
+
42
+ it('should paint the circle and a paired text color when fill is plain', () => {
43
+ render(
44
+ <TestWrapper>
45
+ <Spot appearance='success' fill='plain' icon={TestIcon} />
46
+ </TestWrapper>,
47
+ );
48
+
49
+ expect(
50
+ screen.getByTestId('spot-container').props.style.backgroundColor,
51
+ ).toBe(colors.bg.success);
52
+ expect(screen.getByTestId('spot-icon').props.style.color).toBe(
53
+ colors.text.successStrong,
54
+ );
55
+ });
56
+
57
+ it('should use the disabled text color', () => {
58
+ render(
59
+ <TestWrapper>
60
+ <Spot appearance='success' disabled icon={TestIcon} />
61
+ </TestWrapper>,
62
+ );
63
+
64
+ expect(
65
+ screen.getByTestId('spot-container').props.style.backgroundColor,
66
+ ).toBe(colors.bg.mutedTransparent);
67
+ expect(screen.getByTestId('spot-icon').props.style.color).toBe(
68
+ colors.text.disabled,
69
+ );
70
+ });
71
+ });
@@ -1,22 +1,9 @@
1
1
  import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
2
- import { useMemo } from 'react';
3
- import { StyleSheet, Text } from 'react-native';
4
- import type { LumenTypographyTokens } from '../../../../styles';
5
- import { useStyleSheet } from '../../../../styles';
2
+ import { StyleSheet } from 'react-native';
6
3
  import { Box } from '../../primitives';
7
- import {
8
- BluetoothCircleFill,
9
- CheckmarkCircleFill,
10
- DeleteCircleFill,
11
- InformationFill,
12
- WarningFill,
13
- } from '../../symbols';
14
4
  import type { IconSize } from '../../symbols/Icon';
15
- import type { SpinnerProps } from '../Spinner';
16
- import { Spinner } from '../Spinner';
17
- import type { SpotAppearance, SpotProps, SpotSize } from './types';
18
-
19
- const BLUETOOTH_COLOR = '#0082FC';
5
+ import type { SpotProps, SpotSize } from './types';
6
+ import { useSpotStyles } from './useSpotStyles';
20
7
 
21
8
  const iconSizeMap: Record<SpotSize, IconSize> = {
22
9
  32: 12,
@@ -26,166 +13,37 @@ const iconSizeMap: Record<SpotSize, IconSize> = {
26
13
  72: 40,
27
14
  };
28
15
 
29
- const spotSizeMap: Record<SpotSize, number> = {
30
- 32: 32,
31
- 40: 40,
32
- 48: 48,
33
- 56: 56,
34
- 72: 72,
35
- };
36
-
37
- const numberTypographyMap: Record<SpotSize, keyof LumenTypographyTokens> = {
38
- 32: 'body2SemiBold',
39
- 40: 'body1SemiBold',
40
- 48: 'heading5',
41
- 56: 'heading4',
42
- 72: 'heading2',
43
- };
44
-
45
- const useStyles = ({
46
- size,
47
- appearance,
48
- disabled,
49
- }: {
50
- size: SpotSize;
51
- appearance: SpotAppearance;
52
- disabled?: boolean;
53
- }) => {
54
- return useStyleSheet(
55
- (t) => {
56
- const colorMap: Record<SpotAppearance, string> = {
57
- icon: t.colors.text.base,
58
- bluetooth: BLUETOOTH_COLOR,
59
- check: t.colors.text.success,
60
- error: t.colors.text.error,
61
- warning: t.colors.text.warning,
62
- info: t.colors.text.muted,
63
- loader: t.colors.text.base,
64
- number: t.colors.text.base,
65
- };
66
-
67
- const spotSize = spotSizeMap[size];
68
- const typography = t.typographies[numberTypographyMap[size]];
69
- const contentColor = disabled
70
- ? t.colors.text.disabled
71
- : colorMap[appearance];
72
-
73
- return {
74
- root: {
75
- alignItems: 'center',
76
- justifyContent: 'center',
77
- borderRadius: t.borderRadius.full,
78
- backgroundColor: t.colors.bg.mutedTransparent,
79
- width: spotSize,
80
- height: spotSize,
81
- flexShrink: 0,
82
- },
83
- icon: {
84
- color: contentColor,
85
- },
86
- numberText: StyleSheet.flatten([
87
- typography,
88
- {
89
- color: contentColor,
90
- },
91
- ]),
92
- };
93
- },
94
- [size, appearance, disabled],
95
- );
96
- };
97
-
98
16
  /**
99
- * A circular status indicator component that displays different types of content based on appearance.
100
- *
101
- * Uses a discriminated union type system where the required props depend on the `appearance` value:
102
- * - `'icon'` appearance requires an `icon` prop
103
- * - `'number'` appearance requires a `number` prop
104
- * - All other appearances are self-contained
17
+ * A circular icon container. `appearance` selects the color palette and `fill` selects whether that palette paints only the icon or the circle as well.
105
18
  *
106
19
  * @see {@link https://ldls-react-native.vercel.app/?path=/docs/rnative-spot--docs Storybook}
107
20
  *
108
21
  * @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
109
- * Do not use it to modify the spot's core appearance (colors, size, etc). Use the `appearance` prop instead.
22
+ * Do not use it to modify the spot's core appearance (colors, size, etc). Use the `appearance` and `fill` props instead.
110
23
  *
111
24
  * @example
112
25
  * import { Spot } from '@ledgerhq/lumen-ui-rnative';
26
+ * import { Settings, CheckmarkCircleFill } from '@ledgerhq/lumen-ui-rnative/symbols';
113
27
  *
114
- * // Custom icon spot
115
- * import { Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
116
- *
117
- * <Spot appearance="icon" icon={Settings} />
118
- *
119
- * // Number spot
120
- * <Spot appearance="number" number={5} />
121
- *
122
- * // Status indicators (no additional props needed)
123
- * <Spot appearance="check" />
124
- * <Spot appearance="error" />
125
- * <Spot appearance="warning" />
126
- * <Spot appearance="loader" />
127
- *
128
- * // Bluetooth states
129
- * <Spot appearance="bluetooth" />
130
- * <Spot appearance="bluetooth" disabled />
28
+ * <Spot icon={Settings} />
29
+ * <Spot appearance="success" icon={CheckmarkCircleFill} />
30
+ * <Spot appearance="success" fill="plain" icon={Settings} />
131
31
  */
132
- export const Spot = (props: SpotProps) => {
133
- const {
134
- appearance,
135
- disabled: disabledProp = false,
136
- size = 48,
137
- lx = {},
138
- style,
139
- ...rest
140
- } = props;
32
+ export const Spot = ({
33
+ appearance = 'base',
34
+ fill = 'transparent',
35
+ icon: Icon,
36
+ disabled: disabledProp = false,
37
+ size = 48,
38
+ lx = {},
39
+ style,
40
+ ...rest
41
+ }: SpotProps) => {
141
42
  const disabled = useDisabledContext({
142
43
  consumerName: 'Spot',
143
44
  mergeWith: { disabled: disabledProp },
144
45
  });
145
-
146
- const styles = useStyles({ size, appearance, disabled });
147
- const calculatedIconSize = iconSizeMap[size];
148
-
149
- const content = useMemo(() => {
150
- switch (props.appearance) {
151
- case 'icon': {
152
- const { icon: Icon } = props;
153
- return <Icon size={calculatedIconSize} style={styles.icon} />;
154
- }
155
- case 'number': {
156
- return (
157
- <Text style={styles.numberText} allowFontScaling={false}>
158
- {props.number}
159
- </Text>
160
- );
161
- }
162
- case 'bluetooth':
163
- return (
164
- <BluetoothCircleFill size={calculatedIconSize} style={styles.icon} />
165
- );
166
- case 'check':
167
- return (
168
- <CheckmarkCircleFill size={calculatedIconSize} style={styles.icon} />
169
- );
170
- case 'error':
171
- return (
172
- <DeleteCircleFill size={calculatedIconSize} style={styles.icon} />
173
- );
174
- case 'warning':
175
- return <WarningFill size={calculatedIconSize} style={styles.icon} />;
176
- case 'info':
177
- return (
178
- <InformationFill size={calculatedIconSize} style={styles.icon} />
179
- );
180
- case 'loader':
181
- return (
182
- <Spinner
183
- size={calculatedIconSize}
184
- color={styles.icon.color as SpinnerProps['color']}
185
- />
186
- );
187
- }
188
- }, [props, calculatedIconSize, styles.icon, styles.numberText]);
46
+ const styles = useSpotStyles({ size, appearance, fill, disabled });
189
47
 
190
48
  return (
191
49
  <Box
@@ -194,7 +52,7 @@ export const Spot = (props: SpotProps) => {
194
52
  style={StyleSheet.flatten([styles.root, style])}
195
53
  {...rest}
196
54
  >
197
- {content}
55
+ <Icon size={iconSizeMap[size]} style={styles.icon} />
198
56
  </Box>
199
57
  );
200
58
  };