@coinbase/cds-web 8.40.2 → 8.42.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 (84) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dts/alpha/combobox/DefaultComboboxControl.d.ts.map +1 -1
  3. package/dts/alpha/data-card/DataCard.d.ts +25 -0
  4. package/dts/alpha/data-card/DataCard.d.ts.map +1 -0
  5. package/dts/alpha/data-card/DataCardLayout.d.ts +44 -0
  6. package/dts/alpha/data-card/DataCardLayout.d.ts.map +1 -0
  7. package/dts/alpha/data-card/__figma__/DataCard.figma.d.ts +2 -0
  8. package/dts/alpha/data-card/__figma__/DataCard.figma.d.ts.map +1 -0
  9. package/dts/alpha/data-card/index.d.ts +3 -0
  10. package/dts/alpha/data-card/index.d.ts.map +1 -0
  11. package/dts/alpha/index.d.ts +1 -0
  12. package/dts/alpha/index.d.ts.map +1 -1
  13. package/dts/alpha/select/DefaultSelectControl.d.ts.map +1 -1
  14. package/dts/alpha/select/Select.d.ts.map +1 -1
  15. package/dts/alpha/select/types.d.ts +6 -0
  16. package/dts/alpha/select/types.d.ts.map +1 -1
  17. package/dts/cards/AnnouncementCard.d.ts +1 -1
  18. package/dts/cards/AnnouncementCard.d.ts.map +1 -1
  19. package/dts/cards/CardRoot.d.ts +35 -0
  20. package/dts/cards/CardRoot.d.ts.map +1 -0
  21. package/dts/cards/ContainedAssetCard.d.ts +27 -0
  22. package/dts/cards/ContainedAssetCard.d.ts.map +1 -1
  23. package/dts/cards/ContentCard/ContentCard.d.ts +3 -3
  24. package/dts/cards/ContentCard/ContentCard.d.ts.map +1 -1
  25. package/dts/cards/ContentCard/ContentCardBody.d.ts +58 -3
  26. package/dts/cards/ContentCard/ContentCardBody.d.ts.map +1 -1
  27. package/dts/cards/ContentCard/ContentCardFooter.d.ts +1 -1
  28. package/dts/cards/ContentCard/ContentCardFooter.d.ts.map +1 -1
  29. package/dts/cards/ContentCard/ContentCardHeader.d.ts +39 -5
  30. package/dts/cards/ContentCard/ContentCardHeader.d.ts.map +1 -1
  31. package/dts/cards/DataCard.d.ts +35 -0
  32. package/dts/cards/DataCard.d.ts.map +1 -1
  33. package/dts/cards/FeatureEntryCard.d.ts +2 -2
  34. package/dts/cards/FeatureEntryCard.d.ts.map +1 -1
  35. package/dts/cards/FloatingAssetCard.d.ts +25 -0
  36. package/dts/cards/FloatingAssetCard.d.ts.map +1 -1
  37. package/dts/cards/MediaCard/MediaCardLayout.d.ts +46 -0
  38. package/dts/cards/MediaCard/MediaCardLayout.d.ts.map +1 -0
  39. package/dts/cards/MediaCard/__figma__/MediaCard.figma.d.ts +2 -0
  40. package/dts/cards/MediaCard/__figma__/MediaCard.figma.d.ts.map +1 -0
  41. package/dts/cards/MediaCard/index.d.ts +26 -0
  42. package/dts/cards/MediaCard/index.d.ts.map +1 -0
  43. package/dts/cards/MessagingCard/MessagingCardLayout.d.ts +68 -0
  44. package/dts/cards/MessagingCard/MessagingCardLayout.d.ts.map +1 -0
  45. package/dts/cards/MessagingCard/__figma__/MessagingCard.figma.d.ts +2 -0
  46. package/dts/cards/MessagingCard/__figma__/MessagingCard.figma.d.ts.map +1 -0
  47. package/dts/cards/MessagingCard/index.d.ts +23 -0
  48. package/dts/cards/MessagingCard/index.d.ts.map +1 -0
  49. package/dts/cards/NudgeCard.d.ts +27 -0
  50. package/dts/cards/NudgeCard.d.ts.map +1 -1
  51. package/dts/cards/UpsellCard.d.ts +27 -0
  52. package/dts/cards/UpsellCard.d.ts.map +1 -1
  53. package/dts/cards/index.d.ts +3 -0
  54. package/dts/cards/index.d.ts.map +1 -1
  55. package/esm/alpha/combobox/DefaultComboboxControl.js +6 -2
  56. package/esm/alpha/data-card/DataCard.js +62 -0
  57. package/esm/alpha/data-card/DataCardLayout.js +83 -0
  58. package/esm/alpha/data-card/__figma__/DataCard.figma.js +29 -0
  59. package/esm/alpha/data-card/index.js +1 -0
  60. package/esm/alpha/index.js +1 -0
  61. package/esm/alpha/select/DefaultSelectControl.js +6 -4
  62. package/esm/alpha/select/Select.js +2 -0
  63. package/esm/cards/AnnouncementCard.js +1 -1
  64. package/esm/cards/{CardRemoteImage.js → CardRoot.js} +31 -13
  65. package/esm/cards/ContainedAssetCard.js +28 -0
  66. package/esm/cards/ContentCard/ContentCard.js +8 -7
  67. package/esm/cards/ContentCard/ContentCardBody.js +77 -20
  68. package/esm/cards/ContentCard/ContentCardFooter.js +5 -6
  69. package/esm/cards/ContentCard/ContentCardHeader.js +65 -27
  70. package/esm/cards/DataCard.js +35 -0
  71. package/esm/cards/FeatureEntryCard.js +2 -2
  72. package/esm/cards/FloatingAssetCard.js +26 -0
  73. package/esm/cards/MediaCard/MediaCardLayout.js +77 -0
  74. package/esm/cards/MediaCard/__figma__/MediaCard.figma.js +46 -0
  75. package/esm/cards/MediaCard/index.js +61 -0
  76. package/esm/cards/MessagingCard/MessagingCardLayout.js +195 -0
  77. package/esm/cards/MessagingCard/__figma__/MessagingCard.figma.js +49 -0
  78. package/esm/cards/MessagingCard/index.js +70 -0
  79. package/esm/cards/NudgeCard.js +27 -0
  80. package/esm/cards/UpsellCard.js +27 -0
  81. package/esm/cards/index.js +6 -1
  82. package/package.json +7 -3
  83. package/dts/cards/CardRemoteImage.d.ts +0 -8
  84. package/dts/cards/CardRemoteImage.d.ts.map +0 -1
@@ -0,0 +1,46 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cannot destructure " + t); }
7
+ 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); }
8
+ import React from 'react';
9
+ import { figma } from '@figma/code-connect';
10
+ import { Avatar } from '../../../media';
11
+ import { MediaCard } from '../';
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ figma.connect(MediaCard, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/%E2%9C%A8-CDS-Components?node-id=72941-18302&m=dev', {
14
+ imports: ["import { MediaCard } from '@coinbase/cds-web/cards/MediaCard'", "import { Avatar } from '@coinbase/cds-web/media/Avatar'"],
15
+ props: {
16
+ title: figma.string('title'),
17
+ subtitle: figma.boolean('show subtitle', {
18
+ true: figma.string('↳ subtitle'),
19
+ false: undefined
20
+ }),
21
+ description: figma.boolean('show subdetail', {
22
+ true: figma.instance('↳ subdetail'),
23
+ false: undefined
24
+ }),
25
+ media: figma.boolean('show media', {
26
+ true: figma.instance('↳ media'),
27
+ false: undefined
28
+ }),
29
+ mediaPlacement: figma.enum('media placement', {
30
+ left: 'start',
31
+ right: 'end',
32
+ none: undefined
33
+ })
34
+ },
35
+ example: _ref => {
36
+ let props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
37
+ return /*#__PURE__*/_jsx(MediaCard, _objectSpread({
38
+ thumbnail: /*#__PURE__*/_jsx(Avatar, {
39
+ alt: "",
40
+ shape: "circle",
41
+ size: "l",
42
+ src: ""
43
+ })
44
+ }, props));
45
+ }
46
+ });
@@ -0,0 +1,61 @@
1
+ const _excluded = ["root"],
2
+ _excluded2 = ["root"],
3
+ _excluded3 = ["title", "subtitle", "description", "thumbnail", "media", "children", "mediaPlacement", "as", "classNames", "styles", "className", "style"];
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
8
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
10
+ 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; }
11
+ import React, { forwardRef, memo } from 'react';
12
+ import { cx } from '../../cx';
13
+ import { CardRoot } from '../CardRoot';
14
+ import { MediaCardLayout } from './MediaCardLayout';
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ const mediaCardContainerProps = {
17
+ borderRadius: 500,
18
+ flexDirection: 'row',
19
+ background: 'bgAlternate',
20
+ overflow: 'hidden'
21
+ };
22
+ export const MediaCard = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
23
+ let {
24
+ title,
25
+ subtitle,
26
+ description,
27
+ thumbnail,
28
+ media,
29
+ children,
30
+ mediaPlacement = 'end',
31
+ as,
32
+ classNames: {
33
+ root: rootClassName
34
+ } = {},
35
+ styles: {
36
+ root: rootStyle
37
+ } = {},
38
+ className,
39
+ style
40
+ } = _ref,
41
+ layoutClassNames = _objectWithoutProperties(_ref.classNames, _excluded),
42
+ layoutStyles = _objectWithoutProperties(_ref.styles, _excluded2),
43
+ props = _objectWithoutProperties(_ref, _excluded3);
44
+ return /*#__PURE__*/_jsx(CardRoot, _objectSpread(_objectSpread(_objectSpread({
45
+ ref: ref,
46
+ as: as,
47
+ className: cx(rootClassName, className),
48
+ style: _objectSpread(_objectSpread({}, rootStyle), style)
49
+ }, mediaCardContainerProps), props), {}, {
50
+ children: /*#__PURE__*/_jsx(MediaCardLayout, {
51
+ classNames: layoutClassNames,
52
+ description: description,
53
+ media: media,
54
+ mediaPlacement: mediaPlacement,
55
+ styles: layoutStyles,
56
+ subtitle: subtitle,
57
+ thumbnail: thumbnail,
58
+ title: title
59
+ })
60
+ }));
61
+ }));
@@ -0,0 +1,195 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ import { memo, useMemo } from 'react';
7
+ import { Button } from '../../buttons/Button';
8
+ import { IconButton } from '../../buttons/IconButton';
9
+ import { Box, VStack } from '../../layout';
10
+ import { HStack } from '../../layout/HStack';
11
+ import { Pressable } from '../../system/Pressable';
12
+ import { Tag } from '../../tag/Tag';
13
+ import { Text } from '../../typography/Text';
14
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
15
+ export const MessagingCardLayout = /*#__PURE__*/memo(_ref => {
16
+ let {
17
+ type,
18
+ title,
19
+ description,
20
+ tag,
21
+ action,
22
+ onActionButtonClick,
23
+ actionButtonAccessibilityLabel,
24
+ onDismissButtonClick,
25
+ dismissButtonAccessibilityLabel,
26
+ mediaPlacement = 'end',
27
+ media,
28
+ styles = {},
29
+ classNames = {},
30
+ dismissButton
31
+ } = _ref;
32
+ const titleNode = useMemo(() => {
33
+ if (typeof title === 'string') {
34
+ return /*#__PURE__*/_jsx(Text, {
35
+ as: "div",
36
+ color: type === 'upsell' ? 'fgInverse' : 'fg',
37
+ font: "headline",
38
+ numberOfLines: 2,
39
+ children: title
40
+ });
41
+ }
42
+ return title;
43
+ }, [title, type]);
44
+ const descriptionNode = useMemo(() => {
45
+ if (typeof description === 'string') {
46
+ return /*#__PURE__*/_jsx(Text, {
47
+ as: "p",
48
+ color: type === 'upsell' ? 'fgInverse' : 'fg',
49
+ font: "label2",
50
+ numberOfLines: 3,
51
+ children: description
52
+ });
53
+ }
54
+ return description;
55
+ }, [description, type]);
56
+ const tagNode = useMemo(() => {
57
+ if (typeof tag === 'string') {
58
+ return /*#__PURE__*/_jsx(Tag, {
59
+ children: tag
60
+ });
61
+ }
62
+ return tag;
63
+ }, [tag]);
64
+ const actionButtonNode = useMemo(() => {
65
+ if (!action) return null;
66
+
67
+ // If action is a string, render in a default button
68
+ if (typeof action === 'string') {
69
+ const handleActionClick = event => {
70
+ event.preventDefault();
71
+ event.stopPropagation();
72
+ onActionButtonClick === null || onActionButtonClick === void 0 || onActionButtonClick(event);
73
+ };
74
+ if (type === 'upsell') {
75
+ return /*#__PURE__*/_jsx(Button, {
76
+ compact: true,
77
+ accessibilityLabel: actionButtonAccessibilityLabel !== null && actionButtonAccessibilityLabel !== void 0 ? actionButtonAccessibilityLabel : action,
78
+ onClick: handleActionClick,
79
+ variant: "secondary",
80
+ children: action
81
+ });
82
+ }
83
+ return /*#__PURE__*/_jsx(Pressable, {
84
+ accessibilityLabel: actionButtonAccessibilityLabel !== null && actionButtonAccessibilityLabel !== void 0 ? actionButtonAccessibilityLabel : action,
85
+ background: "transparent",
86
+ onClick: handleActionClick,
87
+ paddingY: 1,
88
+ children: /*#__PURE__*/_jsx(Text, {
89
+ color: "fgPrimary",
90
+ font: "headline",
91
+ children: action
92
+ })
93
+ });
94
+ }
95
+
96
+ // Otherwise, render action as-is (custom React element)
97
+ return action;
98
+ }, [action, actionButtonAccessibilityLabel, onActionButtonClick, type]);
99
+ const computedDismissButtonAccessibilityLabel = useMemo(() => {
100
+ if (dismissButtonAccessibilityLabel) return dismissButtonAccessibilityLabel;
101
+ if (typeof title === 'string') return "Dismiss ".concat(title);
102
+ return 'Dismiss card';
103
+ }, [dismissButtonAccessibilityLabel, title]);
104
+ const dismissButtonNode = useMemo(() => {
105
+ if (dismissButton) {
106
+ return dismissButton;
107
+ }
108
+ if (onDismissButtonClick) {
109
+ const handleDismiss = event => {
110
+ event.preventDefault();
111
+ event.stopPropagation();
112
+ onDismissButtonClick(event);
113
+ };
114
+ return /*#__PURE__*/_jsx(HStack, {
115
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.dismissButtonContainer,
116
+ paddingEnd: 1,
117
+ paddingTop: 1,
118
+ position: "absolute",
119
+ right: 0,
120
+ style: styles === null || styles === void 0 ? void 0 : styles.dismissButtonContainer,
121
+ top: 0,
122
+ children: /*#__PURE__*/_jsx(IconButton, {
123
+ compact: true,
124
+ accessibilityLabel: computedDismissButtonAccessibilityLabel,
125
+ name: "close",
126
+ onClick: handleDismiss,
127
+ variant: "secondary"
128
+ })
129
+ });
130
+ }
131
+ return null;
132
+ }, [classNames === null || classNames === void 0 ? void 0 : classNames.dismissButtonContainer, computedDismissButtonAccessibilityLabel, dismissButton, onDismissButtonClick, styles === null || styles === void 0 ? void 0 : styles.dismissButtonContainer]);
133
+ const contentContainerPaddingProps = useMemo(() => {
134
+ if (mediaPlacement === 'start' && dismissButtonNode) {
135
+ // needs to add additional padding to the end of the content area when media is placed at the start and there is a dismiss button
136
+ // this is to avoid dismiss button from overlapping with the content area
137
+ return {
138
+ paddingY: 2,
139
+ paddingStart: 2,
140
+ paddingEnd: 6
141
+ };
142
+ }
143
+ return {
144
+ padding: 2
145
+ };
146
+ }, [dismissButtonNode, mediaPlacement]);
147
+ const mediaContainerPaddingProps = useMemo(() => {
148
+ if (type === 'upsell') return;
149
+ if (mediaPlacement === 'start') {
150
+ return {
151
+ paddingStart: 3,
152
+ paddingEnd: 1
153
+ };
154
+ }
155
+ // when media is placed at the end, we need to add additional padding to the end of the media container
156
+ // this is to avoid the dismiss button from overlapping with the media
157
+ return dismissButtonNode ? {
158
+ paddingStart: 1,
159
+ paddingEnd: 6
160
+ } : {
161
+ paddingStart: 1,
162
+ paddingEnd: 3
163
+ };
164
+ }, [dismissButtonNode, mediaPlacement, type]);
165
+ return /*#__PURE__*/_jsxs(HStack, {
166
+ alignItems: "stretch",
167
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.layoutContainer,
168
+ flexDirection: mediaPlacement === 'start' ? 'row-reverse' : 'row',
169
+ flexGrow: 1,
170
+ position: "relative",
171
+ style: styles === null || styles === void 0 ? void 0 : styles.layoutContainer,
172
+ children: [/*#__PURE__*/_jsxs(VStack, _objectSpread(_objectSpread({
173
+ alignItems: "flex-start",
174
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.contentContainer,
175
+ flexGrow: 1,
176
+ gap: 2,
177
+ style: styles === null || styles === void 0 ? void 0 : styles.contentContainer
178
+ }, contentContainerPaddingProps), {}, {
179
+ children: [/*#__PURE__*/_jsxs(VStack, {
180
+ alignItems: "flex-start",
181
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.textContainer,
182
+ gap: 0.5,
183
+ style: styles === null || styles === void 0 ? void 0 : styles.textContainer,
184
+ children: [tagNode, titleNode, descriptionNode]
185
+ }), actionButtonNode]
186
+ })), /*#__PURE__*/_jsx(Box, _objectSpread(_objectSpread({
187
+ alignItems: "center",
188
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.mediaContainer,
189
+ flexShrink: 0,
190
+ style: styles === null || styles === void 0 ? void 0 : styles.mediaContainer
191
+ }, mediaContainerPaddingProps), {}, {
192
+ children: media
193
+ })), dismissButtonNode]
194
+ });
195
+ });
@@ -0,0 +1,49 @@
1
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
2
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
3
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
4
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
+ function _objectDestructuringEmpty(t) { if (null == t) throw new TypeError("Cannot destructure " + t); }
7
+ 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); }
8
+ import React from 'react';
9
+ import { figma } from '@figma/code-connect';
10
+ import { MessagingCard } from '../';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ figma.connect(MessagingCard, 'https://www.figma.com/design/k5CtyJccNQUGMI5bI4lJ2g/%E2%9C%A8-CDS-Components?node-id=72941-20711&m=dev', {
13
+ imports: ["import { MessagingCard } from '@coinbase/cds-web/cards/MessagingCard'"],
14
+ props: {
15
+ type: figma.enum('type', {
16
+ upsell: 'upsell',
17
+ nudge: 'nudge'
18
+ }),
19
+ title: figma.boolean('show title', {
20
+ true: figma.string('↳ title'),
21
+ false: undefined
22
+ }),
23
+ description: figma.boolean('show subtitle', {
24
+ true: figma.string('↳ subtitle'),
25
+ false: undefined
26
+ }),
27
+ tag: figma.boolean('show tag', {
28
+ true: figma.instance('↳ tag'),
29
+ false: undefined
30
+ }),
31
+ action: figma.boolean('show cta', {
32
+ true: figma.instance('↳ cta'),
33
+ false: undefined
34
+ }),
35
+ media: figma.instance('media'),
36
+ mediaPlacement: figma.enum('media placement', {
37
+ left: 'start',
38
+ right: 'end'
39
+ }),
40
+ onDismissButtonClick: figma.boolean('show dismiss', {
41
+ true: () => {},
42
+ false: undefined
43
+ })
44
+ },
45
+ example: _ref => {
46
+ let props = _extends({}, (_objectDestructuringEmpty(_ref), _ref));
47
+ return /*#__PURE__*/_jsx(MessagingCard, _objectSpread({}, props));
48
+ }
49
+ });
@@ -0,0 +1,70 @@
1
+ const _excluded = ["root"],
2
+ _excluded2 = ["root"],
3
+ _excluded3 = ["as", "type", "title", "description", "tag", "action", "onActionButtonClick", "actionButtonAccessibilityLabel", "onDismissButtonClick", "dismissButtonAccessibilityLabel", "mediaPlacement", "media", "dismissButton", "styles", "classNames", "className", "style"];
4
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
5
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
6
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
8
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
+ function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
10
+ 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; }
11
+ import { forwardRef, memo } from 'react';
12
+ import { cx } from '../../cx';
13
+ import { CardRoot } from '../CardRoot';
14
+ import { MessagingCardLayout } from './MessagingCardLayout';
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ export const MessagingCard = /*#__PURE__*/memo(/*#__PURE__*/forwardRef((_ref, ref) => {
17
+ let {
18
+ as,
19
+ type,
20
+ title,
21
+ description,
22
+ tag,
23
+ action,
24
+ onActionButtonClick,
25
+ actionButtonAccessibilityLabel,
26
+ onDismissButtonClick,
27
+ dismissButtonAccessibilityLabel,
28
+ mediaPlacement,
29
+ media,
30
+ dismissButton,
31
+ styles: {
32
+ root: rootStyle
33
+ } = {},
34
+ classNames: {
35
+ root: rootClassName
36
+ } = {},
37
+ className,
38
+ style
39
+ } = _ref,
40
+ layoutStyles = _objectWithoutProperties(_ref.styles, _excluded),
41
+ layoutClassNames = _objectWithoutProperties(_ref.classNames, _excluded2),
42
+ props = _objectWithoutProperties(_ref, _excluded3);
43
+ return /*#__PURE__*/_jsx(CardRoot, _objectSpread(_objectSpread({
44
+ ref: ref,
45
+ as: as,
46
+ background: type === 'upsell' ? 'bgPrimary' : 'bgAlternate',
47
+ borderRadius: 500,
48
+ borderWidth: 0,
49
+ className: cx(rootClassName, className),
50
+ overflow: "hidden",
51
+ style: _objectSpread(_objectSpread({}, rootStyle), style)
52
+ }, props), {}, {
53
+ children: /*#__PURE__*/_jsx(MessagingCardLayout, {
54
+ action: action,
55
+ actionButtonAccessibilityLabel: actionButtonAccessibilityLabel,
56
+ classNames: layoutClassNames,
57
+ description: description,
58
+ dismissButton: dismissButton,
59
+ dismissButtonAccessibilityLabel: dismissButtonAccessibilityLabel,
60
+ media: media,
61
+ mediaPlacement: mediaPlacement,
62
+ onActionButtonClick: onActionButtonClick,
63
+ onDismissButtonClick: onDismissButtonClick,
64
+ styles: layoutStyles,
65
+ tag: tag,
66
+ title: title,
67
+ type: type
68
+ })
69
+ }));
70
+ }));
@@ -44,6 +44,33 @@ const getCardBodyPaddingProps = _ref => {
44
44
  paddingEnd: (_ref14 = (_ref15 = paddingEnd !== null && paddingEnd !== void 0 ? paddingEnd : paddingX) !== null && _ref15 !== void 0 ? _ref15 : padding) !== null && _ref14 !== void 0 ? _ref14 : 3
45
45
  };
46
46
  };
47
+ /**
48
+ * @deprecated Use `MessagingCard` with `type="nudge"` instead. NudgeCard will be removed in a future major release.
49
+ *
50
+ * Migration guide:
51
+ * ```tsx
52
+ * // Before
53
+ * <NudgeCard
54
+ * title="Title"
55
+ * description="Description"
56
+ * pictogram="addToWatchlist"
57
+ * action="Learn more"
58
+ * onActionPress={handleAction}
59
+ * onDismissPress={handleDismiss}
60
+ * />
61
+ *
62
+ * // After
63
+ * <MessagingCard
64
+ * type="nudge"
65
+ * title="Title"
66
+ * description="Description"
67
+ * media={<Pictogram dimension="48x48" name="addToWatchlist" />}
68
+ * actions={<Button compact variant="secondary">Learn more</Button>}
69
+ * onDismiss={handleDismiss}
70
+ * mediaPlacement="end"
71
+ * />
72
+ * ```
73
+ */
47
74
  export const NudgeCard = _ref16 => {
48
75
  let {
49
76
  title,
@@ -5,6 +5,33 @@ import { HStack, VStack } from '../layout';
5
5
  import { Pressable } from '../system';
6
6
  import { Text } from '../typography/Text';
7
7
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
8
+ /**
9
+ * @deprecated Use `MessagingCard` with `type="upsell"` instead. UpsellCard will be removed in a future major release.
10
+ *
11
+ * Migration guide:
12
+ * ```tsx
13
+ * // Before
14
+ * <UpsellCard
15
+ * title="Title"
16
+ * description="Description"
17
+ * media={<RemoteImage ... />}
18
+ * action="Get Started"
19
+ * onActionPress={handleAction}
20
+ * onDismissPress={handleDismiss}
21
+ * />
22
+ *
23
+ * // After
24
+ * <MessagingCard
25
+ * type="upsell"
26
+ * title="Title"
27
+ * description="Description"
28
+ * media={<RemoteImage ... />}
29
+ * actions={<Button compact variant="secondary">Get Started</Button>}
30
+ * onDismiss={handleDismiss}
31
+ * mediaPlacement="end"
32
+ * />
33
+ * ```
34
+ */
8
35
  export const UpsellCard = /*#__PURE__*/memo(_ref => {
9
36
  let {
10
37
  title,
@@ -4,6 +4,7 @@ export * from './CardFooter';
4
4
  export * from './CardGroup';
5
5
  export * from './CardHeader';
6
6
  export * from './CardMedia';
7
+ export * from './CardRoot';
7
8
  // Card variants
8
9
  export * from './AnnouncementCard';
9
10
  export * from './FeatureEntryCard';
@@ -14,4 +15,8 @@ export * from './FloatingAssetCard';
14
15
  export * from './NudgeCard';
15
16
  export * from './UpsellCard';
16
17
  // Phoenix cards
17
- export * from './ContentCard';
18
+ export * from './ContentCard';
19
+ // Media card
20
+ export * from './MediaCard';
21
+ // Messaging card
22
+ export * from './MessagingCard';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coinbase/cds-web",
3
- "version": "8.40.2",
3
+ "version": "8.42.0",
4
4
  "description": "Coinbase Design System - Web",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,6 +32,10 @@
32
32
  "types": "./dts/alpha/combobox/index.d.ts",
33
33
  "default": "./esm/alpha/combobox/index.js"
34
34
  },
35
+ "./alpha/data-card": {
36
+ "types": "./dts/alpha/data-card/index.d.ts",
37
+ "default": "./esm/alpha/data-card/index.js"
38
+ },
35
39
  "./alpha/select": {
36
40
  "types": "./dts/alpha/select/index.d.ts",
37
41
  "default": "./esm/alpha/select/index.js"
@@ -203,9 +207,9 @@
203
207
  "react-dom": "^18.3.1"
204
208
  },
205
209
  "dependencies": {
206
- "@coinbase/cds-common": "^8.40.2",
210
+ "@coinbase/cds-common": "^8.42.0",
207
211
  "@coinbase/cds-icons": "^5.10.0",
208
- "@coinbase/cds-illustrations": "^4.30.0",
212
+ "@coinbase/cds-illustrations": "^4.31.0",
209
213
  "@coinbase/cds-lottie-files": "^3.3.4",
210
214
  "@coinbase/cds-utils": "^2.3.5",
211
215
  "@floating-ui/react-dom": "^2.1.1",
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import type { CardRemoteImageProps } from '@coinbase/cds-common/types';
3
- export type { CardRemoteImageProps };
4
- /**
5
- * @deprecated render a <RemoteImage resizeMode="cover" {...props} /> instead
6
- */
7
- export declare const CardRemoteImage: React.NamedExoticComponent<CardRemoteImageProps>;
8
- //# sourceMappingURL=CardRemoteImage.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CardRemoteImage.d.ts","sourceRoot":"","sources":["../../src/cards/CardRemoteImage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAe,MAAM,OAAO,CAAC;AACpC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAIvE,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,eAAe,kDAM1B,CAAC"}