@coinbase/cds-mobile 8.41.0 → 8.43.0

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.
Files changed (114) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dts/alpha/data-card/DataCard.d.ts +27 -0
  3. package/dts/alpha/data-card/DataCard.d.ts.map +1 -0
  4. package/dts/alpha/data-card/DataCardLayout.d.ts +38 -0
  5. package/dts/alpha/data-card/DataCardLayout.d.ts.map +1 -0
  6. package/dts/alpha/data-card/__figma__/DataCard.figma.d.ts +2 -0
  7. package/dts/alpha/data-card/__figma__/DataCard.figma.d.ts.map +1 -0
  8. package/dts/alpha/data-card/index.d.ts +3 -0
  9. package/dts/alpha/data-card/index.d.ts.map +1 -0
  10. package/dts/alpha/index.d.ts +1 -0
  11. package/dts/alpha/index.d.ts.map +1 -1
  12. package/dts/cards/AnnouncementCard.d.ts +2 -2
  13. package/dts/cards/AnnouncementCard.d.ts.map +1 -1
  14. package/dts/cards/CardMedia.d.ts +1 -2
  15. package/dts/cards/CardMedia.d.ts.map +1 -1
  16. package/dts/cards/CardRoot.d.ts +32 -0
  17. package/dts/cards/CardRoot.d.ts.map +1 -0
  18. package/dts/cards/ContainedAssetCard.d.ts +27 -0
  19. package/dts/cards/ContainedAssetCard.d.ts.map +1 -1
  20. package/dts/cards/ContentCard/ContentCard.d.ts.map +1 -1
  21. package/dts/cards/ContentCard/ContentCardBody.d.ts +82 -10
  22. package/dts/cards/ContentCard/ContentCardBody.d.ts.map +1 -1
  23. package/dts/cards/ContentCard/ContentCardFooter.d.ts.map +1 -1
  24. package/dts/cards/ContentCard/ContentCardHeader.d.ts +50 -12
  25. package/dts/cards/ContentCard/ContentCardHeader.d.ts.map +1 -1
  26. package/dts/cards/DataCard.d.ts.map +1 -1
  27. package/dts/cards/FeatureEntryCard.d.ts +2 -2
  28. package/dts/cards/FeatureEntryCard.d.ts.map +1 -1
  29. package/dts/cards/FeedCard.d.ts +3 -0
  30. package/dts/cards/FeedCard.d.ts.map +1 -1
  31. package/dts/cards/FloatingAssetCard.d.ts +25 -0
  32. package/dts/cards/FloatingAssetCard.d.ts.map +1 -1
  33. package/dts/cards/MediaCard/MediaCardLayout.d.ts +40 -0
  34. package/dts/cards/MediaCard/MediaCardLayout.d.ts.map +1 -0
  35. package/dts/cards/MediaCard/__figma__/MediaCard.figma.d.ts +2 -0
  36. package/dts/cards/MediaCard/__figma__/MediaCard.figma.d.ts.map +1 -0
  37. package/dts/cards/MediaCard/index.d.ts +28 -0
  38. package/dts/cards/MediaCard/index.d.ts.map +1 -0
  39. package/dts/cards/MessagingCard/MessagingCardLayout.d.ts +62 -0
  40. package/dts/cards/MessagingCard/MessagingCardLayout.d.ts.map +1 -0
  41. package/dts/cards/MessagingCard/__figma__/MessagingCard.figma.d.ts +2 -0
  42. package/dts/cards/MessagingCard/__figma__/MessagingCard.figma.d.ts.map +1 -0
  43. package/dts/cards/MessagingCard/index.d.ts +21 -0
  44. package/dts/cards/MessagingCard/index.d.ts.map +1 -0
  45. package/dts/cards/NudgeCard.d.ts +27 -0
  46. package/dts/cards/NudgeCard.d.ts.map +1 -1
  47. package/dts/cards/UpsellCard.d.ts +27 -0
  48. package/dts/cards/UpsellCard.d.ts.map +1 -1
  49. package/dts/cards/index.d.ts +4 -0
  50. package/dts/cards/index.d.ts.map +1 -1
  51. package/dts/carousel/Carousel.d.ts +88 -14
  52. package/dts/carousel/Carousel.d.ts.map +1 -1
  53. package/dts/carousel/CarouselContext.d.ts +18 -0
  54. package/dts/carousel/CarouselContext.d.ts.map +1 -1
  55. package/dts/carousel/DefaultCarouselNavigation.d.ts +16 -0
  56. package/dts/carousel/DefaultCarouselNavigation.d.ts.map +1 -1
  57. package/dts/carousel/DefaultCarouselPagination.d.ts.map +1 -1
  58. package/dts/carousel/__figma__/Carousel.figma.d.ts +2 -0
  59. package/dts/carousel/__figma__/Carousel.figma.d.ts.map +1 -0
  60. package/dts/examples/ExampleScreen.d.ts.map +1 -1
  61. package/esm/alpha/data-card/DataCard.js +44 -0
  62. package/esm/alpha/data-card/DataCardLayout.js +80 -0
  63. package/esm/alpha/data-card/__figma__/DataCard.figma.js +29 -0
  64. package/esm/alpha/data-card/__stories__/DataCard.stories.js +367 -0
  65. package/esm/alpha/data-card/index.js +1 -0
  66. package/esm/alpha/index.js +1 -0
  67. package/esm/buttons/__figma__/SlideButton.figma.js +1 -1
  68. package/esm/cards/AnnouncementCard.js +2 -2
  69. package/esm/cards/CardMedia.js +5 -4
  70. package/esm/cards/CardRoot.js +27 -0
  71. package/esm/cards/ContainedAssetCard.js +27 -0
  72. package/esm/cards/ContentCard/ContentCard.js +7 -6
  73. package/esm/cards/ContentCard/ContentCardBody.js +74 -19
  74. package/esm/cards/ContentCard/ContentCardFooter.js +4 -5
  75. package/esm/cards/ContentCard/ContentCardHeader.js +60 -23
  76. package/esm/cards/ContentCard/__figma__/ContentCard.figma.js +9 -6
  77. package/esm/cards/DataCard.js +35 -0
  78. package/esm/cards/FeatureEntryCard.js +2 -2
  79. package/esm/cards/FeedCard.js +5 -0
  80. package/esm/cards/FloatingAssetCard.js +25 -0
  81. package/esm/cards/MediaCard/MediaCardLayout.js +68 -0
  82. package/esm/cards/MediaCard/__figma__/MediaCard.figma.js +46 -0
  83. package/esm/cards/MediaCard/index.js +45 -0
  84. package/esm/cards/MessagingCard/MessagingCardLayout.js +175 -0
  85. package/esm/cards/MessagingCard/__figma__/MessagingCard.figma.js +38 -0
  86. package/esm/cards/MessagingCard/index.js +58 -0
  87. package/esm/cards/NudgeCard.js +27 -0
  88. package/esm/cards/UpsellCard.js +27 -0
  89. package/esm/cards/__stories__/ContentCard.stories.js +375 -47
  90. package/esm/cards/__stories__/MediaCard.stories.js +189 -0
  91. package/esm/cards/__stories__/MessagingCard.stories.js +535 -0
  92. package/esm/cards/__stories__/NudgeCard.stories.js +2 -2
  93. package/esm/cards/__stories__/UpsellCard.stories.js +2 -2
  94. package/esm/cards/index.js +8 -1
  95. package/esm/carousel/Carousel.js +114 -57
  96. package/esm/carousel/CarouselContext.js +8 -0
  97. package/esm/carousel/DefaultCarouselNavigation.js +17 -2
  98. package/esm/carousel/DefaultCarouselPagination.js +150 -15
  99. package/esm/carousel/__figma__/Carousel.figma.js +15 -0
  100. package/esm/carousel/__stories__/Carousel.stories.js +60 -11
  101. package/esm/examples/ExampleScreen.js +2 -2
  102. package/package.json +3 -3
  103. package/dts/cards/CardRemoteImage.d.ts +0 -5
  104. package/dts/cards/CardRemoteImage.d.ts.map +0 -1
  105. package/dts/cards/ContentCard/__figma__/ContentCardBody.figma.d.ts +0 -2
  106. package/dts/cards/ContentCard/__figma__/ContentCardBody.figma.d.ts.map +0 -1
  107. package/dts/cards/ContentCard/__figma__/ContentCardFooter.figma.d.ts +0 -2
  108. package/dts/cards/ContentCard/__figma__/ContentCardFooter.figma.d.ts.map +0 -1
  109. package/dts/cards/ContentCard/__figma__/ContentCardHeader.figma.d.ts +0 -2
  110. package/dts/cards/ContentCard/__figma__/ContentCardHeader.figma.d.ts.map +0 -1
  111. package/esm/cards/CardRemoteImage.js +0 -18
  112. package/esm/cards/ContentCard/__figma__/ContentCardBody.figma.js +0 -39
  113. package/esm/cards/ContentCard/__figma__/ContentCardFooter.figma.js +0 -142
  114. package/esm/cards/ContentCard/__figma__/ContentCardHeader.figma.js +0 -25
@@ -1,47 +1,102 @@
1
- const _excluded = ["body", "label", "media", "mediaPosition", "children", "testID"];
1
+ const _excluded = ["body", "label", "media", "mediaPosition", "mediaPlacement", "title", "description", "children", "gap", "testID", "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, { forwardRef, memo } from 'react';
4
+ import React, { forwardRef, memo, useMemo } from 'react';
5
5
  import { Box, VStack } from '../../layout';
6
6
  import { Text } from '../../typography/Text';
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ const mapMediaPositionToMediaPlacement = {
9
+ top: 'top',
10
+ bottom: 'bottom',
11
+ right: 'end',
12
+ left: 'start'
13
+ };
8
14
  export const ContentCardBody = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(function ContentCardBody(_ref, ref) {
9
15
  let {
10
16
  body,
11
17
  label,
12
18
  media,
13
19
  mediaPosition = 'top',
20
+ mediaPlacement = mapMediaPositionToMediaPlacement[mediaPosition],
21
+ title,
22
+ description = body,
14
23
  children,
15
- testID
24
+ gap = 1,
25
+ testID,
26
+ style,
27
+ styles
16
28
  } = _ref,
17
29
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
18
- const isHorizontal = mediaPosition === 'right' || mediaPosition === 'left';
30
+ const hasMedia = !!media;
31
+ const isHorizontal = mediaPlacement === 'start' || mediaPlacement === 'end';
32
+ const isMediaFirst = hasMedia && (mediaPlacement === 'top' || mediaPlacement === 'start');
33
+ const isMediaLast = hasMedia && (mediaPlacement === 'bottom' || mediaPlacement === 'end');
34
+ const titleNode = useMemo(() => {
35
+ if (typeof title === 'string') {
36
+ return /*#__PURE__*/_jsx(Text, {
37
+ font: "headline",
38
+ numberOfLines: 2,
39
+ children: title
40
+ });
41
+ }
42
+ return title;
43
+ }, [title]);
44
+ const descriptionNode = useMemo(() => {
45
+ if (typeof description === 'string') {
46
+ return /*#__PURE__*/_jsx(Text, {
47
+ color: "fgMuted",
48
+ font: "label2",
49
+ numberOfLines: 3,
50
+ children: description
51
+ });
52
+ }
53
+ return description;
54
+ }, [description]);
55
+ const labelNode = useMemo(() => {
56
+ if (typeof label === 'string') {
57
+ return /*#__PURE__*/_jsx(Text, {
58
+ font: "label2",
59
+ children: label
60
+ });
61
+ }
62
+ return label;
63
+ }, [label]);
64
+ const textNode = useMemo(() => {
65
+ if (!titleNode && !descriptionNode && !labelNode) {
66
+ return null;
67
+ }
68
+ return /*#__PURE__*/_jsxs(VStack, {
69
+ flexShrink: 1,
70
+ gap: isHorizontal ? 1 : 0,
71
+ style: styles == null ? void 0 : styles.textContainer,
72
+ children: [titleNode, descriptionNode, labelNode]
73
+ });
74
+ }, [titleNode, descriptionNode, labelNode, isHorizontal, styles == null ? void 0 : styles.textContainer]);
19
75
  const mediaBox = isHorizontal ? /*#__PURE__*/_jsx(Box, {
76
+ borderRadius: 500,
20
77
  flexShrink: 0,
21
78
  height: 96,
79
+ overflow: "hidden",
80
+ style: styles == null ? void 0 : styles.mediaContainer,
22
81
  width: 96,
23
82
  children: media
24
- }) : media;
83
+ }) : /*#__PURE__*/_jsx(Box, {
84
+ borderRadius: 500,
85
+ overflow: "hidden",
86
+ children: media
87
+ });
25
88
  return /*#__PURE__*/_jsxs(VStack, _extends({
26
89
  ref: ref,
27
- gap: 1,
90
+ gap: gap,
91
+ style: [styles == null ? void 0 : styles.root, style],
28
92
  testID: testID
29
93
  }, props, {
30
- children: [/*#__PURE__*/_jsxs(Box, {
94
+ children: [(mediaBox || textNode) && /*#__PURE__*/_jsxs(Box, {
31
95
  flexDirection: isHorizontal ? 'row' : 'column',
32
96
  gap: isHorizontal ? 2 : 1,
33
- justifyContent: mediaPosition === 'right' ? 'space-between' : 'flex-start',
34
- children: [(mediaPosition === 'top' || mediaPosition === 'left') && mediaBox, /*#__PURE__*/_jsxs(VStack, {
35
- gap: 1,
36
- maxWidth: isHorizontal ? '70%' : '100%',
37
- children: [typeof body === 'string' ? /*#__PURE__*/_jsx(Text, {
38
- font: "body",
39
- children: body
40
- }) : body, typeof label === 'string' ? /*#__PURE__*/_jsx(Text, {
41
- font: "label2",
42
- children: label
43
- }) : label]
44
- }), (mediaPosition === 'bottom' || mediaPosition === 'right') && mediaBox]
97
+ justifyContent: mediaPlacement === 'end' ? 'space-between' : 'flex-start',
98
+ style: styles == null ? void 0 : styles.contentContainer,
99
+ children: [isMediaFirst && mediaBox, textNode, isMediaLast && mediaBox]
45
100
  }), children]
46
101
  }));
47
102
  }));
@@ -1,4 +1,4 @@
1
- const _excluded = ["testID", "children"];
1
+ const _excluded = ["children", "justifyContent"];
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 React, { forwardRef, memo } from 'react';
@@ -6,14 +6,13 @@ import { HStack } from '../../layout';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  export const ContentCardFooter = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
8
8
  let {
9
- testID,
10
- children
9
+ children,
10
+ justifyContent = 'space-between'
11
11
  } = _ref,
12
12
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
13
13
  return /*#__PURE__*/_jsx(HStack, _extends({
14
14
  ref: ref,
15
- justifyContent: "space-between",
16
- testID: testID
15
+ justifyContent: justifyContent
17
16
  }, props, {
18
17
  children: children
19
18
  }));
@@ -1,8 +1,8 @@
1
- const _excluded = ["avatar", "title", "meta", "end", "testID"];
1
+ const _excluded = ["avatar", "title", "meta", "end", "subtitle", "actions", "thumbnail", "gap", "testID", "styles", "style"];
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, { forwardRef, memo } from 'react';
5
- import { HStack } from '../../layout';
4
+ import React, { forwardRef, memo, useMemo } from 'react';
5
+ import { HStack, VStack } from '../../layout';
6
6
  import { Avatar } from '../../media';
7
7
  import { Text } from '../../typography/Text';
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -12,35 +12,72 @@ export const ContentCardHeader = /*#__PURE__*/memo(/*#__PURE__*/forwardRef(funct
12
12
  title,
13
13
  meta,
14
14
  end,
15
- testID
15
+ subtitle = meta,
16
+ actions = end,
17
+ thumbnail,
18
+ gap = 1.5,
19
+ testID,
20
+ styles,
21
+ style
16
22
  } = _ref,
17
23
  props = _objectWithoutPropertiesLoose(_ref, _excluded);
24
+ const titleNode = useMemo(() => {
25
+ if (typeof title === 'string') {
26
+ return /*#__PURE__*/_jsx(Text, {
27
+ font: "label1",
28
+ numberOfLines: 1,
29
+ children: title
30
+ });
31
+ }
32
+ return title;
33
+ }, [title]);
34
+ const subtitleNode = useMemo(() => {
35
+ if (typeof subtitle === 'string') {
36
+ return /*#__PURE__*/_jsx(Text, {
37
+ color: "fgMuted",
38
+ font: "legal",
39
+ numberOfLines: 1,
40
+ children: subtitle
41
+ });
42
+ }
43
+ return subtitle;
44
+ }, [subtitle]);
45
+ const thumbnailNode = useMemo(() => {
46
+ // Use new thumbnail prop if provided
47
+ if (thumbnail) return thumbnail;
48
+ // Fallback to deprecated avatar prop (supports string for backward compatibility)
49
+ if (typeof avatar === 'string') {
50
+ return /*#__PURE__*/_jsx(Avatar, {
51
+ accessibilityLabel: typeof title === 'string' ? title : undefined,
52
+ name: typeof title === 'string' ? title : undefined,
53
+ shape: "circle",
54
+ size: "l",
55
+ src: avatar
56
+ });
57
+ }
58
+ return avatar;
59
+ }, [thumbnail, avatar, title]);
18
60
  return /*#__PURE__*/_jsxs(HStack, _extends({
19
61
  ref: ref,
20
62
  alignItems: "center",
63
+ gap: gap,
21
64
  justifyContent: "space-between",
22
- marginEnd: -1,
65
+ style: [styles == null ? void 0 : styles.root, style],
23
66
  testID: testID
24
67
  }, props, {
25
68
  children: [/*#__PURE__*/_jsxs(HStack, {
26
69
  alignItems: "center",
27
- gap: 1,
28
- children: [typeof avatar === 'string' ? /*#__PURE__*/_jsx(Avatar, {
29
- accessibilityLabel: title,
30
- name: title,
31
- shape: "circle",
32
- size: "l",
33
- src: avatar
34
- }) : avatar, typeof title === 'string' ? /*#__PURE__*/_jsx(Text, {
35
- font: "label1",
36
- numberOfLines: 1,
37
- children: title
38
- }) : title, typeof meta === 'string' ? /*#__PURE__*/_jsx(Text, {
39
- color: "fgMuted",
40
- font: "label2",
41
- numberOfLines: 1,
42
- children: meta
43
- }) : meta]
44
- }), end]
70
+ flexGrow: 1,
71
+ flexShrink: 1,
72
+ gap: 1.5,
73
+ style: styles == null ? void 0 : styles.contentContainer,
74
+ children: [thumbnailNode, /*#__PURE__*/_jsxs(VStack, {
75
+ flexGrow: 1,
76
+ flexShrink: 1,
77
+ justifyContent: "flex-start",
78
+ style: styles == null ? void 0 : styles.textContainer,
79
+ children: [titleNode, subtitleNode]
80
+ })]
81
+ }), actions]
45
82
  }));
46
83
  }));
@@ -5,16 +5,19 @@ import React from 'react';
5
5
  import { figma } from '@figma/code-connect';
6
6
  import { ContentCard } from '../ContentCard';
7
7
  import { jsxs as _jsxs } from "react/jsx-runtime";
8
- figma.connect(ContentCard, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/✨-CDS-Components?node-id=14705%3A22920', {
8
+ figma.connect(ContentCard, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/%E2%9C%A8-CDS-Components?node-id=72941-16019&m=dev', {
9
9
  imports: ["import { ContentCard } from '@coinbase/cds-mobile/cards/ContentCard/ContentCard'"],
10
10
  props: {
11
- header: figma.boolean('show card header', {
12
- true: figma.children('.📦 ContentCardHeader'),
11
+ header: figma.boolean('show header', {
12
+ true: figma.children('.cardHeader'),
13
13
  false: undefined
14
14
  }),
15
- body: figma.children('.📦 ContentCardBody'),
16
- footer: figma.boolean('show card footer', {
17
- true: figma.children('.📦 ContentCardFooter'),
15
+ body: figma.boolean('show body', {
16
+ true: figma.children('.CardBody'),
17
+ false: undefined
18
+ }),
19
+ footer: figma.boolean('show footer', {
20
+ true: figma.children('.CardFooter'),
18
21
  false: undefined
19
22
  })
20
23
  },
@@ -1,6 +1,41 @@
1
1
  const _excluded = ["onPress", "title", "description", "progressVariant", "progress", "progressColor", "startLabel", "endLabel", "testID", "borderRadius", "elevation"];
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
+ /**
5
+ * @deprecated This component is deprecated. Please use the alpha `DataCard` from `@coinbase/cds-mobile/alpha/data-card` instead.
6
+ *
7
+ * ### Migration Guide
8
+ *
9
+ * The new `DataCard` provides more flexibility with custom layouts and visualization components.
10
+ *
11
+ * **Before:**
12
+ * ```jsx
13
+ * <DataCard
14
+ * title="Progress"
15
+ * description="45% complete"
16
+ * progress={0.45}
17
+ * progressVariant="bar"
18
+ * startLabel="0"
19
+ * endLabel="45"
20
+ * />
21
+ * ```
22
+ *
23
+ * **After:**
24
+ * ```jsx
25
+ * import { DataCard } from '@coinbase/cds-mobile/alpha/data-card';
26
+ *
27
+ * <DataCard
28
+ * title="Progress"
29
+ * subtitle="45% complete"
30
+ * layout="vertical"
31
+ * thumbnail={<RemoteImage source={{ uri: assetUrl }} shape="circle" size="l" />}
32
+ * >
33
+ * <ProgressBarWithFixedLabels startLabel={0} endLabel={45} labelPlacement="below">
34
+ * <ProgressBar accessibilityLabel="45% complete" progress={0.45} weight="semiheavy" />
35
+ * </ProgressBarWithFixedLabels>
36
+ * </DataCard>
37
+ * ```
38
+ */
4
39
  import { memo, useMemo } from 'react';
5
40
  import { defaultMediaSize } from '@coinbase/cds-common/tokens/card';
6
41
  import { gutter } from '@coinbase/cds-common/tokens/sizing';
@@ -5,9 +5,9 @@ import React, { memo } from 'react';
5
5
  import { Card } from './Card';
6
6
  import { CardBody } from './CardBody';
7
7
 
8
- /** @deprecated will be removed in v7.0.0 use NudgeCard or UpsellCard instead */
8
+ /** @deprecated Use MessagingCard instead. FeatureEntryCard will be removed in a future major release. */
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
- /** @deprecated will be removed in v7.0.0 use NudgeCard or UpsellCard instead */
10
+ /** @deprecated Use MessagingCard instead. FeatureEntryCard will be removed in a future major release. */
11
11
  export const FeatureEntryCard = /*#__PURE__*/memo(function FeatureEntryCard(_ref) {
12
12
  let {
13
13
  onPress,
@@ -9,7 +9,12 @@ import { CardBody } from './CardBody';
9
9
  import { CardFooter } from './CardFooter';
10
10
  import { CardHeader } from './CardHeader';
11
11
  import { LikeButton } from './LikeButton';
12
+
13
+ /** @deprecated Use the ContentCard component instead. */
14
+
15
+ /** @deprecated Use the ContentCard component instead. */
12
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
17
+ /** @deprecated Use the ContentCard component instead. */
13
18
  export const FeedCard = /*#__PURE__*/memo(function FeedCard(_ref) {
14
19
  let {
15
20
  testID = 'feed-card',
@@ -4,6 +4,31 @@ import { HStack, VStack } from '../layout';
4
4
  import { Pressable } from '../system';
5
5
  import { Text } from '../typography/Text';
6
6
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ /**
8
+ * @deprecated Use `MediaCard` instead. FloatingAssetCard will be removed in a future major release.
9
+ *
10
+ * Migration guide:
11
+ * ```tsx
12
+ * // Before
13
+ * <FloatingAssetCard
14
+ * title="Asset Title"
15
+ * subtitle="Subtitle"
16
+ * description="Description"
17
+ * media={<RemoteImage ... />}
18
+ * />
19
+ *
20
+ * // After
21
+ * <MediaCard
22
+ * title="Asset Title"
23
+ * subtitle="Subtitle"
24
+ * description="Description"
25
+ * thumbnail={<RemoteImage ... />}
26
+ * />
27
+ * ```
28
+ *
29
+ * Note: The floating variation (media outside the card container) is no longer supported.
30
+ * MediaCard provides a contained layout with media placement options (start/end).
31
+ */
7
32
  export const FloatingAssetCard = /*#__PURE__*/memo(_ref => {
8
33
  let {
9
34
  title,
@@ -0,0 +1,68 @@
1
+ import React, { memo, useMemo } from 'react';
2
+ import { HStack } from '../../layout/HStack';
3
+ import { VStack } from '../../layout/VStack';
4
+ import { Text } from '../../typography/Text';
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ const MediaCardLayout = /*#__PURE__*/memo(_ref => {
7
+ let {
8
+ title,
9
+ subtitle,
10
+ description,
11
+ thumbnail,
12
+ media,
13
+ mediaPlacement = 'end',
14
+ styles = {}
15
+ } = _ref;
16
+ const titleNode = useMemo(() => {
17
+ if (typeof title === 'string') {
18
+ return /*#__PURE__*/_jsx(Text, {
19
+ font: "headline",
20
+ numberOfLines: 2,
21
+ children: title
22
+ });
23
+ }
24
+ return title;
25
+ }, [title]);
26
+ const subtitleNode = useMemo(() => typeof subtitle === 'string' ? /*#__PURE__*/_jsx(Text, {
27
+ color: "fgMuted",
28
+ font: "legal",
29
+ numberOfLines: 1,
30
+ children: subtitle
31
+ }) : subtitle, [subtitle]);
32
+ const headerNode = useMemo(() => /*#__PURE__*/_jsxs(VStack, {
33
+ style: styles == null ? void 0 : styles.headerContainer,
34
+ children: [subtitleNode, titleNode]
35
+ }), [subtitleNode, titleNode, styles == null ? void 0 : styles.headerContainer]);
36
+ const descriptionNode = useMemo(() => typeof description === 'string' ? /*#__PURE__*/_jsx(Text, {
37
+ color: "fgMuted",
38
+ font: "label2",
39
+ numberOfLines: 2,
40
+ children: description
41
+ }) : description, [description]);
42
+ const contentNode = useMemo(() => /*#__PURE__*/_jsxs(VStack, {
43
+ flexBasis: "50%",
44
+ gap: 4,
45
+ justifyContent: "space-between",
46
+ padding: 2,
47
+ style: styles == null ? void 0 : styles.contentContainer,
48
+ children: [thumbnail, /*#__PURE__*/_jsxs(VStack, {
49
+ style: styles == null ? void 0 : styles.textContainer,
50
+ children: [headerNode, descriptionNode]
51
+ })]
52
+ }), [styles == null ? void 0 : styles.contentContainer, styles == null ? void 0 : styles.textContainer, thumbnail, headerNode, descriptionNode]);
53
+ const mediaNode = useMemo(() => {
54
+ if (media) {
55
+ return /*#__PURE__*/_jsx(HStack, {
56
+ flexBasis: "50%",
57
+ style: styles == null ? void 0 : styles.mediaContainer,
58
+ children: media
59
+ });
60
+ }
61
+ }, [media, styles == null ? void 0 : styles.mediaContainer]);
62
+ return /*#__PURE__*/_jsxs(HStack, {
63
+ flexGrow: 1,
64
+ style: styles == null ? void 0 : styles.layoutContainer,
65
+ children: [mediaPlacement === 'start' ? mediaNode : contentNode, mediaPlacement === 'end' ? mediaNode : contentNode]
66
+ });
67
+ });
68
+ export { MediaCardLayout };
@@ -0,0 +1,46 @@
1
+ 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); }
2
+ import React from 'react';
3
+ import { ethBackground } from '@coinbase/cds-common/internal/data/assets';
4
+ import { figma } from '@figma/code-connect';
5
+ import { RemoteImage } from '../../../media';
6
+ import { MediaCard } from '../';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ figma.connect(MediaCard, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/%E2%9C%A8-CDS-Components?node-id=72941-18302&m=dev', {
9
+ imports: ["import { MediaCard } from '@coinbase/cds-mobile/cards/MediaCard'", "import { Avatar } from '@coinbase/cds-mobile/media/Avatar'"],
10
+ props: {
11
+ title: figma.string('title'),
12
+ subtitle: figma.boolean('show subtitle', {
13
+ true: figma.string('↳ subtitle'),
14
+ false: undefined
15
+ }),
16
+ description: figma.boolean('show subdetail', {
17
+ true: figma.instance('↳ subdetail'),
18
+ false: undefined
19
+ }),
20
+ thumbnail: figma.boolean('show media', {
21
+ true: figma.instance('↳ media'),
22
+ false: undefined
23
+ }),
24
+ mediaPlacement: figma.enum('image placement', {
25
+ left: 'start',
26
+ right: 'end',
27
+ none: undefined
28
+ }),
29
+ media: figma.enum('image placement', {
30
+ left: /*#__PURE__*/_jsx(RemoteImage, {
31
+ alt: "Media",
32
+ shape: "rectangle",
33
+ source: ethBackground,
34
+ width: "100%"
35
+ }),
36
+ right: /*#__PURE__*/_jsx(RemoteImage, {
37
+ alt: "Media",
38
+ shape: "rectangle",
39
+ source: ethBackground,
40
+ width: "100%"
41
+ }),
42
+ none: undefined
43
+ })
44
+ },
45
+ example: props => /*#__PURE__*/_jsx(MediaCard, _extends({}, props))
46
+ });
@@ -0,0 +1,45 @@
1
+ const _excluded = ["root"],
2
+ _excluded2 = ["title", "subtitle", "description", "thumbnail", "media", "mediaPlacement", "style", "styles"];
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
+ 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
+ import { forwardRef, memo } from 'react';
6
+ import { CardRoot } from '../CardRoot';
7
+ import { MediaCardLayout } from './MediaCardLayout';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ const mediaCardContainerProps = {
10
+ borderRadius: 500,
11
+ background: 'bgAlternate',
12
+ overflow: 'hidden'
13
+ };
14
+ export const MediaCard = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
15
+ let {
16
+ title,
17
+ subtitle,
18
+ description,
19
+ thumbnail,
20
+ media,
21
+ mediaPlacement = 'end',
22
+ style,
23
+ styles: {
24
+ root: rootStyle
25
+ } = {}
26
+ } = _ref,
27
+ layoutStyles = _objectWithoutPropertiesLoose(_ref.styles, _excluded),
28
+ props = _objectWithoutPropertiesLoose(_ref, _excluded2);
29
+ return /*#__PURE__*/_jsx(CardRoot, _extends({
30
+ ref: ref
31
+ }, mediaCardContainerProps, {
32
+ style: [style, rootStyle]
33
+ }, props, {
34
+ children: /*#__PURE__*/_jsx(MediaCardLayout, {
35
+ description: description,
36
+ media: media,
37
+ mediaPlacement: mediaPlacement,
38
+ styles: layoutStyles,
39
+ subtitle: subtitle,
40
+ thumbnail: thumbnail,
41
+ title: title
42
+ })
43
+ }));
44
+ }));
45
+ MediaCard.displayName = 'MediaCard';