@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
|
@@ -1,12 +1,27 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
createSafeContext,
|
|
3
|
+
isTextChildren,
|
|
4
|
+
} from '@ledgerhq/lumen-utils-shared';
|
|
5
|
+
import React, { forwardRef, ReactNode } from 'react';
|
|
6
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
7
|
import { useStyleSheet } from '../../../styles';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
8
|
+
import { Spot } from '../Spot';
|
|
9
|
+
import { Box, Pressable, Text } from '../Utility';
|
|
10
|
+
import {
|
|
11
|
+
TileContentProps,
|
|
12
|
+
TileContextValue,
|
|
13
|
+
TileDescriptionProps,
|
|
14
|
+
TileProps,
|
|
15
|
+
TileSpotProps,
|
|
16
|
+
TileTitleProps,
|
|
17
|
+
} from './types';
|
|
18
|
+
|
|
19
|
+
const [TileProvider, useTileContext] =
|
|
20
|
+
createSafeContext<TileContextValue>('Tile');
|
|
6
21
|
|
|
7
22
|
type Appearance = NonNullable<TileProps['appearance']>;
|
|
8
23
|
|
|
9
|
-
const
|
|
24
|
+
const useRootStyles = ({
|
|
10
25
|
appearance,
|
|
11
26
|
disabled,
|
|
12
27
|
pressed,
|
|
@@ -35,7 +50,8 @@ const useStyles = ({
|
|
|
35
50
|
width: '100%',
|
|
36
51
|
alignItems: 'center',
|
|
37
52
|
gap: t.spacings.s8,
|
|
38
|
-
|
|
53
|
+
paddingHorizontal: t.spacings.s8,
|
|
54
|
+
paddingVertical: t.spacings.s12,
|
|
39
55
|
borderRadius: t.borderRadius.sm,
|
|
40
56
|
backgroundColor: bgColors[appearance],
|
|
41
57
|
},
|
|
@@ -44,152 +60,283 @@ const useStyles = ({
|
|
|
44
60
|
backgroundColor: pressedBgColors[appearance],
|
|
45
61
|
},
|
|
46
62
|
]),
|
|
47
|
-
contentWrapper: {
|
|
48
|
-
width: t.sizes.full,
|
|
49
|
-
alignItems: 'center',
|
|
50
|
-
gap: t.spacings.s8,
|
|
51
|
-
},
|
|
52
|
-
leadingWrapper: {
|
|
53
|
-
alignItems: 'center',
|
|
54
|
-
justifyContent: 'center',
|
|
55
|
-
},
|
|
56
|
-
textWrapper: {
|
|
57
|
-
width: t.sizes.full,
|
|
58
|
-
alignItems: 'center',
|
|
59
|
-
gap: t.spacings.s4,
|
|
60
|
-
},
|
|
61
|
-
titleWrapper: {
|
|
62
|
-
width: t.sizes.full,
|
|
63
|
-
alignItems: 'center',
|
|
64
|
-
},
|
|
65
|
-
title: StyleSheet.flatten([
|
|
66
|
-
t.typographies.body3SemiBold,
|
|
67
|
-
{
|
|
68
|
-
width: t.sizes.full,
|
|
69
|
-
textAlign: 'center',
|
|
70
|
-
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
71
|
-
},
|
|
72
|
-
]),
|
|
73
|
-
description: StyleSheet.flatten([
|
|
74
|
-
t.typographies.body3,
|
|
75
|
-
{
|
|
76
|
-
width: t.sizes.full,
|
|
77
|
-
textAlign: 'center',
|
|
78
|
-
color: disabled ? t.colors.text.disabled : t.colors.text.muted,
|
|
79
|
-
},
|
|
80
|
-
]),
|
|
81
63
|
};
|
|
82
64
|
},
|
|
83
65
|
[appearance, disabled, pressed],
|
|
84
66
|
);
|
|
85
67
|
};
|
|
86
68
|
|
|
87
|
-
type TileContentProps = {
|
|
88
|
-
appearance: Appearance;
|
|
89
|
-
disabled: boolean;
|
|
90
|
-
pressed: boolean;
|
|
91
|
-
leadingContent: TileProps['leadingContent'];
|
|
92
|
-
title: string;
|
|
93
|
-
description?: string;
|
|
94
|
-
trailingContent?: TileProps['trailingContent'];
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
const TileContent: FC<TileContentProps> = ({
|
|
98
|
-
appearance,
|
|
99
|
-
disabled,
|
|
100
|
-
pressed,
|
|
101
|
-
leadingContent,
|
|
102
|
-
title,
|
|
103
|
-
description,
|
|
104
|
-
trailingContent,
|
|
105
|
-
}) => {
|
|
106
|
-
const styles = useStyles({ appearance, disabled, pressed });
|
|
107
|
-
|
|
108
|
-
return (
|
|
109
|
-
<View style={styles.container}>
|
|
110
|
-
<View style={styles.contentWrapper}>
|
|
111
|
-
<View style={styles.leadingWrapper}>{leadingContent}</View>
|
|
112
|
-
<View style={styles.textWrapper}>
|
|
113
|
-
<View style={styles.titleWrapper}>
|
|
114
|
-
<Text numberOfLines={1} style={styles.title}>
|
|
115
|
-
{title}
|
|
116
|
-
</Text>
|
|
117
|
-
{description && (
|
|
118
|
-
<Text numberOfLines={1} style={styles.description}>
|
|
119
|
-
{description}
|
|
120
|
-
</Text>
|
|
121
|
-
)}
|
|
122
|
-
</View>
|
|
123
|
-
{trailingContent}
|
|
124
|
-
</View>
|
|
125
|
-
</View>
|
|
126
|
-
</View>
|
|
127
|
-
);
|
|
128
|
-
};
|
|
129
|
-
|
|
130
69
|
/**
|
|
131
|
-
* A tile
|
|
132
|
-
*
|
|
133
|
-
* and supports long press actions.
|
|
70
|
+
* A flexible tile component that uses a composite pattern for maximum customization.
|
|
71
|
+
* Displays content in a vertical layout with support for spots, text, and custom content.
|
|
134
72
|
*
|
|
135
|
-
* @see {@link https://ldls.vercel.app/?path=/docs/
|
|
136
|
-
* @see {@link https://ldls.vercel.app/?path=/docs/
|
|
73
|
+
* @see {@link https://ldls.vercel.app/?path=/docs/react-native_containment-tile--docs Storybook}
|
|
74
|
+
* @see {@link https://ldls.vercel.app/?path=/docs/react-native_containment-tile--docs#dos-and-donts Guidelines}
|
|
137
75
|
*
|
|
138
76
|
* @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
|
|
139
77
|
* Do not use it to modify the tile's core appearance (colors, padding, etc). Use the `appearance` prop instead.
|
|
140
78
|
*
|
|
141
79
|
* @example
|
|
142
|
-
* // Basic tile
|
|
143
|
-
* import { Tile,
|
|
80
|
+
* // Basic tile with spot and content
|
|
81
|
+
* import { Tile, TileSpot, TileContent, TileTitle, TileDescription } from '@ledgerhq/lumen-ui-rnative';
|
|
144
82
|
* import { Wallet } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
145
83
|
*
|
|
146
|
-
* <Tile
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
84
|
+
* <Tile appearance="card" onPress={() => console.log('Pressed!')}>
|
|
85
|
+
* <TileSpot appearance="icon" icon={Wallet} />
|
|
86
|
+
* <TileContent>
|
|
87
|
+
* <TileTitle>My Wallet</TileTitle>
|
|
88
|
+
* <TileDescription>Description</TileDescription>
|
|
89
|
+
* </TileContent>
|
|
90
|
+
* </Tile>
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* // With custom content and long press
|
|
94
|
+
* import { Tile, TileSpot, TileContent, TileTitle, Tag } from '@ledgerhq/lumen-ui-rnative';
|
|
95
|
+
* import { Bitcoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
96
|
+
*
|
|
97
|
+
* <Tile appearance="card" onLongPress={() => console.log('Long pressed')}>
|
|
98
|
+
* <TileSpot appearance="icon" icon={Bitcoin} />
|
|
99
|
+
* <TileContent>
|
|
100
|
+
* <TileTitle>Bitcoin</TileTitle>
|
|
101
|
+
* </TileContent>
|
|
102
|
+
* <Tag label="Active" />
|
|
103
|
+
* </Tile>
|
|
153
104
|
*/
|
|
154
105
|
export const Tile = forwardRef<React.ElementRef<typeof Pressable>, TileProps>(
|
|
155
106
|
(
|
|
156
107
|
{
|
|
157
108
|
lx = {},
|
|
158
109
|
style,
|
|
159
|
-
title,
|
|
160
|
-
description,
|
|
161
|
-
leadingContent,
|
|
162
|
-
trailingContent,
|
|
163
110
|
appearance = 'no-background',
|
|
164
111
|
disabled = false,
|
|
112
|
+
children,
|
|
165
113
|
...props
|
|
166
114
|
},
|
|
167
115
|
ref,
|
|
168
116
|
) => {
|
|
169
117
|
return (
|
|
170
|
-
<
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
</
|
|
118
|
+
<TileProvider value={{ disabled }}>
|
|
119
|
+
<Pressable
|
|
120
|
+
ref={ref}
|
|
121
|
+
lx={lx}
|
|
122
|
+
style={StyleSheet.flatten([{ width: '100%' }, style])}
|
|
123
|
+
disabled={disabled}
|
|
124
|
+
accessibilityRole='button'
|
|
125
|
+
accessibilityState={{ disabled }}
|
|
126
|
+
{...props}
|
|
127
|
+
>
|
|
128
|
+
{({ pressed }) => (
|
|
129
|
+
<TilePressableContent
|
|
130
|
+
appearance={appearance}
|
|
131
|
+
disabled={disabled}
|
|
132
|
+
pressed={pressed}
|
|
133
|
+
>
|
|
134
|
+
{children}
|
|
135
|
+
</TilePressableContent>
|
|
136
|
+
)}
|
|
137
|
+
</Pressable>
|
|
138
|
+
</TileProvider>
|
|
191
139
|
);
|
|
192
140
|
},
|
|
193
141
|
);
|
|
194
|
-
|
|
195
142
|
Tile.displayName = 'Tile';
|
|
143
|
+
|
|
144
|
+
const TilePressableContent = ({
|
|
145
|
+
appearance,
|
|
146
|
+
disabled,
|
|
147
|
+
pressed,
|
|
148
|
+
children,
|
|
149
|
+
}: {
|
|
150
|
+
appearance: Appearance;
|
|
151
|
+
disabled: boolean;
|
|
152
|
+
pressed: boolean;
|
|
153
|
+
children: ReactNode;
|
|
154
|
+
}) => {
|
|
155
|
+
const styles = useRootStyles({ appearance, disabled, pressed });
|
|
156
|
+
return <View style={styles.container}>{children}</View>;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* A spot adapter for use within Tile. Automatically inherits the disabled state from the parent Tile.
|
|
161
|
+
* Always renders at a fixed size of 48.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* <Tile>
|
|
165
|
+
* <TileSpot appearance="icon" icon={Settings} />
|
|
166
|
+
* </Tile>
|
|
167
|
+
*/
|
|
168
|
+
export const TileSpot = (props: TileSpotProps) => {
|
|
169
|
+
const { disabled } = useTileContext({
|
|
170
|
+
consumerName: 'TileSpot',
|
|
171
|
+
contextRequired: true,
|
|
172
|
+
});
|
|
173
|
+
return <Spot {...props} size={48} disabled={disabled} />;
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
const useContentStyles = () => {
|
|
177
|
+
return useStyleSheet(
|
|
178
|
+
(t) => ({
|
|
179
|
+
container: {
|
|
180
|
+
width: t.sizes.full,
|
|
181
|
+
alignItems: 'center',
|
|
182
|
+
gap: t.spacings.s4,
|
|
183
|
+
},
|
|
184
|
+
}),
|
|
185
|
+
[],
|
|
186
|
+
);
|
|
187
|
+
};
|
|
188
|
+
TileSpot.displayName = 'TileSpot';
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* A container for grouping TileTitle and TileDescription with consistent spacing.
|
|
192
|
+
* Use this to wrap text content within a Tile.
|
|
193
|
+
*
|
|
194
|
+
* @example
|
|
195
|
+
* <Tile>
|
|
196
|
+
* <TileContent>
|
|
197
|
+
* <TileTitle>My Title</TileTitle>
|
|
198
|
+
* <TileDescription>My Description</TileDescription>
|
|
199
|
+
* </TileContent>
|
|
200
|
+
* </Tile>
|
|
201
|
+
*/
|
|
202
|
+
export const TileContent = ({ children, lx, style }: TileContentProps) => {
|
|
203
|
+
const styles = useContentStyles();
|
|
204
|
+
return (
|
|
205
|
+
<Box
|
|
206
|
+
lx={lx}
|
|
207
|
+
style={StyleSheet.flatten([styles.container, style])}
|
|
208
|
+
testID='tile-content'
|
|
209
|
+
>
|
|
210
|
+
{children}
|
|
211
|
+
</Box>
|
|
212
|
+
);
|
|
213
|
+
};
|
|
214
|
+
TileContent.displayName = 'TileContent';
|
|
215
|
+
|
|
216
|
+
const useTitleStyles = ({ disabled }: { disabled: boolean }) => {
|
|
217
|
+
return useStyleSheet(
|
|
218
|
+
(t) => ({
|
|
219
|
+
container: {
|
|
220
|
+
width: t.sizes.full,
|
|
221
|
+
alignItems: 'center',
|
|
222
|
+
},
|
|
223
|
+
text: StyleSheet.flatten([
|
|
224
|
+
t.typographies.body3SemiBold,
|
|
225
|
+
{
|
|
226
|
+
alignItems: 'center',
|
|
227
|
+
width: t.sizes.full,
|
|
228
|
+
textAlign: 'center',
|
|
229
|
+
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
230
|
+
},
|
|
231
|
+
]),
|
|
232
|
+
}),
|
|
233
|
+
[disabled],
|
|
234
|
+
);
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* The primary text label for a Tile. Automatically inherits the disabled state from the parent Tile.
|
|
239
|
+
* Text will truncate with ellipsis if it exceeds the available width.
|
|
240
|
+
* If children is a string, it will be automatically wrapped in a Text component.
|
|
241
|
+
*/
|
|
242
|
+
export const TileTitle = ({ children, lx, style }: TileTitleProps) => {
|
|
243
|
+
const { disabled } = useTileContext({
|
|
244
|
+
consumerName: 'TileTitle',
|
|
245
|
+
contextRequired: true,
|
|
246
|
+
});
|
|
247
|
+
const styles = useTitleStyles({ disabled });
|
|
248
|
+
|
|
249
|
+
if (isTextChildren(children)) {
|
|
250
|
+
return (
|
|
251
|
+
<Text
|
|
252
|
+
testID='tile-title'
|
|
253
|
+
numberOfLines={1}
|
|
254
|
+
lx={lx}
|
|
255
|
+
style={StyleSheet.flatten([styles.text, style])}
|
|
256
|
+
>
|
|
257
|
+
{children}
|
|
258
|
+
</Text>
|
|
259
|
+
);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return (
|
|
263
|
+
<Box
|
|
264
|
+
lx={lx}
|
|
265
|
+
style={StyleSheet.flatten([styles.container, style])}
|
|
266
|
+
testID='tile-title'
|
|
267
|
+
>
|
|
268
|
+
{children}
|
|
269
|
+
</Box>
|
|
270
|
+
);
|
|
271
|
+
};
|
|
272
|
+
TileTitle.displayName = 'TileTitle';
|
|
273
|
+
|
|
274
|
+
const useDescriptionStyles = ({ disabled }: { disabled: boolean }) => {
|
|
275
|
+
return useStyleSheet(
|
|
276
|
+
(t) => ({
|
|
277
|
+
container: {
|
|
278
|
+
width: t.sizes.full,
|
|
279
|
+
alignItems: 'center',
|
|
280
|
+
},
|
|
281
|
+
text: StyleSheet.flatten([
|
|
282
|
+
t.typographies.body3,
|
|
283
|
+
{
|
|
284
|
+
width: t.sizes.full,
|
|
285
|
+
alignItems: 'center',
|
|
286
|
+
textAlign: 'center',
|
|
287
|
+
color: disabled ? t.colors.text.disabled : t.colors.text.muted,
|
|
288
|
+
},
|
|
289
|
+
]),
|
|
290
|
+
}),
|
|
291
|
+
[disabled],
|
|
292
|
+
);
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* The secondary text label for a Tile. Automatically inherits the disabled state from the parent Tile.
|
|
297
|
+
* Text will truncate with ellipsis if it exceeds the available width.
|
|
298
|
+
* If children is a string, it will be automatically wrapped in a Text component.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* <Tile>
|
|
302
|
+
* <TileContent>
|
|
303
|
+
* <TileTitle>My Title</TileTitle>
|
|
304
|
+
* <TileDescription>My Description</TileDescription>
|
|
305
|
+
* </TileContent>
|
|
306
|
+
* </Tile>
|
|
307
|
+
*/
|
|
308
|
+
export const TileDescription = ({
|
|
309
|
+
children,
|
|
310
|
+
lx,
|
|
311
|
+
style,
|
|
312
|
+
}: TileDescriptionProps) => {
|
|
313
|
+
const { disabled } = useTileContext({
|
|
314
|
+
consumerName: 'TileDescription',
|
|
315
|
+
contextRequired: true,
|
|
316
|
+
});
|
|
317
|
+
const styles = useDescriptionStyles({ disabled });
|
|
318
|
+
|
|
319
|
+
if (isTextChildren(children)) {
|
|
320
|
+
return (
|
|
321
|
+
<Text
|
|
322
|
+
lx={lx}
|
|
323
|
+
numberOfLines={1}
|
|
324
|
+
style={StyleSheet.flatten([styles.text, style])}
|
|
325
|
+
testID='tile-description'
|
|
326
|
+
>
|
|
327
|
+
{children}
|
|
328
|
+
</Text>
|
|
329
|
+
);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return (
|
|
333
|
+
<Box
|
|
334
|
+
lx={lx}
|
|
335
|
+
style={StyleSheet.flatten([styles.container, style])}
|
|
336
|
+
testID='tile-description'
|
|
337
|
+
>
|
|
338
|
+
{children}
|
|
339
|
+
</Box>
|
|
340
|
+
);
|
|
341
|
+
};
|
|
342
|
+
TileDescription.displayName = 'TileDescription';
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
StyledPressableProps,
|
|
4
|
+
StyledTextProps,
|
|
5
|
+
StyledViewProps,
|
|
6
|
+
} from '../../../styles';
|
|
7
|
+
import { DiscriminatedSpotProps } from '../Spot/types';
|
|
8
|
+
|
|
9
|
+
export type TileContextValue = {
|
|
10
|
+
disabled: boolean;
|
|
11
|
+
};
|
|
3
12
|
|
|
4
13
|
export type TileProps = {
|
|
5
|
-
/**
|
|
6
|
-
* Custom content to display at the top (leading area) of the tile.
|
|
7
|
-
* Accepts ReactNode such as <Spot appearance="icon" icon={Settings} />
|
|
8
|
-
*/
|
|
9
|
-
leadingContent: ReactNode;
|
|
10
|
-
/**
|
|
11
|
-
* The title of the tile.
|
|
12
|
-
*/
|
|
13
|
-
title: string;
|
|
14
|
-
/**
|
|
15
|
-
* The description of the tile.
|
|
16
|
-
*/
|
|
17
|
-
description?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Custom content to display at the bottom (trailing area) of the tile.
|
|
20
|
-
* Accepts ReactNode such as <Tag label="New" appearance="base" />
|
|
21
|
-
*/
|
|
22
|
-
trailingContent?: ReactNode;
|
|
23
14
|
/**
|
|
24
15
|
* The visual style of the tile.
|
|
25
16
|
* - `no-background`: Transparent background with pressed state
|
|
@@ -42,4 +33,32 @@ export type TileProps = {
|
|
|
42
33
|
* Can be used to perform secondary actions.
|
|
43
34
|
*/
|
|
44
35
|
onLongPress?: StyledPressableProps['onLongPress'];
|
|
36
|
+
/**
|
|
37
|
+
* The children to display inside the tile.
|
|
38
|
+
*/
|
|
39
|
+
children: ReactNode;
|
|
45
40
|
} & Omit<StyledPressableProps, 'onPress' | 'onLongPress' | 'disabled'>;
|
|
41
|
+
|
|
42
|
+
export type TileSpotProps = DiscriminatedSpotProps;
|
|
43
|
+
|
|
44
|
+
export type TileContentProps = {
|
|
45
|
+
/**
|
|
46
|
+
* The children to display inside the tile content area.
|
|
47
|
+
* Typically contains TileTitle and TileDescription.
|
|
48
|
+
*/
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
} & StyledViewProps;
|
|
51
|
+
|
|
52
|
+
export type TileTitleProps = {
|
|
53
|
+
/**
|
|
54
|
+
* The title text to display.
|
|
55
|
+
*/
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
} & StyledViewProps;
|
|
58
|
+
|
|
59
|
+
export type TileDescriptionProps = {
|
|
60
|
+
/**
|
|
61
|
+
* The description text to display.
|
|
62
|
+
*/
|
|
63
|
+
children: ReactNode;
|
|
64
|
+
} & StyledTextProps;
|