@coinbase/cds-mobile 8.15.0 → 8.16.1
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/CHANGELOG.md +10 -0
- package/dts/cells/Cell.d.ts +29 -2
- package/dts/cells/Cell.d.ts.map +1 -1
- package/dts/cells/CellDetail.d.ts +4 -0
- package/dts/cells/CellDetail.d.ts.map +1 -1
- package/dts/cells/CellMedia.d.ts +4 -0
- package/dts/cells/CellMedia.d.ts.map +1 -1
- package/dts/cells/ListCell.d.ts +58 -4
- package/dts/cells/ListCell.d.ts.map +1 -1
- package/dts/cells/ListCellFallback.d.ts +1 -1
- package/dts/cells/ListCellFallback.d.ts.map +1 -1
- package/esm/cells/Cell.js +32 -16
- package/esm/cells/CellDetail.js +3 -2
- package/esm/cells/CellMedia.js +4 -0
- package/esm/cells/ListCell.js +53 -15
- package/esm/cells/ListCellFallback.js +10 -3
- package/esm/cells/__stories__/ListCell.stories.js +595 -110
- package/esm/cells/__stories__/ListCellFallback.stories.js +49 -30
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,16 @@ All notable changes to this project will be documented in this file.
|
|
|
8
8
|
|
|
9
9
|
<!-- template-start -->
|
|
10
10
|
|
|
11
|
+
## 8.16.1 ((10/9/2025, 08:02 AM PST))
|
|
12
|
+
|
|
13
|
+
This is an artificial version bump with no new change.
|
|
14
|
+
|
|
15
|
+
## 8.16.0 (10/8/2025 PST)
|
|
16
|
+
|
|
17
|
+
#### 🚀 Updates
|
|
18
|
+
|
|
19
|
+
- New ListCell in layoutSpacing variants. [[#31](https://github.com/coinbase/cds/pull/31)]
|
|
20
|
+
|
|
11
21
|
## 8.15.0 ((10/8/2025, 6:30 AM PST))
|
|
12
22
|
|
|
13
23
|
This is an artificial version bump with no new change.
|
package/dts/cells/Cell.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type StyleProp, type ViewProps, type ViewStyle } from 'react-native';
|
|
3
3
|
import type { ThemeVars } from '@coinbase/cds-common/core/theme';
|
|
4
4
|
import type { CellPriority, SharedProps } from '@coinbase/cds-common/types';
|
|
5
5
|
import { type BoxBaseProps, type BoxProps } from '../layout/Box';
|
|
@@ -24,13 +24,27 @@ export type CellSpacing = Pick<
|
|
|
24
24
|
>;
|
|
25
25
|
export type CellBaseProps = SharedProps &
|
|
26
26
|
LinkableProps & {
|
|
27
|
+
/** Accessory element rendered at the end of the cell (e.g., chevron). */
|
|
27
28
|
accessory?: React.ReactElement<CellAccessoryProps>;
|
|
29
|
+
/** Main content of the cell; typically title/description content. */
|
|
28
30
|
children: React.ReactNode;
|
|
31
|
+
/**
|
|
32
|
+
* End-aligned content (e.g., value, status).
|
|
33
|
+
* Replaces the deprecated `detail` prop.
|
|
34
|
+
*/
|
|
35
|
+
end?: React.ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated Use `end` instead. `detail` will be removed in a release.
|
|
38
|
+
*/
|
|
29
39
|
detail?: React.ReactNode;
|
|
40
|
+
/** Middle content between main content and detail. */
|
|
30
41
|
intermediary?: React.ReactNode;
|
|
42
|
+
/** Media rendered at the start of the cell (icon, avatar, image, etc). */
|
|
31
43
|
media?: React.ReactElement;
|
|
32
44
|
borderRadius?: ThemeVars.BorderRadius;
|
|
33
|
-
/**
|
|
45
|
+
/**
|
|
46
|
+
* @deprecated Use `styles.end` instead. `detailWidth` will be removed in a release.
|
|
47
|
+
*/
|
|
34
48
|
detailWidth?: number | string;
|
|
35
49
|
/** Is the cell disabled? Will apply opacity and disable interaction. */
|
|
36
50
|
disabled?: boolean;
|
|
@@ -46,6 +60,19 @@ export type CellBaseProps = SharedProps &
|
|
|
46
60
|
bottomContent?: React.ReactNode;
|
|
47
61
|
/** Measure the dimensions of the cell. */
|
|
48
62
|
onLayout?: ViewProps['onLayout'];
|
|
63
|
+
/** Styles for the components */
|
|
64
|
+
styles?: {
|
|
65
|
+
root?: StyleProp<ViewStyle>;
|
|
66
|
+
contentContainer?: StyleProp<ViewStyle>;
|
|
67
|
+
topContent?: StyleProp<ViewStyle>;
|
|
68
|
+
bottomContent?: StyleProp<ViewStyle>;
|
|
69
|
+
pressable?: StyleProp<ViewStyle>;
|
|
70
|
+
media?: StyleProp<ViewStyle>;
|
|
71
|
+
intermediary?: StyleProp<ViewStyle>;
|
|
72
|
+
/** Applied to the container of detail or action */
|
|
73
|
+
end?: StyleProp<ViewStyle>;
|
|
74
|
+
accessory?: StyleProp<ViewStyle>;
|
|
75
|
+
};
|
|
49
76
|
};
|
|
50
77
|
export type CellProps = BoxProps & CellBaseProps;
|
|
51
78
|
export declare const Cell: React.NamedExoticComponent<CellProps>;
|
package/dts/cells/Cell.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../src/cells/Cell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../src/cells/Cell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,KAAK,SAAS,EAAc,KAAK,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAK5E,OAAO,EAAO,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAGzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,MAAM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AE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC5B,gBAAgB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACxC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,aAAa,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACrC,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACjC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7B,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACpC,mDAAmD;QACnD,GAAG,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC3B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KAClC,CAAC;CACH,CAAC;AAEJ,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;AAEjD,eAAO,MAAM,IAAI,uCAgNf,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type TextProps } from '../typography/Text';
|
|
2
3
|
export type CellDetailVariant = 'foregroundMuted' | 'negative' | 'positive' | 'warning';
|
|
3
4
|
export type CellDetailProps = {
|
|
4
5
|
/**
|
|
@@ -13,7 +14,10 @@ export type CellDetailProps = {
|
|
|
13
14
|
subdetail?: React.ReactNode;
|
|
14
15
|
/** Variant color to apply to the subdetail text. */
|
|
15
16
|
variant?: CellDetailVariant;
|
|
17
|
+
/** Specifies whether font should be scaled down automatically to fit given style constraints. */
|
|
16
18
|
adjustsFontSizeToFit?: boolean;
|
|
19
|
+
/** Font to apply to the subdetail text. */
|
|
20
|
+
subdetailFont?: TextProps['font'];
|
|
17
21
|
};
|
|
18
22
|
export declare const CellDetail: React.NamedExoticComponent<CellDetailProps>;
|
|
19
23
|
//# sourceMappingURL=CellDetail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellDetail.d.ts","sourceRoot":"","sources":["../../src/cells/CellDetail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CellDetail.d.ts","sourceRoot":"","sources":["../../src/cells/CellDetail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AAIpC,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE1D,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AACxF,MAAM,MAAM,eAAe,GAAG;IAC5B;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,oDAAoD;IACpD,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,iGAAiG;IACjG,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,2CAA2C;IAC3C,aAAa,CAAC,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;CACnC,CAAC;AASF,eAAO,MAAM,UAAU,6CA2BrB,CAAC"}
|
package/dts/cells/CellMedia.d.ts
CHANGED
|
@@ -35,6 +35,10 @@ export type CellMediaProps = SharedProps &
|
|
|
35
35
|
*/
|
|
36
36
|
cache?: ImageURISource['cache'];
|
|
37
37
|
};
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated This component will be removed in a future release. Pass media directly via the `media` prop.
|
|
40
|
+
* For example: `<Avatar src={...} />`, `<Icon name={...} />`, `<RemoteImage source={...} />`, or a Pictogram.
|
|
41
|
+
*/
|
|
38
42
|
export declare const CellMedia: React.NamedExoticComponent<CellMediaProps>;
|
|
39
43
|
export {};
|
|
40
44
|
//# sourceMappingURL=CellMedia.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CellMedia.d.ts","sourceRoot":"","sources":["../../src/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AAmB,CAAC;AAEhG,MAAM,MAAM,cAAc,GAAG,WAAW,GACtC,qBAAqB,GACrB,IAAI,CAAC,wBAAwB,EAAE,oBAAoB,GAAG,mBAAmB,CAAC,GAAG;IAC3E;;;OAGG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;CACjC,CAAC;AAEJ;;;GAGG;AACH,eAAO,MAAM,SAAS,4CAwEpB,CAAC"}
|
package/dts/cells/ListCell.d.ts
CHANGED
|
@@ -1,15 +1,58 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import type { StyleProp, TextStyle } from 'react-native';
|
|
3
|
+
import { type CellBaseProps, type CellProps, type CellSpacing } from './Cell';
|
|
3
4
|
import { type CellAccessoryType } from './CellAccessory';
|
|
4
5
|
import { type CellDetailProps } from './CellDetail';
|
|
6
|
+
export declare const hugInnerSpacing: CellSpacing;
|
|
7
|
+
export declare const hugOuterSpacing: CellSpacing;
|
|
8
|
+
type CellStyles = NonNullable<CellBaseProps['styles']>;
|
|
5
9
|
export type ListCellBaseProps = CellDetailProps &
|
|
6
10
|
Omit<CellBaseProps, 'accessory' | 'children'> & {
|
|
7
11
|
/** Accessory to display at the end of the cell. */
|
|
8
12
|
accessory?: CellAccessoryType;
|
|
9
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* End-aligned content (e.g., CTA, form element, metric). Replacement for the deprecated action prop, and takes precedence over it.
|
|
15
|
+
* If the content is a action (like button, link, etc), we recommand avoid using alongside `onPress`.
|
|
16
|
+
* If used alongside `onClick`, the end action is triggered first and then the `onClick` handler.
|
|
17
|
+
*/
|
|
18
|
+
end?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated Use `end` instead. `action` will be removed in a release.
|
|
21
|
+
*/
|
|
10
22
|
action?: React.ReactNode;
|
|
11
|
-
/**
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated Use `layoutSpacing="compact"`. `compact` will be removed in a release.
|
|
25
|
+
*/
|
|
12
26
|
compact?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Layout spacing configuration.
|
|
29
|
+
* Deprecated values: 'spacious' and 'compact'. Prefer 'hug'.
|
|
30
|
+
* This prop will be removed in the next major release, new list cell will only have 'hug' spacing.
|
|
31
|
+
*
|
|
32
|
+
* When 'spacious' is set, the cell will have the following behavior:
|
|
33
|
+
* 1. min-height is 80px
|
|
34
|
+
* 2. Effective padding is '16px 24px' with 8px padding around the pressable area
|
|
35
|
+
* 3. border radius is 8px for pressable area
|
|
36
|
+
* 4. Title always cap at 1 line when there is no description, cap at 2 lines when there is description
|
|
37
|
+
* 5. Description and subdetail have font 'body'
|
|
38
|
+
*
|
|
39
|
+
* When 'compact' is set, the cell will have the following behavior:
|
|
40
|
+
* 1. min-height is 40px
|
|
41
|
+
* 2. Effective padding is '16px 24px' with 8px padding around the pressable area
|
|
42
|
+
* 3. border radius is 8px for pressable area
|
|
43
|
+
* 4. Title always cap at 1 line when there is no description, cap at 2 lines when there is description
|
|
44
|
+
* 5. Description and subdetail have font 'body'
|
|
45
|
+
*
|
|
46
|
+
* When 'hug' is set, the cell will have the following behavior:
|
|
47
|
+
* 1. No min-height, height is determined by the content
|
|
48
|
+
* 2. Padding is '4px 16px', no extra padding around the pressable area
|
|
49
|
+
* 3. 0 border radius for pressable area
|
|
50
|
+
* 4. Title always cap at 2 lines
|
|
51
|
+
* 5. Description and subdetail have font 'label2'
|
|
52
|
+
*
|
|
53
|
+
* @default 'spacious'
|
|
54
|
+
*/
|
|
55
|
+
layoutSpacing?: 'spacious' | 'compact' | 'hug';
|
|
13
56
|
/** Description of content. Max 1 line (with title) or 2 lines (without), otherwise will truncate. */
|
|
14
57
|
description?: React.ReactNode;
|
|
15
58
|
/**
|
|
@@ -24,7 +67,7 @@ export type ListCellBaseProps = CellDetailProps &
|
|
|
24
67
|
* the title will take up a single line truncating with ellipses.
|
|
25
68
|
*/
|
|
26
69
|
disableMultilineTitle?: boolean;
|
|
27
|
-
/**
|
|
70
|
+
/** Assistive message to display below the cell content. */
|
|
28
71
|
helperText?: React.ReactNode;
|
|
29
72
|
/** For internal use only. */
|
|
30
73
|
intermediary?: React.ReactNode;
|
|
@@ -33,7 +76,18 @@ export type ListCellBaseProps = CellDetailProps &
|
|
|
33
76
|
multiline?: boolean;
|
|
34
77
|
/** Title of content. Max 1 line (with description) or 2 lines (without), otherwise will truncate. */
|
|
35
78
|
title?: React.ReactNode;
|
|
79
|
+
/** Styles for the components */
|
|
80
|
+
styles?: Pick<
|
|
81
|
+
CellStyles,
|
|
82
|
+
'root' | 'media' | 'intermediary' | 'end' | 'accessory' | 'contentContainer' | 'pressable'
|
|
83
|
+
> & {
|
|
84
|
+
mainContent?: CellStyles['topContent'];
|
|
85
|
+
helperText?: CellStyles['bottomContent'];
|
|
86
|
+
title?: StyleProp<TextStyle>;
|
|
87
|
+
description?: StyleProp<TextStyle>;
|
|
88
|
+
};
|
|
36
89
|
};
|
|
37
90
|
export type ListCellProps = ListCellBaseProps & Omit<CellProps, 'accessory' | 'children'>;
|
|
38
91
|
export declare const ListCell: React.NamedExoticComponent<ListCellProps>;
|
|
92
|
+
export {};
|
|
39
93
|
//# sourceMappingURL=ListCell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListCell.d.ts","sourceRoot":"","sources":["../../src/cells/ListCell.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"ListCell.d.ts","sourceRoot":"","sources":["../../src/cells/ListCell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzD,OAAO,EAAQ,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,QAAQ,CAAC;AACpF,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACxE,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GAAG,WAAW,CAC3F,GAAG;QACF,WAAW,CAAC,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;QACvC,UAAU,CAAC,EAAE,UAAU,CAAC,eAAe,CAAC,CAAC;QACzC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7B,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KACpC,CAAC;CACH,CAAC;AAEJ,MAAM,MAAM,aAAa,GAAG,iBAAiB,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,GAAG,UAAU,CAAC,CAAC;AAE1F,eAAO,MAAM,QAAQ,2CAyHnB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import type { CellMediaType } from './CellMedia';
|
|
|
4
4
|
import { type ListCellBaseProps } from './ListCell';
|
|
5
5
|
export type ListCellFallbackBaseProps = SharedProps &
|
|
6
6
|
FallbackRectWidthProps &
|
|
7
|
-
Pick<ListCellBaseProps, 'compact' | 'innerSpacing' | 'outerSpacing'> & {
|
|
7
|
+
Pick<ListCellBaseProps, 'compact' | 'innerSpacing' | 'outerSpacing' | 'layoutSpacing'> & {
|
|
8
8
|
/** Display description shimmer. */
|
|
9
9
|
description?: boolean;
|
|
10
10
|
/** Display detail shimmer. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListCellFallback.d.ts","sourceRoot":"","sources":["../../src/cells/ListCellFallback.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ListCellFallback.d.ts","sourceRoot":"","sources":["../../src/cells/ListCellFallback.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAQtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAoC,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGtF,MAAM,MAAM,yBAAyB,GAAG,WAAW,GACjD,sBAAsB,GACtB,IAAI,CAAC,iBAAiB,EAAE,SAAS,GAAG,cAAc,GAAG,cAAc,GAAG,eAAe,CAAC,GAAG;IACvF,mCAAmC;IACnC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,mCAAmC;IACnC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,4DAA4D;IAC5D,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEJ,MAAM,MAAM,qBAAqB,GAAG,yBAAyB,GAAG;IAC9D,+DAA+D;IAC/D,MAAM,CAAC,EAAE;QACP,kEAAkE;QAClE,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAClC,4CAA4C;QAC5C,MAAM,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC9B,+CAA+C;QAC/C,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QACjC,2CAA2C;QAC3C,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;QAC7B,iDAAiD;QACjD,WAAW,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;KACpC,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,gBAAgB,6DA+I3B,CAAC"}
|
package/esm/cells/Cell.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
const _excluded = ["accessory", "alignItems", "borderRadius", "children", "detail", "detailWidth", "disabled", "intermediary", "media", "minHeight", "maxHeight", "onLayout", "onPress", "priority", "selected", "testID", "accessibilityLabel", "accessibilityHint", "gap", "columnGap", "rowGap", "innerSpacing", "outerSpacing", "bottomContent"],
|
|
1
|
+
const _excluded = ["accessory", "alignItems", "borderRadius", "children", "styles", "end", "detail", "detailWidth", "disabled", "intermediary", "media", "minHeight", "maxHeight", "onLayout", "onPress", "priority", "selected", "testID", "accessibilityLabel", "accessibilityHint", "gap", "columnGap", "rowGap", "innerSpacing", "outerSpacing", "bottomContent", "style"],
|
|
2
2
|
_excluded2 = ["marginX"];
|
|
3
3
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
4
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
5
5
|
import React, { memo, useMemo } from 'react';
|
|
6
|
+
import { StyleSheet } from 'react-native';
|
|
6
7
|
import { hasCellPriority } from '@coinbase/cds-common/utils/cell';
|
|
7
8
|
import { useCellSpacing } from '../hooks/useCellSpacing';
|
|
8
9
|
import { useTheme } from '../hooks/useTheme';
|
|
@@ -17,6 +18,8 @@ export const Cell = /*#__PURE__*/memo(function Cell(_ref) {
|
|
|
17
18
|
alignItems = 'center',
|
|
18
19
|
borderRadius = 200,
|
|
19
20
|
children,
|
|
21
|
+
styles,
|
|
22
|
+
end,
|
|
20
23
|
detail,
|
|
21
24
|
detailWidth,
|
|
22
25
|
disabled,
|
|
@@ -36,7 +39,8 @@ export const Cell = /*#__PURE__*/memo(function Cell(_ref) {
|
|
|
36
39
|
rowGap = 1,
|
|
37
40
|
innerSpacing: innerSpacingProp,
|
|
38
41
|
outerSpacing: outerSpacingProp,
|
|
39
|
-
bottomContent
|
|
42
|
+
bottomContent,
|
|
43
|
+
style
|
|
40
44
|
} = _ref,
|
|
41
45
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
42
46
|
const theme = useTheme();
|
|
@@ -52,23 +56,30 @@ export const Cell = /*#__PURE__*/memo(function Cell(_ref) {
|
|
|
52
56
|
} = innerSpacing,
|
|
53
57
|
innerSpacingWithoutMarginX = _objectWithoutPropertiesLoose(innerSpacing, _excluded2);
|
|
54
58
|
const content = useMemo(() => {
|
|
59
|
+
var _StyleSheet$flatten$w, _StyleSheet$flatten;
|
|
55
60
|
const contentContainerProps = _extends({
|
|
56
61
|
borderRadius,
|
|
57
62
|
testID,
|
|
58
63
|
renderToHardwareTextureAndroid: disabled
|
|
59
64
|
}, selected ? {
|
|
60
65
|
background: 'bgAlternate'
|
|
61
|
-
} : {}, onPress ? innerSpacingWithoutMarginX : innerSpacing
|
|
62
|
-
|
|
66
|
+
} : {}, onPress ? innerSpacingWithoutMarginX : innerSpacing, {
|
|
67
|
+
style: styles == null ? void 0 : styles.contentContainer
|
|
68
|
+
});
|
|
69
|
+
const topContentProps = {
|
|
63
70
|
alignItems,
|
|
64
71
|
flexGrow: 1,
|
|
65
72
|
gap: columnGap || gap,
|
|
66
|
-
width: '100%'
|
|
73
|
+
width: '100%',
|
|
74
|
+
style: styles == null ? void 0 : styles.topContent
|
|
67
75
|
};
|
|
76
|
+
const endWidth = (_StyleSheet$flatten$w = (_StyleSheet$flatten = StyleSheet.flatten(styles == null ? void 0 : styles.end)) == null ? void 0 : _StyleSheet$flatten.width) != null ? _StyleSheet$flatten$w : detailWidth;
|
|
77
|
+
const endContent = end != null ? end : detail;
|
|
68
78
|
const topContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
69
79
|
children: [!!media && /*#__PURE__*/_jsx(Box, {
|
|
70
80
|
flexGrow: 0,
|
|
71
81
|
flexShrink: 0,
|
|
82
|
+
style: styles == null ? void 0 : styles.media,
|
|
72
83
|
children: media
|
|
73
84
|
}), /*#__PURE__*/_jsx(Box, {
|
|
74
85
|
flexGrow: 1,
|
|
@@ -79,22 +90,25 @@ export const Cell = /*#__PURE__*/memo(function Cell(_ref) {
|
|
|
79
90
|
flexGrow: 0,
|
|
80
91
|
flexShrink: hasCellPriority('middle', priority) ? 0 : 1,
|
|
81
92
|
justifyContent: "center",
|
|
93
|
+
style: styles == null ? void 0 : styles.intermediary,
|
|
82
94
|
children: intermediary
|
|
83
|
-
}), !!
|
|
95
|
+
}), !!endContent && /*#__PURE__*/_jsx(Box, {
|
|
84
96
|
alignItems: "flex-end",
|
|
85
|
-
flexGrow:
|
|
86
|
-
flexShrink:
|
|
97
|
+
flexGrow: endWidth ? undefined : 1,
|
|
98
|
+
flexShrink: endWidth ? undefined : hasCellPriority('end', priority) ? 0 : 1,
|
|
87
99
|
justifyContent: "flex-end",
|
|
100
|
+
style: styles == null ? void 0 : styles.end,
|
|
88
101
|
width: detailWidth,
|
|
89
|
-
children:
|
|
102
|
+
children: endContent
|
|
90
103
|
}), !!accessory && /*#__PURE__*/_jsx(Box, {
|
|
91
104
|
flexGrow: 0,
|
|
92
105
|
flexShrink: 0,
|
|
106
|
+
style: styles == null ? void 0 : styles.accessory,
|
|
93
107
|
children: accessory
|
|
94
108
|
})]
|
|
95
109
|
});
|
|
96
110
|
if (!bottomContent) {
|
|
97
|
-
return /*#__PURE__*/_jsx(HStack, _extends({},
|
|
111
|
+
return /*#__PURE__*/_jsx(HStack, _extends({}, topContentProps, contentContainerProps, {
|
|
98
112
|
children: topContent
|
|
99
113
|
}));
|
|
100
114
|
}
|
|
@@ -104,14 +118,15 @@ export const Cell = /*#__PURE__*/memo(function Cell(_ref) {
|
|
|
104
118
|
gap: rowGap,
|
|
105
119
|
width: "100%"
|
|
106
120
|
}, contentContainerProps, {
|
|
107
|
-
children: [/*#__PURE__*/_jsx(HStack, _extends({},
|
|
121
|
+
children: [/*#__PURE__*/_jsx(HStack, _extends({}, topContentProps, {
|
|
108
122
|
children: topContent
|
|
109
123
|
})), /*#__PURE__*/_jsx(Box, {
|
|
124
|
+
style: styles == null ? void 0 : styles.bottomContent,
|
|
110
125
|
children: bottomContent
|
|
111
126
|
})]
|
|
112
127
|
}));
|
|
113
|
-
}, [borderRadius, testID, disabled, selected, onPress, innerSpacingWithoutMarginX, innerSpacing, alignItems, columnGap, gap, media, priority, children, intermediary, detail, detailWidth, accessory, bottomContent, rowGap]);
|
|
114
|
-
const
|
|
128
|
+
}, [borderRadius, testID, disabled, selected, onPress, innerSpacingWithoutMarginX, innerSpacing, alignItems, columnGap, gap, media, styles == null ? void 0 : styles.media, priority, children, intermediary, styles == null ? void 0 : styles.intermediary, end, detail, detailWidth, styles == null ? void 0 : styles.end, accessory, styles == null ? void 0 : styles.accessory, bottomContent, styles == null ? void 0 : styles.contentContainer, styles == null ? void 0 : styles.topContent, styles == null ? void 0 : styles.bottomContent, rowGap]);
|
|
129
|
+
const pressableWrappedContent = useMemo(() => {
|
|
115
130
|
if (onPress) {
|
|
116
131
|
const offsetStyle = {
|
|
117
132
|
marginHorizontal: -theme.space[innerSpacingMarginX * -1]
|
|
@@ -130,21 +145,22 @@ export const Cell = /*#__PURE__*/memo(function Cell(_ref) {
|
|
|
130
145
|
contentStyle: pressStyles,
|
|
131
146
|
disabled: disabled,
|
|
132
147
|
onPress: onPress,
|
|
133
|
-
style: [offsetStyle, pressStyles],
|
|
148
|
+
style: [offsetStyle, pressStyles, styles == null ? void 0 : styles.pressable],
|
|
134
149
|
children: content
|
|
135
150
|
});
|
|
136
151
|
}
|
|
137
152
|
return content;
|
|
138
|
-
}, [accessibilityHint, accessibilityLabel, borderRadius, content, disabled, onPress, innerSpacingMarginX, theme.space]);
|
|
153
|
+
}, [accessibilityHint, accessibilityLabel, borderRadius, content, disabled, onPress, innerSpacingMarginX, theme.space, styles == null ? void 0 : styles.pressable]);
|
|
139
154
|
return /*#__PURE__*/_jsx(Box, _extends({
|
|
140
155
|
alignItems: "stretch",
|
|
141
156
|
flexDirection: "row",
|
|
142
157
|
maxHeight: maxHeight,
|
|
143
158
|
minHeight: minHeight,
|
|
144
159
|
onLayout: onLayout,
|
|
160
|
+
style: [styles == null ? void 0 : styles.root, style],
|
|
145
161
|
width: "100%"
|
|
146
162
|
}, outerSpacing, props, {
|
|
147
|
-
children:
|
|
163
|
+
children: pressableWrappedContent
|
|
148
164
|
}));
|
|
149
165
|
});
|
|
150
166
|
Cell.displayName = 'Cell';
|
package/esm/cells/CellDetail.js
CHANGED
|
@@ -13,7 +13,8 @@ export const CellDetail = /*#__PURE__*/memo(function CellDetail(_ref) {
|
|
|
13
13
|
adjustsFontSizeToFit,
|
|
14
14
|
detail,
|
|
15
15
|
subdetail,
|
|
16
|
-
variant = 'foregroundMuted'
|
|
16
|
+
variant = 'foregroundMuted',
|
|
17
|
+
subdetailFont = 'label2'
|
|
17
18
|
} = _ref;
|
|
18
19
|
return /*#__PURE__*/_jsxs(VStack, {
|
|
19
20
|
alignContent: "flex-end",
|
|
@@ -27,7 +28,7 @@ export const CellDetail = /*#__PURE__*/memo(function CellDetail(_ref) {
|
|
|
27
28
|
}), !!subdetail && /*#__PURE__*/_jsx(Text, {
|
|
28
29
|
adjustsFontSizeToFit: adjustsFontSizeToFit,
|
|
29
30
|
color: variantColorMap[variant],
|
|
30
|
-
font:
|
|
31
|
+
font: subdetailFont,
|
|
31
32
|
numberOfLines: 1,
|
|
32
33
|
children: subdetail
|
|
33
34
|
})]
|
package/esm/cells/CellMedia.js
CHANGED
|
@@ -4,6 +4,10 @@ import { Icon } from '../icons/Icon';
|
|
|
4
4
|
import { Box } from '../layout/Box';
|
|
5
5
|
import { getSource, RemoteImage } from '../media/RemoteImage';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated This component will be removed in a future release. Pass media directly via the `media` prop.
|
|
9
|
+
* For example: `<Avatar src={...} />`, `<Icon name={...} />`, `<RemoteImage source={...} />`, or a Pictogram.
|
|
10
|
+
*/
|
|
7
11
|
export const CellMedia = /*#__PURE__*/memo(function CellMedia(props) {
|
|
8
12
|
let size = mediaSize;
|
|
9
13
|
let content = null;
|
package/esm/cells/ListCell.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const _excluded = ["accessory", "action", "compact", "title", "disableMultilineTitle", "description", "detail", "detailWidth", "intermediary", "priority", "innerSpacing", "outerSpacing", "disabled", "disableSelectionAccessory", "helperText", "media", "multiline", "selected", "subdetail", "variant", "onPress"];
|
|
1
|
+
const _excluded = ["accessory", "end", "action", "compact", "title", "disableMultilineTitle", "description", "detail", "detailWidth", "intermediary", "priority", "innerSpacing", "outerSpacing", "disabled", "disableSelectionAccessory", "helperText", "media", "multiline", "selected", "subdetail", "variant", "onPress", "layoutSpacing", "style", "styles"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
|
-
import React, { memo } from 'react';
|
|
4
|
+
import React, { memo, useMemo } from 'react';
|
|
5
5
|
import { compactListHeight, listHeight } from '@coinbase/cds-common/tokens/cell';
|
|
6
6
|
import { VStack } from '../layout/VStack';
|
|
7
7
|
import { Text } from '../typography/Text';
|
|
@@ -9,9 +9,22 @@ import { Cell } from './Cell';
|
|
|
9
9
|
import { CellAccessory } from './CellAccessory';
|
|
10
10
|
import { CellDetail } from './CellDetail';
|
|
11
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
|
+
export const hugInnerSpacing = {
|
|
13
|
+
paddingX: 2,
|
|
14
|
+
paddingY: 0.5,
|
|
15
|
+
marginX: 0
|
|
16
|
+
};
|
|
17
|
+
// no padding outside of the pressable area
|
|
18
|
+
export const hugOuterSpacing = {
|
|
19
|
+
paddingX: 0,
|
|
20
|
+
paddingY: 0,
|
|
21
|
+
marginX: 0
|
|
22
|
+
};
|
|
12
23
|
export const ListCell = /*#__PURE__*/memo(function ListCell(_ref) {
|
|
24
|
+
var _props$borderRadius;
|
|
13
25
|
let {
|
|
14
26
|
accessory,
|
|
27
|
+
end: endProp,
|
|
15
28
|
action,
|
|
16
29
|
compact,
|
|
17
30
|
title,
|
|
@@ -31,46 +44,71 @@ export const ListCell = /*#__PURE__*/memo(function ListCell(_ref) {
|
|
|
31
44
|
selected,
|
|
32
45
|
subdetail,
|
|
33
46
|
variant,
|
|
34
|
-
onPress
|
|
47
|
+
onPress,
|
|
48
|
+
layoutSpacing = compact ? 'compact' : 'spacious',
|
|
49
|
+
style,
|
|
50
|
+
styles
|
|
35
51
|
} = _ref,
|
|
36
52
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
37
|
-
const minHeight = compact ? compactListHeight : listHeight;
|
|
53
|
+
const minHeight = layoutSpacing === 'compact' ? compactListHeight : layoutSpacing === 'spacious' ? listHeight : undefined;
|
|
38
54
|
const accessoryType = selected && !disableSelectionAccessory ? 'selected' : accessory;
|
|
39
55
|
const hasDetails = Boolean(detail || subdetail);
|
|
56
|
+
const end = useMemo(() => endProp || action || hasDetails && /*#__PURE__*/_jsx(CellDetail, {
|
|
57
|
+
adjustsFontSizeToFit: !!detailWidth,
|
|
58
|
+
detail: detail,
|
|
59
|
+
subdetail: subdetail,
|
|
60
|
+
subdetailFont: layoutSpacing === 'hug' ? 'label2' : 'body',
|
|
61
|
+
variant: variant
|
|
62
|
+
}), [endProp, action, hasDetails, detail, subdetail, detailWidth, layoutSpacing, variant]);
|
|
40
63
|
return /*#__PURE__*/_jsx(Cell, _extends({
|
|
41
64
|
accessory: accessoryType ? /*#__PURE__*/_jsx(CellAccessory, {
|
|
42
65
|
type: accessoryType
|
|
43
66
|
}) : undefined,
|
|
67
|
+
borderRadius: (_props$borderRadius = props.borderRadius) != null ? _props$borderRadius : layoutSpacing === 'hug' ? 0 : undefined,
|
|
44
68
|
bottomContent: helperText,
|
|
45
|
-
detail: action || hasDetails && /*#__PURE__*/_jsx(CellDetail, {
|
|
46
|
-
adjustsFontSizeToFit: !!detailWidth,
|
|
47
|
-
detail: detail,
|
|
48
|
-
subdetail: subdetail,
|
|
49
|
-
variant: variant
|
|
50
|
-
}),
|
|
51
69
|
detailWidth: detailWidth,
|
|
52
70
|
disabled: disabled,
|
|
53
|
-
|
|
71
|
+
end: end,
|
|
72
|
+
innerSpacing: innerSpacing != null ? innerSpacing : layoutSpacing === 'hug' ? hugInnerSpacing : undefined,
|
|
54
73
|
intermediary: intermediary,
|
|
55
74
|
media: media,
|
|
56
75
|
minHeight: minHeight,
|
|
57
76
|
onPress: onPress,
|
|
58
|
-
outerSpacing: outerSpacing,
|
|
77
|
+
outerSpacing: outerSpacing != null ? outerSpacing : layoutSpacing === 'hug' ? hugOuterSpacing : undefined,
|
|
59
78
|
priority: priority,
|
|
60
|
-
selected: selected
|
|
79
|
+
selected: selected,
|
|
80
|
+
style: [style, styles == null ? void 0 : styles.root],
|
|
81
|
+
styles: {
|
|
82
|
+
media: styles == null ? void 0 : styles.media,
|
|
83
|
+
intermediary: styles == null ? void 0 : styles.intermediary,
|
|
84
|
+
end: styles == null ? void 0 : styles.end,
|
|
85
|
+
accessory: styles == null ? void 0 : styles.accessory,
|
|
86
|
+
topContent: styles == null ? void 0 : styles.mainContent,
|
|
87
|
+
bottomContent: styles == null ? void 0 : styles.helperText,
|
|
88
|
+
contentContainer: styles == null ? void 0 : styles.contentContainer,
|
|
89
|
+
pressable: [
|
|
90
|
+
// for the hug spacing, we need to offset the margin vertical to remove the strange gap between the pressable area
|
|
91
|
+
layoutSpacing === 'hug' && !!onPress && {
|
|
92
|
+
marginVertical: -1
|
|
93
|
+
}, styles == null ? void 0 : styles.pressable]
|
|
94
|
+
}
|
|
61
95
|
}, props, {
|
|
62
96
|
children: /*#__PURE__*/_jsxs(VStack, {
|
|
63
97
|
justifyContent: "center",
|
|
64
98
|
children: [!!title && /*#__PURE__*/_jsx(Text, {
|
|
65
99
|
ellipsize: "tail",
|
|
66
100
|
font: "headline",
|
|
67
|
-
numberOfLines:
|
|
101
|
+
numberOfLines: disableMultilineTitle ? 1 :
|
|
102
|
+
// wrap at 2 lines in hug layoutSpacing regardless of description
|
|
103
|
+
layoutSpacing === 'hug' ? 2 : description ? 1 : 2,
|
|
104
|
+
style: styles == null ? void 0 : styles.title,
|
|
68
105
|
children: title
|
|
69
106
|
}), !!description && /*#__PURE__*/_jsx(Text, {
|
|
70
107
|
color: "fgMuted",
|
|
71
108
|
ellipsize: multiline ? undefined : 'tail',
|
|
72
|
-
font:
|
|
109
|
+
font: layoutSpacing === 'hug' ? 'label2' : 'body',
|
|
73
110
|
numberOfLines: multiline ? undefined : title ? 1 : 2,
|
|
111
|
+
style: styles == null ? void 0 : styles.description,
|
|
74
112
|
children: description
|
|
75
113
|
})]
|
|
76
114
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const _excluded = ["title", "description", "detail", "subdetail", "media", "disableRandomRectWidth", "rectWidthVariant", "helperText", "styles"];
|
|
1
|
+
const _excluded = ["title", "description", "detail", "subdetail", "media", "disableRandomRectWidth", "rectWidthVariant", "helperText", "styles", "compact", "layoutSpacing", "innerSpacing", "outerSpacing"];
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
3
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
4
4
|
import { memo, useMemo } from 'react';
|
|
@@ -7,6 +7,7 @@ import { useTheme } from '../hooks/useTheme';
|
|
|
7
7
|
import { VStack } from '../layout';
|
|
8
8
|
import { Fallback } from '../layout/Fallback';
|
|
9
9
|
import { Cell } from './Cell';
|
|
10
|
+
import { hugInnerSpacing, hugOuterSpacing } from './ListCell';
|
|
10
11
|
import { MediaFallback } from './MediaFallback';
|
|
11
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
export const ListCellFallback = /*#__PURE__*/memo(function ListCellFallback(_ref) {
|
|
@@ -19,7 +20,11 @@ export const ListCellFallback = /*#__PURE__*/memo(function ListCellFallback(_ref
|
|
|
19
20
|
disableRandomRectWidth,
|
|
20
21
|
rectWidthVariant,
|
|
21
22
|
helperText,
|
|
22
|
-
styles
|
|
23
|
+
styles,
|
|
24
|
+
compact,
|
|
25
|
+
layoutSpacing = compact ? 'compact' : 'spacious',
|
|
26
|
+
innerSpacing,
|
|
27
|
+
outerSpacing
|
|
23
28
|
} = _ref,
|
|
24
29
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
25
30
|
const theme = useTheme();
|
|
@@ -100,7 +105,9 @@ export const ListCellFallback = /*#__PURE__*/memo(function ListCellFallback(_ref
|
|
|
100
105
|
return /*#__PURE__*/_jsx(Cell, _extends({
|
|
101
106
|
bottomContent: helperTextFallback,
|
|
102
107
|
detail: detailFallback,
|
|
103
|
-
|
|
108
|
+
innerSpacing: innerSpacing != null ? innerSpacing : layoutSpacing === 'hug' ? hugInnerSpacing : undefined,
|
|
109
|
+
media: mediaFallback,
|
|
110
|
+
outerSpacing: outerSpacing != null ? outerSpacing : layoutSpacing === 'hug' ? hugOuterSpacing : undefined
|
|
104
111
|
}, props, {
|
|
105
112
|
children: /*#__PURE__*/_jsxs(VStack, {
|
|
106
113
|
gap: 0.5,
|