@ledgerhq/lumen-ui-rnative 0.1.49 → 0.1.50
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/BaseInput/BaseInput.js +84 -25
- package/dist/module/lib/Components/BaseInput/BaseInput.js.map +1 -1
- package/dist/module/lib/Components/Button/ButtonGroup.figma.js +19 -0
- package/dist/module/lib/Components/Button/ButtonGroup.figma.js.map +1 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.js +31 -9
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.js.map +1 -1
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.mdx +10 -7
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.stories.js +29 -40
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.stories.js.map +1 -1
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.test.js +22 -0
- package/dist/module/lib/Components/DescriptionItem/DescriptionItem.test.js.map +1 -1
- package/dist/module/lib/Components/ListItem/ListItem.figma.js +11 -0
- package/dist/module/lib/Components/ListItem/ListItem.figma.js.map +1 -1
- package/dist/module/lib/Components/ListItem/ListItem.js +78 -20
- package/dist/module/lib/Components/ListItem/ListItem.js.map +1 -1
- package/dist/module/lib/Components/ListItem/ListItem.mdx +17 -0
- package/dist/module/lib/Components/ListItem/ListItem.stories.js +132 -0
- package/dist/module/lib/Components/ListItem/ListItem.stories.js.map +1 -1
- package/dist/module/lib/Components/ListItem/ListItem.test.js +80 -0
- package/dist/module/lib/Components/ListItem/ListItem.test.js.map +1 -1
- package/dist/module/lib/Components/SectionHeader/SectionHeader.figma.js +22 -0
- package/dist/module/lib/Components/SectionHeader/SectionHeader.figma.js.map +1 -0
- package/dist/module/lib/Components/SectionHeader/SectionHeader.js +99 -0
- package/dist/module/lib/Components/SectionHeader/SectionHeader.js.map +1 -0
- package/dist/module/lib/Components/SectionHeader/SectionHeader.mdx +79 -0
- package/dist/module/lib/Components/SectionHeader/SectionHeader.stories.js +104 -0
- package/dist/module/lib/Components/SectionHeader/SectionHeader.stories.js.map +1 -0
- package/dist/module/lib/Components/SectionHeader/SectionHeader.test.js +108 -0
- package/dist/module/lib/Components/SectionHeader/SectionHeader.test.js.map +1 -0
- package/dist/module/lib/Components/SectionHeader/index.js +5 -0
- package/dist/module/lib/Components/SectionHeader/index.js.map +1 -0
- package/dist/module/lib/Components/SectionHeader/types.js +4 -0
- package/dist/module/lib/Components/SectionHeader/types.js.map +1 -0
- package/dist/module/lib/Components/TextInput/TextInput.figma.js +5 -0
- package/dist/module/lib/Components/TextInput/TextInput.figma.js.map +1 -1
- package/dist/module/lib/Components/TextInput/TextInput.mdx +43 -73
- package/dist/module/lib/Components/TextInput/TextInput.stories.js +58 -1
- package/dist/module/lib/Components/TextInput/TextInput.stories.js.map +1 -1
- package/dist/module/lib/Components/TextInput/TextInput.test.js +45 -1
- package/dist/module/lib/Components/TextInput/TextInput.test.js.map +1 -1
- package/dist/module/lib/Components/TileButton/TileButton.figma.js +5 -0
- package/dist/module/lib/Components/TileButton/TileButton.figma.js.map +1 -1
- package/dist/module/lib/Components/TileButton/TileButton.js +39 -27
- package/dist/module/lib/Components/TileButton/TileButton.js.map +1 -1
- package/dist/module/lib/Components/TileButton/TileButton.mdx +10 -1
- package/dist/module/lib/Components/TileButton/TileButton.stories.js +33 -2
- package/dist/module/lib/Components/TileButton/TileButton.stories.js.map +1 -1
- package/dist/module/lib/Components/TileButton/TileButton.test.js +26 -0
- package/dist/module/lib/Components/TileButton/TileButton.test.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/module/lib/Symbols/Icons/Upload.js +50 -0
- package/dist/module/lib/Symbols/Icons/Upload.js.map +1 -0
- package/dist/module/lib/Symbols/index.js +1 -0
- package/dist/module/lib/Symbols/index.js.map +1 -1
- package/dist/typescript/src/lib/Components/BaseInput/BaseInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/BaseInput/BaseInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BaseInput/types.d.ts +16 -0
- package/dist/typescript/src/lib/Components/BaseInput/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DescriptionItem/DescriptionItem.d.ts +1 -1
- package/dist/typescript/src/lib/Components/DescriptionItem/DescriptionItem.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/DescriptionItem/types.d.ts +6 -0
- package/dist/typescript/src/lib/Components/DescriptionItem/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts +1 -1
- package/dist/typescript/src/lib/Components/ListItem/ListItem.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/ListItem/types.d.ts +11 -1
- package/dist/typescript/src/lib/Components/ListItem/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/SectionHeader/SectionHeader.d.ts +20 -0
- package/dist/typescript/src/lib/Components/SectionHeader/SectionHeader.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/SectionHeader/index.d.ts +3 -0
- package/dist/typescript/src/lib/Components/SectionHeader/index.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/SectionHeader/types.d.ts +27 -0
- package/dist/typescript/src/lib/Components/SectionHeader/types.d.ts.map +1 -0
- package/dist/typescript/src/lib/Components/TileButton/TileButton.d.ts +1 -1
- package/dist/typescript/src/lib/Components/TileButton/TileButton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/TileButton/types.d.ts +5 -0
- package/dist/typescript/src/lib/Components/TileButton/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/dist/typescript/src/lib/Symbols/Icons/Upload.d.ts +35 -0
- package/dist/typescript/src/lib/Symbols/Icons/Upload.d.ts.map +1 -0
- package/dist/typescript/src/lib/Symbols/index.d.ts +1 -0
- package/dist/typescript/src/lib/Symbols/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/lib/Components/BaseInput/BaseInput.tsx +93 -22
- package/src/lib/Components/BaseInput/types.ts +18 -0
- package/src/lib/Components/Button/ButtonGroup.figma.tsx +15 -0
- package/src/lib/Components/DescriptionItem/DescriptionItem.mdx +10 -7
- package/src/lib/Components/DescriptionItem/DescriptionItem.stories.tsx +21 -41
- package/src/lib/Components/DescriptionItem/DescriptionItem.test.tsx +24 -0
- package/src/lib/Components/DescriptionItem/DescriptionItem.tsx +31 -8
- package/src/lib/Components/DescriptionItem/types.ts +6 -0
- package/src/lib/Components/ListItem/ListItem.figma.tsx +43 -8
- package/src/lib/Components/ListItem/ListItem.mdx +17 -0
- package/src/lib/Components/ListItem/ListItem.stories.tsx +92 -0
- package/src/lib/Components/ListItem/ListItem.test.tsx +78 -0
- package/src/lib/Components/ListItem/ListItem.tsx +64 -19
- package/src/lib/Components/ListItem/types.ts +11 -1
- package/src/lib/Components/SectionHeader/SectionHeader.figma.tsx +24 -0
- package/src/lib/Components/SectionHeader/SectionHeader.mdx +79 -0
- package/src/lib/Components/SectionHeader/SectionHeader.stories.tsx +95 -0
- package/src/lib/Components/SectionHeader/SectionHeader.test.tsx +103 -0
- package/src/lib/Components/SectionHeader/SectionHeader.tsx +125 -0
- package/src/lib/Components/SectionHeader/index.ts +6 -0
- package/src/lib/Components/SectionHeader/types.ts +30 -0
- package/src/lib/Components/TextInput/TextInput.figma.tsx +6 -1
- package/src/lib/Components/TextInput/TextInput.mdx +43 -73
- package/src/lib/Components/TextInput/TextInput.stories.tsx +57 -1
- package/src/lib/Components/TextInput/TextInput.test.tsx +60 -1
- package/src/lib/Components/TileButton/TileButton.figma.tsx +5 -0
- package/src/lib/Components/TileButton/TileButton.mdx +10 -1
- package/src/lib/Components/TileButton/TileButton.stories.tsx +28 -4
- package/src/lib/Components/TileButton/TileButton.test.tsx +35 -1
- package/src/lib/Components/TileButton/TileButton.tsx +47 -28
- package/src/lib/Components/TileButton/types.ts +5 -0
- package/src/lib/Components/index.ts +1 -0
- package/src/lib/Symbols/Icons/Upload.tsx +45 -0
- package/src/lib/Symbols/index.ts +1 -0
|
@@ -4,6 +4,7 @@ import { render, screen } from '@testing-library/react-native';
|
|
|
4
4
|
import type { ReactElement } from 'react';
|
|
5
5
|
import { CheckmarkCircleFill } from '../../Symbols/Icons/CheckmarkCircleFill';
|
|
6
6
|
import { DeleteCircleFill } from '../../Symbols/Icons/DeleteCircleFill';
|
|
7
|
+
import { InformationFill } from '../../Symbols/Icons/InformationFill';
|
|
7
8
|
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
8
9
|
import { TextInput } from './TextInput';
|
|
9
10
|
|
|
@@ -36,7 +37,7 @@ describe('TextInput', () => {
|
|
|
36
37
|
});
|
|
37
38
|
|
|
38
39
|
describe('Helper text', () => {
|
|
39
|
-
it('renders neutral helper text
|
|
40
|
+
it('renders neutral helper text with an info icon', () => {
|
|
40
41
|
renderWithProvider(
|
|
41
42
|
<TextInput label='Address' helperText='Enter your ETH address' />,
|
|
42
43
|
);
|
|
@@ -47,6 +48,7 @@ describe('TextInput', () => {
|
|
|
47
48
|
expect(helperText.props.style).toEqual(
|
|
48
49
|
expect.objectContaining({ color: colors.text.muted }),
|
|
49
50
|
);
|
|
51
|
+
expect(screen.UNSAFE_getByType(InformationFill)).toBeTruthy();
|
|
50
52
|
expect(screen.UNSAFE_queryByType(DeleteCircleFill)).toBeNull();
|
|
51
53
|
expect(screen.UNSAFE_queryByType(CheckmarkCircleFill)).toBeNull();
|
|
52
54
|
});
|
|
@@ -87,4 +89,61 @@ describe('TextInput', () => {
|
|
|
87
89
|
expect(screen.UNSAFE_queryByType(DeleteCircleFill)).toBeNull();
|
|
88
90
|
});
|
|
89
91
|
});
|
|
92
|
+
|
|
93
|
+
describe('Character counter', () => {
|
|
94
|
+
it('renders character counter when maxCount is set', () => {
|
|
95
|
+
renderWithProvider(
|
|
96
|
+
<TextInput
|
|
97
|
+
label='Bio'
|
|
98
|
+
value='Hello'
|
|
99
|
+
onChangeText={() => {}}
|
|
100
|
+
maxCount={32}
|
|
101
|
+
/>,
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
expect(screen.getByText('5/32')).toBeTruthy();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it('does not render character counter when maxCount is omitted', () => {
|
|
108
|
+
renderWithProvider(
|
|
109
|
+
<TextInput label='Bio' value='Hello' onChangeText={() => {}} />,
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
expect(screen.queryByText(/\d+\/\d+/)).toBeNull();
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('keeps counter muted when count exceeds maxCount', () => {
|
|
116
|
+
const longValue = 'This text exceeds the character limit';
|
|
117
|
+
|
|
118
|
+
renderWithProvider(
|
|
119
|
+
<TextInput
|
|
120
|
+
label='Bio'
|
|
121
|
+
value={longValue}
|
|
122
|
+
onChangeText={() => {}}
|
|
123
|
+
maxCount={32}
|
|
124
|
+
/>,
|
|
125
|
+
);
|
|
126
|
+
|
|
127
|
+
const counter = screen.getByText(`${longValue.length}/32`);
|
|
128
|
+
|
|
129
|
+
expect(counter.props.style).toEqual(
|
|
130
|
+
expect.objectContaining({ color: colors.text.muted }),
|
|
131
|
+
);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('does not truncate input when count exceeds maxCount', () => {
|
|
135
|
+
const longValue = 'This text exceeds the character limit';
|
|
136
|
+
|
|
137
|
+
renderWithProvider(
|
|
138
|
+
<TextInput
|
|
139
|
+
label='Bio'
|
|
140
|
+
value={longValue}
|
|
141
|
+
onChangeText={() => {}}
|
|
142
|
+
maxCount={32}
|
|
143
|
+
/>,
|
|
144
|
+
);
|
|
145
|
+
|
|
146
|
+
expect(screen.getByDisplayValue(longValue)).toBeTruthy();
|
|
147
|
+
});
|
|
148
|
+
});
|
|
90
149
|
});
|
|
@@ -15,6 +15,10 @@ figma.connect(
|
|
|
15
15
|
disabled: figma.enum('state', {
|
|
16
16
|
disabled: true,
|
|
17
17
|
}),
|
|
18
|
+
appearance: figma.enum('appearance', {
|
|
19
|
+
gray: 'gray',
|
|
20
|
+
red: 'red',
|
|
21
|
+
}),
|
|
18
22
|
children: figma.string('label'),
|
|
19
23
|
icon: Placeholder,
|
|
20
24
|
},
|
|
@@ -25,6 +29,7 @@ figma.connect(
|
|
|
25
29
|
) => (
|
|
26
30
|
<TileButton
|
|
27
31
|
disabled={props.disabled}
|
|
32
|
+
appearance={props.appearance}
|
|
28
33
|
icon={props.icon}
|
|
29
34
|
onPress={() => {}}
|
|
30
35
|
>
|
|
@@ -30,9 +30,18 @@ TileButton is a compact interactive component that displays an icon above a labe
|
|
|
30
30
|
<Canvas of={TileButtonStories.Base} />
|
|
31
31
|
<Controls of={TileButtonStories.Base} />
|
|
32
32
|
|
|
33
|
+
### Appearance
|
|
34
|
+
|
|
35
|
+
TileButton comes in two appearances:
|
|
36
|
+
|
|
37
|
+
- **gray** (default): neutral surface background with base text and icon color
|
|
38
|
+
- **red**: same surface background but with red text and icon, for destructive or error actions
|
|
39
|
+
|
|
40
|
+
<Canvas of={TileButtonStories.AppearanceShowcase} />
|
|
41
|
+
|
|
33
42
|
### States
|
|
34
43
|
|
|
35
|
-
TileButton supports default, pressed, and disabled states:
|
|
44
|
+
TileButton supports default, pressed, and disabled states. The disabled state renders identically regardless of appearance:
|
|
36
45
|
|
|
37
46
|
<Canvas of={TileButtonStories.DisabledShowcase} />
|
|
38
47
|
|
|
@@ -23,6 +23,10 @@ const meta: Meta<typeof TileButton> = {
|
|
|
23
23
|
mapping: iconOptions,
|
|
24
24
|
control: { type: 'select' },
|
|
25
25
|
},
|
|
26
|
+
appearance: {
|
|
27
|
+
options: ['gray', 'red'],
|
|
28
|
+
control: { type: 'select' },
|
|
29
|
+
},
|
|
26
30
|
onPress: {
|
|
27
31
|
action: 'pressed',
|
|
28
32
|
},
|
|
@@ -47,14 +51,34 @@ export const Base: Story = {
|
|
|
47
51
|
},
|
|
48
52
|
};
|
|
49
53
|
|
|
54
|
+
export const AppearanceShowcase: Story = {
|
|
55
|
+
render: (args) => (
|
|
56
|
+
<View style={{ gap: 16 }}>
|
|
57
|
+
<View style={{ flexDirection: 'row', gap: 16 }}>
|
|
58
|
+
<TileButton icon={Settings} onPress={args.onPress}>
|
|
59
|
+
Gray
|
|
60
|
+
</TileButton>
|
|
61
|
+
<TileButton icon={Settings} appearance='red' onPress={args.onPress}>
|
|
62
|
+
Red
|
|
63
|
+
</TileButton>
|
|
64
|
+
</View>
|
|
65
|
+
</View>
|
|
66
|
+
),
|
|
67
|
+
};
|
|
68
|
+
|
|
50
69
|
export const DisabledShowcase: Story = {
|
|
51
70
|
render: (args) => (
|
|
52
71
|
<View style={{ flexDirection: 'row', gap: 16 }}>
|
|
53
|
-
<TileButton icon={Settings} onPress={args.onPress}>
|
|
54
|
-
Enabled
|
|
55
|
-
</TileButton>
|
|
56
72
|
<TileButton icon={Settings} onPress={args.onPress} disabled>
|
|
57
|
-
|
|
73
|
+
Gray disabled
|
|
74
|
+
</TileButton>
|
|
75
|
+
<TileButton
|
|
76
|
+
icon={Settings}
|
|
77
|
+
appearance='red'
|
|
78
|
+
onPress={args.onPress}
|
|
79
|
+
disabled
|
|
80
|
+
>
|
|
81
|
+
Red disabled
|
|
58
82
|
</TileButton>
|
|
59
83
|
</View>
|
|
60
84
|
),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it, expect, jest } from '@jest/globals';
|
|
2
2
|
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
3
|
import { render, screen, fireEvent } from '@testing-library/react-native';
|
|
4
|
-
import type { ViewStyle } from 'react-native';
|
|
4
|
+
import type { TextStyle, ViewStyle } from 'react-native';
|
|
5
5
|
|
|
6
6
|
import { Settings } from '../../Symbols';
|
|
7
7
|
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
@@ -100,4 +100,38 @@ describe('TileButton Component', () => {
|
|
|
100
100
|
expect(button.props.style).toBeDefined();
|
|
101
101
|
});
|
|
102
102
|
});
|
|
103
|
+
|
|
104
|
+
describe('Appearances', () => {
|
|
105
|
+
const { dark: darkTheme } = ledgerLiveThemes;
|
|
106
|
+
|
|
107
|
+
it.each([
|
|
108
|
+
['gray' as const, darkTheme.colors.text.base],
|
|
109
|
+
['red' as const, darkTheme.colors.text.error],
|
|
110
|
+
])(
|
|
111
|
+
'should apply correct text color for %s appearance',
|
|
112
|
+
(appearance, expectedColor) => {
|
|
113
|
+
renderWithProvider(
|
|
114
|
+
<TileButton icon={Settings} appearance={appearance}>
|
|
115
|
+
Label
|
|
116
|
+
</TileButton>,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const label = screen.getByText('Label');
|
|
120
|
+
const style = label.props.style as TextStyle;
|
|
121
|
+
expect(style.color).toBe(expectedColor);
|
|
122
|
+
},
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
it('should override red appearance with disabled color when disabled', () => {
|
|
126
|
+
renderWithProvider(
|
|
127
|
+
<TileButton icon={Settings} appearance='red' disabled>
|
|
128
|
+
Label
|
|
129
|
+
</TileButton>,
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const label = screen.getByText('Label');
|
|
133
|
+
const style = label.props.style as TextStyle;
|
|
134
|
+
expect(style.color).toBe(darkTheme.colors.text.disabled);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
103
137
|
});
|
|
@@ -26,40 +26,55 @@ const useStyles = ({
|
|
|
26
26
|
disabled,
|
|
27
27
|
pressed,
|
|
28
28
|
isFull,
|
|
29
|
+
appearance,
|
|
29
30
|
}: {
|
|
30
31
|
disabled: boolean;
|
|
31
32
|
pressed: boolean;
|
|
32
33
|
isFull: boolean;
|
|
34
|
+
appearance: 'gray' | 'red';
|
|
33
35
|
}) => {
|
|
34
36
|
return useStyleSheet(
|
|
35
|
-
(t) =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
37
|
+
(t) => {
|
|
38
|
+
const foregroundColors: Record<'gray' | 'red', string> = {
|
|
39
|
+
gray: t.colors.text.base,
|
|
40
|
+
red: t.colors.text.error,
|
|
41
|
+
};
|
|
42
|
+
const foregroundColor = disabled
|
|
43
|
+
? t.colors.text.disabled
|
|
44
|
+
: foregroundColors[appearance];
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
container: StyleSheet.flatten([
|
|
48
|
+
{
|
|
49
|
+
flexDirection: 'column',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
gap: t.spacings.s8,
|
|
53
|
+
padding: t.spacings.s12,
|
|
54
|
+
borderRadius: t.borderRadius.md,
|
|
55
|
+
backgroundColor: t.colors.bg.surface,
|
|
56
|
+
},
|
|
57
|
+
isFull && { width: t.sizes.full },
|
|
58
|
+
pressed &&
|
|
59
|
+
!disabled && {
|
|
60
|
+
backgroundColor: t.colors.bg.surfacePressed,
|
|
61
|
+
},
|
|
62
|
+
disabled && { backgroundColor: t.colors.bg.disabled },
|
|
63
|
+
]),
|
|
64
|
+
label: StyleSheet.flatten([
|
|
65
|
+
t.typographies.body2SemiBold,
|
|
66
|
+
{
|
|
67
|
+
textAlign: 'center',
|
|
68
|
+
color: foregroundColor,
|
|
69
|
+
},
|
|
70
|
+
]),
|
|
71
|
+
icon: {
|
|
72
|
+
flexShrink: 0,
|
|
73
|
+
color: foregroundColor,
|
|
55
74
|
},
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
60
|
-
},
|
|
61
|
-
}),
|
|
62
|
-
[disabled, pressed, isFull],
|
|
75
|
+
};
|
|
76
|
+
},
|
|
77
|
+
[disabled, pressed, isFull, appearance],
|
|
63
78
|
);
|
|
64
79
|
};
|
|
65
80
|
|
|
@@ -84,6 +99,7 @@ export const TileButton = ({
|
|
|
84
99
|
children,
|
|
85
100
|
disabled: disabledProp = false,
|
|
86
101
|
isFull = false,
|
|
102
|
+
appearance = 'gray',
|
|
87
103
|
numberOfLines = 2,
|
|
88
104
|
...props
|
|
89
105
|
}: TileButtonProps) => {
|
|
@@ -107,6 +123,7 @@ export const TileButton = ({
|
|
|
107
123
|
disabled={disabled}
|
|
108
124
|
pressed={pressed}
|
|
109
125
|
isFull={isFull}
|
|
126
|
+
appearance={appearance}
|
|
110
127
|
IconProp={IconProp}
|
|
111
128
|
numberOfLines={numberOfLines}
|
|
112
129
|
>
|
|
@@ -121,6 +138,7 @@ type TileButtonContentProps = PropsWithChildren<{
|
|
|
121
138
|
disabled: boolean;
|
|
122
139
|
pressed: boolean;
|
|
123
140
|
isFull: boolean;
|
|
141
|
+
appearance: 'gray' | 'red';
|
|
124
142
|
IconProp: TileButtonProps['icon'];
|
|
125
143
|
numberOfLines?: number;
|
|
126
144
|
}>;
|
|
@@ -129,11 +147,12 @@ const TileButtonContent: FC<TileButtonContentProps> = ({
|
|
|
129
147
|
disabled,
|
|
130
148
|
pressed,
|
|
131
149
|
isFull,
|
|
150
|
+
appearance,
|
|
132
151
|
IconProp,
|
|
133
152
|
numberOfLines,
|
|
134
153
|
children,
|
|
135
154
|
}) => {
|
|
136
|
-
const styles = useStyles({ disabled, pressed, isFull });
|
|
155
|
+
const styles = useStyles({ disabled, pressed, isFull, appearance });
|
|
137
156
|
|
|
138
157
|
return (
|
|
139
158
|
<View style={styles.container} testID='tile-button-content'>
|
|
@@ -23,6 +23,11 @@ export type TileButtonProps = {
|
|
|
23
23
|
* @default false
|
|
24
24
|
*/
|
|
25
25
|
isFull?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* The visual appearance of the button.
|
|
28
|
+
* @default 'gray'
|
|
29
|
+
*/
|
|
30
|
+
appearance?: 'gray' | 'red';
|
|
26
31
|
/**
|
|
27
32
|
* Maximum number of lines for the label text.
|
|
28
33
|
* Text will be truncated with ellipsis if it exceeds this limit.
|
|
@@ -29,6 +29,7 @@ export * from './NavBar';
|
|
|
29
29
|
export * from './OptionList';
|
|
30
30
|
export * from './PageIndicator';
|
|
31
31
|
export * from './SearchInput';
|
|
32
|
+
export * from './SectionHeader';
|
|
32
33
|
export * from './SegmentedControl';
|
|
33
34
|
export * from './Skeleton';
|
|
34
35
|
export * from './Spinner';
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import Svg, { Path } from 'react-native-svg';
|
|
2
|
+
import createIcon from '../../Components/Icon/createIcon';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Upload icon component for React Native.
|
|
6
|
+
*
|
|
7
|
+
* This icon component is automatically generated from SVG files and uses the createIcon utility
|
|
8
|
+
* to create a consistent icon interface. It supports all standard SVG props (from react-native-svg)
|
|
9
|
+
* and additional size variants defined in the Icon component.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @param {16 | 20 | 24 | 40 | 48 | 56} [size=24] - The size of the icon in pixels.
|
|
13
|
+
* @param {string} [color] - The color of the icon.
|
|
14
|
+
* @param {SVGProps} [...props] - All standard SVG element props (from react-native-svg).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Basic usage with default size (24px)
|
|
18
|
+
* import { Upload } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
19
|
+
*
|
|
20
|
+
* <Upload />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With custom size and style
|
|
24
|
+
* <Upload size={40} color="warning" lx={{ marginTop: 's4' }} />
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Used within a Button component
|
|
28
|
+
* import { Button } from '@ledgerhq/lumen-ui-rnative';
|
|
29
|
+
*
|
|
30
|
+
* <Button icon={Upload} size="md">
|
|
31
|
+
* Click me
|
|
32
|
+
* </Button>
|
|
33
|
+
*/
|
|
34
|
+
export const Upload = createIcon(
|
|
35
|
+
'Upload',
|
|
36
|
+
<Svg width={24} height={24} fill='currentColor' viewBox='0 0 16 16'>
|
|
37
|
+
<Path
|
|
38
|
+
stroke='currentColor'
|
|
39
|
+
strokeLinecap='round'
|
|
40
|
+
strokeLinejoin='round'
|
|
41
|
+
strokeWidth={1.3}
|
|
42
|
+
d='M13.333 10.963a2.37 2.37 0 0 1-2.37 2.37H5.037a2.37 2.37 0 0 1-2.37-2.37m7.704-5.926L8 2.667l-2.37 2.37M8 2.667v7.111'
|
|
43
|
+
/>
|
|
44
|
+
</Svg>,
|
|
45
|
+
);
|
package/src/lib/Symbols/index.ts
CHANGED
|
@@ -246,6 +246,7 @@ export { Truck } from './Icons/Truck';
|
|
|
246
246
|
export { Twitter } from './Icons/Twitter';
|
|
247
247
|
export { Unlink } from './Icons/Unlink';
|
|
248
248
|
export { Unlock } from './Icons/Unlock';
|
|
249
|
+
export { Upload } from './Icons/Upload';
|
|
249
250
|
export { Usb } from './Icons/Usb';
|
|
250
251
|
export { UsbC } from './Icons/UsbC';
|
|
251
252
|
export { User } from './Icons/User';
|