@ledgerhq/lumen-ui-rnative 0.0.47 → 0.0.48
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/package.json +3 -3
- package/dist/src/lib/Components/Divider/Divider.d.ts +25 -0
- package/dist/src/lib/Components/Divider/Divider.d.ts.map +1 -0
- package/dist/src/lib/Components/Divider/Divider.js +40 -0
- package/dist/src/lib/Components/Divider/Divider.stories.d.ts +9 -0
- package/dist/src/lib/Components/Divider/Divider.stories.d.ts.map +1 -0
- package/dist/src/lib/Components/Divider/Divider.stories.js +51 -0
- package/dist/src/lib/Components/Divider/index.d.ts +3 -0
- package/dist/src/lib/Components/Divider/index.d.ts.map +1 -0
- package/dist/src/lib/Components/Divider/index.js +1 -0
- package/dist/src/lib/Components/Divider/types.d.ts +9 -0
- package/dist/src/lib/Components/Divider/types.d.ts.map +1 -0
- package/dist/src/lib/Components/Divider/types.js +1 -0
- package/dist/src/lib/Components/ListItem/ListItem.d.ts.map +1 -1
- package/dist/src/lib/Components/ListItem/ListItem.js +9 -3
- package/dist/src/lib/Components/Select/GlobalSelectBottomSheet.d.ts.map +1 -1
- package/dist/src/lib/Components/Select/GlobalSelectBottomSheet.js +2 -7
- package/dist/src/lib/Components/Select/Select.d.ts.map +1 -1
- package/dist/src/lib/Components/Select/Select.js +4 -10
- package/dist/src/lib/Components/Select/types.d.ts.map +1 -1
- package/dist/src/lib/Components/Tile/Tile.d.ts +84 -19
- package/dist/src/lib/Components/Tile/Tile.d.ts.map +1 -1
- package/dist/src/lib/Components/Tile/Tile.figma.js +8 -18
- package/dist/src/lib/Components/Tile/Tile.js +160 -59
- package/dist/src/lib/Components/Tile/Tile.stories.d.ts +2 -2
- package/dist/src/lib/Components/Tile/Tile.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/Tile/Tile.stories.js +30 -81
- package/dist/src/lib/Components/Tile/index.d.ts +1 -1
- package/dist/src/lib/Components/Tile/index.d.ts.map +1 -1
- package/dist/src/lib/Components/Tile/index.js +1 -1
- package/dist/src/lib/Components/Tile/types.d.ts +29 -19
- package/dist/src/lib/Components/Tile/types.d.ts.map +1 -1
- package/dist/src/lib/Components/index.d.ts +1 -0
- package/dist/src/lib/Components/index.d.ts.map +1 -1
- package/dist/src/lib/Components/index.js +1 -0
- package/package.json +3 -3
- package/src/lib/Components/Divider/Divider.mdx +151 -0
- package/src/lib/Components/Divider/Divider.stories.tsx +140 -0
- package/src/lib/Components/Divider/Divider.test.tsx +92 -0
- package/src/lib/Components/Divider/Divider.tsx +52 -0
- package/src/lib/Components/Divider/index.ts +2 -0
- package/src/lib/Components/Divider/types.ts +9 -0
- package/src/lib/Components/ListItem/ListItem.tsx +10 -3
- package/src/lib/Components/Select/GlobalSelectBottomSheet.tsx +5 -7
- package/src/lib/Components/Select/Select.tsx +4 -18
- package/src/lib/Components/Select/types.ts +1 -3
- package/src/lib/Components/Tile/Tile.figma.tsx +24 -23
- package/src/lib/Components/Tile/Tile.mdx +128 -35
- package/src/lib/Components/Tile/Tile.stories.tsx +167 -146
- package/src/lib/Components/Tile/Tile.test.tsx +193 -221
- package/src/lib/Components/Tile/Tile.tsx +270 -123
- package/src/lib/Components/Tile/index.ts +7 -1
- package/src/lib/Components/Tile/types.ts +38 -19
- package/src/lib/Components/index.ts +1 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { Meta, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import * as DividerStories from './Divider.stories';
|
|
3
|
+
import { Divider } from './Divider';
|
|
4
|
+
import {
|
|
5
|
+
CustomTabs,
|
|
6
|
+
Tab,
|
|
7
|
+
} from '../../../../.storybook/components';
|
|
8
|
+
import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/CommonRulesDoAndDont.mdx';
|
|
9
|
+
|
|
10
|
+
<Meta title='Layout/Divider' of={DividerStories} />
|
|
11
|
+
|
|
12
|
+
# ➖ Divider
|
|
13
|
+
|
|
14
|
+
<CustomTabs>
|
|
15
|
+
<Tab label="Overview ">
|
|
16
|
+
|
|
17
|
+
## Introduction
|
|
18
|
+
|
|
19
|
+
The Divider component provides a simple, semantic way to visually separate content sections in your interface. It creates a horizontal or vertical line that helps organize information and improve content hierarchy.
|
|
20
|
+
|
|
21
|
+
> View in [Figma](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=285-5969&m=dev).
|
|
22
|
+
|
|
23
|
+
> ⚠️ **Note on Web Preview:** The Storybook preview below may display visual inconsistencies as certain React Native APIs cannot be fully translated to web environments. For the complete native experience, please refer to the component on an actual iOS or Android device.
|
|
24
|
+
|
|
25
|
+
## Anatomy
|
|
26
|
+
|
|
27
|
+
<Canvas of={DividerStories.Base} />
|
|
28
|
+
|
|
29
|
+
The Divider is a simple component consisting of a single line that uses design system tokens for consistent styling.
|
|
30
|
+
|
|
31
|
+
## Properties
|
|
32
|
+
|
|
33
|
+
### Overview
|
|
34
|
+
|
|
35
|
+
<Canvas of={DividerStories.Base} />
|
|
36
|
+
<Controls of={DividerStories.Base} />
|
|
37
|
+
|
|
38
|
+
### Orientation
|
|
39
|
+
|
|
40
|
+
Dividers support both horizontal and vertical orientations to accommodate different layout needs:
|
|
41
|
+
|
|
42
|
+
- `horizontal` (default): Creates a horizontal line spanning the full width of its container
|
|
43
|
+
- `vertical`: Creates a vertical line with a height determined by its container or custom styling via `lx` props
|
|
44
|
+
|
|
45
|
+
<Canvas of={DividerStories.OrientationShowcase} />
|
|
46
|
+
|
|
47
|
+
## Usage Examples
|
|
48
|
+
|
|
49
|
+
### In Lists
|
|
50
|
+
|
|
51
|
+
A common use case is separating list items or sections within a card:
|
|
52
|
+
|
|
53
|
+
<Canvas of={DividerStories.InList} />
|
|
54
|
+
|
|
55
|
+
## Responsive Layout
|
|
56
|
+
|
|
57
|
+
Dividers automatically adapt to their container's dimensions. For horizontal dividers, they span the full width. For vertical dividers, set an explicit height using the `lx` prop.
|
|
58
|
+
|
|
59
|
+
## Accessibility
|
|
60
|
+
|
|
61
|
+
The Divider component uses `accessibilityRole='none'` as it's purely decorative and doesn't require accessibility announcements.
|
|
62
|
+
|
|
63
|
+
</Tab>
|
|
64
|
+
|
|
65
|
+
<Tab label="Implementation">
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm install @ledgerhq/lumen-ui-rnative
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
> **Note**: `@ledgerhq/lumen-design-core` and other peer dependencies (`react-native`, etc.) are required. See our Setup Guide for complete installation.
|
|
74
|
+
|
|
75
|
+
## Basic Usage
|
|
76
|
+
|
|
77
|
+
```tsx
|
|
78
|
+
import { Divider } from '@ledgerhq/lumen-ui-rnative';
|
|
79
|
+
|
|
80
|
+
function MyComponent() {
|
|
81
|
+
return (
|
|
82
|
+
<Box>
|
|
83
|
+
<Text>Content above the divider</Text>
|
|
84
|
+
<Divider />
|
|
85
|
+
<Text>Content below the divider</Text>
|
|
86
|
+
</Box>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Vertical Divider
|
|
92
|
+
|
|
93
|
+
For vertical separation between content:
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import { Divider, Box, Text } from '@ledgerhq/lumen-ui-rnative';
|
|
97
|
+
|
|
98
|
+
function MyComponent() {
|
|
99
|
+
return (
|
|
100
|
+
<Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's16' }}>
|
|
101
|
+
<Text>Left content</Text>
|
|
102
|
+
<Divider orientation='vertical' lx={{ height: 's48' }} />
|
|
103
|
+
<Text>Right content</Text>
|
|
104
|
+
</Box>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Note: For vertical dividers, you typically need to set an explicit height using the `lx` prop.
|
|
110
|
+
|
|
111
|
+
### In List Components
|
|
112
|
+
|
|
113
|
+
Dividers are perfect for separating items in lists, menus, or cards:
|
|
114
|
+
|
|
115
|
+
```tsx
|
|
116
|
+
import { Divider, Box, Text } from '@ledgerhq/lumen-ui-rnative';
|
|
117
|
+
|
|
118
|
+
function MyList() {
|
|
119
|
+
return (
|
|
120
|
+
<Box
|
|
121
|
+
lx={{
|
|
122
|
+
borderRadius: 'lg',
|
|
123
|
+
borderWidth: 's1',
|
|
124
|
+
borderColor: 'muted',
|
|
125
|
+
}}
|
|
126
|
+
>
|
|
127
|
+
<Box lx={{ padding: 's16' }}>
|
|
128
|
+
<Text>Item 1</Text>
|
|
129
|
+
</Box>
|
|
130
|
+
<Divider />
|
|
131
|
+
<Box lx={{ padding: 's16' }}>
|
|
132
|
+
<Text>Item 2</Text>
|
|
133
|
+
</Box>
|
|
134
|
+
<Divider />
|
|
135
|
+
<Box lx={{ padding: 's16' }}>
|
|
136
|
+
<Text>Item 3</Text>
|
|
137
|
+
</Box>
|
|
138
|
+
</Box>
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
<CommonRulesDoAndDont />
|
|
144
|
+
|
|
145
|
+
## Performance Considerations
|
|
146
|
+
|
|
147
|
+
The Divider component is extremely lightweight with minimal performance impact. It renders a simple `Box` component with border styling, making it suitable for use in FlatLists and ScrollViews with many items.
|
|
148
|
+
|
|
149
|
+
</Tab>
|
|
150
|
+
</CustomTabs>
|
|
151
|
+
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-native-web-vite';
|
|
2
|
+
import { Box } from '../Utility/Box';
|
|
3
|
+
import { Text } from '../Utility/Text';
|
|
4
|
+
import { Divider } from './Divider';
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Divider> = {
|
|
7
|
+
component: Divider,
|
|
8
|
+
title: 'Layout/Divider',
|
|
9
|
+
parameters: {
|
|
10
|
+
actions: { disable: true },
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof Divider>;
|
|
16
|
+
|
|
17
|
+
export const Base: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
orientation: 'horizontal',
|
|
20
|
+
},
|
|
21
|
+
render: (args) => {
|
|
22
|
+
const isVertical = args.orientation === 'vertical';
|
|
23
|
+
return (
|
|
24
|
+
<Box
|
|
25
|
+
lx={
|
|
26
|
+
isVertical
|
|
27
|
+
? { flexDirection: 'row', alignItems: 'center', gap: 's16' }
|
|
28
|
+
: { width: 'full', gap: 's16' }
|
|
29
|
+
}
|
|
30
|
+
>
|
|
31
|
+
<Text typography='body2' lx={{ color: 'base' }}>
|
|
32
|
+
{isVertical ? 'Left content' : 'Content above'}
|
|
33
|
+
</Text>
|
|
34
|
+
<Divider {...args} lx={isVertical ? { height: 's48' } : undefined} />
|
|
35
|
+
<Text typography='body2' lx={{ color: 'base' }}>
|
|
36
|
+
{isVertical ? 'Right content' : 'Content below'}
|
|
37
|
+
</Text>
|
|
38
|
+
</Box>
|
|
39
|
+
);
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const OrientationShowcase: Story = {
|
|
44
|
+
render: () => (
|
|
45
|
+
<Box lx={{ gap: 's32' }}>
|
|
46
|
+
<Box lx={{ gap: 's8' }}>
|
|
47
|
+
<Text typography='body3' lx={{ color: 'muted' }}>
|
|
48
|
+
Horizontal (default)
|
|
49
|
+
</Text>
|
|
50
|
+
<Box lx={{ width: 'full', gap: 's16' }}>
|
|
51
|
+
<Text typography='body2' lx={{ color: 'base' }}>
|
|
52
|
+
Content above
|
|
53
|
+
</Text>
|
|
54
|
+
<Divider orientation='horizontal' />
|
|
55
|
+
<Text typography='body2' lx={{ color: 'base' }}>
|
|
56
|
+
Content below
|
|
57
|
+
</Text>
|
|
58
|
+
</Box>
|
|
59
|
+
</Box>
|
|
60
|
+
|
|
61
|
+
<Box lx={{ gap: 's8' }}>
|
|
62
|
+
<Text typography='body3' lx={{ color: 'muted' }}>
|
|
63
|
+
Vertical
|
|
64
|
+
</Text>
|
|
65
|
+
<Box lx={{ flexDirection: 'row', alignItems: 'center', gap: 's16' }}>
|
|
66
|
+
<Text typography='body2' lx={{ color: 'base' }}>
|
|
67
|
+
Left content
|
|
68
|
+
</Text>
|
|
69
|
+
<Divider orientation='vertical' lx={{ height: 's48' }} />
|
|
70
|
+
<Text typography='body2' lx={{ color: 'base' }}>
|
|
71
|
+
Right content
|
|
72
|
+
</Text>
|
|
73
|
+
</Box>
|
|
74
|
+
</Box>
|
|
75
|
+
</Box>
|
|
76
|
+
),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const InList: Story = {
|
|
80
|
+
render: () => (
|
|
81
|
+
<Box
|
|
82
|
+
lx={{
|
|
83
|
+
width: 'full',
|
|
84
|
+
maxWidth: 's400',
|
|
85
|
+
backgroundColor: 'canvas',
|
|
86
|
+
borderRadius: 'lg',
|
|
87
|
+
borderWidth: 's1',
|
|
88
|
+
borderColor: 'muted',
|
|
89
|
+
}}
|
|
90
|
+
>
|
|
91
|
+
<Box
|
|
92
|
+
lx={{
|
|
93
|
+
flexDirection: 'row',
|
|
94
|
+
justifyContent: 'space-between',
|
|
95
|
+
alignItems: 'center',
|
|
96
|
+
padding: 's16',
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
<Text typography='body2' lx={{ color: 'base' }}>
|
|
100
|
+
Item 1
|
|
101
|
+
</Text>
|
|
102
|
+
<Text typography='body3' lx={{ color: 'muted' }}>
|
|
103
|
+
$100
|
|
104
|
+
</Text>
|
|
105
|
+
</Box>
|
|
106
|
+
<Divider />
|
|
107
|
+
<Box
|
|
108
|
+
lx={{
|
|
109
|
+
flexDirection: 'row',
|
|
110
|
+
justifyContent: 'space-between',
|
|
111
|
+
alignItems: 'center',
|
|
112
|
+
padding: 's16',
|
|
113
|
+
}}
|
|
114
|
+
>
|
|
115
|
+
<Text typography='body2' lx={{ color: 'base' }}>
|
|
116
|
+
Item 2
|
|
117
|
+
</Text>
|
|
118
|
+
<Text typography='body3' lx={{ color: 'muted' }}>
|
|
119
|
+
$200
|
|
120
|
+
</Text>
|
|
121
|
+
</Box>
|
|
122
|
+
<Divider />
|
|
123
|
+
<Box
|
|
124
|
+
lx={{
|
|
125
|
+
flexDirection: 'row',
|
|
126
|
+
justifyContent: 'space-between',
|
|
127
|
+
alignItems: 'center',
|
|
128
|
+
padding: 's16',
|
|
129
|
+
}}
|
|
130
|
+
>
|
|
131
|
+
<Text typography='body2' lx={{ color: 'base' }}>
|
|
132
|
+
Item 3
|
|
133
|
+
</Text>
|
|
134
|
+
<Text typography='body3' lx={{ color: 'muted' }}>
|
|
135
|
+
$300
|
|
136
|
+
</Text>
|
|
137
|
+
</Box>
|
|
138
|
+
</Box>
|
|
139
|
+
),
|
|
140
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { describe, it, expect } from '@jest/globals';
|
|
2
|
+
import { ledgerLiveThemes } from '@ledgerhq/lumen-design-core';
|
|
3
|
+
import { render } from '@testing-library/react-native';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { ThemeProvider } from '../ThemeProvider/ThemeProvider';
|
|
6
|
+
import { Divider } from './Divider';
|
|
7
|
+
|
|
8
|
+
const { colors } = ledgerLiveThemes.dark;
|
|
9
|
+
|
|
10
|
+
const TestWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => (
|
|
11
|
+
<ThemeProvider themes={ledgerLiveThemes} colorScheme='dark' locale='en'>
|
|
12
|
+
{children}
|
|
13
|
+
</ThemeProvider>
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
describe('Divider Component', () => {
|
|
17
|
+
it('should render with horizontal orientation by default', () => {
|
|
18
|
+
const { getByTestId } = render(
|
|
19
|
+
<TestWrapper>
|
|
20
|
+
<Divider testID='divider' />
|
|
21
|
+
</TestWrapper>,
|
|
22
|
+
);
|
|
23
|
+
const divider = getByTestId('divider');
|
|
24
|
+
expect(divider).toBeTruthy();
|
|
25
|
+
const style = divider.props.style;
|
|
26
|
+
// Style might be an array or object after flattening
|
|
27
|
+
const flatStyle = Array.isArray(style)
|
|
28
|
+
? Object.assign({}, ...style)
|
|
29
|
+
: style;
|
|
30
|
+
expect(flatStyle.borderTopWidth).toBe(1);
|
|
31
|
+
expect(flatStyle.borderTopColor).toBe(colors.border.mutedSubtle);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it('should render with vertical orientation', () => {
|
|
35
|
+
const { getByTestId } = render(
|
|
36
|
+
<TestWrapper>
|
|
37
|
+
<Divider testID='divider' orientation='vertical' />
|
|
38
|
+
</TestWrapper>,
|
|
39
|
+
);
|
|
40
|
+
const divider = getByTestId('divider');
|
|
41
|
+
const style = divider.props.style;
|
|
42
|
+
// Style might be an array or object after flattening
|
|
43
|
+
const flatStyle = Array.isArray(style)
|
|
44
|
+
? Object.assign({}, ...style)
|
|
45
|
+
: style;
|
|
46
|
+
expect(flatStyle.borderLeftWidth).toBe(1);
|
|
47
|
+
expect(flatStyle.borderLeftColor).toBe(colors.border.mutedSubtle);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it('should apply custom lx props', () => {
|
|
51
|
+
const { getByTestId } = render(
|
|
52
|
+
<TestWrapper>
|
|
53
|
+
<Divider testID='divider' lx={{ marginVertical: 's16' }} />
|
|
54
|
+
</TestWrapper>,
|
|
55
|
+
);
|
|
56
|
+
const divider = getByTestId('divider');
|
|
57
|
+
const style = divider.props.style;
|
|
58
|
+
const flatStyle = Array.isArray(style)
|
|
59
|
+
? Object.assign({}, ...style)
|
|
60
|
+
: style;
|
|
61
|
+
expect(flatStyle.marginVertical).toBe(16);
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('should pass through additional props', () => {
|
|
65
|
+
const { getByTestId } = render(
|
|
66
|
+
<TestWrapper>
|
|
67
|
+
<Divider testID='custom-divider' />
|
|
68
|
+
</TestWrapper>,
|
|
69
|
+
);
|
|
70
|
+
const divider = getByTestId('custom-divider');
|
|
71
|
+
expect(divider).toBeTruthy();
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
it('should handle style merging with lx props', () => {
|
|
75
|
+
const { getByTestId } = render(
|
|
76
|
+
<TestWrapper>
|
|
77
|
+
<Divider
|
|
78
|
+
testID='divider'
|
|
79
|
+
lx={{ marginTop: 's8' }}
|
|
80
|
+
style={{ opacity: 0.5 }}
|
|
81
|
+
/>
|
|
82
|
+
</TestWrapper>,
|
|
83
|
+
);
|
|
84
|
+
const divider = getByTestId('divider');
|
|
85
|
+
const style = divider.props.style;
|
|
86
|
+
const flatStyle = Array.isArray(style)
|
|
87
|
+
? Object.assign({}, ...style)
|
|
88
|
+
: style;
|
|
89
|
+
expect(flatStyle.marginTop).toBe(8);
|
|
90
|
+
expect(flatStyle.opacity).toBe(0.5);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { Box } from '../Utility';
|
|
4
|
+
import { DividerProps } from './types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A simple divider component for separating content sections.
|
|
8
|
+
*
|
|
9
|
+
* The Divider renders a horizontal or vertical line to create visual separation
|
|
10
|
+
* between content areas. It uses design system tokens for consistent styling.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://ldls.vercel.app/?path=/docs/layout-divider--docs Storybook}
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* // Horizontal divider (default)
|
|
16
|
+
* <Divider />
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* // Vertical divider
|
|
20
|
+
* <Divider orientation="vertical" />
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // With custom styling using lx props
|
|
24
|
+
* <Divider lx={{ marginVertical: 's16' }} />
|
|
25
|
+
*/
|
|
26
|
+
export const Divider = forwardRef<View, DividerProps>(
|
|
27
|
+
({ lx = {}, orientation = 'horizontal', ...props }, ref) => {
|
|
28
|
+
return (
|
|
29
|
+
<Box
|
|
30
|
+
ref={ref}
|
|
31
|
+
accessibilityRole='none'
|
|
32
|
+
lx={{
|
|
33
|
+
...(orientation === 'horizontal'
|
|
34
|
+
? {
|
|
35
|
+
alignSelf: 'stretch',
|
|
36
|
+
borderTopWidth: 's1',
|
|
37
|
+
borderTopColor: 'mutedSubtle',
|
|
38
|
+
}
|
|
39
|
+
: {
|
|
40
|
+
alignSelf: 'stretch',
|
|
41
|
+
borderLeftWidth: 's1',
|
|
42
|
+
borderLeftColor: 'mutedSubtle',
|
|
43
|
+
}),
|
|
44
|
+
...lx,
|
|
45
|
+
}}
|
|
46
|
+
{...props}
|
|
47
|
+
/>
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
Divider.displayName = 'Divider';
|
|
@@ -169,16 +169,21 @@ ListItemLeading.displayName = 'ListItemLeading';
|
|
|
169
169
|
*/
|
|
170
170
|
export const ListItemContent = React.forwardRef<View, ListItemContentProps>(
|
|
171
171
|
({ children, lx = {}, style, ...viewProps }, ref) => {
|
|
172
|
+
const { isInTrailing } = useListItemTrailingContext({
|
|
173
|
+
consumerName: 'ListItemContent',
|
|
174
|
+
contextRequired: false,
|
|
175
|
+
});
|
|
176
|
+
|
|
172
177
|
const styles = useStyleSheet(
|
|
173
178
|
(t) => ({
|
|
174
179
|
content: {
|
|
175
|
-
flex: 1,
|
|
180
|
+
flex: isInTrailing ? 0 : 1,
|
|
176
181
|
minWidth: 0,
|
|
177
182
|
flexDirection: 'column',
|
|
178
183
|
gap: t.spacings.s4,
|
|
179
184
|
},
|
|
180
185
|
}),
|
|
181
|
-
[],
|
|
186
|
+
[isInTrailing],
|
|
182
187
|
);
|
|
183
188
|
|
|
184
189
|
return (
|
|
@@ -419,7 +424,9 @@ export const ListItemIcon = ({
|
|
|
419
424
|
<Icon
|
|
420
425
|
size={24}
|
|
421
426
|
style={{
|
|
422
|
-
color: disabled
|
|
427
|
+
color: disabled
|
|
428
|
+
? theme.colors.text.disabled
|
|
429
|
+
: (color ?? theme.colors.text.base),
|
|
423
430
|
}}
|
|
424
431
|
/>
|
|
425
432
|
</Box>
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
BottomSheetView,
|
|
9
9
|
useBottomSheetRef,
|
|
10
10
|
} from '../BottomSheet';
|
|
11
|
+
import { Divider } from '../Divider';
|
|
11
12
|
import { Box, Text } from '../Utility';
|
|
12
13
|
import { useGlobalSelectSafeContext } from './GlobalSelectContext';
|
|
13
14
|
|
|
@@ -17,12 +18,6 @@ const useStyles = () => {
|
|
|
17
18
|
bottomSheetView: {
|
|
18
19
|
paddingHorizontal: t.spacings.s8,
|
|
19
20
|
},
|
|
20
|
-
separator: {
|
|
21
|
-
marginVertical: t.spacings.s4,
|
|
22
|
-
marginHorizontal: t.spacings.s8,
|
|
23
|
-
height: 1,
|
|
24
|
-
backgroundColor: t.colors.bg.muted,
|
|
25
|
-
},
|
|
26
21
|
groupLabel: {
|
|
27
22
|
marginBottom: t.spacings.s4,
|
|
28
23
|
paddingHorizontal: t.spacings.s8,
|
|
@@ -133,7 +128,10 @@ export const GlobalSelectBottomSheet: React.FC = () => {
|
|
|
133
128
|
{currentSelect.items.map((item, index) => {
|
|
134
129
|
if (item.type === 'separator') {
|
|
135
130
|
return (
|
|
136
|
-
<
|
|
131
|
+
<Divider
|
|
132
|
+
key={`separator-${index}`}
|
|
133
|
+
lx={{ marginVertical: 's4', marginHorizontal: 's8' }}
|
|
134
|
+
/>
|
|
137
135
|
);
|
|
138
136
|
}
|
|
139
137
|
if (item.type === 'group-label') {
|
|
@@ -458,23 +458,9 @@ export const SelectItemText: React.FC<SelectItemTextProps> = ({
|
|
|
458
458
|
};
|
|
459
459
|
SelectItemText.displayName = 'SelectItemText';
|
|
460
460
|
|
|
461
|
-
export const SelectSeparator: React.FC<SelectSeparatorProps> = ({
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}) => {
|
|
466
|
-
const styles = useStyleSheet(
|
|
467
|
-
(t) => ({
|
|
468
|
-
separator: {
|
|
469
|
-
marginHorizontal: t.spacings.s8,
|
|
470
|
-
marginVertical: t.spacings.s4,
|
|
471
|
-
height: t.sizes.s1,
|
|
472
|
-
backgroundColor: t.colors.border.mutedSubtle,
|
|
473
|
-
},
|
|
474
|
-
}),
|
|
475
|
-
[],
|
|
476
|
-
);
|
|
477
|
-
|
|
478
|
-
return <Box lx={lx} style={[styles.separator, style]} {...props} />;
|
|
461
|
+
export const SelectSeparator: React.FC<SelectSeparatorProps> = () => {
|
|
462
|
+
// This component doesn't render anything - it's used for structure
|
|
463
|
+
// The actual separators are rendered in GlobalSelectBottomSheet
|
|
464
|
+
return null;
|
|
479
465
|
};
|
|
480
466
|
SelectSeparator.displayName = 'SelectSeparator';
|
|
@@ -116,9 +116,7 @@ export type SelectItemTextProps = {
|
|
|
116
116
|
children: ReactNode;
|
|
117
117
|
} & StyledTextProps;
|
|
118
118
|
|
|
119
|
-
export type SelectSeparatorProps = {
|
|
120
|
-
// No extra props needed
|
|
121
|
-
} & BoxProps;
|
|
119
|
+
export type SelectSeparatorProps = {} & BoxProps;
|
|
122
120
|
|
|
123
121
|
export type SelectItemData = {
|
|
124
122
|
type: 'item';
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
import figma from '@figma/code-connect';
|
|
2
2
|
import { Settings } from '../../Symbols';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* to return the code example you'd like to see in Figma
|
|
11
|
-
*/
|
|
3
|
+
import {
|
|
4
|
+
Tile,
|
|
5
|
+
TileSpot,
|
|
6
|
+
TileContent,
|
|
7
|
+
TileTitle,
|
|
8
|
+
TileDescription,
|
|
9
|
+
} from './Tile';
|
|
12
10
|
|
|
13
11
|
figma.connect(
|
|
14
12
|
Tile,
|
|
15
13
|
'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=5783-1328',
|
|
16
14
|
{
|
|
17
|
-
imports: [
|
|
15
|
+
imports: [
|
|
16
|
+
"import { Tile, TileSpot, TileContent, TileTitle, TileDescription } from '@ledgerhq/lumen-ui-rnative'",
|
|
17
|
+
],
|
|
18
18
|
props: {
|
|
19
19
|
title: figma.string('title'),
|
|
20
20
|
description: figma.boolean('show-description', {
|
|
21
21
|
true: figma.string('description'),
|
|
22
22
|
false: undefined,
|
|
23
23
|
}),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
true: figma.instance('tag'),
|
|
27
|
-
false: undefined,
|
|
28
|
-
}),
|
|
24
|
+
showTag: figma.boolean('show-tag'),
|
|
25
|
+
tag: figma.instance('tag'),
|
|
29
26
|
disabled: figma.enum('state', {
|
|
30
27
|
disabled: true,
|
|
31
28
|
}),
|
|
@@ -38,15 +35,19 @@ figma.connect(
|
|
|
38
35
|
],
|
|
39
36
|
example: (props) => (
|
|
40
37
|
<Tile
|
|
41
|
-
title={props.title}
|
|
42
|
-
description={props.description}
|
|
43
|
-
leadingContent={props.leadingContent}
|
|
44
|
-
trailingContent={props.trailingContent}
|
|
45
38
|
disabled={props.disabled}
|
|
46
|
-
onPress={() =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
onPress={() => console.log('Tile pressed')}
|
|
40
|
+
onLongPress={() => console.log('Long press - secondary action')}
|
|
41
|
+
>
|
|
42
|
+
<TileSpot appearance='icon' icon={Settings} />
|
|
43
|
+
<TileContent>
|
|
44
|
+
<TileTitle>{props.title}</TileTitle>
|
|
45
|
+
{props.description && (
|
|
46
|
+
<TileDescription>{props.description}</TileDescription>
|
|
47
|
+
)}
|
|
48
|
+
</TileContent>
|
|
49
|
+
{props.showTag && props.tag}
|
|
50
|
+
</Tile>
|
|
50
51
|
),
|
|
51
52
|
},
|
|
52
53
|
);
|