@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
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
LumenTextStyle,
|
|
4
|
+
StyledPressableProps,
|
|
5
|
+
StyledTextProps,
|
|
6
|
+
StyledViewProps,
|
|
7
|
+
} from '../../../styles';
|
|
8
|
+
import { DiscriminatedSpotProps } from '../Spot';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Context value for passing state to sub-components
|
|
12
|
+
*/
|
|
13
|
+
export type ListItemContextValue = {
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Props for the ListItem root component
|
|
19
|
+
*/
|
|
20
|
+
export type ListItemProps = {
|
|
21
|
+
/**
|
|
22
|
+
* The content of the list item (ListItemLeading, ListItemTrailing)
|
|
23
|
+
*/
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
/**
|
|
26
|
+
* Whether the list item is disabled.
|
|
27
|
+
*/
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Callback function when the list item is pressed.
|
|
31
|
+
*/
|
|
32
|
+
onPress?: StyledPressableProps['onPress'];
|
|
33
|
+
} & Omit<StyledPressableProps, 'disabled' | 'children'>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Props for the ListItemLeading component
|
|
37
|
+
*/
|
|
38
|
+
export type ListItemLeadingProps = {
|
|
39
|
+
/**
|
|
40
|
+
* The content of the leading area (visual element + ListItemContent)
|
|
41
|
+
*/
|
|
42
|
+
children: React.ReactNode;
|
|
43
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Props for the ListItemContent component
|
|
47
|
+
*/
|
|
48
|
+
export type ListItemContentProps = {
|
|
49
|
+
/**
|
|
50
|
+
* The content (ListItemTitle, ListItemDescription)
|
|
51
|
+
*/
|
|
52
|
+
children: React.ReactNode;
|
|
53
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Props for the ListItemTitle component
|
|
57
|
+
*/
|
|
58
|
+
export type ListItemTitleProps = {
|
|
59
|
+
/**
|
|
60
|
+
* The title text or custom content
|
|
61
|
+
*/
|
|
62
|
+
children: React.ReactNode;
|
|
63
|
+
} & Omit<StyledTextProps, 'children'>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Props for the ListItemDescription component
|
|
67
|
+
*/
|
|
68
|
+
export type ListItemDescriptionProps = {
|
|
69
|
+
/**
|
|
70
|
+
* The description text or custom content
|
|
71
|
+
*/
|
|
72
|
+
children: React.ReactNode;
|
|
73
|
+
} & Omit<StyledTextProps, 'children'>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Props for the ListItemTrailing component
|
|
77
|
+
*/
|
|
78
|
+
export type ListItemTrailingProps = {
|
|
79
|
+
/**
|
|
80
|
+
* The trailing content (icons, switches, values, etc.)
|
|
81
|
+
*/
|
|
82
|
+
children: React.ReactNode;
|
|
83
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Props for the ListItemTruncate component
|
|
87
|
+
* Used to truncate text that should when ListItemDescription or ListItemTitle contain custom content
|
|
88
|
+
*/
|
|
89
|
+
export type ListItemTruncateProps = {
|
|
90
|
+
/**
|
|
91
|
+
* The text content to truncate
|
|
92
|
+
*/
|
|
93
|
+
children: string;
|
|
94
|
+
/**
|
|
95
|
+
* The variant determines typography and color styling.
|
|
96
|
+
* Use 'title' inside ListItemTitle and 'description' inside ListItemDescription.
|
|
97
|
+
* @default 'description'
|
|
98
|
+
*/
|
|
99
|
+
variant?: 'title' | 'description';
|
|
100
|
+
} & Omit<StyledTextProps, 'children'>;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Props for the ListItemSpot component
|
|
104
|
+
* Spot adapter that inherits disabled state from parent ListItem
|
|
105
|
+
*/
|
|
106
|
+
export type ListItemSpotProps = DiscriminatedSpotProps &
|
|
107
|
+
Omit<StyledViewProps, 'children'>;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Props for the ListItemIcon component
|
|
111
|
+
*/
|
|
112
|
+
export type ListItemIconProps = {
|
|
113
|
+
/**
|
|
114
|
+
* The icon component to render
|
|
115
|
+
*/
|
|
116
|
+
icon: React.ComponentType<any>;
|
|
117
|
+
/**
|
|
118
|
+
* Optional color override. If not provided, uses theme color with disabled state handling.
|
|
119
|
+
*/
|
|
120
|
+
color?: LumenTextStyle['color'];
|
|
121
|
+
} & Omit<StyledViewProps, 'children'>;
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
BottomSheetView,
|
|
9
9
|
useBottomSheetRef,
|
|
10
10
|
} from '../BottomSheet';
|
|
11
|
+
import { Divider } from '../Divider';
|
|
11
12
|
import { Box, Text } from '../Utility';
|
|
12
13
|
import { useGlobalSelectSafeContext } from './GlobalSelectContext';
|
|
13
14
|
|
|
@@ -17,12 +18,6 @@ const useStyles = () => {
|
|
|
17
18
|
bottomSheetView: {
|
|
18
19
|
paddingHorizontal: t.spacings.s8,
|
|
19
20
|
},
|
|
20
|
-
separator: {
|
|
21
|
-
marginVertical: t.spacings.s4,
|
|
22
|
-
marginHorizontal: t.spacings.s8,
|
|
23
|
-
height: 1,
|
|
24
|
-
backgroundColor: t.colors.bg.muted,
|
|
25
|
-
},
|
|
26
21
|
groupLabel: {
|
|
27
22
|
marginBottom: t.spacings.s4,
|
|
28
23
|
paddingHorizontal: t.spacings.s8,
|
|
@@ -133,7 +128,10 @@ export const GlobalSelectBottomSheet: React.FC = () => {
|
|
|
133
128
|
{currentSelect.items.map((item, index) => {
|
|
134
129
|
if (item.type === 'separator') {
|
|
135
130
|
return (
|
|
136
|
-
<
|
|
131
|
+
<Divider
|
|
132
|
+
key={`separator-${index}`}
|
|
133
|
+
lx={{ marginVertical: 's4', marginHorizontal: 's8' }}
|
|
134
|
+
/>
|
|
137
135
|
);
|
|
138
136
|
}
|
|
139
137
|
if (item.type === 'group-label') {
|
|
@@ -458,23 +458,9 @@ export const SelectItemText: React.FC<SelectItemTextProps> = ({
|
|
|
458
458
|
};
|
|
459
459
|
SelectItemText.displayName = 'SelectItemText';
|
|
460
460
|
|
|
461
|
-
export const SelectSeparator: React.FC<SelectSeparatorProps> = ({
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
}) => {
|
|
466
|
-
const styles = useStyleSheet(
|
|
467
|
-
(t) => ({
|
|
468
|
-
separator: {
|
|
469
|
-
marginHorizontal: t.spacings.s8,
|
|
470
|
-
marginVertical: t.spacings.s4,
|
|
471
|
-
height: t.sizes.s1,
|
|
472
|
-
backgroundColor: t.colors.border.mutedSubtle,
|
|
473
|
-
},
|
|
474
|
-
}),
|
|
475
|
-
[],
|
|
476
|
-
);
|
|
477
|
-
|
|
478
|
-
return <Box lx={lx} style={[styles.separator, style]} {...props} />;
|
|
461
|
+
export const SelectSeparator: React.FC<SelectSeparatorProps> = () => {
|
|
462
|
+
// This component doesn't render anything - it's used for structure
|
|
463
|
+
// The actual separators are rendered in GlobalSelectBottomSheet
|
|
464
|
+
return null;
|
|
479
465
|
};
|
|
480
466
|
SelectSeparator.displayName = 'SelectSeparator';
|
|
@@ -116,9 +116,7 @@ export type SelectItemTextProps = {
|
|
|
116
116
|
children: ReactNode;
|
|
117
117
|
} & StyledTextProps;
|
|
118
118
|
|
|
119
|
-
export type SelectSeparatorProps = {
|
|
120
|
-
// No extra props needed
|
|
121
|
-
} & BoxProps;
|
|
119
|
+
export type SelectSeparatorProps = {} & BoxProps;
|
|
122
120
|
|
|
123
121
|
export type SelectItemData = {
|
|
124
122
|
type: 'item';
|
|
@@ -41,7 +41,11 @@ type StatusSpotProps = {
|
|
|
41
41
|
appearance: Exclude<SpotAppearance, 'icon' | 'number'>;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
type DiscriminatedSpotProps =
|
|
44
|
+
export type DiscriminatedSpotProps =
|
|
45
|
+
| IconSpotProps
|
|
46
|
+
| NumberSpotProps
|
|
47
|
+
| StatusSpotProps;
|
|
48
|
+
|
|
45
49
|
export type SpotSize = 48 | 56 | 72;
|
|
46
50
|
|
|
47
51
|
export type SpotProps = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Meta, Story, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
2
|
import * as SwitchStories from './Switch.stories';
|
|
3
3
|
import { Switch } from './Switch';
|
|
4
|
+
import { Box } from '../Utility';
|
|
4
5
|
import { CustomTabs, Tab } from '../../../../.storybook/components';
|
|
5
6
|
import { DoVsDontRow, DoBlockItem, DontBlockItem } from '../../../../.storybook/components/DoVsDont';
|
|
6
7
|
import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/CommonRulesDoAndDont.mdx';
|
|
@@ -1,31 +1,28 @@
|
|
|
1
1
|
import figma from '@figma/code-connect';
|
|
2
2
|
import { Settings } from '../../Symbols';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* to return the code example you'd like to see in Figma
|
|
11
|
-
*/
|
|
3
|
+
import {
|
|
4
|
+
Tile,
|
|
5
|
+
TileSpot,
|
|
6
|
+
TileContent,
|
|
7
|
+
TileTitle,
|
|
8
|
+
TileDescription,
|
|
9
|
+
} from './Tile';
|
|
12
10
|
|
|
13
11
|
figma.connect(
|
|
14
12
|
Tile,
|
|
15
13
|
'https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7?node-id=5783-1328',
|
|
16
14
|
{
|
|
17
|
-
imports: [
|
|
15
|
+
imports: [
|
|
16
|
+
"import { Tile, TileSpot, TileContent, TileTitle, TileDescription } from '@ledgerhq/lumen-ui-rnative'",
|
|
17
|
+
],
|
|
18
18
|
props: {
|
|
19
19
|
title: figma.string('title'),
|
|
20
20
|
description: figma.boolean('show-description', {
|
|
21
21
|
true: figma.string('description'),
|
|
22
22
|
false: undefined,
|
|
23
23
|
}),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
true: figma.instance('tag'),
|
|
27
|
-
false: undefined,
|
|
28
|
-
}),
|
|
24
|
+
showTag: figma.boolean('show-tag'),
|
|
25
|
+
tag: figma.instance('tag'),
|
|
29
26
|
disabled: figma.enum('state', {
|
|
30
27
|
disabled: true,
|
|
31
28
|
}),
|
|
@@ -38,15 +35,19 @@ figma.connect(
|
|
|
38
35
|
],
|
|
39
36
|
example: (props) => (
|
|
40
37
|
<Tile
|
|
41
|
-
title={props.title}
|
|
42
|
-
description={props.description}
|
|
43
|
-
leadingContent={props.leadingContent}
|
|
44
|
-
trailingContent={props.trailingContent}
|
|
45
38
|
disabled={props.disabled}
|
|
46
|
-
onPress={() =>
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
onPress={() => console.log('Tile pressed')}
|
|
40
|
+
onLongPress={() => console.log('Long press - secondary action')}
|
|
41
|
+
>
|
|
42
|
+
<TileSpot appearance='icon' icon={Settings} />
|
|
43
|
+
<TileContent>
|
|
44
|
+
<TileTitle>{props.title}</TileTitle>
|
|
45
|
+
{props.description && (
|
|
46
|
+
<TileDescription>{props.description}</TileDescription>
|
|
47
|
+
)}
|
|
48
|
+
</TileContent>
|
|
49
|
+
{props.showTag && props.tag}
|
|
50
|
+
</Tile>
|
|
50
51
|
),
|
|
51
52
|
},
|
|
52
53
|
);
|
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
import { Meta, Story, Canvas, Controls } from '@storybook/addon-docs/blocks';
|
|
2
2
|
import * as TileStories from './Tile.stories';
|
|
3
3
|
import { Tile } from './Tile';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
CustomTabs,
|
|
6
|
+
Tab,
|
|
7
|
+
DoVsDontRow,
|
|
8
|
+
DoBlockItem,
|
|
9
|
+
DontBlockItem,
|
|
10
|
+
} from '../../../../.storybook/components';
|
|
5
11
|
import CommonRulesDoAndDont from '../../../../.storybook/components/DoVsDont/CommonRulesDoAndDont.mdx';
|
|
6
12
|
import { Box } from '../Utility';
|
|
7
13
|
|
|
@@ -14,42 +20,47 @@ import { Box } from '../Utility';
|
|
|
14
20
|
|
|
15
21
|
## Introduction
|
|
16
22
|
|
|
17
|
-
Tile components are compact, card-like interactive elements designed for horizontal lists, carousels, or grids. They
|
|
23
|
+
Tile components are compact, card-like interactive elements designed for horizontal lists, carousels, or grids. They use a flexible composite pattern that allows you to compose tiles with spots, text content, tags, and custom elements in a vertical layout.
|
|
18
24
|
|
|
19
25
|
> View in [Figma](https://www.figma.com/design/JxaLVMTWirCpU0rsbZ30k7/2.-Components-Library?node-id=5783-1328).
|
|
20
26
|
|
|
21
27
|
## Anatomy
|
|
22
28
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- **
|
|
26
|
-
- **
|
|
27
|
-
- **
|
|
28
|
-
- **Trailing Content (optional)**: Trailing custom content at the bottom of the tile
|
|
29
|
-
- **Secondary Action (optional)**: Action button in the top right corner, visible on hover
|
|
29
|
+
- **TileSpot**: Visual icon or element at the top
|
|
30
|
+
- **TileContent**: Container for title and description
|
|
31
|
+
- **TileTitle**: The main label of the item (required)
|
|
32
|
+
- **TileDescription (optional)**: Provides additional context
|
|
33
|
+
- **Custom Content (optional)**: Any ReactNode like Tag, View, etc.
|
|
30
34
|
|
|
31
35
|
## Properties
|
|
32
36
|
|
|
33
|
-
### Overview
|
|
34
|
-
|
|
35
37
|
<Canvas of={TileStories.Base} />
|
|
36
38
|
<Controls of={TileStories.Base} />
|
|
37
39
|
|
|
38
|
-
###
|
|
40
|
+
### Appearance & States
|
|
41
|
+
|
|
42
|
+
Two appearance variants are available with multiple interactive states:
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
**Appearances:**
|
|
45
|
+
- **no-background** (default): Transparent background with pressed states
|
|
46
|
+
- **card**: Surface background color with pressed states
|
|
41
47
|
|
|
42
|
-
|
|
48
|
+
**States:**
|
|
49
|
+
- **Default**: Base state with no interaction
|
|
50
|
+
- **Pressed**: Darker background when pressed
|
|
51
|
+
- **Disabled**: Non-interactive state with disabled styles
|
|
43
52
|
|
|
44
|
-
|
|
53
|
+
<Canvas of={TileStories.AppearanceShowcase} />
|
|
45
54
|
|
|
46
|
-
|
|
55
|
+
### Variants
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
Tile components support various configurations including different spot icons, with/without description, and with/without trailing content (tags).
|
|
49
58
|
|
|
50
|
-
|
|
59
|
+
<Canvas of={TileStories.VariantsShowcase} />
|
|
51
60
|
|
|
52
|
-
|
|
61
|
+
### Secondary Action (Long Press)
|
|
62
|
+
|
|
63
|
+
Use `onLongPress` for secondary actions on mobile devices. Try long pressing the tile below to see it in action.
|
|
53
64
|
|
|
54
65
|
<Canvas of={TileStories.WithSecondaryAction} />
|
|
55
66
|
|
|
@@ -75,42 +86,124 @@ Install and set up the library with our [Setup Guide →](?path=/docs/getting-st
|
|
|
75
86
|
## Basic Usage
|
|
76
87
|
|
|
77
88
|
```tsx
|
|
78
|
-
import {
|
|
89
|
+
import {
|
|
90
|
+
Tile,
|
|
91
|
+
TileSpot,
|
|
92
|
+
TileContent,
|
|
93
|
+
TileTitle,
|
|
94
|
+
TileDescription,
|
|
95
|
+
} from '@ledgerhq/lumen-ui-rnative';
|
|
79
96
|
import { Settings } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
80
97
|
|
|
81
98
|
function MyComponent() {
|
|
82
99
|
return (
|
|
83
100
|
<Tile
|
|
84
101
|
lx={{ width: 's128' }}
|
|
85
|
-
title='Settings'
|
|
86
|
-
description='BTC'
|
|
87
|
-
leadingContent={<Spot appearance='icon' icon={Settings} />}
|
|
88
|
-
trailingContent={<Tag label='Active' appearance='success' size='sm' />}
|
|
89
102
|
onPress={() => console.log('Primary action')}
|
|
90
103
|
onLongPress={() => console.log('Secondary action')}
|
|
91
|
-
|
|
104
|
+
>
|
|
105
|
+
<TileSpot appearance='icon' icon={Settings} />
|
|
106
|
+
<TileContent>
|
|
107
|
+
<TileTitle>Settings</TileTitle>
|
|
108
|
+
<TileDescription>Manage preferences</TileDescription>
|
|
109
|
+
</TileContent>
|
|
110
|
+
</Tile>
|
|
92
111
|
);
|
|
93
112
|
}
|
|
94
113
|
```
|
|
95
114
|
|
|
115
|
+
## Advanced Patterns
|
|
116
|
+
|
|
117
|
+
### With Custom Content (Tags, etc.)
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
import {
|
|
121
|
+
Tile,
|
|
122
|
+
TileSpot,
|
|
123
|
+
TileContent,
|
|
124
|
+
TileTitle,
|
|
125
|
+
TileDescription,
|
|
126
|
+
Tag,
|
|
127
|
+
} from '@ledgerhq/lumen-ui-rnative';
|
|
128
|
+
import { Bitcoin } from '@ledgerhq/lumen-ui-rnative/symbols';
|
|
129
|
+
|
|
130
|
+
<Tile appearance='card'>
|
|
131
|
+
<TileSpot appearance='icon' icon={Bitcoin} />
|
|
132
|
+
<TileContent>
|
|
133
|
+
<TileTitle>Bitcoin</TileTitle>
|
|
134
|
+
<TileDescription>BTC</TileDescription>
|
|
135
|
+
</TileContent>
|
|
136
|
+
<Tag label='Active' appearance='success' />
|
|
137
|
+
</Tile>;
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Disabled State
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
<Tile disabled>
|
|
144
|
+
<TileSpot appearance='icon' icon={Settings} />
|
|
145
|
+
<TileContent>
|
|
146
|
+
<TileTitle>Settings</TileTitle>
|
|
147
|
+
<TileDescription>Unavailable</TileDescription>
|
|
148
|
+
</TileContent>
|
|
149
|
+
</Tile>
|
|
150
|
+
```
|
|
151
|
+
|
|
96
152
|
### With Coin Icon
|
|
97
153
|
|
|
98
154
|
```tsx
|
|
99
|
-
import {
|
|
155
|
+
import {
|
|
156
|
+
Tile,
|
|
157
|
+
TileSpot,
|
|
158
|
+
TileContent,
|
|
159
|
+
TileTitle,
|
|
160
|
+
TileDescription,
|
|
161
|
+
} from '@ledgerhq/lumen-ui-rnative';
|
|
162
|
+
|
|
163
|
+
<Tile onPress={() => console.log('Clicked!')}>
|
|
164
|
+
<TileSpot appearance='coin' icon='btc' />
|
|
165
|
+
<TileContent>
|
|
166
|
+
<TileTitle>Bitcoin</TileTitle>
|
|
167
|
+
<TileDescription>BTC</TileDescription>
|
|
168
|
+
</TileContent>
|
|
169
|
+
</Tile>;
|
|
170
|
+
```
|
|
100
171
|
|
|
101
|
-
|
|
102
|
-
|
|
172
|
+
### Horizontal List
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
import { ScrollView } from 'react-native';
|
|
176
|
+
|
|
177
|
+
<ScrollView horizontal>
|
|
178
|
+
{items.map((item) => (
|
|
179
|
+
<Tile key={item.id} lx={{ width: 's128', flexShrink: 0 }}>
|
|
180
|
+
<TileSpot appearance='icon' icon={item.icon} />
|
|
181
|
+
<TileContent>
|
|
182
|
+
<TileTitle>{item.title}</TileTitle>
|
|
183
|
+
<TileDescription>{item.description}</TileDescription>
|
|
184
|
+
</TileContent>
|
|
185
|
+
</Tile>
|
|
186
|
+
))}
|
|
187
|
+
</ScrollView>;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### With Secondary Action (Long Press)
|
|
191
|
+
|
|
192
|
+
```tsx
|
|
103
193
|
<Tile
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
194
|
+
onPress={() => console.log('Primary action')}
|
|
195
|
+
onLongPress={() => console.log('Secondary action - show menu')}
|
|
196
|
+
>
|
|
197
|
+
<TileSpot appearance='icon' icon={Settings} />
|
|
198
|
+
<TileContent>
|
|
199
|
+
<TileTitle>Settings</TileTitle>
|
|
200
|
+
<TileDescription>Long press for options</TileDescription>
|
|
201
|
+
</TileContent>
|
|
202
|
+
</Tile>
|
|
111
203
|
```
|
|
112
204
|
|
|
113
205
|
## Do's and Don'ts
|
|
206
|
+
|
|
114
207
|
<Box lx={{ flexDirection: 'column', gap: 's24' }}>
|
|
115
208
|
<CommonRulesDoAndDont />
|
|
116
209
|
</Box>
|