@ledgerhq/lumen-ui-rnative 0.1.24 → 0.1.25
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.
- package/dist/module/lib/Components/DotIcon/DotIcon.js +134 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.js.map +1 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.mdx +56 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.stories.js +217 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.stories.js.map +1 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.test.js +238 -0
- package/dist/module/lib/Components/DotIcon/DotIcon.test.js.map +1 -0
- package/dist/module/lib/Components/DotIcon/index.js +5 -0
- package/dist/module/lib/Components/DotIcon/index.js.map +1 -0
- package/dist/module/lib/Components/DotIcon/types.js +4 -0
- package/dist/module/lib/Components/DotIcon/types.js.map +1 -0
- package/dist/module/lib/Components/DotSymbol/DotSymbol.js +29 -22
- package/dist/module/lib/Components/DotSymbol/DotSymbol.js.map +1 -1
- package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js +31 -9
- package/dist/module/lib/Components/DotSymbol/DotSymbol.stories.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.js +2 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.js.map +1 -1
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js +4 -0
- package/dist/module/lib/Components/MediaImage/MediaImage.stories.js.map +1 -1
- package/dist/module/lib/Components/Spinner/Spinner.js +6 -1
- package/dist/module/lib/Components/Spinner/Spinner.js.map +1 -1
- package/dist/module/lib/Components/Tag/Tag.js +2 -0
- package/dist/module/lib/Components/Tag/Tag.js.map +1 -1
- package/dist/module/lib/Components/Tag/Tag.stories.js +8 -1
- package/dist/module/lib/Components/Tag/Tag.stories.js.map +1 -1
- package/dist/module/lib/Components/index.js +1 -0
- package/dist/module/lib/Components/index.js.map +1 -1
- package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts +30 -0
- package/dist/typescript/src/lib/Components/DotIcon/DotIcon.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DotIcon/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/DotIcon/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DotIcon/types.d.ts +40 -0
- package/dist/typescript/src/lib/Components/DotIcon/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/DotSymbol/DotSymbol.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/MediaImage.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/MediaImage/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Spinner/Spinner.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tag/Tag.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tag/types.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Tag/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/index.d.ts +1 -0
- package/dist/typescript/src/lib/Components/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/Components/DotIcon/DotIcon.mdx +56 -0
- package/src/lib/Components/DotIcon/DotIcon.stories.tsx +154 -0
- package/src/lib/Components/DotIcon/DotIcon.test.tsx +224 -0
- package/src/lib/Components/DotIcon/DotIcon.tsx +146 -0
- package/src/lib/Components/DotIcon/index.ts +6 -0
- package/src/lib/Components/DotIcon/types.ts +44 -0
- package/src/lib/Components/DotSymbol/DotSymbol.stories.tsx +26 -7
- package/src/lib/Components/DotSymbol/DotSymbol.tsx +22 -23
- package/src/lib/Components/MediaImage/MediaImage.stories.tsx +1 -0
- package/src/lib/Components/MediaImage/MediaImage.tsx +3 -1
- package/src/lib/Components/MediaImage/types.ts +1 -1
- package/src/lib/Components/Spinner/Spinner.tsx +6 -2
- package/src/lib/Components/Tag/Tag.stories.tsx +11 -1
- package/src/lib/Components/Tag/Tag.tsx +2 -0
- package/src/lib/Components/Tag/types.ts +8 -1
- package/src/lib/Components/index.ts +1 -0
|
@@ -32,8 +32,12 @@ export const Base: Story = {
|
|
|
32
32
|
pin: 'bottom-end',
|
|
33
33
|
size: 20,
|
|
34
34
|
shape: 'circle',
|
|
35
|
-
children: <MediaImage src={parentSrc} alt='Cardano' shape='circle' />,
|
|
36
35
|
},
|
|
36
|
+
render: (args) => (
|
|
37
|
+
<DotSymbol {...args}>
|
|
38
|
+
<MediaImage src={parentSrc} alt='Cardano' shape={args.shape} />
|
|
39
|
+
</DotSymbol>
|
|
40
|
+
),
|
|
37
41
|
};
|
|
38
42
|
|
|
39
43
|
export const PinShowcase: Story = {
|
|
@@ -135,6 +139,13 @@ export const SizeShowcase: Story = {
|
|
|
135
139
|
>
|
|
136
140
|
<MediaImage src={parentSrc} size={56} shape='circle' />
|
|
137
141
|
</DotSymbol>
|
|
142
|
+
<DotSymbol
|
|
143
|
+
src={dotSrc}
|
|
144
|
+
size={mediaImageDotSizeMap[64]}
|
|
145
|
+
pin='bottom-end'
|
|
146
|
+
>
|
|
147
|
+
<MediaImage src={parentSrc} size={64} shape='circle' />
|
|
148
|
+
</DotSymbol>
|
|
138
149
|
</Box>
|
|
139
150
|
<Box lx={{ flexDirection: 'row', alignItems: 'flex-end', gap: 's24' }}>
|
|
140
151
|
<DotSymbol
|
|
@@ -143,7 +154,7 @@ export const SizeShowcase: Story = {
|
|
|
143
154
|
size={mediaImageDotSizeMap[20]}
|
|
144
155
|
pin='bottom-end'
|
|
145
156
|
>
|
|
146
|
-
<MediaImage src={parentSrc} size={20} shape='
|
|
157
|
+
<MediaImage src={parentSrc} size={20} shape='square' />
|
|
147
158
|
</DotSymbol>
|
|
148
159
|
<DotSymbol
|
|
149
160
|
shape='square'
|
|
@@ -151,7 +162,7 @@ export const SizeShowcase: Story = {
|
|
|
151
162
|
size={mediaImageDotSizeMap[24]}
|
|
152
163
|
pin='bottom-end'
|
|
153
164
|
>
|
|
154
|
-
<MediaImage src={parentSrc} size={24} shape='
|
|
165
|
+
<MediaImage src={parentSrc} size={24} shape='square' />
|
|
155
166
|
</DotSymbol>
|
|
156
167
|
<DotSymbol
|
|
157
168
|
shape='square'
|
|
@@ -159,7 +170,7 @@ export const SizeShowcase: Story = {
|
|
|
159
170
|
size={mediaImageDotSizeMap[32]}
|
|
160
171
|
pin='bottom-end'
|
|
161
172
|
>
|
|
162
|
-
<MediaImage src={parentSrc} size={32} shape='
|
|
173
|
+
<MediaImage src={parentSrc} size={32} shape='square' />
|
|
163
174
|
</DotSymbol>
|
|
164
175
|
<DotSymbol
|
|
165
176
|
shape='square'
|
|
@@ -167,7 +178,7 @@ export const SizeShowcase: Story = {
|
|
|
167
178
|
size={mediaImageDotSizeMap[40]}
|
|
168
179
|
pin='bottom-end'
|
|
169
180
|
>
|
|
170
|
-
<MediaImage src={parentSrc} size={40} shape='
|
|
181
|
+
<MediaImage src={parentSrc} size={40} shape='square' />
|
|
171
182
|
</DotSymbol>
|
|
172
183
|
<DotSymbol
|
|
173
184
|
shape='square'
|
|
@@ -175,7 +186,7 @@ export const SizeShowcase: Story = {
|
|
|
175
186
|
size={mediaImageDotSizeMap[48]}
|
|
176
187
|
pin='bottom-end'
|
|
177
188
|
>
|
|
178
|
-
<MediaImage src={parentSrc} size={48} shape='
|
|
189
|
+
<MediaImage src={parentSrc} size={48} shape='square' />
|
|
179
190
|
</DotSymbol>
|
|
180
191
|
<DotSymbol
|
|
181
192
|
shape='square'
|
|
@@ -183,7 +194,15 @@ export const SizeShowcase: Story = {
|
|
|
183
194
|
size={mediaImageDotSizeMap[56]}
|
|
184
195
|
pin='bottom-end'
|
|
185
196
|
>
|
|
186
|
-
<MediaImage src={parentSrc} size={56} shape='
|
|
197
|
+
<MediaImage src={parentSrc} size={56} shape='square' />
|
|
198
|
+
</DotSymbol>
|
|
199
|
+
<DotSymbol
|
|
200
|
+
shape='square'
|
|
201
|
+
src={dotSrc}
|
|
202
|
+
size={mediaImageDotSizeMap[64]}
|
|
203
|
+
pin='bottom-end'
|
|
204
|
+
>
|
|
205
|
+
<MediaImage src={parentSrc} size={64} shape='square' />
|
|
187
206
|
</DotSymbol>
|
|
188
207
|
</Box>
|
|
189
208
|
</Box>
|
|
@@ -6,15 +6,13 @@ import type { SpotSize } from '../Spot';
|
|
|
6
6
|
import { Box } from '../Utility';
|
|
7
7
|
import type { DotSymbolPin, DotSymbolProps, DotSymbolSize } from './types';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
20: 'sm',
|
|
17
|
-
24: 'md',
|
|
9
|
+
const dotSquareRadiusMap: Record<DotSymbolSize, number> = {
|
|
10
|
+
8: 2,
|
|
11
|
+
10: 3,
|
|
12
|
+
12: 4,
|
|
13
|
+
16: 5,
|
|
14
|
+
20: 6,
|
|
15
|
+
24: 8,
|
|
18
16
|
};
|
|
19
17
|
|
|
20
18
|
const offsetBySize: Record<DotSymbolSize, number> = {
|
|
@@ -35,6 +33,7 @@ export const mediaImageDotSizeMap: Record<MediaImageSize, DotSymbolSize> = {
|
|
|
35
33
|
40: 16,
|
|
36
34
|
48: 20,
|
|
37
35
|
56: 24,
|
|
36
|
+
64: 24,
|
|
38
37
|
};
|
|
39
38
|
|
|
40
39
|
export const spotDotSizeMap: Record<SpotSize, DotSymbolSize> = {
|
|
@@ -75,9 +74,7 @@ const useStyles = ({
|
|
|
75
74
|
(t) => {
|
|
76
75
|
const sizeValue = t.sizes[`s${size}` as keyof typeof t.sizes] as number;
|
|
77
76
|
const radius =
|
|
78
|
-
shape === 'circle'
|
|
79
|
-
? t.borderRadius.full
|
|
80
|
-
: t.borderRadius[shapeRadiusMap[size]];
|
|
77
|
+
shape === 'circle' ? t.borderRadius.full : dotSquareRadiusMap[size];
|
|
81
78
|
const pinOffset = getPinOffset(pin, size);
|
|
82
79
|
|
|
83
80
|
return {
|
|
@@ -142,17 +139,19 @@ export const DotSymbol = ({
|
|
|
142
139
|
accessibilityLabel={alt}
|
|
143
140
|
{...rest}
|
|
144
141
|
>
|
|
145
|
-
{
|
|
146
|
-
|
|
147
|
-
{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
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
|
+
)}
|
|
154
|
+
</Box>
|
|
156
155
|
</Box>
|
|
157
156
|
</Box>
|
|
158
157
|
);
|
|
@@ -41,6 +41,7 @@ export const SizeShowcase: Story = {
|
|
|
41
41
|
<MediaImage src={exampleSrc} alt='Size 40' size={40} />
|
|
42
42
|
<MediaImage src={exampleSrc} alt='Size 48' size={48} />
|
|
43
43
|
<MediaImage src={exampleSrc} alt='Size 56' size={56} />
|
|
44
|
+
<MediaImage src={exampleSrc} alt='Size 64' size={64} />
|
|
44
45
|
</Box>
|
|
45
46
|
),
|
|
46
47
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
import { Image, StyleSheet } from 'react-native';
|
|
3
3
|
import { useStyleSheet } from '../../../styles';
|
|
4
|
+
import type { LumenStyleSheetTheme } from '../../../styles';
|
|
4
5
|
import { Box } from '../Utility';
|
|
5
6
|
import type { MediaImageProps, MediaImageSize, MediaImageShape } from './types';
|
|
6
7
|
|
|
7
|
-
type BorderRadiusKey =
|
|
8
|
+
type BorderRadiusKey = keyof LumenStyleSheetTheme['borderRadius'];
|
|
8
9
|
|
|
9
10
|
const borderRadiusMap: Record<MediaImageSize, BorderRadiusKey> = {
|
|
10
11
|
12: 'xs',
|
|
@@ -15,6 +16,7 @@ const borderRadiusMap: Record<MediaImageSize, BorderRadiusKey> = {
|
|
|
15
16
|
40: 'md',
|
|
16
17
|
48: 'md',
|
|
17
18
|
56: 'lg',
|
|
19
|
+
64: 'lg',
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
const useStyles = ({
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
1
2
|
import Svg, { Path } from 'react-native-svg';
|
|
2
3
|
import { useCommonTranslation } from '../../../i18n';
|
|
3
4
|
import type { LumenTextStyle } from '../../../styles';
|
|
@@ -24,17 +25,20 @@ export const Spinner = ({
|
|
|
24
25
|
lx = {},
|
|
25
26
|
size = 16,
|
|
26
27
|
color,
|
|
28
|
+
style,
|
|
27
29
|
ref,
|
|
28
30
|
...props
|
|
29
31
|
}: SpinnerProps) => {
|
|
30
32
|
const { t } = useCommonTranslation();
|
|
31
33
|
const { theme } = useTheme();
|
|
32
34
|
const resolvedColorStyle = useResolveTextStyle({ color } as LumenTextStyle);
|
|
35
|
+
const flatStyle = StyleSheet.flatten(style);
|
|
36
|
+
const styleColor = flatStyle?.color;
|
|
33
37
|
const strokeColor =
|
|
34
|
-
resolvedColorStyle?.color ?? color ?? theme.colors.text.base;
|
|
38
|
+
resolvedColorStyle?.color ?? color ?? styleColor ?? theme.colors.text.base;
|
|
35
39
|
|
|
36
40
|
return (
|
|
37
|
-
<Box ref={ref} lx={{ flexShrink: 0, ...lx }} {...props}>
|
|
41
|
+
<Box ref={ref} lx={{ flexShrink: 0, ...lx }} style={style} {...props}>
|
|
38
42
|
<Spin>
|
|
39
43
|
<Svg
|
|
40
44
|
width={size}
|
|
@@ -9,7 +9,15 @@ const meta: Meta<typeof Tag> = {
|
|
|
9
9
|
argTypes: {
|
|
10
10
|
appearance: {
|
|
11
11
|
control: 'select',
|
|
12
|
-
options: [
|
|
12
|
+
options: [
|
|
13
|
+
'base',
|
|
14
|
+
'gray',
|
|
15
|
+
'accent',
|
|
16
|
+
'accent-subtle',
|
|
17
|
+
'success',
|
|
18
|
+
'error',
|
|
19
|
+
'warning',
|
|
20
|
+
],
|
|
13
21
|
},
|
|
14
22
|
size: {
|
|
15
23
|
control: 'radio',
|
|
@@ -47,6 +55,7 @@ export const AppearanceShowcase: Story = {
|
|
|
47
55
|
<Tag appearance='base' label='Base' />
|
|
48
56
|
<Tag appearance='gray' label='Gray' />
|
|
49
57
|
<Tag appearance='accent' label='Accent' />
|
|
58
|
+
<Tag appearance='accent-subtle' label='Accent subtle' />
|
|
50
59
|
<Tag appearance='success' label='Success' />
|
|
51
60
|
<Tag appearance='error' label='Error' />
|
|
52
61
|
<Tag appearance='warning' label='Warning' />
|
|
@@ -56,6 +65,7 @@ export const AppearanceShowcase: Story = {
|
|
|
56
65
|
<Tag appearance='base' label='Base' icon={Check} />
|
|
57
66
|
<Tag appearance='gray' label='Gray' icon={Check} />
|
|
58
67
|
<Tag appearance='accent' label='Accent' icon={Check} />
|
|
68
|
+
<Tag appearance='accent-subtle' label='Accent subtle' icon={Check} />
|
|
59
69
|
<Tag appearance='success' label='Success' icon={Check} />
|
|
60
70
|
<Tag appearance='error' label='Error' icon={Check} />
|
|
61
71
|
<Tag appearance='warning' label='Warning' icon={Check} />
|
|
@@ -23,6 +23,7 @@ const useStyles = ({
|
|
|
23
23
|
base: t.colors.bg.mutedTransparent,
|
|
24
24
|
gray: t.colors.bg.mutedTransparent,
|
|
25
25
|
accent: t.colors.bg.accent,
|
|
26
|
+
'accent-subtle': t.colors.bg.activeSubtle,
|
|
26
27
|
success: t.colors.bg.success,
|
|
27
28
|
error: t.colors.bg.error,
|
|
28
29
|
warning: t.colors.bg.warning,
|
|
@@ -32,6 +33,7 @@ const useStyles = ({
|
|
|
32
33
|
base: t.colors.text.base,
|
|
33
34
|
gray: t.colors.text.muted,
|
|
34
35
|
accent: t.colors.text.onAccent,
|
|
36
|
+
'accent-subtle': t.colors.text.active,
|
|
35
37
|
success: t.colors.text.success,
|
|
36
38
|
error: t.colors.text.error,
|
|
37
39
|
warning: t.colors.text.warning,
|
|
@@ -6,7 +6,14 @@ export type TagProps = {
|
|
|
6
6
|
/**
|
|
7
7
|
* The appearance of the tag.
|
|
8
8
|
*/
|
|
9
|
-
appearance?:
|
|
9
|
+
appearance?:
|
|
10
|
+
| 'base'
|
|
11
|
+
| 'gray'
|
|
12
|
+
| 'accent'
|
|
13
|
+
| 'accent-subtle'
|
|
14
|
+
| 'success'
|
|
15
|
+
| 'error'
|
|
16
|
+
| 'warning';
|
|
10
17
|
/**
|
|
11
18
|
* The icon of the tag.
|
|
12
19
|
*/
|