@carbon/ibm-products 2.4.0 → 2.4.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/css/index-full-carbon.css +27 -0
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +16 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +27 -0
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +23 -0
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/css/index.min.css.map +1 -1
- package/es/components/Card/Card.js +11 -1
- package/es/components/Card/CardFooter.js +4 -2
- package/es/components/Card/CardHeader.js +20 -2
- package/es/components/EditUpdateCards/EditUpdateCards.js +66 -4
- package/es/components/ProductiveCard/ProductiveCard.js +21 -1
- package/lib/components/Card/Card.js +11 -1
- package/lib/components/Card/CardFooter.js +4 -2
- package/lib/components/Card/CardHeader.js +20 -2
- package/lib/components/EditUpdateCards/EditUpdateCards.js +66 -4
- package/lib/components/ProductiveCard/ProductiveCard.js +21 -1
- package/package.json +2 -2
- package/scss/components/Datagrid/_storybook-styles.scss +5 -0
- package/scss/components/EditUpdateCards/_edit-update-cards.scss +10 -0
- package/scss/components/ProductiveCard/_productive-card.scss +15 -0
- package/scss/components/Tearsheet/_tearsheet.scss +6 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
-
var _excluded = ["actionIcons", "actionsPlacement", "className", "description", "editChildren", "editMode", "label", "previewChildren", "title", "titleSize"];
|
4
|
+
var _excluded = ["actionIcons", "actionsPlacement", "className", "description", "editChildren", "editMode", "label", "onPrimaryButtonClick", "onSecondaryButtonClick", "previewChildren", "title", "titleSize", "primaryButtonIcon", "primaryButtonText", "secondaryButtonIcon", "secondaryButtonText"];
|
5
5
|
/**
|
6
6
|
* Copyright IBM Corp. 2022, 2022
|
7
7
|
*
|
@@ -56,12 +56,30 @@ export var EditUpdateCards = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
56
56
|
editChildren = _ref.editChildren,
|
57
57
|
editMode = _ref.editMode,
|
58
58
|
label = _ref.label,
|
59
|
+
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
60
|
+
onSecondaryButtonClick = _ref.onSecondaryButtonClick,
|
59
61
|
previewChildren = _ref.previewChildren,
|
60
62
|
title = _ref.title,
|
61
63
|
titleSize = _ref.titleSize,
|
64
|
+
primaryButtonIcon = _ref.primaryButtonIcon,
|
65
|
+
primaryButtonText = _ref.primaryButtonText,
|
66
|
+
secondaryButtonIcon = _ref.secondaryButtonIcon,
|
67
|
+
secondaryButtonText = _ref.secondaryButtonText,
|
62
68
|
rest = _objectWithoutProperties(_ref, _excluded);
|
63
|
-
// const [
|
69
|
+
// const [editCardMode, setEditCardMode] = useState(editMode);
|
64
70
|
|
71
|
+
var conditionalProps = {
|
72
|
+
onPrimaryButtonClick: onPrimaryButtonClick,
|
73
|
+
onSecondaryButtonClick: onSecondaryButtonClick,
|
74
|
+
primaryButtonIcon: primaryButtonIcon,
|
75
|
+
primaryButtonKind: 'ghost',
|
76
|
+
primaryButtonPlacement: 'top',
|
77
|
+
primaryButtonText: primaryButtonText,
|
78
|
+
secondaryButtonIcon: secondaryButtonIcon,
|
79
|
+
secondaryButtonKind: 'ghost',
|
80
|
+
secondaryButtonPlacement: 'top',
|
81
|
+
secondaryButtonText: secondaryButtonText
|
82
|
+
};
|
65
83
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
66
84
|
className: cx(blockClass,
|
67
85
|
// Apply the block class to the main HTML element
|
@@ -70,7 +88,7 @@ export var EditUpdateCards = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
70
88
|
_defineProperty({}, "".concat(blockClass, "__actions-bottom"), actionsPlacement === 'bottom')),
|
71
89
|
ref: ref,
|
72
90
|
role: "main"
|
73
|
-
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(ProductiveCard, {
|
91
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(ProductiveCard, _extends({
|
74
92
|
actionIcons: actionIcons,
|
75
93
|
actionsPlacement: actionsPlacement,
|
76
94
|
className: className,
|
@@ -78,7 +96,7 @@ export var EditUpdateCards = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
78
96
|
label: label,
|
79
97
|
title: title,
|
80
98
|
titleSize: titleSize
|
81
|
-
}, editMode === false && /*#__PURE__*/React.createElement("div", null, previewChildren), editMode && /*#__PURE__*/React.createElement("div", null, editChildren)));
|
99
|
+
}, editMode && conditionalProps), editMode === false && /*#__PURE__*/React.createElement("div", null, previewChildren), editMode && /*#__PURE__*/React.createElement("div", null, editChildren)));
|
82
100
|
});
|
83
101
|
|
84
102
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -127,10 +145,54 @@ EditUpdateCards.propTypes = {
|
|
127
145
|
* Optional label for the top of the card
|
128
146
|
*/
|
129
147
|
label: PropTypes.string,
|
148
|
+
/**
|
149
|
+
* Function that's called from the primary button or action icon
|
150
|
+
*/
|
151
|
+
onPrimaryButtonClick: PropTypes.func,
|
152
|
+
/**
|
153
|
+
* Function that's called from the secondary button or action icon
|
154
|
+
*/
|
155
|
+
onSecondaryButtonClick: PropTypes.func,
|
130
156
|
/**
|
131
157
|
* Preview mode children
|
132
158
|
*/
|
133
159
|
previewChildren: PropTypes.node,
|
160
|
+
/**
|
161
|
+
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
162
|
+
*/
|
163
|
+
primaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
164
|
+
/**
|
165
|
+
* Establishes the kind of button displayed for the primary button
|
166
|
+
*/
|
167
|
+
primaryButtonKind: PropTypes.oneOf(['primary', 'ghost']),
|
168
|
+
/**
|
169
|
+
* Determines if the primary button is on the top or bottom of the card
|
170
|
+
*/
|
171
|
+
primaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
|
172
|
+
/**
|
173
|
+
* The text that's displayed in the primary button
|
174
|
+
*/
|
175
|
+
primaryButtonText: PropTypes.string,
|
176
|
+
/**
|
177
|
+
* Optionally specify an href for your Button to become an <a> element
|
178
|
+
*/
|
179
|
+
secondaryButtonHref: PropTypes.string,
|
180
|
+
/**
|
181
|
+
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
182
|
+
*/
|
183
|
+
secondaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
184
|
+
/**
|
185
|
+
* Establishes the kind of button displayed for the secondary button
|
186
|
+
*/
|
187
|
+
secondaryButtonKind: PropTypes.oneOf(['secondary', 'ghost']),
|
188
|
+
/**
|
189
|
+
* Determines if the secondary button is on the top or bottom of the card
|
190
|
+
*/
|
191
|
+
secondaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
|
192
|
+
/**
|
193
|
+
* The text that's displayed in the secondary button
|
194
|
+
*/
|
195
|
+
secondaryButtonText: PropTypes.string,
|
134
196
|
/**
|
135
197
|
* Title that's displayed at the top of the card
|
136
198
|
*/
|
@@ -27,7 +27,7 @@ export var ProductiveCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
27
27
|
var _ref$actionsPlacement = _ref.actionsPlacement,
|
28
28
|
actionsPlacement = _ref$actionsPlacement === void 0 ? defaults.actionsPlacement : _ref$actionsPlacement,
|
29
29
|
rest = _objectWithoutProperties(_ref, _excluded);
|
30
|
-
var validProps = prepareProps(rest, ['media', 'mediaPosition', '
|
30
|
+
var validProps = prepareProps(rest, ['media', 'mediaPosition', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind']);
|
31
31
|
return /*#__PURE__*/React.createElement(Card, _extends({}, _objectSpread(_objectSpread({}, validProps), {}, {
|
32
32
|
actionsPlacement: actionsPlacement,
|
33
33
|
ref: ref
|
@@ -82,6 +82,10 @@ ProductiveCard.propTypes = {
|
|
82
82
|
* Function that's called from the primary button or action icon
|
83
83
|
*/
|
84
84
|
onPrimaryButtonClick: PropTypes.func,
|
85
|
+
/**
|
86
|
+
* Function that's called from the secondary button or action icon
|
87
|
+
*/
|
88
|
+
onSecondaryButtonClick: PropTypes.func,
|
85
89
|
/**
|
86
90
|
* Use an overflow menu instead of action icons. Refer to design documentation for implementation guidelines
|
87
91
|
*/
|
@@ -111,6 +115,22 @@ ProductiveCard.propTypes = {
|
|
111
115
|
* The text that's displayed in the primary button
|
112
116
|
*/
|
113
117
|
primaryButtonText: PropTypes.node,
|
118
|
+
/**
|
119
|
+
* Optionally specify an href for your Button to become an <a> element
|
120
|
+
*/
|
121
|
+
secondaryButtonHref: PropTypes.string,
|
122
|
+
/**
|
123
|
+
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
124
|
+
*/
|
125
|
+
secondaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
126
|
+
/**
|
127
|
+
* Determines if the secondary button is on the top or bottom of the card
|
128
|
+
*/
|
129
|
+
secondaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
|
130
|
+
/**
|
131
|
+
* The text that's displayed in the secondary button
|
132
|
+
*/
|
133
|
+
secondaryButtonText: PropTypes.node,
|
114
134
|
/**
|
115
135
|
* Title that's displayed at the top of the card
|
116
136
|
*/
|
@@ -16,7 +16,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
16
16
|
var _CardHeader = require("./CardHeader");
|
17
17
|
var _CardFooter = require("./CardFooter");
|
18
18
|
var _settings = require("../../settings");
|
19
|
-
var _excluded = ["actionIcons", "actionsPlacement", "children", "className", "clickZone", "description", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "overflowAriaLabel", "onSecondaryButtonClick", "pictogram", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonPlacement", "primaryButtonText", "productive", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonText", "title", "titleSize"],
|
19
|
+
var _excluded = ["actionIcons", "actionsPlacement", "children", "className", "clickZone", "description", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "overflowAriaLabel", "onSecondaryButtonClick", "pictogram", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonPlacement", "primaryButtonText", "productive", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonPlacement", "secondaryButtonText", "title", "titleSize"],
|
20
20
|
_excluded2 = ["id"],
|
21
21
|
_excluded3 = ["id", "icon", "onClick", "iconDescription", "href"]; //
|
22
22
|
// Copyright IBM Corp. 2020, 2023
|
@@ -41,6 +41,7 @@ var defaults = {
|
|
41
41
|
primaryButtonPlacement: 'bottom',
|
42
42
|
productive: false,
|
43
43
|
secondaryButtonKind: 'secondary',
|
44
|
+
secondaryButtonPlacement: 'bottom',
|
44
45
|
titleSize: 'default'
|
45
46
|
};
|
46
47
|
var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
@@ -78,6 +79,8 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
78
79
|
secondaryButtonIcon = _ref.secondaryButtonIcon,
|
79
80
|
_ref$secondaryButtonK = _ref.secondaryButtonKind,
|
80
81
|
secondaryButtonKind = _ref$secondaryButtonK === void 0 ? defaults.secondaryButtonKind : _ref$secondaryButtonK,
|
82
|
+
_ref$secondaryButtonP = _ref.secondaryButtonPlacement,
|
83
|
+
secondaryButtonPlacement = _ref$secondaryButtonP === void 0 ? defaults.secondaryButtonPlacement : _ref$secondaryButtonP,
|
81
84
|
secondaryButtonText = _ref.secondaryButtonText,
|
82
85
|
title = _ref.title,
|
83
86
|
_ref$titleSize = _ref.titleSize,
|
@@ -182,12 +185,17 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
182
185
|
noActionIcons: actionIcons.length > 0 && actionsPlacement === 'top' ? false : true,
|
183
186
|
actionsPlacement: actionsPlacement,
|
184
187
|
onPrimaryButtonClick: onPrimaryButtonClick,
|
188
|
+
onSecondaryButtonClick: onSecondaryButtonClick,
|
185
189
|
primaryButtonIcon: primaryButtonIcon,
|
186
190
|
primaryButtonPlacement: primaryButtonPlacement,
|
187
191
|
primaryButtonText: primaryButtonText,
|
188
192
|
description: description,
|
189
193
|
hasActions: hasActions,
|
190
194
|
label: label,
|
195
|
+
secondaryButtonHref: secondaryButtonHref,
|
196
|
+
secondaryButtonIcon: secondaryButtonIcon,
|
197
|
+
secondaryButtonPlacement: secondaryButtonPlacement,
|
198
|
+
secondaryButtonText: secondaryButtonText,
|
191
199
|
title: title,
|
192
200
|
titleSize: titleSize
|
193
201
|
};
|
@@ -216,6 +224,7 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
216
224
|
secondaryButtonHref: secondaryButtonHref,
|
217
225
|
secondaryButtonIcon: secondaryButtonIcon,
|
218
226
|
secondaryButtonKind: secondaryButtonKind,
|
227
|
+
secondaryButtonPlacement: secondaryButtonPlacement,
|
219
228
|
secondaryButtonText: secondaryButtonText
|
220
229
|
};
|
221
230
|
};
|
@@ -266,6 +275,7 @@ Card.propTypes = {
|
|
266
275
|
secondaryButtonHref: _propTypes.default.string,
|
267
276
|
secondaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
268
277
|
secondaryButtonKind: _propTypes.default.oneOf(['secondary', 'ghost']),
|
278
|
+
secondaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
|
269
279
|
secondaryButtonText: _propTypes.default.string,
|
270
280
|
title: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object, _propTypes.default.node]),
|
271
281
|
titleSize: _propTypes.default.oneOf(['default', 'large'])
|
@@ -44,14 +44,15 @@ var CardFooter = function CardFooter(_ref) {
|
|
44
44
|
secondaryButtonIcon = _ref.secondaryButtonIcon,
|
45
45
|
_ref$secondaryButtonK = _ref.secondaryButtonKind,
|
46
46
|
secondaryButtonKind = _ref$secondaryButtonK === void 0 ? defaults.secondaryButtonKind : _ref$secondaryButtonK,
|
47
|
+
secondaryButtonPlacement = _ref.secondaryButtonPlacement,
|
47
48
|
secondaryButtonText = _ref.secondaryButtonText;
|
48
49
|
var blockClass = "".concat(_settings.pkg.prefix, "--card");
|
49
50
|
var footerClass = "".concat(_settings.pkg.prefix, "--card__footer");
|
50
51
|
var footerClasses = (0, _classnames.default)(footerClass, (0, _defineProperty2.default)({}, "".concat(footerClass, "-no-button"), !hasButton));
|
51
52
|
return /*#__PURE__*/_react.default.createElement("div", {
|
52
53
|
className: footerClasses
|
53
|
-
}, secondaryButtonText && /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
54
|
-
kind: secondaryButtonKind,
|
54
|
+
}, secondaryButtonText && secondaryButtonPlacement === 'bottom' && /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
55
|
+
kind: productive ? 'ghost' : secondaryButtonKind,
|
55
56
|
onClick: onSecondaryButtonClick,
|
56
57
|
size: "md",
|
57
58
|
renderIcon: secondaryButtonIcon,
|
@@ -82,6 +83,7 @@ CardFooter.propTypes = {
|
|
82
83
|
secondaryButtonHref: _propTypes.default.string,
|
83
84
|
secondaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
84
85
|
secondaryButtonKind: _propTypes.default.oneOf(['secondary', 'ghost']),
|
86
|
+
secondaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
|
85
87
|
secondaryButtonText: _propTypes.default.string
|
86
88
|
};
|
87
89
|
CardFooter.displayName = componentName;
|
@@ -28,6 +28,7 @@ var CardHeader = function CardHeader(_ref) {
|
|
28
28
|
var actions = _ref.actions,
|
29
29
|
noActionIcons = _ref.noActionIcons,
|
30
30
|
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
31
|
+
onSecondaryButtonClick = _ref.onSecondaryButtonClick,
|
31
32
|
primaryButtonIcon = _ref.primaryButtonIcon,
|
32
33
|
primaryButtonPlacement = _ref.primaryButtonPlacement,
|
33
34
|
primaryButtonText = _ref.primaryButtonText,
|
@@ -35,6 +36,10 @@ var CardHeader = function CardHeader(_ref) {
|
|
35
36
|
_ref$hasActions = _ref.hasActions,
|
36
37
|
hasActions = _ref$hasActions === void 0 ? defaults.hasActions : _ref$hasActions,
|
37
38
|
label = _ref.label,
|
39
|
+
secondaryButtonHref = _ref.secondaryButtonHref,
|
40
|
+
secondaryButtonIcon = _ref.secondaryButtonIcon,
|
41
|
+
secondaryButtonPlacement = _ref.secondaryButtonPlacement,
|
42
|
+
secondaryButtonText = _ref.secondaryButtonText,
|
38
43
|
title = _ref.title,
|
39
44
|
_ref$titleSize = _ref.titleSize,
|
40
45
|
titleSize = _ref$titleSize === void 0 ? defaults.titleSize : _ref$titleSize;
|
@@ -57,9 +62,16 @@ var CardHeader = function CardHeader(_ref) {
|
|
57
62
|
className: "".concat(blockClass, "__description")
|
58
63
|
}, description)), hasActions && /*#__PURE__*/_react.default.createElement("div", {
|
59
64
|
className: "".concat(blockClass, "__actions ").concat(blockClass, "__actions-header")
|
60
|
-
}, actions,
|
65
|
+
}, actions, secondaryButtonText && secondaryButtonPlacement === 'top' && /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
61
66
|
kind: "ghost",
|
62
|
-
|
67
|
+
onClick: onSecondaryButtonClick,
|
68
|
+
size: "sm",
|
69
|
+
renderIcon: secondaryButtonIcon,
|
70
|
+
href: secondaryButtonHref,
|
71
|
+
className: actionGhostButtonClass
|
72
|
+
}, secondaryButtonText), primaryButtonText && primaryButtonPlacement === 'top' && /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
73
|
+
kind: "ghost",
|
74
|
+
size: "sm",
|
63
75
|
renderIcon: primaryButtonIcon,
|
64
76
|
onClick: onPrimaryButtonClick,
|
65
77
|
className: actionGhostButtonClass
|
@@ -73,9 +85,15 @@ CardHeader.propTypes = {
|
|
73
85
|
label: _propTypes.default.string,
|
74
86
|
noActionIcons: _propTypes.default.bool,
|
75
87
|
onPrimaryButtonClick: _propTypes.default.func,
|
88
|
+
onSecondaryButtonClick: _propTypes.default.func,
|
76
89
|
primaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
77
90
|
primaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
|
78
91
|
primaryButtonText: _propTypes.default.string,
|
92
|
+
secondaryButtonHref: _propTypes.default.string,
|
93
|
+
secondaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
94
|
+
secondaryButtonKind: _propTypes.default.oneOf(['secondary', 'ghost']),
|
95
|
+
secondaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
|
96
|
+
secondaryButtonText: _propTypes.default.string,
|
79
97
|
title: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.object, _propTypes.default.node]),
|
80
98
|
titleSize: _propTypes.default.oneOf(['default', 'large'])
|
81
99
|
};
|
@@ -14,7 +14,7 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
14
|
var _devtools = require("../../global/js/utils/devtools");
|
15
15
|
var _settings = require("../../settings");
|
16
16
|
var _ProductiveCard = require("../ProductiveCard");
|
17
|
-
var _excluded = ["actionIcons", "actionsPlacement", "className", "description", "editChildren", "editMode", "label", "previewChildren", "title", "titleSize"];
|
17
|
+
var _excluded = ["actionIcons", "actionsPlacement", "className", "description", "editChildren", "editMode", "label", "onPrimaryButtonClick", "onSecondaryButtonClick", "previewChildren", "title", "titleSize", "primaryButtonIcon", "primaryButtonText", "secondaryButtonIcon", "secondaryButtonText"];
|
18
18
|
/**
|
19
19
|
* Copyright IBM Corp. 2022, 2022
|
20
20
|
*
|
@@ -59,12 +59,30 @@ var EditUpdateCards = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
59
59
|
editChildren = _ref.editChildren,
|
60
60
|
editMode = _ref.editMode,
|
61
61
|
label = _ref.label,
|
62
|
+
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
63
|
+
onSecondaryButtonClick = _ref.onSecondaryButtonClick,
|
62
64
|
previewChildren = _ref.previewChildren,
|
63
65
|
title = _ref.title,
|
64
66
|
titleSize = _ref.titleSize,
|
67
|
+
primaryButtonIcon = _ref.primaryButtonIcon,
|
68
|
+
primaryButtonText = _ref.primaryButtonText,
|
69
|
+
secondaryButtonIcon = _ref.secondaryButtonIcon,
|
70
|
+
secondaryButtonText = _ref.secondaryButtonText,
|
65
71
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
66
|
-
// const [
|
72
|
+
// const [editCardMode, setEditCardMode] = useState(editMode);
|
67
73
|
|
74
|
+
var conditionalProps = {
|
75
|
+
onPrimaryButtonClick: onPrimaryButtonClick,
|
76
|
+
onSecondaryButtonClick: onSecondaryButtonClick,
|
77
|
+
primaryButtonIcon: primaryButtonIcon,
|
78
|
+
primaryButtonKind: 'ghost',
|
79
|
+
primaryButtonPlacement: 'top',
|
80
|
+
primaryButtonText: primaryButtonText,
|
81
|
+
secondaryButtonIcon: secondaryButtonIcon,
|
82
|
+
secondaryButtonKind: 'ghost',
|
83
|
+
secondaryButtonPlacement: 'top',
|
84
|
+
secondaryButtonText: secondaryButtonText
|
85
|
+
};
|
68
86
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
69
87
|
className: (0, _classnames.default)(blockClass,
|
70
88
|
// Apply the block class to the main HTML element
|
@@ -73,7 +91,7 @@ var EditUpdateCards = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
73
91
|
(0, _defineProperty2.default)({}, "".concat(blockClass, "__actions-bottom"), actionsPlacement === 'bottom')),
|
74
92
|
ref: ref,
|
75
93
|
role: "main"
|
76
|
-
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_ProductiveCard.ProductiveCard, {
|
94
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_ProductiveCard.ProductiveCard, (0, _extends2.default)({
|
77
95
|
actionIcons: actionIcons,
|
78
96
|
actionsPlacement: actionsPlacement,
|
79
97
|
className: className,
|
@@ -81,7 +99,7 @@ var EditUpdateCards = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
81
99
|
label: label,
|
82
100
|
title: title,
|
83
101
|
titleSize: titleSize
|
84
|
-
}, editMode === false && /*#__PURE__*/_react.default.createElement("div", null, previewChildren), editMode && /*#__PURE__*/_react.default.createElement("div", null, editChildren)));
|
102
|
+
}, editMode && conditionalProps), editMode === false && /*#__PURE__*/_react.default.createElement("div", null, previewChildren), editMode && /*#__PURE__*/_react.default.createElement("div", null, editChildren)));
|
85
103
|
});
|
86
104
|
|
87
105
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -131,10 +149,54 @@ EditUpdateCards.propTypes = {
|
|
131
149
|
* Optional label for the top of the card
|
132
150
|
*/
|
133
151
|
label: _propTypes.default.string,
|
152
|
+
/**
|
153
|
+
* Function that's called from the primary button or action icon
|
154
|
+
*/
|
155
|
+
onPrimaryButtonClick: _propTypes.default.func,
|
156
|
+
/**
|
157
|
+
* Function that's called from the secondary button or action icon
|
158
|
+
*/
|
159
|
+
onSecondaryButtonClick: _propTypes.default.func,
|
134
160
|
/**
|
135
161
|
* Preview mode children
|
136
162
|
*/
|
137
163
|
previewChildren: _propTypes.default.node,
|
164
|
+
/**
|
165
|
+
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
166
|
+
*/
|
167
|
+
primaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
168
|
+
/**
|
169
|
+
* Establishes the kind of button displayed for the primary button
|
170
|
+
*/
|
171
|
+
primaryButtonKind: _propTypes.default.oneOf(['primary', 'ghost']),
|
172
|
+
/**
|
173
|
+
* Determines if the primary button is on the top or bottom of the card
|
174
|
+
*/
|
175
|
+
primaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
|
176
|
+
/**
|
177
|
+
* The text that's displayed in the primary button
|
178
|
+
*/
|
179
|
+
primaryButtonText: _propTypes.default.string,
|
180
|
+
/**
|
181
|
+
* Optionally specify an href for your Button to become an <a> element
|
182
|
+
*/
|
183
|
+
secondaryButtonHref: _propTypes.default.string,
|
184
|
+
/**
|
185
|
+
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
186
|
+
*/
|
187
|
+
secondaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
188
|
+
/**
|
189
|
+
* Establishes the kind of button displayed for the secondary button
|
190
|
+
*/
|
191
|
+
secondaryButtonKind: _propTypes.default.oneOf(['secondary', 'ghost']),
|
192
|
+
/**
|
193
|
+
* Determines if the secondary button is on the top or bottom of the card
|
194
|
+
*/
|
195
|
+
secondaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
|
196
|
+
/**
|
197
|
+
* The text that's displayed in the secondary button
|
198
|
+
*/
|
199
|
+
secondaryButtonText: _propTypes.default.string,
|
138
200
|
/**
|
139
201
|
* Title that's displayed at the top of the card
|
140
202
|
*/
|
@@ -35,7 +35,7 @@ var ProductiveCard = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
35
35
|
var _ref$actionsPlacement = _ref.actionsPlacement,
|
36
36
|
actionsPlacement = _ref$actionsPlacement === void 0 ? defaults.actionsPlacement : _ref$actionsPlacement,
|
37
37
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
38
|
-
var validProps = (0, _propsHelper.prepareProps)(rest, ['media', 'mediaPosition', '
|
38
|
+
var validProps = (0, _propsHelper.prepareProps)(rest, ['media', 'mediaPosition', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind']);
|
39
39
|
return /*#__PURE__*/_react.default.createElement(_Card.Card, (0, _extends2.default)({}, _objectSpread(_objectSpread({}, validProps), {}, {
|
40
40
|
actionsPlacement: actionsPlacement,
|
41
41
|
ref: ref
|
@@ -91,6 +91,10 @@ ProductiveCard.propTypes = {
|
|
91
91
|
* Function that's called from the primary button or action icon
|
92
92
|
*/
|
93
93
|
onPrimaryButtonClick: _propTypes.default.func,
|
94
|
+
/**
|
95
|
+
* Function that's called from the secondary button or action icon
|
96
|
+
*/
|
97
|
+
onSecondaryButtonClick: _propTypes.default.func,
|
94
98
|
/**
|
95
99
|
* Use an overflow menu instead of action icons. Refer to design documentation for implementation guidelines
|
96
100
|
*/
|
@@ -120,6 +124,22 @@ ProductiveCard.propTypes = {
|
|
120
124
|
* The text that's displayed in the primary button
|
121
125
|
*/
|
122
126
|
primaryButtonText: _propTypes.default.node,
|
127
|
+
/**
|
128
|
+
* Optionally specify an href for your Button to become an <a> element
|
129
|
+
*/
|
130
|
+
secondaryButtonHref: _propTypes.default.string,
|
131
|
+
/**
|
132
|
+
* Optional prop to allow overriding the icon rendering. Can be a React component class
|
133
|
+
*/
|
134
|
+
secondaryButtonIcon: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object]),
|
135
|
+
/**
|
136
|
+
* Determines if the secondary button is on the top or bottom of the card
|
137
|
+
*/
|
138
|
+
secondaryButtonPlacement: _propTypes.default.oneOf(['top', 'bottom']),
|
139
|
+
/**
|
140
|
+
* The text that's displayed in the secondary button
|
141
|
+
*/
|
142
|
+
secondaryButtonText: _propTypes.default.node,
|
123
143
|
/**
|
124
144
|
* Title that's displayed at the top of the card
|
125
145
|
*/
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "2.4.
|
4
|
+
"version": "2.4.1",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -94,5 +94,5 @@
|
|
94
94
|
"react": "^16.8.6 || ^17.0.1",
|
95
95
|
"react-dom": "^16.8.6 || ^17.0.1"
|
96
96
|
},
|
97
|
-
"gitHead": "
|
97
|
+
"gitHead": "3e735167a2cc5e2a7e2f87069c4ae1bc31ce0736"
|
98
98
|
}
|
@@ -54,6 +54,11 @@ $block-class: #{c4p-settings.$pkg-prefix}--datagrid;
|
|
54
54
|
padding-bottom: $spacing-06;
|
55
55
|
}
|
56
56
|
|
57
|
+
.#{$block-class}__side-panel-link {
|
58
|
+
padding-top: $spacing-01;
|
59
|
+
padding-bottom: $spacing-06;
|
60
|
+
}
|
61
|
+
|
57
62
|
.#{$block-class}__side-panel-section-inner {
|
58
63
|
display: flex;
|
59
64
|
padding: $spacing-01 0;
|
@@ -31,6 +31,9 @@ $block-class: #{c4p-settings.$pkg-prefix}--edit-update-cards;
|
|
31
31
|
.#{c4p-settings.$pkg-prefix}--card__header,
|
32
32
|
.#{c4p-settings.$pkg-prefix}--card__footer {
|
33
33
|
button {
|
34
|
+
// stylelint-disable-next-line carbon/theme-token-use
|
35
|
+
color: $white-0;
|
36
|
+
|
34
37
|
&:hover {
|
35
38
|
// stylelint-disable-next-line carbon/theme-token-use
|
36
39
|
background-color: $blue-60-hover;
|
@@ -54,12 +57,14 @@ $block-class: #{c4p-settings.$pkg-prefix}--edit-update-cards;
|
|
54
57
|
}
|
55
58
|
}
|
56
59
|
}
|
60
|
+
|
57
61
|
.#{c4p-settings.$pkg-prefix}--card__footer {
|
58
62
|
// stylelint-disable-next-line carbon/theme-token-use
|
59
63
|
background-color: $blue-60;
|
60
64
|
// stylelint-disable-next-line carbon/theme-token-use
|
61
65
|
color: $white-0;
|
62
66
|
}
|
67
|
+
|
63
68
|
.#{c4p-settings.$pkg-prefix}--loading {
|
64
69
|
animation-duration: $duration-slow-02;
|
65
70
|
animation-fill-mode: forwards;
|
@@ -71,7 +76,12 @@ $block-class: #{c4p-settings.$pkg-prefix}--edit-update-cards;
|
|
71
76
|
background-color: transparent;
|
72
77
|
}
|
73
78
|
}
|
79
|
+
|
80
|
+
.#{c4p-settings.$pkg-prefix}--card__header-container {
|
81
|
+
align-items: center;
|
82
|
+
}
|
74
83
|
}
|
84
|
+
|
75
85
|
&:not(.#{$block-class}__actions-bottom) {
|
76
86
|
&##{$block-class}--edit {
|
77
87
|
.#{c4p-settings.$pkg-prefix}--card__header {
|
@@ -77,6 +77,21 @@ $block-class: #{c4p-settings.$pkg-prefix}--card;
|
|
77
77
|
&::before {
|
78
78
|
opacity: 0;
|
79
79
|
}
|
80
|
+
|
81
|
+
+ .#{$block-class}__actions-header-ghost-button {
|
82
|
+
/* stylelint-disable-next-line max-nesting-depth */
|
83
|
+
&::before {
|
84
|
+
opacity: 0;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
}
|
88
|
+
|
89
|
+
/* stylelint-disable-next-line max-nesting-depth */
|
90
|
+
&:first-child:not(:last-child) {
|
91
|
+
/* stylelint-disable-next-line max-nesting-depth */
|
92
|
+
&::before {
|
93
|
+
display: none;
|
94
|
+
}
|
80
95
|
}
|
81
96
|
}
|
82
97
|
|
@@ -127,6 +127,12 @@ $motion-duration: $duration-moderate-02;
|
|
127
127
|
width: 100%;
|
128
128
|
}
|
129
129
|
|
130
|
+
&.#{$block-class}--wide
|
131
|
+
.#{$pkg-prefix}--action-set
|
132
|
+
.#{$pkg-prefix}--action-set__action-button.#{$pkg-prefix}--action-set__action-button--expressive {
|
133
|
+
height: $spacing-11;
|
134
|
+
}
|
135
|
+
|
130
136
|
@include breakpoint(md) {
|
131
137
|
&.#{$block-class}--wide .#{$block-class}__container {
|
132
138
|
width: calc(100% - (2 * #{$spacing-10}));
|