@ledgerhq/lumen-ui-rnative 0.1.9 → 0.1.11
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 +16 -10
- package/dist/module/lib/Components/AmountInput/AmountInput.js.map +1 -1
- package/dist/module/lib/Components/BaseInput/BaseInput.js +15 -8
- package/dist/module/lib/Components/BaseInput/BaseInput.js.map +1 -1
- package/dist/module/lib/Components/Button/BaseButton.js +8 -1
- package/dist/module/lib/Components/Button/BaseButton.js.map +1 -1
- package/dist/module/lib/Components/Card/Card.js +45 -49
- package/dist/module/lib/Components/Card/Card.js.map +1 -1
- package/dist/module/lib/Components/CardButton/CardButton.js +8 -1
- package/dist/module/lib/Components/CardButton/CardButton.js.map +1 -1
- package/dist/module/lib/Components/Checkbox/Checkbox.js +8 -1
- package/dist/module/lib/Components/Checkbox/Checkbox.js.map +1 -1
- package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.js +10 -3
- package/dist/module/lib/Components/InteractiveIcon/InteractiveIcon.js.map +1 -1
- package/dist/module/lib/Components/Label/Label.js +9 -2
- package/dist/module/lib/Components/Label/Label.js.map +1 -1
- package/dist/module/lib/Components/ListItem/ListItem.js +14 -19
- package/dist/module/lib/Components/ListItem/ListItem.js.map +1 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.js +8 -1
- package/dist/module/lib/Components/SegmentedControl/SegmentedControl.js.map +1 -1
- package/dist/module/lib/Components/Select/Select.js +8 -1
- package/dist/module/lib/Components/Select/Select.js.map +1 -1
- package/dist/module/lib/Components/Spot/Spot.js +4 -4
- package/dist/module/lib/Components/Spot/Spot.js.map +1 -1
- package/dist/module/lib/Components/Stepper/Stepper.js +9 -3
- package/dist/module/lib/Components/Stepper/Stepper.js.map +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.js +1 -34
- package/dist/module/lib/Components/Subheader/Subheader.js.map +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.mdx +26 -61
- package/dist/module/lib/Components/Subheader/Subheader.stories.js +23 -12
- package/dist/module/lib/Components/Subheader/Subheader.stories.js.map +1 -1
- package/dist/module/lib/Components/Subheader/Subheader.test.js +2 -26
- package/dist/module/lib/Components/Subheader/Subheader.test.js.map +1 -1
- package/dist/module/lib/Components/Subheader/index.js +1 -1
- package/dist/module/lib/Components/Subheader/index.js.map +1 -1
- package/dist/module/lib/Components/Switch/Switch.js +8 -1
- package/dist/module/lib/Components/Switch/Switch.js.map +1 -1
- package/dist/module/lib/Components/TabBar/TabBar.js +4 -3
- package/dist/module/lib/Components/TabBar/TabBar.js.map +1 -1
- package/dist/module/lib/Components/Tag/Tag.js +9 -2
- package/dist/module/lib/Components/Tag/Tag.js.map +1 -1
- package/dist/module/lib/Components/Tile/Tile.js +27 -48
- package/dist/module/lib/Components/Tile/Tile.js.map +1 -1
- package/dist/module/lib/Components/Tile/Tile.mdx +34 -26
- package/dist/module/lib/Components/Tile/Tile.stories.js +31 -28
- package/dist/module/lib/Components/Tile/Tile.stories.js.map +1 -1
- package/dist/module/lib/Components/Tile/Tile.test.js +33 -188
- package/dist/module/lib/Components/Tile/Tile.test.js.map +1 -1
- package/dist/module/lib/Components/Tile/index.js +1 -1
- package/dist/module/lib/Components/Tile/index.js.map +1 -1
- package/dist/module/lib/Components/TileButton/TileButton.js +8 -2
- package/dist/module/lib/Components/TileButton/TileButton.js.map +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts +1 -1
- package/dist/typescript/src/lib/Components/AmountInput/AmountInput.d.ts.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/Button/BaseButton.d.ts +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/Card/types.d.ts +1 -3
- package/dist/typescript/src/lib/Components/Card/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/CardButton/CardButton.d.ts +1 -1
- package/dist/typescript/src/lib/Components/CardButton/CardButton.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts +1 -1
- package/dist/typescript/src/lib/Components/InteractiveIcon/InteractiveIcon.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/InteractiveIcon/types.d.ts +6 -1
- package/dist/typescript/src/lib/Components/InteractiveIcon/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Label/Label.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Label/Label.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/SegmentedControl/SegmentedControl.d.ts +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControlContext.d.ts +1 -1
- package/dist/typescript/src/lib/Components/SegmentedControl/SegmentedControlContext.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Select/Select.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Select/Select.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Stepper/Stepper.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Stepper/Stepper.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Subheader/Subheader.d.ts +2 -7
- package/dist/typescript/src/lib/Components/Subheader/Subheader.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Subheader/index.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Subheader/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Subheader/types.d.ts +1 -11
- package/dist/typescript/src/lib/Components/Subheader/types.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Switch/Switch.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Switch/Switch.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/TabBar/TabBar.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tag/Tag.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Tag/Tag.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tile/Tile.d.ts +17 -23
- package/dist/typescript/src/lib/Components/Tile/Tile.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tile/index.d.ts +1 -1
- package/dist/typescript/src/lib/Components/Tile/index.d.ts.map +1 -1
- package/dist/typescript/src/lib/Components/Tile/types.d.ts +0 -9
- package/dist/typescript/src/lib/Components/Tile/types.d.ts.map +1 -1
- 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/package.json +3 -3
- package/src/lib/Components/AmountInput/AmountInput.tsx +15 -7
- package/src/lib/Components/BaseInput/BaseInput.tsx +12 -7
- package/src/lib/Components/Button/BaseButton.tsx +6 -1
- package/src/lib/Components/Card/Card.tsx +45 -50
- package/src/lib/Components/Card/types.ts +1 -4
- package/src/lib/Components/CardButton/CardButton.tsx +7 -1
- package/src/lib/Components/Checkbox/Checkbox.tsx +7 -1
- package/src/lib/Components/InteractiveIcon/InteractiveIcon.tsx +8 -3
- package/src/lib/Components/InteractiveIcon/types.ts +6 -1
- package/src/lib/Components/Label/Label.tsx +7 -2
- package/src/lib/Components/ListItem/ListItem.tsx +15 -12
- package/src/lib/Components/SegmentedControl/SegmentedControl.tsx +6 -1
- package/src/lib/Components/SegmentedControl/SegmentedControlContext.tsx +1 -1
- package/src/lib/Components/Select/Select.tsx +6 -1
- package/src/lib/Components/Spot/Spot.tsx +4 -4
- package/src/lib/Components/Stepper/Stepper.tsx +9 -2
- package/src/lib/Components/Subheader/Subheader.mdx +26 -61
- package/src/lib/Components/Subheader/Subheader.stories.tsx +16 -10
- package/src/lib/Components/Subheader/Subheader.test.tsx +0 -22
- package/src/lib/Components/Subheader/Subheader.tsx +1 -42
- package/src/lib/Components/Subheader/index.ts +0 -1
- package/src/lib/Components/Subheader/types.ts +1 -16
- package/src/lib/Components/Switch/Switch.tsx +6 -1
- package/src/lib/Components/TabBar/TabBar.tsx +5 -2
- package/src/lib/Components/Tag/Tag.tsx +7 -2
- package/src/lib/Components/Tile/Tile.mdx +34 -26
- package/src/lib/Components/Tile/Tile.stories.tsx +26 -26
- package/src/lib/Components/Tile/Tile.test.tsx +17 -137
- package/src/lib/Components/Tile/Tile.tsx +28 -40
- package/src/lib/Components/Tile/index.ts +0 -1
- package/src/lib/Components/Tile/types.ts +0 -11
- package/src/lib/Components/TileButton/TileButton.tsx +9 -2
|
@@ -129,18 +129,18 @@ const useStyles = ({
|
|
|
129
129
|
export const Spot = (props: SpotProps) => {
|
|
130
130
|
const {
|
|
131
131
|
appearance,
|
|
132
|
-
disabled = false,
|
|
132
|
+
disabled: disabledProp = false,
|
|
133
133
|
size = 48,
|
|
134
134
|
lx = {},
|
|
135
135
|
style,
|
|
136
136
|
...rest
|
|
137
137
|
} = props;
|
|
138
|
-
const
|
|
138
|
+
const disabled = useDisabledContext({
|
|
139
139
|
consumerName: 'Spot',
|
|
140
|
-
mergeWith: { disabled },
|
|
140
|
+
mergeWith: { disabled: disabledProp },
|
|
141
141
|
});
|
|
142
142
|
|
|
143
|
-
const styles = useStyles({ size, appearance, disabled
|
|
143
|
+
const styles = useStyles({ size, appearance, disabled });
|
|
144
144
|
const calculatedIconSize = iconSizeMap[size];
|
|
145
145
|
|
|
146
146
|
const content = useMemo(() => {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getStepperCalculations,
|
|
3
|
+
useDisabledContext,
|
|
4
|
+
} from '@ledgerhq/lumen-utils-shared';
|
|
2
5
|
import { useEffect } from 'react';
|
|
3
6
|
import Animated, {
|
|
4
7
|
cancelAnimation,
|
|
@@ -59,11 +62,15 @@ export const Stepper = ({
|
|
|
59
62
|
lx = {},
|
|
60
63
|
currentStep,
|
|
61
64
|
totalSteps,
|
|
62
|
-
disabled = false,
|
|
65
|
+
disabled: disabledProp = false,
|
|
63
66
|
label,
|
|
64
67
|
ref,
|
|
65
68
|
...props
|
|
66
69
|
}: StepperProps) => {
|
|
70
|
+
const disabled = useDisabledContext({
|
|
71
|
+
consumerName: 'Stepper',
|
|
72
|
+
mergeWith: { disabled: disabledProp },
|
|
73
|
+
});
|
|
67
74
|
const { t } = useCommonTranslation();
|
|
68
75
|
const { theme } = useTheme();
|
|
69
76
|
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
SubheaderInfo,
|
|
10
10
|
SubheaderShowMore,
|
|
11
11
|
SubheaderDescription,
|
|
12
|
-
SubheaderAction,
|
|
13
12
|
} from './Subheader';
|
|
14
13
|
import {
|
|
15
14
|
CustomTabs,
|
|
@@ -29,7 +28,7 @@ import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/Com
|
|
|
29
28
|
|
|
30
29
|
## Introduction
|
|
31
30
|
|
|
32
|
-
Subheaders are section headers that provide context and organization to content blocks. They use a composite component pattern that provides full flexibility over layout and content through composable sub-components.
|
|
31
|
+
Subheaders are section headers that provide context and organization to content blocks. They use a composite component pattern that provides full flexibility over layout and content through composable sub-components. The right-side action slot (`SubheaderAction`) has been removed to simplify the API.
|
|
33
32
|
|
|
34
33
|
> View in [Figma](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=your-node-id).
|
|
35
34
|
|
|
@@ -46,7 +45,6 @@ The Subheader uses a composite structure with the following components:
|
|
|
46
45
|
- **SubheaderShowMore**: Static chevron right icon to indicate expandable content, positioned after the count (optional)
|
|
47
46
|
- **SubheaderInfo**: Information icon that can be wrapped in tooltips or bottom sheets (optional)
|
|
48
47
|
- **SubheaderDescription**: Additional descriptive text below the row (optional)
|
|
49
|
-
- **SubheaderAction**: Container for action elements, positioned at the far right (optional)
|
|
50
48
|
|
|
51
49
|
## Properties
|
|
52
50
|
|
|
@@ -67,9 +65,9 @@ Use the info icon to provide contextual help:
|
|
|
67
65
|
|
|
68
66
|
<Canvas of={SubheaderStories.WithInfoIcon} />
|
|
69
67
|
|
|
70
|
-
### With
|
|
68
|
+
### With action (layout)
|
|
71
69
|
|
|
72
|
-
|
|
70
|
+
You can add an action by placing a Link in a flex row aligned with the title row.
|
|
73
71
|
|
|
74
72
|
<Canvas of={SubheaderStories.WithAction} />
|
|
75
73
|
|
|
@@ -79,7 +77,6 @@ Use actions for quick access to related functionality:
|
|
|
79
77
|
> - Title truncates with ellipsis when too long for the available space
|
|
80
78
|
> - Count, hint, and action elements maintain their positions
|
|
81
79
|
> - Uses flex layout for responsive arrangement
|
|
82
|
-
> - Action elements are positioned at the far right using `marginLeft: 'auto'`
|
|
83
80
|
|
|
84
81
|
## Accessibility
|
|
85
82
|
|
|
@@ -208,27 +205,39 @@ function InfoExample() {
|
|
|
208
205
|
}
|
|
209
206
|
```
|
|
210
207
|
|
|
211
|
-
### With
|
|
208
|
+
### With action (layout pattern)
|
|
212
209
|
|
|
213
|
-
|
|
210
|
+
Add an action by placing a Link in a flex row aligned with the title:
|
|
214
211
|
|
|
215
212
|
```tsx
|
|
216
213
|
import {
|
|
217
214
|
Subheader,
|
|
218
215
|
SubheaderRow,
|
|
219
216
|
SubheaderTitle,
|
|
220
|
-
|
|
217
|
+
SubheaderDescription,
|
|
218
|
+
Link,
|
|
221
219
|
} from '@ledgerhq/lumen-ui-rnative';
|
|
220
|
+
import { View } from 'react-native';
|
|
222
221
|
|
|
223
|
-
function
|
|
222
|
+
function WithActionExample() {
|
|
224
223
|
return (
|
|
225
224
|
<Subheader>
|
|
226
|
-
<
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
225
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 24 }}>
|
|
226
|
+
<SubheaderRow style={{ flex: 1, minWidth: 0 }}>
|
|
227
|
+
<SubheaderTitle>Recent Activity</SubheaderTitle>
|
|
228
|
+
</SubheaderRow>
|
|
229
|
+
<Link
|
|
230
|
+
onPress={() => {}}
|
|
231
|
+
appearance="accent"
|
|
232
|
+
size="sm"
|
|
233
|
+
underline={false}
|
|
234
|
+
>
|
|
235
|
+
View all
|
|
236
|
+
</Link>
|
|
237
|
+
</View>
|
|
238
|
+
<SubheaderDescription>
|
|
239
|
+
Place the action link in a flex layout beside the subheader
|
|
240
|
+
</SubheaderDescription>
|
|
232
241
|
</Subheader>
|
|
233
242
|
);
|
|
234
243
|
}
|
|
@@ -303,7 +312,7 @@ function InteractiveExample() {
|
|
|
303
312
|
|
|
304
313
|
### Combining Multiple Options
|
|
305
314
|
|
|
306
|
-
You can combine different components as needed. The `SubheaderRow` and `SubheaderTitle` are required, while all other components (`SubheaderCount`, `SubheaderInfo`, `SubheaderDescription
|
|
315
|
+
You can combine different components as needed. The `SubheaderRow` and `SubheaderTitle` are required, while all other components (`SubheaderCount`, `SubheaderInfo`, `SubheaderDescription`) are optional:
|
|
307
316
|
|
|
308
317
|
```tsx
|
|
309
318
|
import {
|
|
@@ -313,7 +322,6 @@ import {
|
|
|
313
322
|
SubheaderCount,
|
|
314
323
|
SubheaderInfo,
|
|
315
324
|
SubheaderDescription,
|
|
316
|
-
SubheaderAction,
|
|
317
325
|
Tooltip,
|
|
318
326
|
TooltipTrigger,
|
|
319
327
|
TooltipContent,
|
|
@@ -332,9 +340,6 @@ function FullExample() {
|
|
|
332
340
|
</TooltipTrigger>
|
|
333
341
|
<TooltipContent content={<Text>Additional info</Text>} />
|
|
334
342
|
</Tooltip>
|
|
335
|
-
<SubheaderAction onPress={() => console.log('Action clicked')}>
|
|
336
|
-
Action
|
|
337
|
-
</SubheaderAction>
|
|
338
343
|
</SubheaderRow>
|
|
339
344
|
<SubheaderDescription>
|
|
340
345
|
This is a detailed description of the section.
|
|
@@ -435,46 +440,6 @@ The following guidelines ensure consistent usage of the Subheader component and
|
|
|
435
440
|
|
|
436
441
|
</DoVsDontRow>
|
|
437
442
|
|
|
438
|
-
<DoVsDontRow>
|
|
439
|
-
<DoBlockItem
|
|
440
|
-
title='Use Action in Row with onPress'
|
|
441
|
-
description='Action should have an onPress handler and be placed in Row for right alignment'
|
|
442
|
-
>
|
|
443
|
-
|
|
444
|
-
{/* prettier-ignore */}
|
|
445
|
-
```tsx
|
|
446
|
-
<Subheader>
|
|
447
|
-
<SubheaderRow>
|
|
448
|
-
<SubheaderTitle>Title</SubheaderTitle>
|
|
449
|
-
<SubheaderAction onPress={handleAction}>
|
|
450
|
-
Action
|
|
451
|
-
</SubheaderAction>
|
|
452
|
-
</SubheaderRow>
|
|
453
|
-
</Subheader>
|
|
454
|
-
```
|
|
455
|
-
|
|
456
|
-
</DoBlockItem>
|
|
457
|
-
<DontBlockItem
|
|
458
|
-
title="Don't place Action outside Row"
|
|
459
|
-
description='Action must be inside SubheaderRow for proper positioning'
|
|
460
|
-
>
|
|
461
|
-
|
|
462
|
-
{/* prettier-ignore */}
|
|
463
|
-
```tsx
|
|
464
|
-
<Subheader>
|
|
465
|
-
<SubheaderRow>
|
|
466
|
-
<SubheaderTitle>Title</SubheaderTitle>
|
|
467
|
-
</SubheaderRow>
|
|
468
|
-
<SubheaderAction onPress={handleAction}>
|
|
469
|
-
Action
|
|
470
|
-
</SubheaderAction>
|
|
471
|
-
</Subheader>
|
|
472
|
-
```
|
|
473
|
-
|
|
474
|
-
</DontBlockItem>
|
|
475
|
-
|
|
476
|
-
</DoVsDontRow>
|
|
477
|
-
|
|
478
443
|
<DoVsDontRow>
|
|
479
444
|
<DoBlockItem
|
|
480
445
|
title='Use lx for layout adjustments only'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-native';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { View, Text } from 'react-native';
|
|
4
|
+
import { Link } from '../Link';
|
|
4
5
|
import { Tooltip, TooltipTrigger, TooltipContent } from '../Tooltip';
|
|
5
6
|
import {
|
|
6
7
|
Subheader,
|
|
@@ -10,11 +11,10 @@ import {
|
|
|
10
11
|
SubheaderInfo,
|
|
11
12
|
SubheaderShowMore,
|
|
12
13
|
SubheaderDescription,
|
|
13
|
-
SubheaderAction,
|
|
14
14
|
} from './Subheader';
|
|
15
15
|
|
|
16
16
|
const Container = ({ children }: { children: React.ReactNode }) => (
|
|
17
|
-
<View style={{ padding: 8, backgroundColor: '#ffffff', width:
|
|
17
|
+
<View style={{ padding: 8, backgroundColor: '#ffffff', width: 400 }}>
|
|
18
18
|
{children}
|
|
19
19
|
</View>
|
|
20
20
|
);
|
|
@@ -29,7 +29,6 @@ const meta: Meta<typeof Subheader> = {
|
|
|
29
29
|
SubheaderCount,
|
|
30
30
|
SubheaderInfo,
|
|
31
31
|
SubheaderShowMore,
|
|
32
|
-
SubheaderAction,
|
|
33
32
|
},
|
|
34
33
|
decorators: [
|
|
35
34
|
(Story) => (
|
|
@@ -96,15 +95,22 @@ export const WithInfoIcon: Story = {
|
|
|
96
95
|
|
|
97
96
|
export const WithAction: Story = {
|
|
98
97
|
render: () => (
|
|
99
|
-
<Subheader
|
|
100
|
-
<
|
|
101
|
-
<
|
|
102
|
-
|
|
98
|
+
<Subheader>
|
|
99
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: 24 }}>
|
|
100
|
+
<SubheaderRow style={{ flex: 1, minWidth: 0 }}>
|
|
101
|
+
<SubheaderTitle>Recent Activity</SubheaderTitle>
|
|
102
|
+
</SubheaderRow>
|
|
103
|
+
<Link
|
|
104
|
+
onPress={() => console.log('View all')}
|
|
105
|
+
appearance='accent'
|
|
106
|
+
size='sm'
|
|
107
|
+
underline={false}
|
|
108
|
+
>
|
|
103
109
|
View all
|
|
104
|
-
</
|
|
105
|
-
</
|
|
110
|
+
</Link>
|
|
111
|
+
</View>
|
|
106
112
|
<SubheaderDescription>
|
|
107
|
-
|
|
113
|
+
Place the action link in a flex layout beside the subheader
|
|
108
114
|
</SubheaderDescription>
|
|
109
115
|
</Subheader>
|
|
110
116
|
),
|
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
SubheaderInfo,
|
|
12
12
|
SubheaderShowMore,
|
|
13
13
|
SubheaderDescription,
|
|
14
|
-
SubheaderAction,
|
|
15
14
|
} from './Subheader';
|
|
16
15
|
|
|
17
16
|
const TestWrapper = ({ children }: { children: React.ReactNode }) => (
|
|
@@ -122,24 +121,6 @@ describe('Subheader', () => {
|
|
|
122
121
|
expect(screen.getByText('This is a description')).toBeTruthy();
|
|
123
122
|
});
|
|
124
123
|
|
|
125
|
-
it('renders the action in row', () => {
|
|
126
|
-
const handlePress = jest.fn();
|
|
127
|
-
render(
|
|
128
|
-
<TestWrapper>
|
|
129
|
-
<Subheader>
|
|
130
|
-
<SubheaderRow>
|
|
131
|
-
<SubheaderTitle>Title</SubheaderTitle>
|
|
132
|
-
<SubheaderAction onPress={handlePress}>Action</SubheaderAction>
|
|
133
|
-
</SubheaderRow>
|
|
134
|
-
</Subheader>
|
|
135
|
-
</TestWrapper>,
|
|
136
|
-
);
|
|
137
|
-
const button = screen.getByText('Action');
|
|
138
|
-
expect(button).toBeTruthy();
|
|
139
|
-
fireEvent.press(button);
|
|
140
|
-
expect(handlePress).toHaveBeenCalledTimes(1);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
124
|
it('renders interactive row with onPress', () => {
|
|
144
125
|
const handlePress = jest.fn();
|
|
145
126
|
render(
|
|
@@ -160,7 +141,6 @@ describe('Subheader', () => {
|
|
|
160
141
|
});
|
|
161
142
|
|
|
162
143
|
it('renders all components together', () => {
|
|
163
|
-
const handleAction = jest.fn();
|
|
164
144
|
render(
|
|
165
145
|
<TestWrapper>
|
|
166
146
|
<Subheader>
|
|
@@ -168,7 +148,6 @@ describe('Subheader', () => {
|
|
|
168
148
|
<SubheaderTitle>Title</SubheaderTitle>
|
|
169
149
|
<SubheaderCount value={42} />
|
|
170
150
|
<SubheaderInfo />
|
|
171
|
-
<SubheaderAction onPress={handleAction}>Action</SubheaderAction>
|
|
172
151
|
</SubheaderRow>
|
|
173
152
|
<SubheaderDescription>Description text</SubheaderDescription>
|
|
174
153
|
</Subheader>
|
|
@@ -176,7 +155,6 @@ describe('Subheader', () => {
|
|
|
176
155
|
);
|
|
177
156
|
expect(screen.getByText('Title')).toBeTruthy();
|
|
178
157
|
expect(screen.getByText('(42)')).toBeTruthy();
|
|
179
|
-
expect(screen.getByText('Action')).toBeTruthy();
|
|
180
158
|
expect(screen.getByText('Description text')).toBeTruthy();
|
|
181
159
|
});
|
|
182
160
|
|
|
@@ -4,7 +4,6 @@ import { ChevronRight, Information } from '../../Symbols';
|
|
|
4
4
|
import { InteractiveIcon } from '../InteractiveIcon';
|
|
5
5
|
import { Box, Pressable, Text } from '../Utility';
|
|
6
6
|
import {
|
|
7
|
-
SubheaderActionProps,
|
|
8
7
|
SubheaderCountProps,
|
|
9
8
|
SubheaderDescriptionProps,
|
|
10
9
|
SubheaderInfoProps,
|
|
@@ -201,46 +200,6 @@ export const SubheaderDescription = ({
|
|
|
201
200
|
);
|
|
202
201
|
};
|
|
203
202
|
|
|
204
|
-
/**
|
|
205
|
-
* Action component for the Subheader. Displays an interactive text button.
|
|
206
|
-
* Automatically positions itself at the end of the row using marginLeft: 'auto'.
|
|
207
|
-
*/
|
|
208
|
-
export const SubheaderAction = ({
|
|
209
|
-
children,
|
|
210
|
-
onPress,
|
|
211
|
-
lx,
|
|
212
|
-
style,
|
|
213
|
-
...props
|
|
214
|
-
}: SubheaderActionProps) => {
|
|
215
|
-
const styles = useStyleSheet(
|
|
216
|
-
(t) => ({
|
|
217
|
-
container: {
|
|
218
|
-
flexShrink: 0,
|
|
219
|
-
marginLeft: 'auto',
|
|
220
|
-
paddingLeft: t.spacings.s8,
|
|
221
|
-
},
|
|
222
|
-
text: StyleSheet.flatten([
|
|
223
|
-
t.typographies.body2,
|
|
224
|
-
{
|
|
225
|
-
color: t.colors.text.interactive,
|
|
226
|
-
},
|
|
227
|
-
]),
|
|
228
|
-
}),
|
|
229
|
-
[],
|
|
230
|
-
);
|
|
231
|
-
|
|
232
|
-
return (
|
|
233
|
-
<Pressable
|
|
234
|
-
lx={lx}
|
|
235
|
-
onPress={onPress}
|
|
236
|
-
style={[styles.container, style]}
|
|
237
|
-
{...props}
|
|
238
|
-
>
|
|
239
|
-
<Text style={styles.text}>{children}</Text>
|
|
240
|
-
</Pressable>
|
|
241
|
-
);
|
|
242
|
-
};
|
|
243
|
-
|
|
244
203
|
/**
|
|
245
204
|
* A subheader component for displaying section titles with optional count, hints, descriptions, and action elements.
|
|
246
205
|
* Uses a composable API where you explicitly nest sub-components to define the layout.
|
|
@@ -269,7 +228,7 @@ export const SubheaderAction = ({
|
|
|
269
228
|
* </Subheader>
|
|
270
229
|
*
|
|
271
230
|
* @example
|
|
272
|
-
* // Interactive row
|
|
231
|
+
* // Interactive row
|
|
273
232
|
* <Subheader>
|
|
274
233
|
* <SubheaderRow onPress={handleClick}>
|
|
275
234
|
* <SubheaderTitle>Accounts</SubheaderTitle>
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
StyledPressableProps,
|
|
4
|
-
StyledTextProps,
|
|
5
|
-
StyledViewProps,
|
|
6
|
-
} from '../../../styles';
|
|
2
|
+
import { StyledTextProps, StyledViewProps } from '../../../styles';
|
|
7
3
|
import { InteractiveIconProps } from '../InteractiveIcon';
|
|
8
4
|
|
|
9
5
|
export type SubheaderProps = {
|
|
@@ -61,15 +57,4 @@ export type SubheaderDescriptionProps = {
|
|
|
61
57
|
children: ReactNode;
|
|
62
58
|
} & Omit<StyledTextProps, 'children'>;
|
|
63
59
|
|
|
64
|
-
export type SubheaderActionProps = {
|
|
65
|
-
/**
|
|
66
|
-
* The action text to display.
|
|
67
|
-
*/
|
|
68
|
-
children: ReactNode;
|
|
69
|
-
/**
|
|
70
|
-
* Press handler for the action.
|
|
71
|
-
*/
|
|
72
|
-
onPress: () => void;
|
|
73
|
-
} & Omit<StyledPressableProps, 'children' | 'onPress'>;
|
|
74
|
-
|
|
75
60
|
export type SubheaderShowMoreProps = Omit<StyledViewProps, 'children'>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
|
|
1
2
|
import { useControllableState } from '../../utils';
|
|
2
3
|
import { Pressable } from '../Utility';
|
|
3
4
|
import { BaseSwitchThumb, BaseSwitchRoot } from './BaseSwitch';
|
|
@@ -33,11 +34,15 @@ export const Switch = ({
|
|
|
33
34
|
checked: checkedProp,
|
|
34
35
|
onCheckedChange: onCheckedChangeProp,
|
|
35
36
|
defaultChecked = false,
|
|
36
|
-
disabled,
|
|
37
|
+
disabled: disabledProp,
|
|
37
38
|
size = 'md',
|
|
38
39
|
ref,
|
|
39
40
|
...props
|
|
40
41
|
}: SwitchProps) => {
|
|
42
|
+
const disabled = useDisabledContext({
|
|
43
|
+
consumerName: 'Switch',
|
|
44
|
+
mergeWith: { disabled: disabledProp },
|
|
45
|
+
});
|
|
41
46
|
const [checked, onCheckedChange] = useControllableState({
|
|
42
47
|
prop: checkedProp,
|
|
43
48
|
onChange: onCheckedChangeProp,
|
|
@@ -268,7 +268,7 @@ export function TabBar({
|
|
|
268
268
|
>
|
|
269
269
|
{children}
|
|
270
270
|
{Platform.OS === 'android' ? (
|
|
271
|
-
<View style={styles.
|
|
271
|
+
<View style={styles.fallbackBackground} />
|
|
272
272
|
) : (
|
|
273
273
|
<BlurView
|
|
274
274
|
style={styles.blur}
|
|
@@ -279,6 +279,9 @@ export function TabBar({
|
|
|
279
279
|
? 'rgba(0,0,0,0.15)'
|
|
280
280
|
: 'rgba(255,255,255,0.2)'
|
|
281
281
|
}
|
|
282
|
+
reducedTransparencyFallbackColor={
|
|
283
|
+
styles.fallbackBackground.backgroundColor
|
|
284
|
+
}
|
|
282
285
|
/>
|
|
283
286
|
)}
|
|
284
287
|
<Animated.View style={[styles.pill, animatedPillStyle]} />
|
|
@@ -305,7 +308,7 @@ const useStyles = () =>
|
|
|
305
308
|
height: TAB_BAR_HEIGHT + t.sizes.s16,
|
|
306
309
|
zIndex: -1,
|
|
307
310
|
},
|
|
308
|
-
|
|
311
|
+
fallbackBackground: {
|
|
309
312
|
...StyleSheet.absoluteFillObject,
|
|
310
313
|
zIndex: -1,
|
|
311
314
|
backgroundColor: t.colors.bg.muted,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useDisabledContext } from '@ledgerhq/lumen-utils-shared';
|
|
1
2
|
import { StyleSheet, Text } from 'react-native';
|
|
2
3
|
import { useStyleSheet } from '../../../styles';
|
|
3
4
|
import { IconSize } from '../Icon';
|
|
@@ -131,13 +132,17 @@ export const Tag = ({
|
|
|
131
132
|
size = 'md',
|
|
132
133
|
icon,
|
|
133
134
|
label,
|
|
134
|
-
disabled = false,
|
|
135
|
+
disabled: disabledProp = false,
|
|
135
136
|
lx = {},
|
|
136
137
|
style,
|
|
137
138
|
ref,
|
|
138
139
|
...props
|
|
139
140
|
}: TagProps) => {
|
|
140
|
-
const
|
|
141
|
+
const disabled = useDisabledContext({
|
|
142
|
+
consumerName: 'Tag',
|
|
143
|
+
mergeWith: { disabled: disabledProp },
|
|
144
|
+
});
|
|
145
|
+
const styles = useStyles({ appearance, size, disabled: !!disabled });
|
|
141
146
|
|
|
142
147
|
const IconComponent = icon;
|
|
143
148
|
const iconSize = iconSizeMap[size];
|
|
@@ -26,11 +26,11 @@ Tile components are compact, card-like interactive elements designed for horizon
|
|
|
26
26
|
|
|
27
27
|
## Anatomy
|
|
28
28
|
|
|
29
|
-
- **
|
|
30
|
-
- **TileContent**: Container for title, description
|
|
29
|
+
- **Tile**: Root container; direct children are laid out vertically (e.g. Spot, TileContent)
|
|
30
|
+
- **TileContent**: Container for title, description and trailing content
|
|
31
31
|
- **TileTitle**: The main label of the item (required)
|
|
32
32
|
- **TileDescription (optional)**: Provides additional context
|
|
33
|
-
- **TileTrailingContent (optional)**: Container for
|
|
33
|
+
- **TileTrailingContent (optional)**: Container for Tags, labels, or other supplementary content
|
|
34
34
|
|
|
35
35
|
## Properties
|
|
36
36
|
|
|
@@ -94,10 +94,10 @@ Install and set up the library with our [Setup Guide →](?path=/docs/getting-st
|
|
|
94
94
|
```tsx
|
|
95
95
|
import {
|
|
96
96
|
Tile,
|
|
97
|
-
TileSpot,
|
|
98
97
|
TileContent,
|
|
99
98
|
TileTitle,
|
|
100
99
|
TileDescription,
|
|
100
|
+
Spot,
|
|
101
101
|
} from '@ledgerhq/lumen-ui-rnative';
|
|
102
102
|
import { Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
103
103
|
|
|
@@ -108,7 +108,7 @@ function MyComponent() {
|
|
|
108
108
|
onPress={() => console.log('Primary action')}
|
|
109
109
|
onLongPress={() => console.log('Secondary action')}
|
|
110
110
|
>
|
|
111
|
-
<
|
|
111
|
+
<Spot appearance='icon' icon={Settings} />
|
|
112
112
|
<TileContent>
|
|
113
113
|
<TileTitle>Settings</TileTitle>
|
|
114
114
|
<TileDescription>Manage preferences</TileDescription>
|
|
@@ -122,20 +122,22 @@ function MyComponent() {
|
|
|
122
122
|
|
|
123
123
|
### With Trailing Content (Tags, etc.)
|
|
124
124
|
|
|
125
|
+
Use TileTrailingContent inside TileContent to wrap Tags or other supplementary content.
|
|
126
|
+
|
|
125
127
|
```tsx
|
|
126
128
|
import {
|
|
127
129
|
Tile,
|
|
128
|
-
TileSpot,
|
|
129
130
|
TileContent,
|
|
130
131
|
TileTitle,
|
|
131
132
|
TileDescription,
|
|
132
133
|
TileTrailingContent,
|
|
133
134
|
Tag,
|
|
135
|
+
Spot,
|
|
134
136
|
} from '@ledgerhq/lumen-ui-rnative';
|
|
135
137
|
import { Bitcoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
136
138
|
|
|
137
139
|
<Tile appearance='card'>
|
|
138
|
-
<
|
|
140
|
+
<Spot appearance='icon' icon={Bitcoin} />
|
|
139
141
|
<TileContent>
|
|
140
142
|
<TileTitle>Bitcoin</TileTitle>
|
|
141
143
|
<TileDescription>BTC</TileDescription>
|
|
@@ -150,7 +152,7 @@ import { Bitcoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
|
150
152
|
|
|
151
153
|
```tsx
|
|
152
154
|
<Tile disabled>
|
|
153
|
-
<
|
|
155
|
+
<Spot appearance='icon' icon={Settings} />
|
|
154
156
|
<TileContent>
|
|
155
157
|
<TileTitle>Settings</TileTitle>
|
|
156
158
|
<TileDescription>Unavailable</TileDescription>
|
|
@@ -163,13 +165,14 @@ import { Bitcoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
|
163
165
|
Use the `centered` prop to vertically center the tile content. This is useful when a tile has less content than its neighbors in a grid, like a "Show more" tile that needs to align with richer tiles.
|
|
164
166
|
|
|
165
167
|
```tsx
|
|
166
|
-
import { ChevronRight } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
168
|
+
import { ChevronRight, CryptoBitcoinCoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
169
|
+
import { Spot, Tile, TileContent, TileTitle, TileDescription, TileTrailingContent, Tag } from '@ledgerhq/lumen-ui-rnative';
|
|
167
170
|
import { View } from 'react-native';
|
|
168
171
|
|
|
169
172
|
// In a grid where other tiles have more content
|
|
170
173
|
<View style={{ flexDirection: 'row', gap: 8 }}>
|
|
171
174
|
<Tile appearance='card'>
|
|
172
|
-
<
|
|
175
|
+
<Spot appearance='icon' icon={CryptoBitcoinCoin} />
|
|
173
176
|
<TileContent>
|
|
174
177
|
<TileTitle>Title</TileTitle>
|
|
175
178
|
<TileDescription>Description</TileDescription>
|
|
@@ -181,7 +184,7 @@ import { View } from 'react-native';
|
|
|
181
184
|
|
|
182
185
|
{/* Show more tile with centered content */}
|
|
183
186
|
<Tile appearance='card' centered>
|
|
184
|
-
<
|
|
187
|
+
<Spot appearance='icon' icon={ChevronRight} />
|
|
185
188
|
<TileContent>
|
|
186
189
|
<TileTitle>Show more</TileTitle>
|
|
187
190
|
</TileContent>
|
|
@@ -194,14 +197,15 @@ import { View } from 'react-native';
|
|
|
194
197
|
```tsx
|
|
195
198
|
import {
|
|
196
199
|
Tile,
|
|
197
|
-
TileSpot,
|
|
198
200
|
TileContent,
|
|
199
201
|
TileTitle,
|
|
200
202
|
TileDescription,
|
|
203
|
+
Spot,
|
|
201
204
|
} from '@ledgerhq/lumen-ui-rnative';
|
|
205
|
+
import { CryptoBitcoinCoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
202
206
|
|
|
203
207
|
<Tile onPress={() => console.log('Clicked!')}>
|
|
204
|
-
<
|
|
208
|
+
<Spot appearance='icon' icon={CryptoBitcoinCoin} />
|
|
205
209
|
<TileContent>
|
|
206
210
|
<TileTitle>Bitcoin</TileTitle>
|
|
207
211
|
<TileDescription>BTC</TileDescription>
|
|
@@ -213,17 +217,21 @@ import {
|
|
|
213
217
|
|
|
214
218
|
```tsx
|
|
215
219
|
import { ScrollView } from 'react-native';
|
|
220
|
+
import { Tile, TileContent, TileTitle, TileDescription, Spot } from '@ledgerhq/lumen-ui-rnative';
|
|
216
221
|
|
|
217
222
|
<ScrollView horizontal>
|
|
218
|
-
{items.map((item) =>
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
<
|
|
222
|
-
<
|
|
223
|
-
<
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
{items.map((item) => {
|
|
224
|
+
const Icon = item.icon;
|
|
225
|
+
return (
|
|
226
|
+
<Tile key={item.id} lx={{ width: 's128', flexShrink: 0 }}>
|
|
227
|
+
<Spot appearance='icon' icon={Icon} />
|
|
228
|
+
<TileContent>
|
|
229
|
+
<TileTitle>{item.title}</TileTitle>
|
|
230
|
+
<TileDescription>{item.description}</TileDescription>
|
|
231
|
+
</TileContent>
|
|
232
|
+
</Tile>
|
|
233
|
+
);
|
|
234
|
+
})}
|
|
227
235
|
</ScrollView>;
|
|
228
236
|
```
|
|
229
237
|
|
|
@@ -234,7 +242,7 @@ import { ScrollView } from 'react-native';
|
|
|
234
242
|
onPress={() => console.log('Primary action')}
|
|
235
243
|
onLongPress={() => console.log('Secondary action - show menu')}
|
|
236
244
|
>
|
|
237
|
-
<
|
|
245
|
+
<Spot appearance='icon' icon={Settings} />
|
|
238
246
|
<TileContent>
|
|
239
247
|
<TileTitle>Settings</TileTitle>
|
|
240
248
|
<TileDescription>Long press for options</TileDescription>
|
|
@@ -251,13 +259,13 @@ import { ScrollView } from 'react-native';
|
|
|
251
259
|
<DoVsDontRow>
|
|
252
260
|
<DoBlockItem
|
|
253
261
|
title='Use TileTrailingContent for additional elements'
|
|
254
|
-
description='Wrap Tags, labels, or supplementary content inside TileTrailingContent within TileContent for proper
|
|
262
|
+
description='Wrap Tags, labels, or supplementary content inside TileTrailingContent within TileContent for proper spacing.'
|
|
255
263
|
>
|
|
256
264
|
|
|
257
265
|
```tsx
|
|
258
266
|
{/* prettier-ignore */}
|
|
259
267
|
<Tile>
|
|
260
|
-
<
|
|
268
|
+
<Spot appearance="icon" icon={Settings} />
|
|
261
269
|
<TileContent>
|
|
262
270
|
<TileTitle>Title</TileTitle>
|
|
263
271
|
<TileDescription>Description</TileDescription>
|
|
@@ -277,7 +285,7 @@ import { ScrollView } from 'react-native';
|
|
|
277
285
|
```tsx
|
|
278
286
|
{/* prettier-ignore */}
|
|
279
287
|
<Tile>
|
|
280
|
-
<
|
|
288
|
+
<Spot appearance="icon" icon={Settings} />
|
|
281
289
|
<TileContent>
|
|
282
290
|
<TileTitle>Title</TileTitle>
|
|
283
291
|
<TileDescription>Description</TileDescription>
|