@ledgerhq/lumen-ui-rnative 0.0.46 → 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 +6 -2
- 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/Icon/Icon.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/Icon.js +3 -4
- package/dist/src/lib/Components/Icon/createIcon.d.ts.map +1 -1
- package/dist/src/lib/Components/Icon/createIcon.js +1 -1
- package/dist/src/lib/Components/ListItem/ListItem.d.ts +88 -34
- package/dist/src/lib/Components/ListItem/ListItem.d.ts.map +1 -1
- package/dist/src/lib/Components/ListItem/ListItem.js +248 -97
- package/dist/src/lib/Components/ListItem/ListItem.stories.d.ts +2 -3
- package/dist/src/lib/Components/ListItem/ListItem.stories.d.ts.map +1 -1
- package/dist/src/lib/Components/ListItem/ListItem.stories.js +63 -73
- package/dist/src/lib/Components/ListItem/index.d.ts +1 -1
- package/dist/src/lib/Components/ListItem/index.d.ts.map +1 -1
- package/dist/src/lib/Components/ListItem/index.js +1 -1
- package/dist/src/lib/Components/ListItem/types.d.ts +106 -0
- package/dist/src/lib/Components/ListItem/types.d.ts.map +1 -0
- package/dist/src/lib/Components/ListItem/types.js +1 -0
- 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/Spot/types.d.ts +1 -1
- package/dist/src/lib/Components/Spot/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/dist/src/lib/utils/index.d.ts +3 -4
- package/dist/src/lib/utils/index.d.ts.map +1 -1
- package/dist/src/lib/utils/index.js +3 -4
- package/dist/src/lib/utils/react/{extract-text-from-children.d.ts → extractTextFromChildren.d.ts} +1 -1
- package/dist/src/lib/utils/react/extractTextFromChildren.d.ts.map +1 -0
- package/dist/src/lib/utils/react/index.d.ts +1 -1
- package/dist/src/lib/utils/react/index.d.ts.map +1 -1
- package/dist/src/lib/utils/react/index.js +1 -1
- package/dist/src/lib/utils/startTransition/index.d.ts +2 -0
- package/dist/src/lib/utils/startTransition/index.d.ts.map +1 -0
- package/dist/src/lib/utils/startTransition/index.js +1 -0
- package/dist/src/lib/utils/{start-transition/start-transition.d.ts → startTransition/startTransition.d.ts} +1 -1
- package/dist/src/lib/utils/startTransition/startTransition.d.ts.map +1 -0
- package/dist/src/lib/utils/useControllableState/index.d.ts +2 -0
- package/dist/src/lib/utils/useControllableState/index.d.ts.map +1 -0
- package/dist/src/lib/utils/useControllableState/index.js +1 -0
- package/dist/src/lib/utils/{use-controllable-state/use-controllable-state.d.ts → useControllableState/useControllableState.d.ts} +1 -1
- package/dist/src/lib/utils/useControllableState/useControllableState.d.ts.map +1 -0
- package/dist/src/lib/utils/{use-controllable-state/use-controllable-state.js → useControllableState/useControllableState.js} +2 -2
- package/dist/src/lib/utils/useEvent/index.d.ts +3 -0
- package/dist/src/lib/utils/useEvent/index.d.ts.map +1 -0
- package/dist/src/lib/utils/useEvent/index.js +2 -0
- package/dist/src/lib/utils/{use-event/use-event.d.ts → useEvent/useEvent.d.ts} +1 -1
- package/dist/src/lib/utils/useEvent/useEvent.d.ts.map +1 -0
- package/dist/src/lib/utils/{use-event/use-event.js → useEvent/useEvent.js} +1 -1
- package/dist/src/lib/utils/{use-event/use-get.d.ts → useEvent/useGet.d.ts} +1 -1
- package/dist/src/lib/utils/useEvent/useGet.d.ts.map +1 -0
- package/dist/src/styles/provider/LumenStyleSheetProvider.d.ts +1 -1
- package/dist/src/styles/provider/LumenStyleSheetProvider.d.ts.map +1 -1
- package/dist/src/styles/provider/LumenStyleSheetProvider.js +1 -2
- package/package.json +6 -2
- package/src/lib/Components/Checkbox/Checkbox.mdx +1 -0
- 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/Icon/Icon.tsx +3 -5
- package/src/lib/Components/Icon/createIcon.ts +1 -1
- package/src/lib/Components/ListItem/ListItem.mdx +402 -124
- package/src/lib/Components/ListItem/ListItem.stories.tsx +357 -228
- package/src/lib/Components/ListItem/ListItem.tsx +444 -181
- package/src/lib/Components/ListItem/index.ts +1 -1
- package/src/lib/Components/ListItem/types.ts +121 -0
- 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/Spot/types.ts +5 -1
- package/src/lib/Components/Switch/Switch.mdx +1 -0
- 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
- package/src/lib/utils/index.ts +3 -4
- package/src/lib/utils/react/index.ts +1 -1
- package/src/lib/utils/startTransition/index.ts +1 -0
- package/src/lib/utils/useControllableState/index.ts +1 -0
- package/src/lib/utils/{use-controllable-state/use-controllable-state.ts → useControllableState/useControllableState.ts} +2 -2
- package/src/lib/utils/useEvent/index.ts +2 -0
- package/src/lib/utils/{use-event/use-event.ts → useEvent/useEvent.ts} +1 -1
- package/src/styles/provider/LumenStyleSheetProvider.tsx +2 -3
- package/dist/src/lib/Components/ListItem/ListItem.types.d.ts +0 -31
- package/dist/src/lib/Components/ListItem/ListItem.types.d.ts.map +0 -1
- package/dist/src/lib/utils/react/extract-text-from-children.d.ts.map +0 -1
- package/dist/src/lib/utils/start-transition/index.d.ts +0 -2
- package/dist/src/lib/utils/start-transition/index.d.ts.map +0 -1
- package/dist/src/lib/utils/start-transition/index.js +0 -1
- package/dist/src/lib/utils/start-transition/start-transition.d.ts.map +0 -1
- package/dist/src/lib/utils/string-utils.d.ts +0 -6
- package/dist/src/lib/utils/string-utils.d.ts.map +0 -1
- package/dist/src/lib/utils/string-utils.js +0 -12
- package/dist/src/lib/utils/use-controllable-state/index.d.ts +0 -2
- package/dist/src/lib/utils/use-controllable-state/index.d.ts.map +0 -1
- package/dist/src/lib/utils/use-controllable-state/index.js +0 -1
- package/dist/src/lib/utils/use-controllable-state/use-controllable-state.d.ts.map +0 -1
- package/dist/src/lib/utils/use-event/index.d.ts +0 -3
- package/dist/src/lib/utils/use-event/index.d.ts.map +0 -1
- package/dist/src/lib/utils/use-event/index.js +0 -2
- package/dist/src/lib/utils/use-event/use-event.d.ts.map +0 -1
- package/dist/src/lib/utils/use-event/use-get.d.ts.map +0 -1
- package/src/lib/Components/ListItem/ListItem.types.ts +0 -31
- package/src/lib/utils/start-transition/index.ts +0 -1
- package/src/lib/utils/string-utils.test.ts +0 -73
- package/src/lib/utils/string-utils.ts +0 -11
- package/src/lib/utils/use-controllable-state/index.ts +0 -1
- package/src/lib/utils/use-event/index.ts +0 -2
- /package/dist/src/lib/Components/{ListItem/ListItem.types.js → Divider/types.js} +0 -0
- /package/dist/src/lib/utils/react/{extract-text-from-children.js → extractTextFromChildren.js} +0 -0
- /package/dist/src/lib/utils/{start-transition/start-transition.js → startTransition/startTransition.js} +0 -0
- /package/dist/src/lib/utils/{use-event/use-get.js → useEvent/useGet.js} +0 -0
- /package/src/lib/utils/react/{extract-text-from-children.ts → extractTextFromChildren.ts} +0 -0
- /package/src/lib/utils/{start-transition/start-transition.ts → startTransition/startTransition.ts} +0 -0
- /package/src/lib/utils/{use-event/use-get.ts → useEvent/useGet.ts} +0 -0
|
@@ -1,122 +1,273 @@
|
|
|
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 React from 'react';
|
|
3
|
-
import { StyleSheet,
|
|
4
|
-
import { useStyleSheet } from '../../../styles';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
gap: t.spacings.s16,
|
|
16
|
-
borderRadius: t.borderRadius.md,
|
|
17
|
-
backgroundColor: 'transparent',
|
|
18
|
-
paddingHorizontal: t.spacings.s8,
|
|
19
|
-
paddingVertical: t.spacings.s12,
|
|
20
|
-
},
|
|
21
|
-
pressed && {
|
|
22
|
-
backgroundColor: t.colors.bg.baseTransparentPressed,
|
|
23
|
-
},
|
|
24
|
-
disabled && {
|
|
25
|
-
backgroundColor: 'transparent',
|
|
26
|
-
},
|
|
27
|
-
]),
|
|
28
|
-
contentWrapper: {
|
|
29
|
-
flex: 1,
|
|
30
|
-
minWidth: 0,
|
|
4
|
+
import { StyleSheet, View } from 'react-native';
|
|
5
|
+
import { useStyleSheet, useTheme } from '../../../styles';
|
|
6
|
+
import { Spot } from '../Spot';
|
|
7
|
+
import { Box, Pressable, Text } from '../Utility';
|
|
8
|
+
const [ListItemProvider, useListItemContext] = createSafeContext('ListItem', {});
|
|
9
|
+
const [ListItemTrailingProvider, useListItemTrailingContext] = createSafeContext('ListItemTrailing', {
|
|
10
|
+
isInTrailing: false,
|
|
11
|
+
});
|
|
12
|
+
const useRootStyles = ({ pressed }) => {
|
|
13
|
+
return useStyleSheet((t) => ({
|
|
14
|
+
container: StyleSheet.flatten([
|
|
15
|
+
{
|
|
31
16
|
flexDirection: 'row',
|
|
32
17
|
alignItems: 'center',
|
|
33
|
-
|
|
18
|
+
height: t.sizes.s64,
|
|
19
|
+
width: t.sizes.full,
|
|
20
|
+
gap: t.spacings.s16,
|
|
21
|
+
borderRadius: t.borderRadius.md,
|
|
22
|
+
backgroundColor: 'transparent',
|
|
23
|
+
paddingHorizontal: t.spacings.s8,
|
|
24
|
+
paddingVertical: t.spacings.s12,
|
|
34
25
|
},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
pressed && {
|
|
27
|
+
backgroundColor: t.colors.bg.baseTransparentPressed,
|
|
28
|
+
},
|
|
29
|
+
]),
|
|
30
|
+
}), [pressed]);
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* A flexible list item component that provides a composable structure for displaying
|
|
34
|
+
* interactive list items with leading content, title, description, and trailing content.
|
|
35
|
+
*
|
|
36
|
+
* @see {@link https://ldls.vercel.app/?path=/docs/react-native_containment-listitem--docs Storybook}
|
|
37
|
+
* @see {@link https://ldls.vercel.app/?path=/docs/react-native_containment-listitem--docs#dos-and-donts Guidelines}
|
|
38
|
+
*
|
|
39
|
+
* @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
|
|
40
|
+
* Do not use it to modify the list item's core appearance (colors, padding, etc).
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* import {
|
|
44
|
+
* ListItem,
|
|
45
|
+
* ListItemLeading,
|
|
46
|
+
* ListItemSpot,
|
|
47
|
+
* ListItemContent,
|
|
48
|
+
* ListItemTitle,
|
|
49
|
+
* ListItemDescription,
|
|
50
|
+
* ListItemTrailing,
|
|
51
|
+
* } from '@ledgerhq/lumen-ui-rnative';
|
|
52
|
+
* import { Wallet, ChevronRight } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
53
|
+
*
|
|
54
|
+
* <ListItem onPress={() => console.log('Clicked!')}>
|
|
55
|
+
* <ListItemLeading>
|
|
56
|
+
* <ListItemSpot appearance="icon" icon={Wallet} />
|
|
57
|
+
* <ListItemContent>
|
|
58
|
+
* <ListItemTitle>Balance</ListItemTitle>
|
|
59
|
+
* <ListItemDescription>Optional description</ListItemDescription>
|
|
60
|
+
* </ListItemContent>
|
|
61
|
+
* </ListItemLeading>
|
|
62
|
+
* <ListItemTrailing>
|
|
63
|
+
* <ChevronRight size={24} />
|
|
64
|
+
* </ListItemTrailing>
|
|
65
|
+
* </ListItem>
|
|
66
|
+
*/
|
|
67
|
+
export const ListItem = React.forwardRef(({ children, lx = {}, style, disabled = false, ...pressableProps }, ref) => {
|
|
68
|
+
return (_jsx(ListItemProvider, { value: { disabled }, children: _jsx(Pressable, { ref: ref, lx: lx, style: style, disabled: disabled, accessibilityRole: 'button', accessibilityState: { disabled }, ...pressableProps, children: ({ pressed }) => (_jsx(ListItemInner, { pressed: pressed, children: children })) }) }));
|
|
69
|
+
});
|
|
70
|
+
ListItem.displayName = 'ListItem';
|
|
71
|
+
/**
|
|
72
|
+
* Internal component to handle pressed state styling
|
|
73
|
+
*/
|
|
74
|
+
const ListItemInner = ({ pressed, children, }) => {
|
|
75
|
+
const styles = useRootStyles({ pressed });
|
|
76
|
+
return (_jsx(View, { style: styles.container, testID: 'list-item-content', children: children }));
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Container for the leading (left) part of the list item.
|
|
80
|
+
* Contains the visual element (ListItemSpot, Avatar, Icon) and the content (title + description).
|
|
81
|
+
*/
|
|
82
|
+
export const ListItemLeading = React.forwardRef(({ children, lx = {}, style, ...viewProps }, ref) => {
|
|
83
|
+
const styles = useStyleSheet((t) => ({
|
|
84
|
+
leading: {
|
|
85
|
+
flex: 1,
|
|
86
|
+
minWidth: 0,
|
|
87
|
+
flexDirection: 'row',
|
|
88
|
+
alignItems: 'center',
|
|
89
|
+
gap: t.spacings.s12,
|
|
90
|
+
},
|
|
91
|
+
}), []);
|
|
92
|
+
return (_jsx(Box, { ref: ref, lx: lx, style: StyleSheet.flatten([styles.leading, style]), ...viewProps, children: children }));
|
|
93
|
+
});
|
|
94
|
+
ListItemLeading.displayName = 'ListItemLeading';
|
|
95
|
+
/**
|
|
96
|
+
* Container for the text content (title and description) within the leading area.
|
|
97
|
+
*/
|
|
98
|
+
export const ListItemContent = React.forwardRef(({ children, lx = {}, style, ...viewProps }, ref) => {
|
|
99
|
+
const { isInTrailing } = useListItemTrailingContext({
|
|
100
|
+
consumerName: 'ListItemContent',
|
|
101
|
+
contextRequired: false,
|
|
102
|
+
});
|
|
103
|
+
const styles = useStyleSheet((t) => ({
|
|
104
|
+
content: {
|
|
105
|
+
flex: isInTrailing ? 0 : 1,
|
|
106
|
+
minWidth: 0,
|
|
107
|
+
flexDirection: 'column',
|
|
108
|
+
gap: t.spacings.s4,
|
|
109
|
+
},
|
|
110
|
+
}), [isInTrailing]);
|
|
111
|
+
return (_jsx(Box, { ref: ref, lx: lx, style: StyleSheet.flatten([styles.content, style]), ...viewProps, children: children }));
|
|
112
|
+
});
|
|
113
|
+
ListItemContent.displayName = 'ListItemContent';
|
|
114
|
+
/**
|
|
115
|
+
* The main title of the list item. Can contain text directly or
|
|
116
|
+
* ListItemTruncate + Tag for more complex layouts.
|
|
117
|
+
*/
|
|
118
|
+
export const ListItemTitle = React.forwardRef(({ children, lx = {}, style, ...viewProps }, ref) => {
|
|
119
|
+
const { disabled } = useListItemContext({
|
|
120
|
+
consumerName: 'ListItemTitle',
|
|
121
|
+
contextRequired: true,
|
|
122
|
+
});
|
|
123
|
+
const { isInTrailing } = useListItemTrailingContext({
|
|
124
|
+
consumerName: 'ListItemTitle',
|
|
125
|
+
contextRequired: false,
|
|
126
|
+
});
|
|
127
|
+
const styles = useStyleSheet((t) => {
|
|
128
|
+
const { boxStyle } = StyleSheet.create({
|
|
129
|
+
boxStyle: {
|
|
130
|
+
flexDirection: 'row',
|
|
131
|
+
alignItems: 'center',
|
|
39
132
|
gap: t.spacings.s4,
|
|
133
|
+
width: '100%',
|
|
134
|
+
textAlign: isInTrailing ? 'right' : 'left',
|
|
135
|
+
justifyContent: isInTrailing ? 'flex-end' : 'flex-start',
|
|
40
136
|
},
|
|
41
|
-
|
|
137
|
+
});
|
|
138
|
+
return {
|
|
139
|
+
asBox: boxStyle,
|
|
140
|
+
asText: StyleSheet.flatten([
|
|
42
141
|
t.typographies.body2SemiBold,
|
|
43
142
|
{
|
|
143
|
+
...boxStyle,
|
|
44
144
|
color: disabled ? t.colors.text.disabled : t.colors.text.base,
|
|
45
145
|
},
|
|
46
146
|
]),
|
|
47
|
-
|
|
147
|
+
};
|
|
148
|
+
}, [disabled]);
|
|
149
|
+
// If children is a string, render it directly as Text with truncation
|
|
150
|
+
if (isTextChildren(children)) {
|
|
151
|
+
return (_jsx(Text, { ref: ref, lx: lx, style: StyleSheet.flatten([styles.asText, style]), numberOfLines: 1, ellipsizeMode: 'tail', children: children }));
|
|
152
|
+
}
|
|
153
|
+
// Otherwise, render as a row container for ListItemTruncate + Tag
|
|
154
|
+
return (_jsx(Box, { ref: ref, lx: lx, style: StyleSheet.flatten([styles.asBox, style]), ...viewProps, children: children }));
|
|
155
|
+
});
|
|
156
|
+
ListItemTitle.displayName = 'ListItemTitle';
|
|
157
|
+
/**
|
|
158
|
+
* Optional description below the title. Can contain text directly or
|
|
159
|
+
* ListItemTruncate + Tag for more complex layouts.
|
|
160
|
+
* Automatically applies disabled styling when the parent ListItem is disabled.
|
|
161
|
+
*/
|
|
162
|
+
export const ListItemDescription = React.forwardRef(({ children, lx = {}, style, ...viewProps }, ref) => {
|
|
163
|
+
const { disabled } = useListItemContext({
|
|
164
|
+
consumerName: 'ListItemDescription',
|
|
165
|
+
contextRequired: true,
|
|
166
|
+
});
|
|
167
|
+
const { isInTrailing } = useListItemTrailingContext({
|
|
168
|
+
consumerName: 'ListItemDescription',
|
|
169
|
+
contextRequired: false,
|
|
170
|
+
});
|
|
171
|
+
const styles = useStyleSheet((t) => {
|
|
172
|
+
const { boxStyle } = StyleSheet.create({
|
|
173
|
+
boxStyle: {
|
|
48
174
|
flexDirection: 'row',
|
|
49
175
|
alignItems: 'center',
|
|
50
176
|
gap: t.spacings.s4,
|
|
177
|
+
width: '100%',
|
|
178
|
+
textAlign: isInTrailing ? 'right' : 'left',
|
|
179
|
+
justifyContent: isInTrailing ? 'flex-end' : 'flex-start',
|
|
51
180
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
description: StyleSheet.flatten([
|
|
181
|
+
});
|
|
182
|
+
return {
|
|
183
|
+
asBox: boxStyle,
|
|
184
|
+
asText: StyleSheet.flatten([
|
|
57
185
|
t.typographies.body3,
|
|
58
186
|
{
|
|
187
|
+
...boxStyle,
|
|
59
188
|
color: disabled ? t.colors.text.disabled : t.colors.text.muted,
|
|
60
|
-
minWidth: 0,
|
|
61
|
-
flexShrink: 1,
|
|
62
189
|
},
|
|
63
190
|
]),
|
|
64
|
-
descriptionTagWrapper: {
|
|
65
|
-
height: t.sizes.s16,
|
|
66
|
-
flexShrink: 0,
|
|
67
|
-
flexDirection: 'row',
|
|
68
|
-
alignItems: 'center',
|
|
69
|
-
},
|
|
70
|
-
trailingWrapper: {
|
|
71
|
-
flexShrink: 0,
|
|
72
|
-
},
|
|
73
191
|
};
|
|
74
|
-
}, [disabled,
|
|
75
|
-
|
|
192
|
+
}, [disabled, isInTrailing]);
|
|
193
|
+
// If children is a string, render it directly as Text with truncation
|
|
194
|
+
if (isTextChildren(children)) {
|
|
195
|
+
return (_jsx(Text, { ref: ref, lx: lx, style: StyleSheet.flatten([styles.asText, style]), numberOfLines: 1, ellipsizeMode: 'tail', children: children }));
|
|
196
|
+
}
|
|
197
|
+
// Otherwise, render as a row container for ListItemTruncate + Tag
|
|
198
|
+
return (_jsx(Box, { ref: ref, lx: lx, style: StyleSheet.flatten([styles.asBox, style]), ...viewProps, children: children }));
|
|
199
|
+
});
|
|
200
|
+
ListItemDescription.displayName = 'ListItemDescription';
|
|
76
201
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* @see {@link https://ldls.vercel.app/?path=/docs/react-native_containment-listitem--docs Storybook}
|
|
81
|
-
* @see {@link https://ldls.vercel.app/?path=/docs/react-native_containment-listitem--docs#dos-and-donts Guidelines}
|
|
82
|
-
*
|
|
83
|
-
* @warning The `lx` prop should only be used for layout adjustments like margins or positioning.
|
|
84
|
-
* Do not use it to modify the list item's core appearance (colors, padding, etc).
|
|
85
|
-
*
|
|
86
|
-
* @example
|
|
87
|
-
* // Basic item
|
|
88
|
-
* import { ListItem } from '@ledgerhq/lumen-ui-rnative';
|
|
89
|
-
*
|
|
90
|
-
* <ListItem
|
|
91
|
-
* title="Basic Item"
|
|
92
|
-
* description="Optional description"
|
|
93
|
-
* onPress={() => console.log('Clicked!')}
|
|
94
|
-
* />
|
|
95
|
-
*
|
|
96
|
-
* // Icon trailing content with leading Spot
|
|
97
|
-
* import { ListItem, Spot } from '@ledgerhq/lumen-ui-rnative';
|
|
98
|
-
* import { Wallet, Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
99
|
-
*
|
|
100
|
-
* <ListItem
|
|
101
|
-
* title="Balance"
|
|
102
|
-
* leadingContent={<Spot appearance="icon" icon={Wallet} />}
|
|
103
|
-
* trailingContent={<Settings />}
|
|
104
|
-
* />
|
|
105
|
-
*
|
|
106
|
-
* // Chevron trailing content
|
|
107
|
-
* import { ListItem } from '@ledgerhq/lumen-ui-rnative';
|
|
108
|
-
* import { ChevronRight } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
109
|
-
*
|
|
110
|
-
* <ListItem
|
|
111
|
-
* title="Settings"
|
|
112
|
-
* trailingContent={<ChevronRight size={24} />}
|
|
113
|
-
* />
|
|
202
|
+
* Container for the trailing (right) content of the list item.
|
|
203
|
+
* Used for icons, switches, values, tags, chevrons, etc.
|
|
114
204
|
*/
|
|
115
|
-
export const
|
|
116
|
-
|
|
205
|
+
export const ListItemTrailing = React.forwardRef(({ children, lx = {}, style, ...viewProps }, ref) => {
|
|
206
|
+
const styles = useStyleSheet(() => ({
|
|
207
|
+
trailing: {
|
|
208
|
+
flexShrink: 0,
|
|
209
|
+
flexDirection: 'row',
|
|
210
|
+
alignItems: 'center',
|
|
211
|
+
},
|
|
212
|
+
}), []);
|
|
213
|
+
return (_jsx(ListItemTrailingProvider, { value: { isInTrailing: true }, children: _jsx(Box, { ref: ref, lx: lx, style: StyleSheet.flatten([styles.trailing, style]), ...viewProps, children: children }) }));
|
|
117
214
|
});
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
215
|
+
ListItemTrailing.displayName = 'ListItemTrailing';
|
|
216
|
+
/**
|
|
217
|
+
* Spot adapter for ListItem. Automatically inherits disabled state from parent ListItem.
|
|
218
|
+
* Fixed at size 48 for consistent list item appearance.
|
|
219
|
+
*/
|
|
220
|
+
export const ListItemSpot = (props) => {
|
|
221
|
+
const { disabled } = useListItemContext({
|
|
222
|
+
consumerName: 'ListItemSpot',
|
|
223
|
+
contextRequired: true,
|
|
224
|
+
});
|
|
225
|
+
return _jsx(Spot, { ...props, size: 48, disabled: disabled });
|
|
121
226
|
};
|
|
122
|
-
|
|
227
|
+
ListItemSpot.displayName = 'ListItemSpot';
|
|
228
|
+
/**
|
|
229
|
+
* Icon adapter for ListItem. Automatically inherits disabled state from parent ListItem.
|
|
230
|
+
* Fixed at size 24 for consistent list item appearance.
|
|
231
|
+
*/
|
|
232
|
+
export const ListItemIcon = ({ icon: Icon, color, lx = {}, style, ...viewProps }) => {
|
|
233
|
+
const { theme } = useTheme();
|
|
234
|
+
const { disabled } = useListItemContext({
|
|
235
|
+
consumerName: 'ListItemIcon',
|
|
236
|
+
contextRequired: true,
|
|
237
|
+
});
|
|
238
|
+
return (_jsx(Box, { lx: lx, style: StyleSheet.flatten([{ flexShrink: 0 }, style]), ...viewProps, children: _jsx(Icon, { size: 24, style: {
|
|
239
|
+
color: disabled
|
|
240
|
+
? theme.colors.text.disabled
|
|
241
|
+
: (color ?? theme.colors.text.base),
|
|
242
|
+
} }) }));
|
|
243
|
+
};
|
|
244
|
+
ListItemIcon.displayName = 'ListItemIcon';
|
|
245
|
+
/**
|
|
246
|
+
* Text wrapper that truncates when space is limited.
|
|
247
|
+
* Use inside ListItemTitle or ListItemDescription when combining text with a Tag.
|
|
248
|
+
* Set variant='title' for title styling or variant='description' (default) for description styling.
|
|
249
|
+
*/
|
|
250
|
+
export const ListItemTruncate = React.forwardRef(({ children, variant = 'description', lx = {}, style, ...textProps }, ref) => {
|
|
251
|
+
const { disabled } = useListItemContext({
|
|
252
|
+
consumerName: 'ListItemTruncate',
|
|
253
|
+
contextRequired: true,
|
|
254
|
+
});
|
|
255
|
+
const styles = useStyleSheet((t) => ({
|
|
256
|
+
truncate: StyleSheet.flatten([
|
|
257
|
+
variant === 'title'
|
|
258
|
+
? t.typographies.body2SemiBold
|
|
259
|
+
: t.typographies.body3,
|
|
260
|
+
{
|
|
261
|
+
color: disabled
|
|
262
|
+
? t.colors.text.disabled
|
|
263
|
+
: variant === 'title'
|
|
264
|
+
? t.colors.text.base
|
|
265
|
+
: t.colors.text.muted,
|
|
266
|
+
minWidth: 0,
|
|
267
|
+
flexShrink: 1,
|
|
268
|
+
},
|
|
269
|
+
]),
|
|
270
|
+
}), [disabled, variant]);
|
|
271
|
+
return (_jsx(Text, { ref: ref, lx: lx, style: StyleSheet.flatten([styles.truncate, style]), numberOfLines: 1, ellipsizeMode: 'tail', ...textProps, children: children }));
|
|
272
|
+
});
|
|
273
|
+
ListItemTruncate.displayName = 'ListItemTruncate';
|
|
@@ -4,8 +4,7 @@ declare const meta: Meta<typeof ListItem>;
|
|
|
4
4
|
export default meta;
|
|
5
5
|
type Story = StoryObj<typeof ListItem>;
|
|
6
6
|
export declare const Base: Story;
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const StateShowcase: Story;
|
|
7
|
+
export declare const VariantsShowcase: Story;
|
|
8
|
+
export declare const DisabledState: Story;
|
|
10
9
|
export declare const ResponsiveLayout: Story;
|
|
11
10
|
//# sourceMappingURL=ListItem.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItem.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/ListItem/ListItem.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"ListItem.stories.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/ListItem/ListItem.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAMvE,OAAO,EACL,QAAQ,EAST,MAAM,YAAY,CAAC;AAEpB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,QAAQ,CAkC/B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,QAAQ,CAAC,CAAC;AAEvC,eAAO,MAAM,IAAI,EAAE,KAgClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAqK9B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,KA+E3B,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAuE9B,CAAC"}
|
|
@@ -1,16 +1,26 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Settings, ChevronRight, Wallet } from '../../Symbols';
|
|
4
|
+
import { Switch } from '../Switch/Switch';
|
|
4
5
|
import { Tag } from '../Tag/Tag';
|
|
5
|
-
import { Box
|
|
6
|
-
import { ListItem } from './ListItem';
|
|
7
|
-
const Balance = ({ disabled }) => {
|
|
8
|
-
return (_jsxs(Box, { lx: { alignItems: 'flex-end' }, children: [_jsx(Text, { typography: 'body2SemiBold', lx: { color: disabled ? 'disabled' : 'base' }, children: "42.00" }), _jsx(Text, { typography: 'body3', lx: { color: disabled ? 'disabled' : 'muted' }, children: "USD" })] }));
|
|
9
|
-
};
|
|
6
|
+
import { Box } from '../Utility';
|
|
7
|
+
import { ListItem, ListItemLeading, ListItemContent, ListItemTitle, ListItemDescription, ListItemTrailing, ListItemSpot, ListItemIcon, ListItemTruncate, } from './ListItem';
|
|
10
8
|
const meta = {
|
|
11
9
|
component: ListItem,
|
|
12
10
|
title: 'Containment/ListItem',
|
|
11
|
+
subcomponents: {
|
|
12
|
+
ListItemLeading,
|
|
13
|
+
ListItemContent,
|
|
14
|
+
ListItemTitle,
|
|
15
|
+
ListItemDescription,
|
|
16
|
+
ListItemTrailing,
|
|
17
|
+
ListItemSpot,
|
|
18
|
+
ListItemIcon,
|
|
19
|
+
ListItemTruncate,
|
|
20
|
+
},
|
|
13
21
|
parameters: {
|
|
22
|
+
layout: 'padded',
|
|
23
|
+
backgrounds: { default: 'light' },
|
|
14
24
|
docs: {
|
|
15
25
|
source: {
|
|
16
26
|
language: 'tsx',
|
|
@@ -20,43 +30,9 @@ const meta = {
|
|
|
20
30
|
},
|
|
21
31
|
},
|
|
22
32
|
argTypes: {
|
|
23
|
-
|
|
24
|
-
control: '
|
|
25
|
-
description: '
|
|
26
|
-
},
|
|
27
|
-
description: {
|
|
28
|
-
control: 'text',
|
|
29
|
-
description: 'Optional description',
|
|
30
|
-
},
|
|
31
|
-
descriptionTag: {
|
|
32
|
-
control: 'select',
|
|
33
|
-
options: ['None', 'Tag'],
|
|
34
|
-
mapping: {
|
|
35
|
-
None: undefined,
|
|
36
|
-
Tag: _jsx(Tag, { label: 'New', appearance: 'accent', icon: Bolt, size: 'sm' }),
|
|
37
|
-
},
|
|
38
|
-
if: { arg: 'description', exists: true },
|
|
39
|
-
},
|
|
40
|
-
leadingContent: {
|
|
41
|
-
control: 'select',
|
|
42
|
-
options: ['None', 'Settings', 'Plus'],
|
|
43
|
-
mapping: {
|
|
44
|
-
None: undefined,
|
|
45
|
-
Settings: _jsx(Spot, { appearance: 'icon', icon: Settings }),
|
|
46
|
-
Plus: _jsx(Spot, { appearance: 'icon', icon: Plus }),
|
|
47
|
-
},
|
|
48
|
-
description: 'Optional leading content',
|
|
49
|
-
},
|
|
50
|
-
trailingContent: {
|
|
51
|
-
control: 'select',
|
|
52
|
-
description: 'Optional trailing content to display on the right side',
|
|
53
|
-
options: ['icon', 'value', 'tag', 'none'],
|
|
54
|
-
mapping: {
|
|
55
|
-
icon: _jsx(PenEdit, { size: 24 }),
|
|
56
|
-
value: _jsx(Balance, {}),
|
|
57
|
-
tag: _jsx(Tag, { label: 'New', appearance: 'accent' }),
|
|
58
|
-
none: undefined,
|
|
59
|
-
},
|
|
33
|
+
disabled: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Whether the list item is disabled',
|
|
60
36
|
},
|
|
61
37
|
onPress: {
|
|
62
38
|
action: 'pressed',
|
|
@@ -67,50 +43,64 @@ const meta = {
|
|
|
67
43
|
export default meta;
|
|
68
44
|
export const Base = {
|
|
69
45
|
args: {
|
|
70
|
-
title: 'Item with Icon and Description',
|
|
71
|
-
leadingContent: _jsx(Spot, { appearance: 'icon', icon: Settings }),
|
|
72
|
-
description: 'Additional information',
|
|
73
46
|
lx: { maxWidth: 's320' },
|
|
74
47
|
},
|
|
48
|
+
render: (args) => (_jsx(ListItem, { ...args, children: _jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Settings }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Item with Icon and Description" }), _jsx(ListItemDescription, { children: "Additional information" })] })] }) })),
|
|
75
49
|
parameters: {
|
|
76
50
|
docs: {
|
|
77
51
|
source: {
|
|
78
52
|
code: `
|
|
79
|
-
<ListItem
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
53
|
+
<ListItem>
|
|
54
|
+
<ListItemLeading>
|
|
55
|
+
<ListItemSpot appearance="icon" icon={Settings} />
|
|
56
|
+
<ListItemContent>
|
|
57
|
+
<ListItemTitle>Item with Icon and Description</ListItemTitle>
|
|
58
|
+
<ListItemDescription>Additional information</ListItemDescription>
|
|
59
|
+
</ListItemContent>
|
|
60
|
+
</ListItemLeading>
|
|
61
|
+
</ListItem>
|
|
84
62
|
`,
|
|
85
63
|
},
|
|
86
64
|
},
|
|
87
65
|
},
|
|
88
66
|
};
|
|
89
|
-
export const
|
|
90
|
-
args: {
|
|
91
|
-
title: 'Item with Description Tag',
|
|
92
|
-
leadingContent: _jsx(Spot, { appearance: 'icon', icon: Settings }),
|
|
93
|
-
description: 'Additional information',
|
|
94
|
-
descriptionTag: (_jsx(Tag, { label: 'New', appearance: 'accent', icon: Bolt, size: 'sm' })),
|
|
95
|
-
},
|
|
96
|
-
render: (args) => (_jsx(Box, { lx: { maxWidth: 's320' }, children: _jsx(ListItem, { ...args }) })),
|
|
97
|
-
};
|
|
98
|
-
export const TrailingContentVariantsShowcase = {
|
|
67
|
+
export const VariantsShowcase = {
|
|
99
68
|
render: () => {
|
|
100
|
-
|
|
69
|
+
const [selected, setSelected] = useState(false);
|
|
70
|
+
return (_jsxs(Box, { lx: { flexDirection: 'column', maxWidth: 's320', gap: 's8' }, children: [_jsx(ListItem, { children: _jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Settings }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Simple composition" }), _jsx(ListItemDescription, { children: "With description" })] })] }) }), _jsxs(ListItem, { onPress: () => setSelected(!selected), children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Wallet }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Switch Variant" }), _jsx(ListItemDescription, { children: "With description" })] })] }), _jsx(ListItemTrailing, { children: _jsx(Switch, { checked: selected, onCheckedChange: setSelected }) })] }), _jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Wallet }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Content Variant" }), _jsx(ListItemDescription, { children: "With description" })] })] }), _jsx(ListItemTrailing, { children: _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "42.10" }), _jsx(ListItemDescription, { children: "USD" })] }) })] }), _jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Wallet }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Content Variant" }), _jsx(ListItemDescription, { children: "Custom style" })] })] }), _jsx(ListItemTrailing, { children: _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "USD" }), _jsx(ListItemDescription, { lx: { color: 'error' }, children: "-7.53%" })] }) })] }), _jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Wallet }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Content Variant" }), _jsx(ListItemDescription, { children: "Custom style" })] })] }), _jsx(ListItemTrailing, { children: _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "USD" }), _jsx(ListItemDescription, { lx: { color: 'success' }, children: "+7.53%" })] }) })] }), _jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Settings }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Tag Variant" }), _jsx(ListItemDescription, { children: "Custom style" })] })] }), _jsx(ListItemTrailing, { children: _jsx(Tag, { size: 'sm', label: 'New', appearance: 'accent' }) })] }), _jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Settings }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Icon Variant" }), _jsx(ListItemDescription, { children: "With description" })] })] }), _jsx(ListItemTrailing, { children: _jsx(ListItemIcon, { icon: ChevronRight }) })] }), _jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemIcon, { icon: Wallet }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Icon without Spot" }), _jsx(ListItemDescription, { children: "Using ListItemIcon" })] })] }), _jsx(ListItemTrailing, { children: _jsx(ListItemIcon, { icon: ChevronRight }) })] }), _jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Wallet }), _jsxs(ListItemContent, { children: [_jsxs(ListItemTitle, { children: [_jsx(ListItemTruncate, { variant: 'title', children: "Complex 1" }), _jsx(Tag, { size: 'sm', label: 'New', appearance: 'base' })] }), _jsxs(ListItemDescription, { children: [_jsx(ListItemTruncate, { children: "With description" }), _jsx(Tag, { size: 'sm', label: 'Custom Tag', appearance: 'gray' })] })] })] }), _jsx(ListItemTrailing, { children: _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "42.10" }), _jsx(ListItemDescription, { children: "USD" })] }) })] }), _jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Wallet }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Complex 2" }), _jsx(ListItemDescription, { children: "With description" })] })] }), _jsx(ListItemTrailing, { children: _jsxs(ListItemContent, { children: [_jsxs(ListItemTitle, { children: [_jsx(Tag, { size: 'sm', label: 'New', appearance: 'base' }), _jsx(ListItemTruncate, { variant: 'title', children: "1200.12" })] }), _jsx(ListItemDescription, { children: _jsx(Tag, { size: 'sm', label: 'BTC', appearance: 'gray' }) })] }) })] })] }));
|
|
101
71
|
},
|
|
102
72
|
};
|
|
103
|
-
export const
|
|
104
|
-
|
|
105
|
-
|
|
73
|
+
export const DisabledState = {
|
|
74
|
+
args: {
|
|
75
|
+
disabled: true,
|
|
76
|
+
},
|
|
77
|
+
render: (args) => (_jsxs(Box, { lx: { flexDirection: 'column', width: 's320' }, children: [_jsxs(ListItem, { ...args, children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Settings }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Disabled Item" }), _jsx(ListItemDescription, { children: "This item is disabled" })] })] }), _jsx(ListItemTrailing, { children: _jsx(Switch, { checked: false, disabled: args.disabled }) })] }), _jsxs(ListItem, { ...args, children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Settings }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Disabled Item" }), _jsx(ListItemDescription, { children: "This item is disabled" })] })] }), _jsx(ListItemTrailing, { children: _jsx(ListItemIcon, { icon: ChevronRight }) })] }), _jsxs(ListItem, { ...args, children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Wallet }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Content Variant" }), _jsx(ListItemDescription, { children: "With description" })] })] }), _jsx(ListItemTrailing, { children: _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "42.10" }), _jsx(ListItemDescription, { children: "USD" })] }) })] }), _jsx(ListItem, { ...args, children: _jsxs(ListItemLeading, { children: [_jsx(ListItemIcon, { icon: Wallet }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Icon without Spot" }), _jsx(ListItemDescription, { children: "Using ListItemIcon" })] })] }) })] })),
|
|
78
|
+
parameters: {
|
|
79
|
+
docs: {
|
|
80
|
+
source: {
|
|
81
|
+
code: `
|
|
82
|
+
<ListItem disabled>
|
|
83
|
+
<ListItemLeading>
|
|
84
|
+
<ListItemSpot appearance="icon" icon={Settings} />
|
|
85
|
+
<ListItemContent>
|
|
86
|
+
<ListItemTitle>Disabled Item</ListItemTitle>
|
|
87
|
+
<ListItemDescription>This item is disabled</ListItemDescription>
|
|
88
|
+
</ListItemContent>
|
|
89
|
+
</ListItemLeading>
|
|
90
|
+
<ListItemTrailing>
|
|
91
|
+
<ChevronRight size={24} />
|
|
92
|
+
</ListItemTrailing>
|
|
93
|
+
</ListItem>
|
|
94
|
+
`,
|
|
95
|
+
},
|
|
96
|
+
},
|
|
106
97
|
},
|
|
107
98
|
};
|
|
108
99
|
export const ResponsiveLayout = {
|
|
109
|
-
render: () => {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
100
|
+
render: () => (_jsx(Box, { lx: {
|
|
101
|
+
width: 's400',
|
|
102
|
+
borderWidth: 's1',
|
|
103
|
+
borderColor: 'mutedSubtle',
|
|
104
|
+
padding: 's16',
|
|
105
|
+
}, children: _jsxs(Box, { lx: { flexDirection: 'column' }, children: [_jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Settings }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Short Title" }), _jsx(ListItemDescription, { children: "Short description" })] })] }), _jsx(ListItemTrailing, { children: _jsx(ListItemIcon, { icon: ChevronRight }) })] }), _jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Settings }), _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "Long Title that should truncate appropriately" }), _jsx(ListItemDescription, { children: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos." })] })] }), _jsx(ListItemTrailing, { children: _jsx(ListItemIcon, { icon: ChevronRight }) })] }), _jsxs(ListItem, { children: [_jsxs(ListItemLeading, { children: [_jsx(ListItemSpot, { appearance: 'icon', icon: Wallet }), _jsxs(ListItemContent, { children: [_jsxs(ListItemTitle, { children: [_jsx(ListItemTruncate, { variant: 'title', children: "Long Title that should truncate appropriately" }), _jsx(Tag, { size: 'sm', label: 'New', appearance: 'base' })] }), _jsxs(ListItemDescription, { children: [_jsx(ListItemTruncate, { children: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Quisquam, quos." }), _jsx(Tag, { size: 'sm', label: 'Custom Tag', appearance: 'gray' })] })] })] }), _jsx(ListItemTrailing, { children: _jsxs(ListItemContent, { children: [_jsx(ListItemTitle, { children: "42.10" }), _jsx(ListItemDescription, { children: "USD" })] }) })] })] }) })),
|
|
116
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/ListItem/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/ListItem/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './ListItem';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './types';
|