@ledgerhq/lumen-ui-rnative 0.1.20 → 0.1.21
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/AmountInput/AmountInput.js +2 -0
- package/dist/module/lib/Components/AmountInput/AmountInput.js.map +1 -1
- package/dist/module/lib/Components/Banner/Banner.js +13 -7
- package/dist/module/lib/Components/Banner/Banner.js.map +1 -1
- package/dist/module/lib/Components/BaseInput/BaseInput.js +7 -6
- package/dist/module/lib/Components/BaseInput/BaseInput.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheet.mdx +4 -4
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js +10 -10
- package/dist/module/lib/Components/BottomSheet/BottomSheet.stories.js.map +1 -1
- package/dist/module/lib/Components/BottomSheet/BottomSheetHeader.js +12 -12
- package/dist/module/lib/Components/BottomSheet/BottomSheetHeader.js.map +1 -1
- package/dist/module/lib/Components/Button/BaseButton.js +3 -1
- package/dist/module/lib/Components/Button/BaseButton.js.map +1 -1
- package/dist/module/lib/Components/Card/Card.js +3 -1
- package/dist/module/lib/Components/Card/Card.js.map +1 -1
- package/dist/module/lib/Components/ListItem/ListItem.js +2 -2
- package/dist/module/lib/Components/ListItem/ListItem.js.map +1 -1
- package/dist/module/lib/Components/MediaBanner/MediaBanner.js +1 -1
- package/dist/module/lib/Components/MediaBanner/MediaBanner.js.map +1 -1
- package/dist/module/lib/Components/MediaCard/MediaCard.js +1 -1
- package/dist/module/lib/Components/MediaCard/MediaCard.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.js +27 -25
- package/dist/module/lib/Components/NavBar/NavBar.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.mdx +7 -7
- package/dist/module/lib/Components/NavBar/NavBar.stories.js +6 -6
- package/dist/module/lib/Components/NavBar/NavBar.stories.js.map +1 -1
- package/dist/module/lib/Components/NavBar/NavBar.test.js +24 -24
- package/dist/module/lib/Components/NavBar/NavBar.test.js.map +1 -1
- package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js +1 -1
- package/dist/module/lib/Components/Select/GlobalSelectBottomSheet.js.map +1 -1
- package/dist/module/lib/Components/Spot/Spot.js +1 -0
- package/dist/module/lib/Components/Spot/Spot.js.map +1 -1
- package/dist/module/lib/Components/Stepper/Stepper.js +3 -0
- package/dist/module/lib/Components/Stepper/Stepper.js.map +1 -1
- package/dist/module/lib/Components/TabBar/TabBar.js +2 -2
- package/dist/module/lib/Components/TabBar/TabBar.js.map +1 -1
- package/dist/module/lib/Components/Tag/Tag.js +0 -2
- package/dist/module/lib/Components/Tag/Tag.js.map +1 -1
- package/dist/module/lib/Components/Tooltip/GlobalTooltipBottomSheet.js +1 -1
- package/dist/module/lib/Components/Tooltip/GlobalTooltipBottomSheet.js.map +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Banner/Banner.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetHeader.d.ts +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/BottomSheetHeader.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts +3 -2
- package/dist/typescript/src/lib/Components/BottomSheet/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Button/BaseButton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Card/Card.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/NavBar/NavBar.d.ts +1 -1
- package/dist/typescript/src/lib/Components/NavBar/NavBar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/NavBar/types.d.ts +3 -3
- package/dist/typescript/src/lib/Components/NavBar/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Spot/Spot.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Stepper/Stepper.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tag/Tag.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/Components/AmountInput/AmountInput.tsx +8 -2
- package/src/lib/Components/Banner/Banner.tsx +10 -4
- package/src/lib/Components/BaseInput/BaseInput.tsx +4 -3
- package/src/lib/Components/BottomSheet/BottomSheet.mdx +4 -4
- package/src/lib/Components/BottomSheet/BottomSheet.stories.tsx +10 -10
- package/src/lib/Components/BottomSheet/BottomSheetHeader.tsx +14 -14
- package/src/lib/Components/BottomSheet/types.ts +3 -2
- package/src/lib/Components/Button/BaseButton.tsx +4 -1
- package/src/lib/Components/Card/Card.tsx +2 -0
- package/src/lib/Components/ListItem/ListItem.tsx +4 -4
- package/src/lib/Components/MediaBanner/MediaBanner.tsx +1 -1
- package/src/lib/Components/MediaCard/MediaCard.tsx +1 -1
- package/src/lib/Components/NavBar/NavBar.mdx +7 -7
- package/src/lib/Components/NavBar/NavBar.stories.tsx +6 -6
- package/src/lib/Components/NavBar/NavBar.test.tsx +25 -25
- package/src/lib/Components/NavBar/NavBar.tsx +31 -29
- package/src/lib/Components/NavBar/types.ts +3 -4
- package/src/lib/Components/Select/GlobalSelectBottomSheet.tsx +1 -1
- package/src/lib/Components/Spot/Spot.tsx +5 -1
- package/src/lib/Components/Stepper/Stepper.tsx +15 -3
- package/src/lib/Components/TabBar/TabBar.tsx +2 -2
- package/src/lib/Components/Tag/Tag.tsx +1 -3
- package/src/lib/Components/Tooltip/GlobalTooltipBottomSheet.tsx +1 -1
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
NavBarTitle,
|
|
77
77
|
} from '@ledgerhq/lumen-ui-rnative';
|
|
78
78
|
|
|
79
|
-
<NavBar
|
|
79
|
+
<NavBar density='compact'>
|
|
80
80
|
<NavBarBackButton onPress={() => navigation.goBack()} />
|
|
81
81
|
<NavBarContent>
|
|
82
82
|
<NavBarTitle>Page Title</NavBarTitle>
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
NavBarDescription,
|
|
96
96
|
} from '@ledgerhq/lumen-ui-rnative';
|
|
97
97
|
|
|
98
|
-
<NavBar
|
|
98
|
+
<NavBar density='expanded'>
|
|
99
99
|
<NavBarBackButton onPress={() => navigation.goBack()} />
|
|
100
100
|
<NavBarContent>
|
|
101
101
|
<NavBarTitle>Account Details</NavBarTitle>
|
|
@@ -110,7 +110,7 @@ import {
|
|
|
110
110
|
import { MoreHorizontal } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
111
111
|
import { IconButton } from '@ledgerhq/lumen-ui-rnative';
|
|
112
112
|
|
|
113
|
-
<NavBar
|
|
113
|
+
<NavBar density='compact'>
|
|
114
114
|
<NavBarBackButton onPress={() => navigation.goBack()} />
|
|
115
115
|
<NavBarContent>
|
|
116
116
|
<NavBarTitle>Settings</NavBarTitle>
|
|
@@ -131,7 +131,7 @@ import { IconButton } from '@ledgerhq/lumen-ui-rnative';
|
|
|
131
131
|
import Icon from '@ledgerhq/crypto-icons/native';
|
|
132
132
|
import { NavBarCoinCapsule } from '@ledgerhq/lumen-ui-rnative';
|
|
133
133
|
|
|
134
|
-
<NavBar
|
|
134
|
+
<NavBar density='compact'>
|
|
135
135
|
<NavBarBackButton onPress={() => navigation.goBack()} />
|
|
136
136
|
<NavBarContent>
|
|
137
137
|
<NavBarCoinCapsule
|
|
@@ -163,7 +163,7 @@ function App() {
|
|
|
163
163
|
<Stack.Navigator
|
|
164
164
|
screenOptions={{
|
|
165
165
|
header: ({ navigation, route }) => (
|
|
166
|
-
<NavBar
|
|
166
|
+
<NavBar density='compact'>
|
|
167
167
|
<NavBarBackButton onPress={() => navigation.goBack()} />
|
|
168
168
|
<NavBarContent>
|
|
169
169
|
<NavBarTitle>{route.name}</NavBarTitle>
|
|
@@ -201,7 +201,7 @@ export default function Layout() {
|
|
|
201
201
|
<Stack
|
|
202
202
|
screenOptions={{
|
|
203
203
|
header: ({ route }) => (
|
|
204
|
-
<NavBar
|
|
204
|
+
<NavBar density='compact'>
|
|
205
205
|
<NavBarBackButton onPress={() => router.back()} />
|
|
206
206
|
<NavBarContent>
|
|
207
207
|
<NavBarTitle>{route.name}</NavBarTitle>
|
|
@@ -236,7 +236,7 @@ export default function DetailsScreen() {
|
|
|
236
236
|
<Stack.Screen
|
|
237
237
|
options={{
|
|
238
238
|
header: () => (
|
|
239
|
-
<NavBar
|
|
239
|
+
<NavBar density='expanded'>
|
|
240
240
|
<NavBarBackButton onPress={() => router.back()} />
|
|
241
241
|
<NavBarContent>
|
|
242
242
|
<NavBarTitle>Details</NavBarTitle>
|
|
@@ -35,10 +35,10 @@ const meta: Meta<typeof NavBar> = {
|
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
argTypes: {
|
|
38
|
-
|
|
38
|
+
density: {
|
|
39
39
|
control: 'select',
|
|
40
40
|
options: ['compact', 'expanded'],
|
|
41
|
-
description: 'Controls the
|
|
41
|
+
description: 'Controls the density/layout of the NavBar',
|
|
42
42
|
},
|
|
43
43
|
},
|
|
44
44
|
};
|
|
@@ -48,7 +48,7 @@ type Story = StoryObj<typeof NavBar>;
|
|
|
48
48
|
|
|
49
49
|
export const Base: Story = {
|
|
50
50
|
args: {
|
|
51
|
-
|
|
51
|
+
density: 'compact',
|
|
52
52
|
lx: {
|
|
53
53
|
width: 's480',
|
|
54
54
|
},
|
|
@@ -74,7 +74,7 @@ export const Base: Story = {
|
|
|
74
74
|
|
|
75
75
|
export const Expanded: Story = {
|
|
76
76
|
args: {
|
|
77
|
-
|
|
77
|
+
density: 'expanded',
|
|
78
78
|
lx: {
|
|
79
79
|
width: 's480',
|
|
80
80
|
},
|
|
@@ -100,7 +100,7 @@ export const Expanded: Story = {
|
|
|
100
100
|
|
|
101
101
|
export const WithCoinCapsule: Story = {
|
|
102
102
|
args: {
|
|
103
|
-
|
|
103
|
+
density: 'compact',
|
|
104
104
|
lx: {
|
|
105
105
|
width: 's480',
|
|
106
106
|
},
|
|
@@ -128,7 +128,7 @@ export const WithCoinCapsule: Story = {
|
|
|
128
128
|
|
|
129
129
|
export const WithMultipleTrailingActions: Story = {
|
|
130
130
|
args: {
|
|
131
|
-
|
|
131
|
+
density: 'compact',
|
|
132
132
|
lx: {
|
|
133
133
|
width: 's480',
|
|
134
134
|
},
|
|
@@ -26,7 +26,7 @@ describe('NavBar', () => {
|
|
|
26
26
|
describe('Rendering', () => {
|
|
27
27
|
it('should render with title', () => {
|
|
28
28
|
renderWithProvider(
|
|
29
|
-
<NavBar testID='navbar'
|
|
29
|
+
<NavBar testID='navbar' density='compact'>
|
|
30
30
|
<NavBarContent>
|
|
31
31
|
<NavBarTitle>Test Title</NavBarTitle>
|
|
32
32
|
</NavBarContent>
|
|
@@ -39,7 +39,7 @@ describe('NavBar', () => {
|
|
|
39
39
|
|
|
40
40
|
it('should render with title and description', () => {
|
|
41
41
|
renderWithProvider(
|
|
42
|
-
<NavBar testID='navbar'
|
|
42
|
+
<NavBar testID='navbar' density='expanded'>
|
|
43
43
|
<NavBarContent>
|
|
44
44
|
<NavBarTitle>Test Title</NavBarTitle>
|
|
45
45
|
<NavBarDescription>Test Description</NavBarDescription>
|
|
@@ -54,7 +54,7 @@ describe('NavBar', () => {
|
|
|
54
54
|
it('should render with back button', () => {
|
|
55
55
|
const onPress = jest.fn();
|
|
56
56
|
renderWithProvider(
|
|
57
|
-
<NavBar testID='navbar'
|
|
57
|
+
<NavBar testID='navbar' density='compact'>
|
|
58
58
|
<NavBarBackButton onPress={onPress} />
|
|
59
59
|
<NavBarContent>
|
|
60
60
|
<NavBarTitle>Test Title</NavBarTitle>
|
|
@@ -67,7 +67,7 @@ describe('NavBar', () => {
|
|
|
67
67
|
|
|
68
68
|
it('should render with coin capsule', () => {
|
|
69
69
|
renderWithProvider(
|
|
70
|
-
<NavBar testID='navbar'
|
|
70
|
+
<NavBar testID='navbar' density='compact'>
|
|
71
71
|
<NavBarContent>
|
|
72
72
|
<NavBarCoinCapsule ticker='BTC' icon={<MockIcon />} />
|
|
73
73
|
</NavBarContent>
|
|
@@ -80,7 +80,7 @@ describe('NavBar', () => {
|
|
|
80
80
|
it('should render with all components', () => {
|
|
81
81
|
const onPress = jest.fn();
|
|
82
82
|
renderWithProvider(
|
|
83
|
-
<NavBar testID='navbar'
|
|
83
|
+
<NavBar testID='navbar' density='expanded'>
|
|
84
84
|
<NavBarBackButton onPress={onPress} />
|
|
85
85
|
<NavBarContent>
|
|
86
86
|
<NavBarTitle>Test Title</NavBarTitle>
|
|
@@ -95,12 +95,12 @@ describe('NavBar', () => {
|
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
-
describe('
|
|
98
|
+
describe('Density', () => {
|
|
99
99
|
it.each(['compact', 'expanded'] as const)(
|
|
100
|
-
'should render with %s
|
|
101
|
-
(
|
|
100
|
+
'should render with %s density',
|
|
101
|
+
(density) => {
|
|
102
102
|
renderWithProvider(
|
|
103
|
-
<NavBar testID='navbar'
|
|
103
|
+
<NavBar testID='navbar' density={density}>
|
|
104
104
|
<NavBarContent>
|
|
105
105
|
<NavBarTitle>Test Title</NavBarTitle>
|
|
106
106
|
</NavBarContent>
|
|
@@ -115,7 +115,7 @@ describe('NavBar', () => {
|
|
|
115
115
|
describe('NavBarTitle', () => {
|
|
116
116
|
it('should truncate to 1 line in compact mode', () => {
|
|
117
117
|
renderWithProvider(
|
|
118
|
-
<NavBar
|
|
118
|
+
<NavBar density='compact'>
|
|
119
119
|
<NavBarContent>
|
|
120
120
|
<NavBarTitle testID='title'>Very long title text</NavBarTitle>
|
|
121
121
|
</NavBarContent>
|
|
@@ -128,7 +128,7 @@ describe('NavBar', () => {
|
|
|
128
128
|
|
|
129
129
|
it('should truncate to 2 lines in expanded mode', () => {
|
|
130
130
|
renderWithProvider(
|
|
131
|
-
<NavBar
|
|
131
|
+
<NavBar density='expanded'>
|
|
132
132
|
<NavBarContent>
|
|
133
133
|
<NavBarTitle testID='title'>Very long title text</NavBarTitle>
|
|
134
134
|
</NavBarContent>
|
|
@@ -142,7 +142,7 @@ describe('NavBar', () => {
|
|
|
142
142
|
it('should accept custom style prop', () => {
|
|
143
143
|
const customStyle = { opacity: 0.5 };
|
|
144
144
|
renderWithProvider(
|
|
145
|
-
<NavBar
|
|
145
|
+
<NavBar density='compact'>
|
|
146
146
|
<NavBarContent>
|
|
147
147
|
<NavBarTitle testID='title' style={customStyle}>
|
|
148
148
|
Test
|
|
@@ -164,7 +164,7 @@ describe('NavBar', () => {
|
|
|
164
164
|
describe('NavBarDescription', () => {
|
|
165
165
|
it('should truncate to 1 line in compact mode', () => {
|
|
166
166
|
renderWithProvider(
|
|
167
|
-
<NavBar
|
|
167
|
+
<NavBar density='compact'>
|
|
168
168
|
<NavBarContent>
|
|
169
169
|
<NavBarTitle>Title</NavBarTitle>
|
|
170
170
|
<NavBarDescription testID='description'>
|
|
@@ -180,7 +180,7 @@ describe('NavBar', () => {
|
|
|
180
180
|
|
|
181
181
|
it('should truncate to 3 lines in expanded mode', () => {
|
|
182
182
|
renderWithProvider(
|
|
183
|
-
<NavBar
|
|
183
|
+
<NavBar density='expanded'>
|
|
184
184
|
<NavBarContent>
|
|
185
185
|
<NavBarTitle>Title</NavBarTitle>
|
|
186
186
|
<NavBarDescription testID='description'>
|
|
@@ -197,7 +197,7 @@ describe('NavBar', () => {
|
|
|
197
197
|
it('should accept custom style prop', () => {
|
|
198
198
|
const customStyle = { opacity: 0.7 };
|
|
199
199
|
renderWithProvider(
|
|
200
|
-
<NavBar
|
|
200
|
+
<NavBar density='expanded'>
|
|
201
201
|
<NavBarContent>
|
|
202
202
|
<NavBarTitle>Title</NavBarTitle>
|
|
203
203
|
<NavBarDescription testID='description' style={customStyle}>
|
|
@@ -221,7 +221,7 @@ describe('NavBar', () => {
|
|
|
221
221
|
it('should call onPress when pressed', () => {
|
|
222
222
|
const handlePress = jest.fn();
|
|
223
223
|
renderWithProvider(
|
|
224
|
-
<NavBar
|
|
224
|
+
<NavBar density='compact'>
|
|
225
225
|
<NavBarBackButton onPress={handlePress} />
|
|
226
226
|
<NavBarContent>
|
|
227
227
|
<NavBarTitle>Test Title</NavBarTitle>
|
|
@@ -236,7 +236,7 @@ describe('NavBar', () => {
|
|
|
236
236
|
it('should accept custom accessibilityLabel', () => {
|
|
237
237
|
const handlePress = jest.fn();
|
|
238
238
|
renderWithProvider(
|
|
239
|
-
<NavBar
|
|
239
|
+
<NavBar density='compact'>
|
|
240
240
|
<NavBarBackButton
|
|
241
241
|
onPress={handlePress}
|
|
242
242
|
accessibilityLabel='Navigate back'
|
|
@@ -254,7 +254,7 @@ describe('NavBar', () => {
|
|
|
254
254
|
describe('NavBarCoinCapsule', () => {
|
|
255
255
|
it('should render ticker and icon', () => {
|
|
256
256
|
renderWithProvider(
|
|
257
|
-
<NavBar
|
|
257
|
+
<NavBar density='compact'>
|
|
258
258
|
<NavBarContent>
|
|
259
259
|
<NavBarCoinCapsule ticker='ETH' icon={<MockIcon />} />
|
|
260
260
|
</NavBarContent>
|
|
@@ -268,7 +268,7 @@ describe('NavBar', () => {
|
|
|
268
268
|
describe('NavBarTrailing', () => {
|
|
269
269
|
it('should render trailing content in compact mode', () => {
|
|
270
270
|
renderWithProvider(
|
|
271
|
-
<NavBar
|
|
271
|
+
<NavBar density='compact'>
|
|
272
272
|
<NavBarBackButton />
|
|
273
273
|
<NavBarContent>
|
|
274
274
|
<NavBarTitle>Test Title</NavBarTitle>
|
|
@@ -284,7 +284,7 @@ describe('NavBar', () => {
|
|
|
284
284
|
|
|
285
285
|
it('should render trailing content in expanded mode', () => {
|
|
286
286
|
renderWithProvider(
|
|
287
|
-
<NavBar
|
|
287
|
+
<NavBar density='expanded'>
|
|
288
288
|
<NavBarBackButton />
|
|
289
289
|
<NavBarContent>
|
|
290
290
|
<NavBarTitle>Test Title</NavBarTitle>
|
|
@@ -301,7 +301,7 @@ describe('NavBar', () => {
|
|
|
301
301
|
it('should accept custom style prop', () => {
|
|
302
302
|
const customStyle = { opacity: 0.8 };
|
|
303
303
|
renderWithProvider(
|
|
304
|
-
<NavBar
|
|
304
|
+
<NavBar density='compact'>
|
|
305
305
|
<NavBarContent>
|
|
306
306
|
<NavBarTitle>Title</NavBarTitle>
|
|
307
307
|
</NavBarContent>
|
|
@@ -324,7 +324,7 @@ describe('NavBar', () => {
|
|
|
324
324
|
describe('NavBarContent', () => {
|
|
325
325
|
it('should render content in both compact and expanded modes', () => {
|
|
326
326
|
const { rerender } = renderWithProvider(
|
|
327
|
-
<NavBar
|
|
327
|
+
<NavBar density='compact'>
|
|
328
328
|
<NavBarContent>
|
|
329
329
|
<NavBarTitle>Title</NavBarTitle>
|
|
330
330
|
<NavBarDescription>Description</NavBarDescription>
|
|
@@ -337,7 +337,7 @@ describe('NavBar', () => {
|
|
|
337
337
|
|
|
338
338
|
rerender(
|
|
339
339
|
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
340
|
-
<NavBar
|
|
340
|
+
<NavBar density='expanded'>
|
|
341
341
|
<NavBarContent>
|
|
342
342
|
<NavBarTitle>Title</NavBarTitle>
|
|
343
343
|
<NavBarDescription>Description</NavBarDescription>
|
|
@@ -353,7 +353,7 @@ describe('NavBar', () => {
|
|
|
353
353
|
it('should render back button in all modes', () => {
|
|
354
354
|
const onPress = jest.fn();
|
|
355
355
|
const { rerender } = renderWithProvider(
|
|
356
|
-
<NavBar
|
|
356
|
+
<NavBar density='compact'>
|
|
357
357
|
<NavBarBackButton onPress={onPress} />
|
|
358
358
|
<NavBarContent>
|
|
359
359
|
<NavBarTitle>Title</NavBarTitle>
|
|
@@ -365,7 +365,7 @@ describe('NavBar', () => {
|
|
|
365
365
|
|
|
366
366
|
rerender(
|
|
367
367
|
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
368
|
-
<NavBar
|
|
368
|
+
<NavBar density='expanded'>
|
|
369
369
|
<NavBarBackButton onPress={onPress} />
|
|
370
370
|
<NavBarContent>
|
|
371
371
|
<NavBarTitle>Title</NavBarTitle>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSafeContext } from '@ledgerhq/lumen-utils-shared';
|
|
1
|
+
import { createSafeContext, Density } from '@ledgerhq/lumen-utils-shared';
|
|
2
2
|
import { Children, isValidElement, ReactNode } from 'react';
|
|
3
3
|
import { StyleSheet } from 'react-native';
|
|
4
4
|
import { useCommonTranslation } from '../../../i18n';
|
|
@@ -8,7 +8,6 @@ import { IconButton } from '../IconButton';
|
|
|
8
8
|
import { Box, Text } from '../Utility';
|
|
9
9
|
import { CoinCapsule } from './CoinCapsule';
|
|
10
10
|
import {
|
|
11
|
-
NavBarAppearance,
|
|
12
11
|
NavBarBackButtonProps,
|
|
13
12
|
NavBarCoinCapsuleProps,
|
|
14
13
|
NavBarContentProps,
|
|
@@ -25,7 +24,7 @@ type Slots = {
|
|
|
25
24
|
};
|
|
26
25
|
|
|
27
26
|
const [NavBarProvider, useNavBarContext] = createSafeContext<{
|
|
28
|
-
|
|
27
|
+
density: Density;
|
|
29
28
|
}>('NavBar');
|
|
30
29
|
|
|
31
30
|
function extractSlots(children: ReactNode): Slots {
|
|
@@ -64,11 +63,11 @@ export function NavBarContent({
|
|
|
64
63
|
style,
|
|
65
64
|
...props
|
|
66
65
|
}: NavBarContentProps) {
|
|
67
|
-
const {
|
|
66
|
+
const { density } = useNavBarContext({
|
|
68
67
|
consumerName: 'NavBarContent',
|
|
69
68
|
contextRequired: true,
|
|
70
69
|
});
|
|
71
|
-
const styles = useStyles({
|
|
70
|
+
const styles = useStyles({ density });
|
|
72
71
|
|
|
73
72
|
return (
|
|
74
73
|
<Box style={[styles.content, style]} {...props}>
|
|
@@ -80,15 +79,15 @@ export function NavBarContent({
|
|
|
80
79
|
NavBarContent.displayName = 'NavBarContent';
|
|
81
80
|
|
|
82
81
|
export function NavBarTitle({ children, style, ...props }: NavBarTitleProps) {
|
|
83
|
-
const {
|
|
82
|
+
const { density } = useNavBarContext({
|
|
84
83
|
consumerName: 'NavBarTitle',
|
|
85
84
|
contextRequired: true,
|
|
86
85
|
});
|
|
87
|
-
const styles = useStyles({
|
|
86
|
+
const styles = useStyles({ density });
|
|
88
87
|
|
|
89
88
|
return (
|
|
90
89
|
<Text
|
|
91
|
-
numberOfLines={
|
|
90
|
+
numberOfLines={density === 'compact' ? 1 : 2}
|
|
92
91
|
style={[styles.title, style]}
|
|
93
92
|
{...props}
|
|
94
93
|
>
|
|
@@ -102,15 +101,15 @@ export function NavBarDescription({
|
|
|
102
101
|
style,
|
|
103
102
|
...props
|
|
104
103
|
}: NavBarDescriptionProps) {
|
|
105
|
-
const {
|
|
104
|
+
const { density } = useNavBarContext({
|
|
106
105
|
consumerName: 'NavBarDescription',
|
|
107
106
|
contextRequired: true,
|
|
108
107
|
});
|
|
109
|
-
const styles = useStyles({
|
|
108
|
+
const styles = useStyles({ density });
|
|
110
109
|
|
|
111
110
|
return (
|
|
112
111
|
<Text
|
|
113
|
-
numberOfLines={
|
|
112
|
+
numberOfLines={density === 'compact' ? 1 : 3}
|
|
114
113
|
style={[styles.description, style]}
|
|
115
114
|
{...props}
|
|
116
115
|
>
|
|
@@ -193,14 +192,14 @@ NavBarTrailing.displayName = 'NavBarTrailing';
|
|
|
193
192
|
/**
|
|
194
193
|
* NavBar component for top navigation
|
|
195
194
|
*/
|
|
196
|
-
export function NavBar({
|
|
197
|
-
const styles = useStyles({
|
|
195
|
+
export function NavBar({ density, children, ...props }: NavBarProps) {
|
|
196
|
+
const styles = useStyles({ density });
|
|
198
197
|
const slots = extractSlots(children);
|
|
199
198
|
|
|
200
199
|
return (
|
|
201
|
-
<NavBarProvider value={{
|
|
200
|
+
<NavBarProvider value={{ density }}>
|
|
202
201
|
<Box style={styles.container} {...props}>
|
|
203
|
-
{
|
|
202
|
+
{density === 'expanded' ? (
|
|
204
203
|
<>
|
|
205
204
|
<Box style={styles.topRow}>
|
|
206
205
|
<Box style={styles.backButtonContainer}>{slots.backButton}</Box>
|
|
@@ -225,10 +224,10 @@ export function NavBar({ appearance, children, ...props }: NavBarProps) {
|
|
|
225
224
|
}
|
|
226
225
|
|
|
227
226
|
type StyleParams = {
|
|
228
|
-
|
|
227
|
+
density: Density;
|
|
229
228
|
};
|
|
230
229
|
|
|
231
|
-
const useStyles = ({
|
|
230
|
+
const useStyles = ({ density }: StyleParams) => {
|
|
232
231
|
return useStyleSheet(
|
|
233
232
|
(t) => {
|
|
234
233
|
return {
|
|
@@ -244,7 +243,7 @@ const useStyles = ({ appearance }: StyleParams) => {
|
|
|
244
243
|
paddingVertical: t.spacings.s8,
|
|
245
244
|
},
|
|
246
245
|
{
|
|
247
|
-
...(
|
|
246
|
+
...(density === 'expanded' && {
|
|
248
247
|
alignItems: 'flex-start',
|
|
249
248
|
flexDirection: 'column',
|
|
250
249
|
}),
|
|
@@ -261,7 +260,7 @@ const useStyles = ({ appearance }: StyleParams) => {
|
|
|
261
260
|
paddingVertical: t.spacings.s8,
|
|
262
261
|
},
|
|
263
262
|
{
|
|
264
|
-
...(
|
|
263
|
+
...(density === 'compact' && {
|
|
265
264
|
position: 'absolute',
|
|
266
265
|
left: t.spacings.s4,
|
|
267
266
|
zIndex: 1,
|
|
@@ -274,28 +273,31 @@ const useStyles = ({ appearance }: StyleParams) => {
|
|
|
274
273
|
flexShrink: 0,
|
|
275
274
|
},
|
|
276
275
|
{
|
|
277
|
-
...(
|
|
276
|
+
...(density === 'compact' && {
|
|
278
277
|
position: 'absolute',
|
|
279
278
|
right: t.spacings.s4,
|
|
280
279
|
zIndex: 1,
|
|
281
280
|
}),
|
|
282
281
|
},
|
|
283
282
|
{
|
|
284
|
-
...(
|
|
283
|
+
...(density === 'expanded' && {
|
|
285
284
|
marginLeft: 'auto',
|
|
286
285
|
}),
|
|
287
286
|
},
|
|
288
287
|
]),
|
|
289
288
|
contentContainer: StyleSheet.flatten([
|
|
290
289
|
{
|
|
291
|
-
|
|
290
|
+
flex: 1,
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
...(density === 'compact' && {
|
|
292
294
|
paddingHorizontal: t.spacings.s48,
|
|
293
295
|
alignItems: 'center',
|
|
294
296
|
justifyContent: 'center',
|
|
295
297
|
}),
|
|
296
298
|
},
|
|
297
299
|
{
|
|
298
|
-
...(
|
|
300
|
+
...(density === 'expanded' && {
|
|
299
301
|
paddingHorizontal: t.spacings.s12,
|
|
300
302
|
paddingBottom: t.spacings.s12,
|
|
301
303
|
width: '100%',
|
|
@@ -307,31 +309,31 @@ const useStyles = ({ appearance }: StyleParams) => {
|
|
|
307
309
|
flexDirection: 'column',
|
|
308
310
|
},
|
|
309
311
|
{
|
|
310
|
-
...(
|
|
312
|
+
...(density === 'compact' && {
|
|
311
313
|
alignItems: 'center',
|
|
312
314
|
justifyContent: 'center',
|
|
313
315
|
}),
|
|
314
316
|
},
|
|
315
317
|
{
|
|
316
|
-
...(
|
|
318
|
+
...(density === 'expanded' && {
|
|
317
319
|
gap: t.spacings.s8,
|
|
318
320
|
}),
|
|
319
321
|
},
|
|
320
322
|
]),
|
|
321
323
|
title: {
|
|
322
|
-
...(
|
|
324
|
+
...(density === 'expanded'
|
|
323
325
|
? t.typographies.heading3SemiBold
|
|
324
326
|
: t.typographies.heading4SemiBold),
|
|
325
327
|
color: t.colors.text.base,
|
|
326
|
-
textAlign:
|
|
328
|
+
textAlign: density === 'expanded' ? 'left' : 'center',
|
|
327
329
|
},
|
|
328
330
|
description: {
|
|
329
331
|
...t.typographies.body2,
|
|
330
332
|
color: t.colors.text.muted,
|
|
331
|
-
textAlign:
|
|
333
|
+
textAlign: density === 'expanded' ? 'left' : 'center',
|
|
332
334
|
},
|
|
333
335
|
};
|
|
334
336
|
},
|
|
335
|
-
[
|
|
337
|
+
[density],
|
|
336
338
|
);
|
|
337
339
|
};
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
+
import { Density } from '@ledgerhq/lumen-utils-shared';
|
|
1
2
|
import { ReactElement, ReactNode } from 'react';
|
|
2
3
|
import { StyledViewProps } from '../../../styles';
|
|
3
4
|
import { IconButtonProps } from '../IconButton';
|
|
4
5
|
|
|
5
|
-
export type NavBarAppearance = 'compact' | 'expanded';
|
|
6
|
-
|
|
7
6
|
export type NavBarProps = {
|
|
8
7
|
/**
|
|
9
|
-
* Controls the
|
|
8
|
+
* Controls the density/layout of the NavBar.
|
|
10
9
|
* - 'compact': Content displayed vertically, centered with standard spacing
|
|
11
10
|
* - 'expanded': Content displayed vertically, left-aligned with increased spacing
|
|
12
11
|
*/
|
|
13
|
-
|
|
12
|
+
density: Density;
|
|
14
13
|
} & StyledViewProps;
|
|
15
14
|
|
|
16
15
|
export type NavBarBackButtonProps = {
|
|
@@ -151,7 +151,11 @@ export const Spot = (props: SpotProps) => {
|
|
|
151
151
|
return <Icon size={calculatedIconSize} style={styles.icon} />;
|
|
152
152
|
}
|
|
153
153
|
case 'number': {
|
|
154
|
-
return
|
|
154
|
+
return (
|
|
155
|
+
<Text style={styles.numberText} allowFontScaling={false}>
|
|
156
|
+
{props.number}
|
|
157
|
+
</Text>
|
|
158
|
+
);
|
|
155
159
|
}
|
|
156
160
|
case 'bluetooth':
|
|
157
161
|
return (
|
|
@@ -168,15 +168,27 @@ export const Stepper = ({
|
|
|
168
168
|
}}
|
|
169
169
|
>
|
|
170
170
|
{label ? (
|
|
171
|
-
<Text
|
|
171
|
+
<Text
|
|
172
|
+
typography='body2SemiBold'
|
|
173
|
+
lx={{ color: 'base' }}
|
|
174
|
+
maxFontSizeMultiplier={1.4}
|
|
175
|
+
>
|
|
172
176
|
{label}
|
|
173
177
|
</Text>
|
|
174
178
|
) : (
|
|
175
179
|
<>
|
|
176
|
-
<Text
|
|
180
|
+
<Text
|
|
181
|
+
typography='body1SemiBold'
|
|
182
|
+
lx={{ color: 'base' }}
|
|
183
|
+
maxFontSizeMultiplier={1.4}
|
|
184
|
+
>
|
|
177
185
|
{Math.min(Math.max(currentStep, 0), totalSteps)}
|
|
178
186
|
</Text>
|
|
179
|
-
<Text
|
|
187
|
+
<Text
|
|
188
|
+
typography='body2SemiBold'
|
|
189
|
+
lx={{ color: 'muted' }}
|
|
190
|
+
maxFontSizeMultiplier={1.4}
|
|
191
|
+
>
|
|
180
192
|
/{totalSteps}
|
|
181
193
|
</Text>
|
|
182
194
|
</>
|
|
@@ -299,7 +299,7 @@ const useStyles = () =>
|
|
|
299
299
|
useStyleSheet(
|
|
300
300
|
(t) => ({
|
|
301
301
|
container: {
|
|
302
|
-
|
|
302
|
+
minHeight: TAB_BAR_HEIGHT,
|
|
303
303
|
flexDirection: 'row',
|
|
304
304
|
justifyContent: 'center',
|
|
305
305
|
padding: t.spacings.s4,
|
|
@@ -310,7 +310,7 @@ const useStyles = () =>
|
|
|
310
310
|
},
|
|
311
311
|
blur: {
|
|
312
312
|
...StyleSheet.absoluteFillObject,
|
|
313
|
-
|
|
313
|
+
bottom: -t.sizes.s16,
|
|
314
314
|
zIndex: -1,
|
|
315
315
|
},
|
|
316
316
|
fallbackBackground: {
|
|
@@ -39,15 +39,13 @@ const useStyles = ({
|
|
|
39
39
|
|
|
40
40
|
const sizeStyles: Record<
|
|
41
41
|
Size,
|
|
42
|
-
{
|
|
42
|
+
{ paddingHorizontal: number; paddingVertical: number }
|
|
43
43
|
> = {
|
|
44
44
|
md: {
|
|
45
|
-
height: t.sizes.s24,
|
|
46
45
|
paddingHorizontal: t.spacings.s8,
|
|
47
46
|
paddingVertical: t.spacings.s4,
|
|
48
47
|
},
|
|
49
48
|
sm: {
|
|
50
|
-
height: t.sizes.s20,
|
|
51
49
|
paddingHorizontal: t.spacings.s4,
|
|
52
50
|
paddingVertical: t.spacings.s2,
|
|
53
51
|
},
|
|
@@ -63,7 +63,7 @@ export const GlobalTooltipBottomSheet: React.FC = () => {
|
|
|
63
63
|
{(currentTooltip?.title || currentTooltip?.content) && (
|
|
64
64
|
<BottomSheetHeader
|
|
65
65
|
title={currentTooltip.title}
|
|
66
|
-
|
|
66
|
+
density='expanded'
|
|
67
67
|
description={currentTooltip.content}
|
|
68
68
|
/>
|
|
69
69
|
)}
|