@ledgerhq/lumen-ui-rnative 0.0.47 → 0.0.49
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 +36 -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 +173 -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
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createSafeContext, isTextChildren, } from '@ledgerhq/lumen-utils-shared';
|
|
2
3
|
import { forwardRef } from 'react';
|
|
3
|
-
import { StyleSheet, View
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
5
|
import { useStyleSheet } from '../../../styles';
|
|
5
|
-
import {
|
|
6
|
-
|
|
6
|
+
import { Spot } from '../Spot';
|
|
7
|
+
import { Box, Pressable, Text } from '../Utility';
|
|
8
|
+
const [TileProvider, useTileContext] = createSafeContext('Tile');
|
|
9
|
+
const useRootStyles = ({ appearance, disabled, pressed, }) => {
|
|
7
10
|
return useStyleSheet((t) => {
|
|
8
11
|
const bgColors = {
|
|
9
12
|
'no-background': t.colors.bg.baseTransparent,
|
|
@@ -21,7 +24,8 @@ const useStyles = ({ appearance, disabled, pressed, }) => {
|
|
|
21
24
|
width: '100%',
|
|
22
25
|
alignItems: 'center',
|
|
23
26
|
gap: t.spacings.s8,
|
|
24
|
-
|
|
27
|
+
paddingHorizontal: t.spacings.s8,
|
|
28
|
+
paddingVertical: t.spacings.s12,
|
|
25
29
|
borderRadius: t.borderRadius.sm,
|
|
26
30
|
backgroundColor: bgColors[appearance],
|
|
27
31
|
},
|
|
@@ -30,72 +34,169 @@ const useStyles = ({ appearance, disabled, pressed, }) => {
|
|
|
30
34
|
backgroundColor: pressedBgColors[appearance],
|
|
31
35
|
},
|
|
32
36
|
]),
|
|
33
|
-
contentWrapper: {
|
|
34
|
-
width: t.sizes.full,
|
|
35
|
-
alignItems: 'center',
|
|
36
|
-
gap: t.spacings.s8,
|
|
37
|
-
},
|
|
38
|
-
leadingWrapper: {
|
|
39
|
-
alignItems: 'center',
|
|
40
|
-
justifyContent: 'center',
|
|
41
|
-
},
|
|
42
|
-
textWrapper: {
|
|
43
|
-
width: t.sizes.full,
|
|
44
|
-
alignItems: 'center',
|
|
45
|
-
gap: t.spacings.s4,
|
|
46
|
-
},
|
|
47
|
-
titleWrapper: {
|
|
48
|
-
width: t.sizes.full,
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
},
|
|
51
|
-
title: StyleSheet.flatten([
|
|
52
|
-
t.typographies.body3SemiBold,
|
|
53
|
-
{
|
|
54
|
-
width: t.sizes.full,
|
|
55
|
-
textAlign: 'center',
|
|
56
|
-
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
57
|
-
},
|
|
58
|
-
]),
|
|
59
|
-
description: StyleSheet.flatten([
|
|
60
|
-
t.typographies.body3,
|
|
61
|
-
{
|
|
62
|
-
width: t.sizes.full,
|
|
63
|
-
textAlign: 'center',
|
|
64
|
-
color: disabled ? t.colors.text.disabled : t.colors.text.muted,
|
|
65
|
-
},
|
|
66
|
-
]),
|
|
67
37
|
};
|
|
68
38
|
}, [appearance, disabled, pressed]);
|
|
69
39
|
};
|
|
70
|
-
const TileContent = ({ appearance, disabled, pressed, leadingContent, title, description, trailingContent, }) => {
|
|
71
|
-
const styles = useStyles({ appearance, disabled, pressed });
|
|
72
|
-
return (_jsx(View, { style: styles.container, children: _jsxs(View, { style: styles.contentWrapper, children: [_jsx(View, { style: styles.leadingWrapper, children: leadingContent }), _jsxs(View, { style: styles.textWrapper, children: [_jsxs(View, { style: styles.titleWrapper, children: [_jsx(Text, { numberOfLines: 1, style: styles.title, children: title }), description && (_jsx(Text, { numberOfLines: 1, style: styles.description, children: description }))] }), trailingContent] })] }) }));
|
|
73
|
-
};
|
|
74
40
|
/**
|
|
75
|
-
* A tile
|
|
76
|
-
*
|
|
77
|
-
* and supports long press actions.
|
|
41
|
+
* A flexible tile component that uses a composite pattern for maximum customization.
|
|
42
|
+
* Displays content in a vertical layout with support for spots, text, and custom content.
|
|
78
43
|
*
|
|
79
|
-
* @see {@link https://ldls.vercel.app/?path=/docs/
|
|
80
|
-
* @see {@link https://ldls.vercel.app/?path=/docs/
|
|
44
|
+
* @see {@link https://ldls.vercel.app/?path=/docs/react-native_containment-tile--docs Storybook}
|
|
45
|
+
* @see {@link https://ldls.vercel.app/?path=/docs/react-native_containment-tile--docs#dos-and-donts Guidelines}
|
|
81
46
|
*
|
|
82
47
|
* @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
|
|
83
48
|
* Do not use it to modify the tile's core appearance (colors, padding, etc). Use the `appearance` prop instead.
|
|
84
49
|
*
|
|
85
50
|
* @example
|
|
86
|
-
* // Basic tile
|
|
87
|
-
* import { Tile,
|
|
51
|
+
* // Basic tile with spot and content
|
|
52
|
+
* import { Tile, TileSpot, TileContent, TileTitle, TileDescription } from '@ledgerhq/lumen-ui-rnative';
|
|
88
53
|
* import { Wallet } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
89
54
|
*
|
|
90
|
-
* <Tile
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
55
|
+
* <Tile appearance="card" onPress={() => console.log('Pressed!')}>
|
|
56
|
+
* <TileSpot appearance="icon" icon={Wallet} />
|
|
57
|
+
* <TileContent>
|
|
58
|
+
* <TileTitle>My Wallet</TileTitle>
|
|
59
|
+
* <TileDescription>Description</TileDescription>
|
|
60
|
+
* </TileContent>
|
|
61
|
+
* </Tile>
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* // With custom content and long press
|
|
65
|
+
* import { Tile, TileSpot, TileContent, TileTitle, Tag } from '@ledgerhq/lumen-ui-rnative';
|
|
66
|
+
* import { Bitcoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
67
|
+
*
|
|
68
|
+
* <Tile appearance="card" onLongPress={() => console.log('Long pressed')}>
|
|
69
|
+
* <TileSpot appearance="icon" icon={Bitcoin} />
|
|
70
|
+
* <TileContent>
|
|
71
|
+
* <TileTitle>Bitcoin</TileTitle>
|
|
72
|
+
* </TileContent>
|
|
73
|
+
* <Tag label="Active" />
|
|
74
|
+
* </Tile>
|
|
97
75
|
*/
|
|
98
|
-
export const Tile = forwardRef(({ lx = {}, style,
|
|
99
|
-
return (_jsx(Pressable, { ref: ref, lx: lx, style: style, disabled: disabled, accessibilityRole: 'button', accessibilityState: { disabled }, ...props, children: ({ pressed }) => (_jsx(
|
|
76
|
+
export const Tile = forwardRef(({ lx = {}, style, appearance = 'no-background', disabled = false, children, ...props }, ref) => {
|
|
77
|
+
return (_jsx(TileProvider, { value: { disabled }, children: _jsx(Pressable, { ref: ref, lx: lx, style: StyleSheet.flatten([{ width: '100%' }, style]), disabled: disabled, accessibilityRole: 'button', accessibilityState: { disabled }, ...props, children: ({ pressed }) => (_jsx(TilePressableContent, { appearance: appearance, disabled: disabled, pressed: pressed, children: children })) }) }));
|
|
100
78
|
});
|
|
101
79
|
Tile.displayName = 'Tile';
|
|
80
|
+
const TilePressableContent = ({ appearance, disabled, pressed, children, }) => {
|
|
81
|
+
const styles = useRootStyles({ appearance, disabled, pressed });
|
|
82
|
+
return _jsx(View, { style: styles.container, children: children });
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* A spot adapter for use within Tile. Automatically inherits the disabled state from the parent Tile.
|
|
86
|
+
* Always renders at a fixed size of 48.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* <Tile>
|
|
90
|
+
* <TileSpot appearance="icon" icon={Settings} />
|
|
91
|
+
* </Tile>
|
|
92
|
+
*/
|
|
93
|
+
export const TileSpot = (props) => {
|
|
94
|
+
const { disabled } = useTileContext({
|
|
95
|
+
consumerName: 'TileSpot',
|
|
96
|
+
contextRequired: true,
|
|
97
|
+
});
|
|
98
|
+
return _jsx(Spot, { ...props, size: 48, disabled: disabled });
|
|
99
|
+
};
|
|
100
|
+
const useContentStyles = () => {
|
|
101
|
+
return useStyleSheet((t) => ({
|
|
102
|
+
container: {
|
|
103
|
+
width: t.sizes.full,
|
|
104
|
+
alignItems: 'center',
|
|
105
|
+
gap: t.spacings.s4,
|
|
106
|
+
},
|
|
107
|
+
}), []);
|
|
108
|
+
};
|
|
109
|
+
TileSpot.displayName = 'TileSpot';
|
|
110
|
+
/**
|
|
111
|
+
* A container for grouping TileTitle and TileDescription with consistent spacing.
|
|
112
|
+
* Use this to wrap text content within a Tile.
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* <Tile>
|
|
116
|
+
* <TileContent>
|
|
117
|
+
* <TileTitle>My Title</TileTitle>
|
|
118
|
+
* <TileDescription>My Description</TileDescription>
|
|
119
|
+
* </TileContent>
|
|
120
|
+
* </Tile>
|
|
121
|
+
*/
|
|
122
|
+
export const TileContent = ({ children, lx, style }) => {
|
|
123
|
+
const styles = useContentStyles();
|
|
124
|
+
return (_jsx(Box, { lx: lx, style: StyleSheet.flatten([styles.container, style]), testID: 'tile-content', children: children }));
|
|
125
|
+
};
|
|
126
|
+
TileContent.displayName = 'TileContent';
|
|
127
|
+
const useTitleStyles = ({ disabled }) => {
|
|
128
|
+
return useStyleSheet((t) => ({
|
|
129
|
+
container: {
|
|
130
|
+
width: t.sizes.full,
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
},
|
|
133
|
+
text: StyleSheet.flatten([
|
|
134
|
+
t.typographies.body3SemiBold,
|
|
135
|
+
{
|
|
136
|
+
alignItems: 'center',
|
|
137
|
+
width: t.sizes.full,
|
|
138
|
+
textAlign: 'center',
|
|
139
|
+
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
140
|
+
},
|
|
141
|
+
]),
|
|
142
|
+
}), [disabled]);
|
|
143
|
+
};
|
|
144
|
+
/**
|
|
145
|
+
* The primary text label for a Tile. Automatically inherits the disabled state from the parent Tile.
|
|
146
|
+
* Text will truncate with ellipsis if it exceeds the available width.
|
|
147
|
+
* If children is a string, it will be automatically wrapped in a Text component.
|
|
148
|
+
*/
|
|
149
|
+
export const TileTitle = ({ children, lx, style }) => {
|
|
150
|
+
const { disabled } = useTileContext({
|
|
151
|
+
consumerName: 'TileTitle',
|
|
152
|
+
contextRequired: true,
|
|
153
|
+
});
|
|
154
|
+
const styles = useTitleStyles({ disabled });
|
|
155
|
+
if (isTextChildren(children)) {
|
|
156
|
+
return (_jsx(Text, { testID: 'tile-title', numberOfLines: 1, lx: lx, style: StyleSheet.flatten([styles.text, style]), children: children }));
|
|
157
|
+
}
|
|
158
|
+
return (_jsx(Box, { lx: lx, style: StyleSheet.flatten([styles.container, style]), testID: 'tile-title', children: children }));
|
|
159
|
+
};
|
|
160
|
+
TileTitle.displayName = 'TileTitle';
|
|
161
|
+
const useDescriptionStyles = ({ disabled }) => {
|
|
162
|
+
return useStyleSheet((t) => ({
|
|
163
|
+
container: {
|
|
164
|
+
width: t.sizes.full,
|
|
165
|
+
alignItems: 'center',
|
|
166
|
+
},
|
|
167
|
+
text: StyleSheet.flatten([
|
|
168
|
+
t.typographies.body3,
|
|
169
|
+
{
|
|
170
|
+
width: t.sizes.full,
|
|
171
|
+
alignItems: 'center',
|
|
172
|
+
textAlign: 'center',
|
|
173
|
+
color: disabled ? t.colors.text.disabled : t.colors.text.muted,
|
|
174
|
+
},
|
|
175
|
+
]),
|
|
176
|
+
}), [disabled]);
|
|
177
|
+
};
|
|
178
|
+
/**
|
|
179
|
+
* The secondary text label for a Tile. Automatically inherits the disabled state from the parent Tile.
|
|
180
|
+
* Text will truncate with ellipsis if it exceeds the available width.
|
|
181
|
+
* If children is a string, it will be automatically wrapped in a Text component.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* <Tile>
|
|
185
|
+
* <TileContent>
|
|
186
|
+
* <TileTitle>My Title</TileTitle>
|
|
187
|
+
* <TileDescription>My Description</TileDescription>
|
|
188
|
+
* </TileContent>
|
|
189
|
+
* </Tile>
|
|
190
|
+
*/
|
|
191
|
+
export const TileDescription = ({ children, lx, style, }) => {
|
|
192
|
+
const { disabled } = useTileContext({
|
|
193
|
+
consumerName: 'TileDescription',
|
|
194
|
+
contextRequired: true,
|
|
195
|
+
});
|
|
196
|
+
const styles = useDescriptionStyles({ disabled });
|
|
197
|
+
if (isTextChildren(children)) {
|
|
198
|
+
return (_jsx(Text, { lx: lx, numberOfLines: 1, style: StyleSheet.flatten([styles.text, style]), testID: 'tile-description', children: children }));
|
|
199
|
+
}
|
|
200
|
+
return (_jsx(Box, { lx: lx, style: StyleSheet.flatten([styles.container, style]), testID: 'tile-description', children: children }));
|
|
201
|
+
};
|
|
202
|
+
TileDescription.displayName = 'TileDescription';
|
|
@@ -4,9 +4,9 @@ declare const meta: Meta<typeof Tile>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof Tile>;
|
|
6
6
|
export declare const Base: Story;
|
|
7
|
-
export declare const
|
|
7
|
+
export declare const VariantsShowcase: Story;
|
|
8
8
|
export declare const WithSecondaryAction: Story;
|
|
9
|
-
export declare const LeadingContentVariantsShowcase: Story;
|
|
10
9
|
export declare const HorizontalList: Story;
|
|
11
10
|
export declare const ResponsiveLayout: Story;
|
|
11
|
+
export declare const AppearanceShowcase: Story;
|
|
12
12
|
//# sourceMappingURL=Tile.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tile.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Tile/Tile.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"Tile.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Tile/Tile.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAIvE,OAAO,EACL,IAAI,EAKL,MAAM,QAAQ,CAAC;AAEhB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,IAAI,CAkB3B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,IAAI,EAAE,KAyBlB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAoC9B,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KA+BjC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KA4C5B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KA0B9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,KA+ChC,CAAC"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Settings, Plus, User,
|
|
3
|
-
import { Spot } from '../Spot/Spot';
|
|
2
|
+
import { Settings, Plus, User, Apps } from '../../Symbols';
|
|
4
3
|
import { Tag } from '../Tag/Tag';
|
|
5
|
-
import { Box } from '../Utility';
|
|
6
|
-
import { Tile } from './Tile';
|
|
4
|
+
import { Box, Text } from '../Utility';
|
|
5
|
+
import { Tile, TileSpot, TileContent, TileTitle, TileDescription, } from './Tile';
|
|
7
6
|
const meta = {
|
|
8
7
|
component: Tile,
|
|
8
|
+
subcomponents: {
|
|
9
|
+
TileSpot,
|
|
10
|
+
TileContent,
|
|
11
|
+
TileTitle,
|
|
12
|
+
TileDescription,
|
|
13
|
+
},
|
|
9
14
|
title: 'Containment/Tile',
|
|
10
15
|
parameters: {
|
|
11
16
|
docs: {
|
|
@@ -16,117 +21,67 @@ const meta = {
|
|
|
16
21
|
},
|
|
17
22
|
},
|
|
18
23
|
},
|
|
19
|
-
argTypes: {
|
|
20
|
-
leadingContent: {
|
|
21
|
-
control: 'select',
|
|
22
|
-
options: ['None', 'Settings', 'Plus'],
|
|
23
|
-
mapping: {
|
|
24
|
-
None: undefined,
|
|
25
|
-
Settings: _jsx(Spot, { appearance: 'icon', icon: Settings }),
|
|
26
|
-
Plus: _jsx(Spot, { appearance: 'icon', icon: Plus }),
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
trailingContent: {
|
|
30
|
-
control: 'select',
|
|
31
|
-
options: ['None', 'Tag', 'Text'],
|
|
32
|
-
mapping: {
|
|
33
|
-
None: undefined,
|
|
34
|
-
Tag: _jsx(Tag, { label: 'Tag', appearance: 'base' }),
|
|
35
|
-
Text: _jsx("span", { children: "Text" }),
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
24
|
};
|
|
40
25
|
export default meta;
|
|
41
26
|
export const Base = {
|
|
42
|
-
|
|
43
|
-
title: 'Item with Spot and Description',
|
|
44
|
-
description: 'Additional information',
|
|
45
|
-
leadingContent: _jsx(Spot, { appearance: 'icon', icon: Settings }),
|
|
46
|
-
lx: { maxWidth: 's256' },
|
|
47
|
-
},
|
|
27
|
+
render: () => (_jsxs(Tile, { lx: { maxWidth: 's112' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: Settings }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "Item with Spot and Description" }), _jsx(TileDescription, { children: "Additional information" })] })] })),
|
|
48
28
|
parameters: {
|
|
49
29
|
docs: {
|
|
50
30
|
source: {
|
|
51
31
|
code: `
|
|
52
|
-
<Tile
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
/>
|
|
32
|
+
<Tile lx={{ maxWidth: 's112' }}>
|
|
33
|
+
<TileSpot appearance="icon" icon={Settings} />
|
|
34
|
+
<TileContent>
|
|
35
|
+
<TileTitle>Item with Spot and Description</TileTitle>
|
|
36
|
+
<TileDescription>Additional information</TileDescription>
|
|
37
|
+
</TileContent>
|
|
38
|
+
</Tile>
|
|
60
39
|
`,
|
|
61
40
|
},
|
|
62
41
|
},
|
|
63
42
|
},
|
|
64
43
|
};
|
|
65
|
-
export const
|
|
66
|
-
|
|
67
|
-
title: 'Item with Trailing Content',
|
|
68
|
-
description: 'Additional information',
|
|
69
|
-
leadingContent: _jsx(Spot, { appearance: 'icon', icon: Settings }),
|
|
70
|
-
trailingContent: _jsx(Tag, { label: 'New', appearance: 'base' }),
|
|
71
|
-
lx: { maxWidth: 's256' },
|
|
72
|
-
},
|
|
73
|
-
parameters: {
|
|
74
|
-
docs: {
|
|
75
|
-
source: {
|
|
76
|
-
code: `
|
|
77
|
-
<Tile
|
|
78
|
-
title="Item with Trailing Content"
|
|
79
|
-
description="Additional information"
|
|
80
|
-
leadingContent={<Spot appearance="icon" icon={Settings} />}
|
|
81
|
-
trailingContent={<Tag label="New" appearance="base" />}
|
|
82
|
-
onLongPress={() => console.log('Long press - secondary action')}
|
|
83
|
-
lx={{ maxWidth: 's256' }}
|
|
84
|
-
/>
|
|
85
|
-
`,
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
},
|
|
44
|
+
export const VariantsShowcase = {
|
|
45
|
+
render: () => (_jsxs(Box, { lx: { flexDirection: 'column', gap: 's16' }, children: [_jsxs(Tile, { lx: { maxWidth: 's176' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: User }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "User" }), _jsx(TileDescription, { children: "With description" })] })] }), _jsxs(Tile, { lx: { maxWidth: 's176' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: Plus }), _jsx(TileContent, { children: _jsx(TileTitle, { children: "Without Description" }) })] }), _jsxs(Tile, { lx: { maxWidth: 's176' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: Settings }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "With Trailing Content" }), _jsx(TileDescription, { children: "Additional information" })] }), _jsx(Tag, { label: 'Custom', appearance: 'base' })] }), _jsxs(Tile, { lx: { maxWidth: 's176' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: Settings }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "With Trailing Content" }), _jsx(TileDescription, { children: "Additional information" })] }), _jsx(Text, { typography: 'body2SemiBold', lx: { color: 'success' }, children: "+7.87%" })] })] })),
|
|
89
46
|
};
|
|
90
47
|
export const WithSecondaryAction = {
|
|
91
|
-
|
|
92
|
-
title: 'Item with secondary action',
|
|
93
|
-
description: 'LongPress to trigger secondary action',
|
|
94
|
-
leadingContent: _jsx(Spot, { appearance: 'icon', icon: Settings }),
|
|
95
|
-
onLongPress: () => alert('Long press - secondary action'),
|
|
96
|
-
lx: { maxWidth: 's256' },
|
|
97
|
-
},
|
|
48
|
+
render: () => (_jsxs(Tile, { onLongPress: () => alert('Long press - secondary action triggered!'), lx: { maxWidth: 's176' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: Settings }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "Long Press Me" }), _jsx(TileDescription, { children: "Try long pressing this tile" })] })] })),
|
|
98
49
|
parameters: {
|
|
99
50
|
docs: {
|
|
100
51
|
source: {
|
|
101
52
|
code: `
|
|
102
53
|
<Tile
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
54
|
+
onLongPress={() => alert('Long press - secondary action triggered!')}
|
|
55
|
+
lx={{ maxWidth: 's160' }}
|
|
56
|
+
>
|
|
57
|
+
<TileSpot appearance="icon" icon={Settings} />
|
|
58
|
+
<TileContent>
|
|
59
|
+
<TileTitle>Long Press Me</TileTitle>
|
|
60
|
+
<TileDescription>Try long pressing this tile</TileDescription>
|
|
61
|
+
</TileContent>
|
|
62
|
+
</Tile>
|
|
109
63
|
`,
|
|
110
64
|
},
|
|
111
65
|
},
|
|
112
66
|
},
|
|
113
67
|
};
|
|
114
|
-
export const LeadingContentVariantsShowcase = {
|
|
115
|
-
render: () => (_jsxs(Box, { lx: { flexDirection: 'row' }, children: [_jsx(Tile, { title: 'User', description: 'With description', leadingContent: _jsx(Spot, { appearance: 'icon', icon: User }), lx: { maxWidth: 's128' } }), _jsx(Tile, { title: 'Wallet', description: 'With description', leadingContent: _jsx(Spot, { appearance: 'icon', icon: Wallet }), lx: { maxWidth: 's128' } }), _jsx(Tile, { title: 'Cart', description: 'With description', leadingContent: _jsx(Spot, { appearance: 'icon', icon: Cart }), lx: { maxWidth: 's128' } }), _jsx(Tile, { title: 'Apps', description: 'With description', leadingContent: _jsx(Spot, { appearance: 'icon', icon: Apps }), lx: { maxWidth: 's128' } }), _jsx(Tile, { title: 'Chart', description: 'With description', leadingContent: _jsx(Spot, { appearance: 'icon', icon: Chart1 }), lx: { maxWidth: 's128' } })] })),
|
|
116
|
-
};
|
|
117
68
|
export const HorizontalList = {
|
|
118
69
|
render: () => (_jsxs(Box, { lx: { flexDirection: 'column', gap: 's16' }, children: [_jsx(Box, { lx: {
|
|
119
70
|
position: 'relative',
|
|
120
71
|
flexDirection: 'row',
|
|
121
72
|
width: 's480',
|
|
122
73
|
backgroundColor: 'base',
|
|
123
|
-
}, children: Array.from({ length:
|
|
74
|
+
}, children: Array.from({ length: 3 }).map((_, i) => (_jsxs(Tile, { children: [_jsx(TileSpot, { appearance: 'icon', icon: Apps }), _jsxs(TileContent, { children: [_jsxs(TileTitle, { children: ["Item ", i + 1] }), _jsxs(TileDescription, { children: ["Description ", i + 1] })] })] }, `list-1-${i}`))) }), _jsx(Box, { lx: {
|
|
124
75
|
flexDirection: 'row',
|
|
125
76
|
width: 's480',
|
|
126
77
|
position: 'relative',
|
|
127
78
|
backgroundColor: 'base',
|
|
128
|
-
|
|
79
|
+
overflow: 'scroll',
|
|
80
|
+
}, children: Array.from({ length: 5 }).map((_, i) => (_jsxs(Tile, { lx: { width: 's128', flexShrink: 0 }, children: [_jsx(TileSpot, { appearance: 'icon', icon: Apps }), _jsxs(TileContent, { children: [_jsxs(TileTitle, { children: ["Item ", i + 1] }), _jsx(TileDescription, { children: "Long description that should truncate appropriately" })] })] }, `list-2-${i}`))) })] })),
|
|
129
81
|
};
|
|
130
82
|
export const ResponsiveLayout = {
|
|
131
|
-
render: () => (_jsxs(Box, { lx: { width: 'full', flexDirection: 'column', gap: 's16' }, children: [_jsx(Box, { children:
|
|
83
|
+
render: () => (_jsxs(Box, { lx: { width: 'full', flexDirection: 'column', gap: 's16' }, children: [_jsx(Box, { children: _jsxs(Tile, { children: [_jsx(TileSpot, { appearance: 'icon', icon: Apps }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "Item fill width" }), _jsx(TileDescription, { children: "Description fill width" })] })] }) }), _jsx(Box, { lx: { alignItems: 'center', justifyContent: 'center' }, children: _jsxs(Tile, { lx: { width: 's224' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: Plus }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "Long Item with fixed width" }), _jsx(TileDescription, { children: "lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos." })] })] }) })] })),
|
|
84
|
+
};
|
|
85
|
+
export const AppearanceShowcase = {
|
|
86
|
+
render: () => (_jsxs(Box, { lx: { flexDirection: 'column', gap: 's24' }, children: [_jsxs(Box, { children: [_jsx(Box, { lx: { marginBottom: 's8' }, children: _jsx(Text, { typography: 'body2SemiBold', children: "No Background" }) }), _jsxs(Box, { lx: { flexDirection: 'row', gap: 's16' }, children: [_jsxs(Tile, { appearance: 'no-background', lx: { width: 's112' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: Settings }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "Press me" }), _jsx(TileDescription, { children: "Press state" })] })] }), _jsxs(Tile, { appearance: 'no-background', disabled: true, lx: { width: 's112' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: Settings }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "Disabled" }), _jsx(TileDescription, { children: "Disabled state" })] })] })] })] }), _jsxs(Box, { children: [_jsx(Box, { lx: { marginBottom: 's8' }, children: _jsx(Text, { typography: 'body2SemiBold', children: "Card" }) }), _jsxs(Box, { lx: { flexDirection: 'row', gap: 's16' }, children: [_jsxs(Tile, { appearance: 'card', lx: { width: 's112' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: User }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "Press me" }), _jsx(TileDescription, { children: "Press state" })] })] }), _jsxs(Tile, { appearance: 'card', disabled: true, lx: { width: 's112' }, children: [_jsx(TileSpot, { appearance: 'icon', icon: User }), _jsxs(TileContent, { children: [_jsx(TileTitle, { children: "Disabled" }), _jsx(TileDescription, { children: "Disabled state" })] })] })] })] })] })),
|
|
132
87
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Tile/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Tile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,eAAe,GAChB,MAAM,QAAQ,CAAC;AAChB,cAAc,SAAS,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { Tile, TileSpot, TileContent, TileTitle, TileDescription, } from './Tile';
|
|
2
2
|
export * from './types';
|
|
@@ -1,24 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { StyledPressableProps } from '../../../styles';
|
|
2
|
+
import { StyledPressableProps, StyledTextProps, StyledViewProps } from '../../../styles';
|
|
3
|
+
import { DiscriminatedSpotProps } from '../Spot/types';
|
|
4
|
+
export type TileContextValue = {
|
|
5
|
+
disabled: boolean;
|
|
6
|
+
};
|
|
3
7
|
export type TileProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Custom content to display at the top (leading area) of the tile.
|
|
6
|
-
* Accepts ReactNode such as <Spot appearance="icon" icon={Settings} />
|
|
7
|
-
*/
|
|
8
|
-
leadingContent: ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
* The title of the tile.
|
|
11
|
-
*/
|
|
12
|
-
title: string;
|
|
13
|
-
/**
|
|
14
|
-
* The description of the tile.
|
|
15
|
-
*/
|
|
16
|
-
description?: string;
|
|
17
|
-
/**
|
|
18
|
-
* Custom content to display at the bottom (trailing area) of the tile.
|
|
19
|
-
* Accepts ReactNode such as <Tag label="New" appearance="base" />
|
|
20
|
-
*/
|
|
21
|
-
trailingContent?: ReactNode;
|
|
22
8
|
/**
|
|
23
9
|
* The visual style of the tile.
|
|
24
10
|
* - `no-background`: Transparent background with pressed state
|
|
@@ -41,5 +27,29 @@ export type TileProps = {
|
|
|
41
27
|
* Can be used to perform secondary actions.
|
|
42
28
|
*/
|
|
43
29
|
onLongPress?: StyledPressableProps['onLongPress'];
|
|
30
|
+
/**
|
|
31
|
+
* The children to display inside the tile.
|
|
32
|
+
*/
|
|
33
|
+
children: ReactNode;
|
|
44
34
|
} & Omit<StyledPressableProps, 'onPress' | 'onLongPress' | 'disabled'>;
|
|
35
|
+
export type TileSpotProps = DiscriminatedSpotProps;
|
|
36
|
+
export type TileContentProps = {
|
|
37
|
+
/**
|
|
38
|
+
* The children to display inside the tile content area.
|
|
39
|
+
* Typically contains TileTitle and TileDescription.
|
|
40
|
+
*/
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
} & StyledViewProps;
|
|
43
|
+
export type TileTitleProps = {
|
|
44
|
+
/**
|
|
45
|
+
* The title text to display.
|
|
46
|
+
*/
|
|
47
|
+
children: ReactNode;
|
|
48
|
+
} & StyledViewProps;
|
|
49
|
+
export type TileDescriptionProps = {
|
|
50
|
+
/**
|
|
51
|
+
* The description text to display.
|
|
52
|
+
*/
|
|
53
|
+
children: ReactNode;
|
|
54
|
+
} & StyledTextProps;
|
|
45
55
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Tile/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Tile/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,eAAe,EAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAEvD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,eAAe,GAAG,MAAM,CAAC;IACtC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC1C;;;OAGG;IACH,WAAW,CAAC,EAAE,oBAAoB,CAAC,aAAa,CAAC,CAAC;IAClD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,IAAI,CAAC,oBAAoB,EAAE,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC,CAAC;AAEvE,MAAM,MAAM,aAAa,GAAG,sBAAsB,CAAC;AAEnD,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,eAAe,CAAC;AAEpB,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,eAAe,CAAC;AAEpB,MAAM,MAAM,oBAAoB,GAAG;IACjC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/Components/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/lumen-ui-rnative",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.49",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
"./styles": "./src/styles/index.ts"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@ledgerhq/lumen-utils-shared": "0.0.
|
|
30
|
+
"@ledgerhq/lumen-utils-shared": "0.0.15",
|
|
31
31
|
"i18next": "^23.7.0",
|
|
32
32
|
"react-i18next": "^14.0.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@gorhom/bottom-sheet": "^5.0.0",
|
|
36
|
-
"@ledgerhq/lumen-design-core": "0.0.
|
|
36
|
+
"@ledgerhq/lumen-design-core": "0.0.39",
|
|
37
37
|
"react": "~18.3.1",
|
|
38
38
|
"react-native": "~0.77.3",
|
|
39
39
|
"react-native-reanimated": "^3.0.0",
|