@ledgerhq/lumen-ui-rnative 0.0.42 → 0.0.44
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 +1 -1
- package/dist/src/lib/Components/Tile/Tile.d.ts.map +1 -1
- package/dist/src/lib/Components/Tile/Tile.js +54 -8
- package/dist/src/lib/Components/Tile/types.d.ts +14 -1
- package/dist/src/lib/Components/Tile/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/lib/Components/Tile/Tile.tsx +64 -13
- package/src/lib/Components/Tile/types.ts +14 -1
package/dist/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tile.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Tile/Tile.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAc,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"Tile.d.ts","sourceRoot":"","sources":["../../../../../src/lib/Components/Tile/Tile.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAc,MAAM,OAAO,CAAC;AAGvC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAiEpC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAwD9B,CAAC"}
|
|
@@ -3,15 +3,61 @@ import { cva } from 'class-variance-authority';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { View, Pressable, Text } from 'react-native';
|
|
5
5
|
const tileVariants = {
|
|
6
|
-
root: cva([
|
|
7
|
-
'relative flex w-full items-center gap-8 p-8',
|
|
8
|
-
'rounded-sm bg-base-transparent text-base transition-colors',
|
|
9
|
-
], {
|
|
6
|
+
root: cva(['relative flex w-full items-center gap-8 p-8', 'rounded-sm text-base'], {
|
|
10
7
|
variants: {
|
|
8
|
+
appearance: {
|
|
9
|
+
'no-background': 'bg-base-transparent',
|
|
10
|
+
card: 'bg-surface',
|
|
11
|
+
},
|
|
11
12
|
pressed: {
|
|
12
|
-
true: '
|
|
13
|
-
false: '
|
|
13
|
+
true: '',
|
|
14
|
+
false: '',
|
|
15
|
+
},
|
|
16
|
+
disabled: {
|
|
17
|
+
true: '',
|
|
18
|
+
false: '',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
compoundVariants: [
|
|
22
|
+
{
|
|
23
|
+
appearance: 'no-background',
|
|
24
|
+
pressed: true,
|
|
25
|
+
disabled: false,
|
|
26
|
+
className: 'bg-base-transparent-pressed',
|
|
14
27
|
},
|
|
28
|
+
{
|
|
29
|
+
appearance: 'card',
|
|
30
|
+
pressed: true,
|
|
31
|
+
disabled: false,
|
|
32
|
+
className: 'bg-surface-pressed',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
defaultVariants: {
|
|
36
|
+
appearance: 'no-background',
|
|
37
|
+
pressed: false,
|
|
38
|
+
disabled: false,
|
|
39
|
+
},
|
|
40
|
+
}),
|
|
41
|
+
title: cva('body-3-semi-bold w-full truncate text-center', {
|
|
42
|
+
variants: {
|
|
43
|
+
disabled: {
|
|
44
|
+
true: 'text-disabled',
|
|
45
|
+
false: 'text-base',
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
disabled: false,
|
|
50
|
+
},
|
|
51
|
+
}),
|
|
52
|
+
description: cva('body-3 w-full overflow-hidden truncate text-center', {
|
|
53
|
+
variants: {
|
|
54
|
+
disabled: {
|
|
55
|
+
true: 'text-disabled',
|
|
56
|
+
false: 'text-muted',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
defaultVariants: {
|
|
60
|
+
disabled: false,
|
|
15
61
|
},
|
|
16
62
|
}),
|
|
17
63
|
};
|
|
@@ -36,6 +82,6 @@ const tileVariants = {
|
|
|
36
82
|
* onLongPress={() => console.log('Long pressed!')}
|
|
37
83
|
* />
|
|
38
84
|
*/
|
|
39
|
-
export const Tile = forwardRef(({ title, description, leadingContent, trailingContent, onPress, onLongPress, ...props }, ref) => {
|
|
40
|
-
return (_jsx(Pressable, { ref: ref, onPress: onPress, onLongPress: onLongPress, ...props, children: ({ pressed }) => (_jsx(View, { className: tileVariants.root({ pressed }), children: _jsxs(View, { className: '
|
|
85
|
+
export const Tile = forwardRef(({ title, description, leadingContent, trailingContent, appearance = 'no-background', disabled = false, onPress, onLongPress, ...props }, ref) => {
|
|
86
|
+
return (_jsx(Pressable, { ref: ref, onPress: onPress, onLongPress: onLongPress, disabled: disabled, ...props, children: ({ pressed }) => (_jsx(View, { className: tileVariants.root({ appearance, pressed, disabled }), children: _jsxs(View, { className: 'w-full items-center gap-8', children: [_jsx(View, { className: 'items-center justify-center', children: leadingContent }), _jsxs(View, { className: 'w-full items-center gap-4', children: [_jsxs(View, { className: 'w-full items-center', children: [_jsx(Text, { numberOfLines: 1, className: tileVariants.title({ disabled }), children: title }), description && (_jsx(Text, { numberOfLines: 1, className: tileVariants.description({ disabled }), children: description }))] }), trailingContent] })] }) })) }));
|
|
41
87
|
});
|
|
@@ -19,6 +19,19 @@ export type TileProps = {
|
|
|
19
19
|
* Accepts ReactNode such as <Tag label="New" appearance="base" />
|
|
20
20
|
*/
|
|
21
21
|
trailingContent?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* The visual style of the tile.
|
|
24
|
+
* - `no-background`: Transparent background with pressed state
|
|
25
|
+
* - `card`: Surface background with pressed state
|
|
26
|
+
* @default 'no-background'
|
|
27
|
+
*/
|
|
28
|
+
appearance?: 'no-background' | 'card';
|
|
29
|
+
/**
|
|
30
|
+
* Whether the tile is disabled.
|
|
31
|
+
* When disabled, the tile will not respond to press events and will appear dimmed.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
disabled?: boolean;
|
|
22
35
|
/**
|
|
23
36
|
* Callback function when the tile is pressed.
|
|
24
37
|
*/
|
|
@@ -28,5 +41,5 @@ export type TileProps = {
|
|
|
28
41
|
* Can be used to perform secondary actions.
|
|
29
42
|
*/
|
|
30
43
|
onLongPress?: PressableProps['onLongPress'];
|
|
31
|
-
} & Omit<PressableProps, 'onPress' | 'onLongPress'>;
|
|
44
|
+
} & Omit<PressableProps, 'onPress' | 'onLongPress' | 'disabled'>;
|
|
32
45
|
//# 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,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,cAAc,EAAE,SAAS,CAAC;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;CAC7C,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,aAAa,CAAC,CAAC"}
|
|
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,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG;IACtB;;;OAGG;IACH,cAAc,EAAE,SAAS,CAAC;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,eAAe,GAAG,MAAM,CAAC;IACtC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IACpC;;;OAGG;IACH,WAAW,CAAC,EAAE,cAAc,CAAC,aAAa,CAAC,CAAC;CAC7C,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,19 +6,65 @@ import { TileProps } from './types';
|
|
|
6
6
|
|
|
7
7
|
const tileVariants = {
|
|
8
8
|
root: cva(
|
|
9
|
-
[
|
|
10
|
-
'relative flex w-full items-center gap-8 p-8',
|
|
11
|
-
'rounded-sm bg-base-transparent text-base transition-colors',
|
|
12
|
-
],
|
|
9
|
+
['relative flex w-full items-center gap-8 p-8', 'rounded-sm text-base'],
|
|
13
10
|
{
|
|
14
11
|
variants: {
|
|
12
|
+
appearance: {
|
|
13
|
+
'no-background': 'bg-base-transparent',
|
|
14
|
+
card: 'bg-surface',
|
|
15
|
+
},
|
|
15
16
|
pressed: {
|
|
16
|
-
true: '
|
|
17
|
-
false: '
|
|
17
|
+
true: '',
|
|
18
|
+
false: '',
|
|
19
|
+
},
|
|
20
|
+
disabled: {
|
|
21
|
+
true: '',
|
|
22
|
+
false: '',
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
compoundVariants: [
|
|
26
|
+
{
|
|
27
|
+
appearance: 'no-background',
|
|
28
|
+
pressed: true,
|
|
29
|
+
disabled: false,
|
|
30
|
+
className: 'bg-base-transparent-pressed',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
appearance: 'card',
|
|
34
|
+
pressed: true,
|
|
35
|
+
disabled: false,
|
|
36
|
+
className: 'bg-surface-pressed',
|
|
18
37
|
},
|
|
38
|
+
],
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
appearance: 'no-background',
|
|
41
|
+
pressed: false,
|
|
42
|
+
disabled: false,
|
|
19
43
|
},
|
|
20
44
|
},
|
|
21
45
|
),
|
|
46
|
+
title: cva('body-3-semi-bold w-full truncate text-center', {
|
|
47
|
+
variants: {
|
|
48
|
+
disabled: {
|
|
49
|
+
true: 'text-disabled',
|
|
50
|
+
false: 'text-base',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
disabled: false,
|
|
55
|
+
},
|
|
56
|
+
}),
|
|
57
|
+
description: cva('body-3 w-full overflow-hidden truncate text-center', {
|
|
58
|
+
variants: {
|
|
59
|
+
disabled: {
|
|
60
|
+
true: 'text-disabled',
|
|
61
|
+
false: 'text-muted',
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
defaultVariants: {
|
|
65
|
+
disabled: false,
|
|
66
|
+
},
|
|
67
|
+
}),
|
|
22
68
|
};
|
|
23
69
|
|
|
24
70
|
/**
|
|
@@ -49,6 +95,8 @@ export const Tile: FC<TileProps> = forwardRef<PressableRef, TileProps>(
|
|
|
49
95
|
description,
|
|
50
96
|
leadingContent,
|
|
51
97
|
trailingContent,
|
|
98
|
+
appearance = 'no-background',
|
|
99
|
+
disabled = false,
|
|
52
100
|
onPress,
|
|
53
101
|
onLongPress,
|
|
54
102
|
...props
|
|
@@ -60,26 +108,29 @@ export const Tile: FC<TileProps> = forwardRef<PressableRef, TileProps>(
|
|
|
60
108
|
ref={ref}
|
|
61
109
|
onPress={onPress}
|
|
62
110
|
onLongPress={onLongPress}
|
|
111
|
+
disabled={disabled}
|
|
63
112
|
{...props}
|
|
64
113
|
>
|
|
65
114
|
{({ pressed }) => (
|
|
66
|
-
<View
|
|
67
|
-
|
|
68
|
-
|
|
115
|
+
<View
|
|
116
|
+
className={tileVariants.root({ appearance, pressed, disabled })}
|
|
117
|
+
>
|
|
118
|
+
<View className='w-full items-center gap-8'>
|
|
119
|
+
<View className='items-center justify-center'>
|
|
69
120
|
{leadingContent}
|
|
70
121
|
</View>
|
|
71
|
-
<View className='
|
|
72
|
-
<View className='
|
|
122
|
+
<View className='w-full items-center gap-4'>
|
|
123
|
+
<View className='w-full items-center'>
|
|
73
124
|
<Text
|
|
74
125
|
numberOfLines={1}
|
|
75
|
-
className=
|
|
126
|
+
className={tileVariants.title({ disabled })}
|
|
76
127
|
>
|
|
77
128
|
{title}
|
|
78
129
|
</Text>
|
|
79
130
|
{description && (
|
|
80
131
|
<Text
|
|
81
132
|
numberOfLines={1}
|
|
82
|
-
className=
|
|
133
|
+
className={tileVariants.description({ disabled })}
|
|
83
134
|
>
|
|
84
135
|
{description}
|
|
85
136
|
</Text>
|
|
@@ -20,6 +20,19 @@ export type TileProps = {
|
|
|
20
20
|
* Accepts ReactNode such as <Tag label="New" appearance="base" />
|
|
21
21
|
*/
|
|
22
22
|
trailingContent?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* The visual style of the tile.
|
|
25
|
+
* - `no-background`: Transparent background with pressed state
|
|
26
|
+
* - `card`: Surface background with pressed state
|
|
27
|
+
* @default 'no-background'
|
|
28
|
+
*/
|
|
29
|
+
appearance?: 'no-background' | 'card';
|
|
30
|
+
/**
|
|
31
|
+
* Whether the tile is disabled.
|
|
32
|
+
* When disabled, the tile will not respond to press events and will appear dimmed.
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
disabled?: boolean;
|
|
23
36
|
/**
|
|
24
37
|
* Callback function when the tile is pressed.
|
|
25
38
|
*/
|
|
@@ -29,4 +42,4 @@ export type TileProps = {
|
|
|
29
42
|
* Can be used to perform secondary actions.
|
|
30
43
|
*/
|
|
31
44
|
onLongPress?: PressableProps['onLongPress'];
|
|
32
|
-
} & Omit<PressableProps, 'onPress' | 'onLongPress'>;
|
|
45
|
+
} & Omit<PressableProps, 'onPress' | 'onLongPress' | 'disabled'>;
|