@carbon/ibm-products 2.43.2-canary.303 → 2.43.2-canary.305
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 +57 -8
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +57 -8
- 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 +57 -8
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +57 -8
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/Card/Card.d.ts +5 -1
- package/es/components/Card/Card.js +9 -2
- package/es/components/Card/CardHeader.d.ts +12 -2
- package/es/components/Card/CardHeader.js +17 -9
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +2 -2
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +8 -8
- package/es/components/Datagrid/Datagrid/DatagridRow.js +14 -10
- package/es/components/Datagrid/Datagrid/addons/{Slug/DatagridSlug.d.ts → AiLabel/DatagridAiLabel.d.ts} +3 -3
- package/es/components/Datagrid/Datagrid/addons/AiLabel/DatagridAiLabel.js +29 -0
- package/es/components/Datagrid/types/index.d.ts +2 -1
- package/es/components/Datagrid/useDefaultStringRenderer.js +3 -3
- package/es/components/Datagrid/useSortableColumns.js +6 -6
- package/es/components/ExpressiveCard/ExpressiveCard.d.ts +5 -0
- package/es/components/ExpressiveCard/ExpressiveCard.js +5 -0
- package/es/components/ProductiveCard/ProductiveCard.d.ts +5 -0
- package/es/components/ProductiveCard/ProductiveCard.js +4 -0
- package/lib/components/Card/Card.d.ts +5 -1
- package/lib/components/Card/Card.js +9 -2
- package/lib/components/Card/CardHeader.d.ts +12 -2
- package/lib/components/Card/CardHeader.js +17 -9
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +2 -2
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +8 -8
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +14 -10
- package/lib/components/Datagrid/Datagrid/addons/{Slug/DatagridSlug.d.ts → AiLabel/DatagridAiLabel.d.ts} +3 -3
- package/lib/components/Datagrid/Datagrid/addons/AiLabel/DatagridAiLabel.js +31 -0
- package/lib/components/Datagrid/types/index.d.ts +2 -1
- package/lib/components/Datagrid/useDefaultStringRenderer.js +3 -3
- package/lib/components/Datagrid/useSortableColumns.js +6 -6
- package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +5 -0
- package/lib/components/ExpressiveCard/ExpressiveCard.js +5 -0
- package/lib/components/ProductiveCard/ProductiveCard.d.ts +5 -0
- package/lib/components/ProductiveCard/ProductiveCard.js +4 -0
- package/package.json +3 -3
- package/scss/components/Card/_card.scss +14 -6
- package/scss/components/Datagrid/styles/_datagrid.scss +80 -2
- package/es/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.js +0 -29
- package/lib/components/Datagrid/Datagrid/addons/Slug/DatagridSlug.js +0 -31
@@ -16,7 +16,7 @@ import { CardFooter } from './CardFooter.js';
|
|
16
16
|
import { pkg } from '../../settings.js';
|
17
17
|
|
18
18
|
var _Incomplete, _CheckmarkOutline;
|
19
|
-
var _excluded = ["actionIcons", "actionsPlacement", "metadata", "children", "className", "clickZone", "description", "disabled", "footerActionIcon", "getStarted", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "overflowAriaLabel", "onSecondaryButtonClick", "pictogram", "primaryButtonDisabled", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonPlacement", "primaryButtonText", "productive", "secondaryButtonDisabled", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonPlacement", "secondaryButtonText", "slug", "status", "sequence", "title", "titleSize", "iconDescription"],
|
19
|
+
var _excluded = ["actionIcons", "actionsPlacement", "aiLabel", "metadata", "children", "className", "clickZone", "description", "disabled", "footerActionIcon", "getStarted", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "overflowAriaLabel", "onSecondaryButtonClick", "pictogram", "primaryButtonDisabled", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonPlacement", "primaryButtonText", "productive", "secondaryButtonDisabled", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonPlacement", "secondaryButtonText", "slug", "status", "sequence", "title", "titleSize", "iconDescription"],
|
20
20
|
_excluded2 = ["id"],
|
21
21
|
_excluded3 = ["id", "icon", "onClick", "iconDescription", "href"];
|
22
22
|
var componentName = 'Card';
|
@@ -25,6 +25,7 @@ var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
25
25
|
actionIcons = _ref$actionIcons === void 0 ? Object.freeze([]) : _ref$actionIcons,
|
26
26
|
_ref$actionsPlacement = _ref.actionsPlacement,
|
27
27
|
actionsPlacement = _ref$actionsPlacement === void 0 ? 'bottom' : _ref$actionsPlacement,
|
28
|
+
aiLabel = _ref.aiLabel,
|
28
29
|
_ref$metadata = _ref.metadata,
|
29
30
|
metadata = _ref$metadata === void 0 ? Object.freeze([]) : _ref$metadata,
|
30
31
|
children = _ref.children,
|
@@ -166,7 +167,7 @@ var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
166
167
|
var clickable = hasClickEvent && !productive || hasClickEvent && productive && clickZone === 'one';
|
167
168
|
var cardProps = _objectSpread2(_objectSpread2({}, rest), {}, {
|
168
169
|
ref: ref,
|
169
|
-
className: cx(blockClass, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__disabled"), disabled), "".concat(blockClass, "__get-started"), getStarted), "".concat(blockClass, "__productive"), productive), "".concat(blockClass, "__clickable"), clickable), "".concat(blockClass, "__media-left"), mediaPosition === 'left'), "".concat(blockClass, "--has-slug"), !!slug), className)
|
170
|
+
className: cx(blockClass, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__disabled"), disabled), "".concat(blockClass, "__get-started"), getStarted), "".concat(blockClass, "__productive"), productive), "".concat(blockClass, "__clickable"), clickable), "".concat(blockClass, "__media-left"), mediaPosition === 'left'), "".concat(blockClass, "--has-slug"), !!slug), "".concat(blockClass, "--has-ai-label"), !!aiLabel), className)
|
170
171
|
}, clickable && clickableProps);
|
171
172
|
return cardProps;
|
172
173
|
};
|
@@ -182,6 +183,7 @@ var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
182
183
|
var getHeaderProps = function getHeaderProps() {
|
183
184
|
return {
|
184
185
|
actions: actionsPlacement === 'top' ? getActions() : '',
|
186
|
+
aiLabel: aiLabel,
|
185
187
|
noActionIcons: getIcons().length > 0 && actionsPlacement === 'top' ? false : true,
|
186
188
|
actionsPlacement: actionsPlacement,
|
187
189
|
onPrimaryButtonClick: onPrimaryButtonClick,
|
@@ -265,6 +267,10 @@ Card.propTypes = {
|
|
265
267
|
href: PropTypes.string
|
266
268
|
})),
|
267
269
|
actionsPlacement: PropTypes.oneOf(['top', 'bottom']),
|
270
|
+
/**
|
271
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
272
|
+
*/
|
273
|
+
aiLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),
|
268
274
|
children: PropTypes.node,
|
269
275
|
className: PropTypes.string,
|
270
276
|
clickZone: PropTypes.oneOf(['one', 'two', 'three']),
|
@@ -316,6 +322,7 @@ Card.propTypes = {
|
|
316
322
|
/**
|
317
323
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
318
324
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
325
|
+
* @deprecated please use the `aiLabel` prop
|
319
326
|
*/
|
320
327
|
slug: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),
|
321
328
|
status: PropTypes.oneOf(['complete', 'incomplete']),
|
@@ -1,7 +1,11 @@
|
|
1
1
|
import React, { ReactNode } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
interface CardHeaderProps {
|
4
|
-
actions?: ReactNode
|
4
|
+
actions?: ReactNode;
|
5
|
+
/**
|
6
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
7
|
+
*/
|
8
|
+
aiLabel?: ReactNode | boolean;
|
5
9
|
description?: ReactNode;
|
6
10
|
hasActions?: boolean;
|
7
11
|
/**
|
@@ -25,16 +29,21 @@ interface CardHeaderProps {
|
|
25
29
|
/**
|
26
30
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
27
31
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
32
|
+
* @deprecated please use the `aiLabel` prop
|
28
33
|
*/
|
29
34
|
slug?: ReactNode;
|
30
35
|
title?: ReactNode;
|
31
36
|
titleSize?: 'default' | 'large';
|
32
37
|
}
|
33
38
|
export declare const CardHeader: {
|
34
|
-
({ actions, noActionIcons, onPrimaryButtonClick, onSecondaryButtonClick, primaryButtonIcon, primaryButtonPlacement, primaryButtonText, primaryButtonDisabled, description, hasActions, inClickableCard, label, secondaryButtonDisabled, secondaryButtonHref, secondaryButtonIcon, secondaryButtonPlacement, secondaryButtonText, slug, title, titleSize, }: CardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
39
|
+
({ actions, aiLabel, noActionIcons, onPrimaryButtonClick, onSecondaryButtonClick, primaryButtonIcon, primaryButtonPlacement, primaryButtonText, primaryButtonDisabled, description, hasActions, inClickableCard, label, secondaryButtonDisabled, secondaryButtonHref, secondaryButtonIcon, secondaryButtonPlacement, secondaryButtonText, slug, title, titleSize, }: CardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
35
40
|
/**@ts-ignore */
|
36
41
|
propTypes: {
|
37
42
|
actions: PropTypes.Requireable<NonNullable<any[] | PropTypes.ReactNodeLike>>;
|
43
|
+
/**
|
44
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
45
|
+
*/
|
46
|
+
aiLabel: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
38
47
|
description: PropTypes.Requireable<NonNullable<object | PropTypes.ReactNodeLike>>;
|
39
48
|
hasActions: PropTypes.Requireable<boolean>;
|
40
49
|
/**
|
@@ -58,6 +67,7 @@ export declare const CardHeader: {
|
|
58
67
|
/**
|
59
68
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
60
69
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
70
|
+
* @deprecated please use the `aiLabel` prop
|
61
71
|
*/
|
62
72
|
slug: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
63
73
|
title: PropTypes.Requireable<NonNullable<object | PropTypes.ReactNodeLike>>;
|
@@ -20,6 +20,7 @@ var defaults = {
|
|
20
20
|
};
|
21
21
|
var CardHeader = function CardHeader(_ref) {
|
22
22
|
var actions = _ref.actions,
|
23
|
+
aiLabel = _ref.aiLabel,
|
23
24
|
noActionIcons = _ref.noActionIcons,
|
24
25
|
onPrimaryButtonClick = _ref.onPrimaryButtonClick,
|
25
26
|
onSecondaryButtonClick = _ref.onSecondaryButtonClick,
|
@@ -47,8 +48,9 @@ var CardHeader = function CardHeader(_ref) {
|
|
47
48
|
var headerClasses = cx(headerClass, _defineProperty(_defineProperty(_defineProperty({}, "".concat(headerClass, "-label-only"), label && !title && !description), "".concat(headerClass, "-has-label"), !!label), "".concat(blockClass, "__title-lg"), titleSize === 'large'));
|
48
49
|
var actionGhostButton = "".concat(blockClass, "__actions-header-ghost-button");
|
49
50
|
var actionGhostButtonClass = cx(actionGhostButton, _defineProperty({}, "".concat(actionGhostButton, "--only"), noActionIcons));
|
50
|
-
var
|
51
|
-
className: "".concat(carbonPrefix, "--slug ").concat(carbonPrefix, "--slug-icon")
|
51
|
+
var hollowAiIcon = /*#__PURE__*/React__default.createElement("svg", {
|
52
|
+
className: "".concat(carbonPrefix, "--slug ").concat(carbonPrefix, "--slug-icon") // NOTE: We cannot change this to ai-label until carbon changes their classnames on their end
|
53
|
+
,
|
52
54
|
width: "24",
|
53
55
|
height: "24",
|
54
56
|
viewBox: "0 0 24 24",
|
@@ -63,12 +65,13 @@ var CardHeader = function CardHeader(_ref) {
|
|
63
65
|
d: "M13.2436 16H11.5996L10.9276 13.864H7.95164L7.29164 16H5.68364L8.49164 7.624H10.4596L13.2436 16ZM10.5436 12.508L9.46364 9.064H9.40364L8.33564 12.508H10.5436ZM17.9341 16H14.1301V14.728H15.2341V8.896H14.1301V7.624H17.9341V8.896H16.8181V14.728H17.9341V16Z",
|
64
66
|
fill: "#161616"
|
65
67
|
})));
|
66
|
-
var
|
67
|
-
if (slug) {
|
68
|
-
if (inClickableCard || typeof slug === 'boolean') {
|
69
|
-
|
68
|
+
var normalizedAiLabel = null;
|
69
|
+
if (aiLabel || slug) {
|
70
|
+
if (inClickableCard || typeof aiLabel === 'boolean' || typeof slug === 'boolean') {
|
71
|
+
normalizedAiLabel = hollowAiIcon;
|
70
72
|
} else {
|
71
|
-
|
73
|
+
var element = aiLabel || slug;
|
74
|
+
normalizedAiLabel = /*#__PURE__*/React__default.cloneElement(element, {
|
72
75
|
size: label && title || title && titleSize === 'large' ? 'sm' : 'xs'
|
73
76
|
});
|
74
77
|
}
|
@@ -76,7 +79,7 @@ var CardHeader = function CardHeader(_ref) {
|
|
76
79
|
return /*#__PURE__*/React__default.createElement("div", {
|
77
80
|
className: headerClasses
|
78
81
|
}, /*#__PURE__*/React__default.createElement("div", {
|
79
|
-
className: cx(["".concat(headerClass, "-container"), _defineProperty({}, "".concat(headerClass, "-container--has-slug"), !!slug), _defineProperty({}, "".concat(headerClass, "-container--has-actions"), !!hasActions), _defineProperty({}, "".concat(headerClass, "-container--large-tile-or-label"), title && (label || titleSize === 'large'))])
|
82
|
+
className: cx(["".concat(headerClass, "-container"), _defineProperty({}, "".concat(headerClass, "-container--has-slug"), !!slug), _defineProperty({}, "".concat(headerClass, "-container--has-ai-label"), !!aiLabel), _defineProperty({}, "".concat(headerClass, "-container--has-actions"), !!hasActions), _defineProperty({}, "".concat(headerClass, "-container--large-tile-or-label"), title && (label || titleSize === 'large'))])
|
80
83
|
}, /*#__PURE__*/React__default.createElement("div", {
|
81
84
|
className: "".concat(blockClass, "__title-container")
|
82
85
|
}, label && /*#__PURE__*/React__default.createElement("p", {
|
@@ -102,11 +105,15 @@ var CardHeader = function CardHeader(_ref) {
|
|
102
105
|
onClick: onPrimaryButtonClick,
|
103
106
|
className: actionGhostButtonClass,
|
104
107
|
disabled: primaryButtonDisabled
|
105
|
-
}, primaryButtonText)),
|
108
|
+
}, primaryButtonText)), normalizedAiLabel));
|
106
109
|
};
|
107
110
|
/**@ts-ignore */
|
108
111
|
CardHeader.propTypes = {
|
109
112
|
actions: PropTypes.oneOfType([PropTypes.array, PropTypes.node]),
|
113
|
+
/**
|
114
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
115
|
+
*/
|
116
|
+
aiLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),
|
110
117
|
description: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.node]),
|
111
118
|
hasActions: PropTypes.bool,
|
112
119
|
/**
|
@@ -130,6 +137,7 @@ CardHeader.propTypes = {
|
|
130
137
|
/**
|
131
138
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
132
139
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
140
|
+
* @deprecated please use the `aiLabel` prop
|
133
141
|
*/
|
134
142
|
slug: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),
|
135
143
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.node]),
|
@@ -16,7 +16,7 @@ var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
16
16
|
// eslint-disable-next-line react/prop-types
|
17
17
|
var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentComponent) {
|
18
18
|
return function (datagridState) {
|
19
|
-
var _row$original;
|
19
|
+
var _row$original, _row$original2;
|
20
20
|
var row = datagridState.row;
|
21
21
|
var expandedContentHeight = row.expandedContentHeight;
|
22
22
|
var toggleParentHoverClass = function toggleParentHoverClass(event) {
|
@@ -36,7 +36,7 @@ var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentCompone
|
|
36
36
|
var key = datagridState.key,
|
37
37
|
_state = _objectWithoutProperties(datagridState, _excluded);
|
38
38
|
return /*#__PURE__*/React__default.createElement("tr", {
|
39
|
-
className: cx("".concat(blockClass, "__expanded-row"), _defineProperty({}, "".concat(blockClass, "__slug--row"), /*#__PURE__*/isValidElement(row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.slug))),
|
39
|
+
className: cx("".concat(blockClass, "__expanded-row"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__slug--row"), /*#__PURE__*/isValidElement(row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.slug)), "".concat(blockClass, "__ai-label--row"), /*#__PURE__*/isValidElement(row === null || row === void 0 || (_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.aiLabel))),
|
40
40
|
onMouseEnter: function onMouseEnter(event) {
|
41
41
|
return toggleParentHoverClass(event, 'enter');
|
42
42
|
},
|
@@ -14,7 +14,7 @@ import { selectionColumnId } from '../common-column-ids.js';
|
|
14
14
|
import { pkg } from '../../../settings.js';
|
15
15
|
import { handleColumnResizeEndEvent, handleColumnResizingEvent } from './addons/stateReducer.js';
|
16
16
|
import { getNodeTextContent } from '../../../global/js/utils/getNodeTextContent.js';
|
17
|
-
import {
|
17
|
+
import { DatagridAILabel } from './addons/AiLabel/DatagridAiLabel.js';
|
18
18
|
import { useInitialColumnSort } from '../useInitialColumnSort.js';
|
19
19
|
|
20
20
|
var _th;
|
@@ -140,17 +140,17 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
140
140
|
}),
|
141
141
|
headerGroupClassName = _headerGroup$getHeade.className,
|
142
142
|
headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded);
|
143
|
-
var
|
143
|
+
var renderAILabel = function renderAILabel(aiLabel) {
|
144
144
|
if (isTableSortable) {
|
145
145
|
return;
|
146
146
|
}
|
147
|
-
return /*#__PURE__*/React__default.createElement(
|
148
|
-
|
147
|
+
return /*#__PURE__*/React__default.createElement(DatagridAILabel, {
|
148
|
+
aiLabel: aiLabel
|
149
149
|
});
|
150
150
|
};
|
151
151
|
var foundAIRow = rows.some(function (r) {
|
152
|
-
var _r$original;
|
153
|
-
return /*#__PURE__*/isValidElement(r === null || r === void 0 || (_r$original = r.original) === null || _r$original === void 0 ? void 0 : _r$original.slug);
|
152
|
+
var _r$original, _r$original2;
|
153
|
+
return /*#__PURE__*/isValidElement(r === null || r === void 0 || (_r$original = r.original) === null || _r$original === void 0 ? void 0 : _r$original.aiLabel) || /*#__PURE__*/isValidElement(r === null || r === void 0 || (_r$original2 = r.original) === null || _r$original2 === void 0 ? void 0 : _r$original2.slug);
|
154
154
|
});
|
155
155
|
var key = headerGroupProps.key,
|
156
156
|
rowProps = _objectWithoutProperties(headerGroupProps, _excluded2);
|
@@ -203,10 +203,10 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
203
203
|
});
|
204
204
|
}
|
205
205
|
return /*#__PURE__*/React__default.createElement(TableHeader, _extends({}, headerProps, {
|
206
|
-
className: cx(header === null || header === void 0 ? void 0 : header.className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default.isValidElement(header === null || header === void 0 ? void 0 : header.slug)), headerProps.className),
|
206
|
+
className: cx(header === null || header === void 0 ? void 0 : header.className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header === null || header === void 0 ? void 0 : header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header === null || header === void 0 ? void 0 : header.isSorted), "".concat(blockClass, "__header-actions-column"), header === null || header === void 0 ? void 0 : header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React__default.isValidElement(header === null || header === void 0 ? void 0 : header.slug)), "".concat(blockClass, "__with-ai-label"), header.aiLabel && /*#__PURE__*/React__default.isValidElement(header === null || header === void 0 ? void 0 : header.aiLabel)), headerProps.className),
|
207
207
|
key: header.id,
|
208
208
|
"aria-hidden": header.id === 'spacer' && 'true'
|
209
|
-
}, getAccessibilityProps(header)), header.render('Header'),
|
209
|
+
}, getAccessibilityProps(header)), header.render('Header'), renderAILabel(header.aiLabel || header.slug), resizerProps && !header.isAction && /*#__PURE__*/React__default.createElement(ResizeHeader, {
|
210
210
|
resizerProps: resizerProps,
|
211
211
|
header: header,
|
212
212
|
handleOnMouseDownResize: handleOnMouseDownResize,
|
@@ -12,7 +12,7 @@ import { px } from '@carbon/layout';
|
|
12
12
|
import { selectionColumnId } from '../common-column-ids.js';
|
13
13
|
import cx from 'classnames';
|
14
14
|
import { pkg, carbon } from '../../../settings.js';
|
15
|
-
import {
|
15
|
+
import { DatagridAILabel } from './addons/AiLabel/DatagridAiLabel.js';
|
16
16
|
|
17
17
|
var _SkeletonText;
|
18
18
|
var _excluded = ["className"],
|
@@ -28,7 +28,7 @@ var rowHeights = {
|
|
28
28
|
|
29
29
|
// eslint-disable-next-line react/prop-types
|
30
30
|
var DatagridRow = function DatagridRow(datagridState) {
|
31
|
-
var _row$original, _row$original2, _row$original3;
|
31
|
+
var _row$original, _row$original2, _row$original3, _row$original4, _row$original5, _row$original6;
|
32
32
|
var row = datagridState.row,
|
33
33
|
rows = datagridState.rows,
|
34
34
|
rowSize = datagridState.rowSize,
|
@@ -115,10 +115,10 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
115
115
|
className = _row$getRowProps.className,
|
116
116
|
rowProps = _objectWithoutProperties(_row$getRowProps, _excluded);
|
117
117
|
var foundAIRow = rows.some(function (r) {
|
118
|
-
var _r$original;
|
119
|
-
return /*#__PURE__*/isValidElement(r === null || r === void 0 || (_r$original = r.original) === null || _r$original === void 0 ? void 0 : _r$original.slug);
|
118
|
+
var _r$original, _r$original2;
|
119
|
+
return /*#__PURE__*/isValidElement(r === null || r === void 0 || (_r$original = r.original) === null || _r$original === void 0 ? void 0 : _r$original.aiLabel) || /*#__PURE__*/isValidElement(r === null || r === void 0 || (_r$original2 = r.original) === null || _r$original2 === void 0 ? void 0 : _r$original2.slug);
|
120
120
|
});
|
121
|
-
var rowClassNames = cx("".concat(blockClass, "__carbon-row"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), "".concat(blockClass, "__carbon-row-expandable"), row.canExpand), "".concat(blockClass, "__carbon-row-expandable--async"), getAsyncSubRows && row.depth > 0), "".concat(carbon.prefix, "--data-table--selected"), row.isSelected), "".concat(blockClass, "__slug--row"), /*#__PURE__*/isValidElement(row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.slug)));
|
121
|
+
var rowClassNames = cx("".concat(blockClass, "__carbon-row"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), "".concat(blockClass, "__carbon-row-expandable"), row.canExpand), "".concat(blockClass, "__carbon-row-expandable--async"), getAsyncSubRows && row.depth > 0), "".concat(carbon.prefix, "--data-table--selected"), row.isSelected), "".concat(blockClass, "__slug--row"), /*#__PURE__*/isValidElement(row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original.slug)), "".concat(blockClass, "__ai-label--row"), /*#__PURE__*/isValidElement(row === null || row === void 0 || (_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2.aiLabel)));
|
122
122
|
var withActionsColumn = headers ? !!headers.filter(function (header) {
|
123
123
|
return header.isAction;
|
124
124
|
}).length : false;
|
@@ -133,14 +133,18 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
133
133
|
onFocus: hoverHandler,
|
134
134
|
onBlur: focusRemover,
|
135
135
|
onKeyUp: handleOnKeyUp
|
136
|
-
}, setAdditionalRowProps()), foundAIRow ? row !== null && row !== void 0 && (_row$
|
136
|
+
}, setAdditionalRowProps()), foundAIRow ? row !== null && row !== void 0 && (_row$original3 = row.original) !== null && _row$original3 !== void 0 && _row$original3.aiLabel ? /*#__PURE__*/React__default.createElement("td", {
|
137
|
+
className: cx("".concat(blockClass, "__table-row-ai-enabled"), _defineProperty({}, "".concat(blockClass, "__ai-label--expanded"), row.isExpanded))
|
138
|
+
}, /*#__PURE__*/React__default.createElement(DatagridAILabel, {
|
139
|
+
aiLabel: row === null || row === void 0 || (_row$original4 = row.original) === null || _row$original4 === void 0 ? void 0 : _row$original4.aiLabel
|
140
|
+
})) : row !== null && row !== void 0 && (_row$original5 = row.original) !== null && _row$original5 !== void 0 && _row$original5.slug ? /*#__PURE__*/React__default.createElement("td", {
|
137
141
|
className: cx("".concat(blockClass, "__table-row-ai-enabled"), _defineProperty({}, "".concat(blockClass, "__slug--expanded"), row.isExpanded))
|
138
|
-
}, /*#__PURE__*/React__default.createElement(
|
139
|
-
|
142
|
+
}, /*#__PURE__*/React__default.createElement(DatagridAILabel, {
|
143
|
+
aiLabel: row === null || row === void 0 || (_row$original6 = row.original) === null || _row$original6 === void 0 ? void 0 : _row$original6.slug
|
140
144
|
})) : /*#__PURE__*/React__default.createElement("td", {
|
141
145
|
className: "".concat(blockClass, "__table-row-ai-spacer")
|
142
146
|
}) : null, row.cells.map(function (cell, index) {
|
143
|
-
var _cell$column, _cell$column2, _associatedHeader
|
147
|
+
var _cell$column, _cell$column2, _associatedHeader$, _associatedHeader$2;
|
144
148
|
var cellProps = cell.getCellProps({
|
145
149
|
role: undefined
|
146
150
|
});
|
@@ -166,7 +170,7 @@ var DatagridRow = function DatagridRow(datagridState) {
|
|
166
170
|
style.flex = lastVisibleFlexStyle;
|
167
171
|
}
|
168
172
|
return /*#__PURE__*/React__default.createElement(TableCell, _extends({
|
169
|
-
className: cx("".concat(blockClass, "__cell"), _defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__expandable-row-cell"), (row.canExpand || getAsyncSubRows) && index === 0), "".concat(blockClass, "__expandable-row-cell--is-expanded"), row.isExpanded && index === 0), "".concat(blockClass, "__slug--cell"), associatedHeader && associatedHeader.length && /*#__PURE__*/isValidElement((_associatedHeader$ = associatedHeader[0]) === null || _associatedHeader$ === void 0 ? void 0 : _associatedHeader$.slug)), columnClassname)
|
173
|
+
className: cx("".concat(blockClass, "__cell"), _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__expandable-row-cell"), (row.canExpand || getAsyncSubRows) && index === 0), "".concat(blockClass, "__expandable-row-cell--is-expanded"), row.isExpanded && index === 0), "".concat(blockClass, "__slug--cell"), associatedHeader && associatedHeader.length && /*#__PURE__*/isValidElement((_associatedHeader$ = associatedHeader[0]) === null || _associatedHeader$ === void 0 ? void 0 : _associatedHeader$.slug)), "".concat(blockClass, "__ai-label--cell"), associatedHeader && associatedHeader.length && /*#__PURE__*/isValidElement((_associatedHeader$2 = associatedHeader[0]) === null || _associatedHeader$2 === void 0 ? void 0 : _associatedHeader$2.aiLabel)), columnClassname)
|
170
174
|
}, restProps, {
|
171
175
|
style: style,
|
172
176
|
key: cell.column.id
|
@@ -5,8 +5,8 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
import React, { ReactNode } from 'react';
|
8
|
-
interface
|
9
|
-
|
8
|
+
interface DatagridAILabelProps {
|
9
|
+
aiLabel?: ReactNode;
|
10
10
|
}
|
11
|
-
export declare const
|
11
|
+
export declare const DatagridAILabel: React.ForwardRefExoticComponent<DatagridAILabelProps & React.RefAttributes<HTMLDivElement>>;
|
12
12
|
export {};
|
@@ -0,0 +1,29 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import React__default, { forwardRef, isValidElement } from 'react';
|
9
|
+
import PropTypes from '../../../../../_virtual/index.js';
|
10
|
+
|
11
|
+
var DatagridAILabel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
12
|
+
var aiLabel = _ref.aiLabel;
|
13
|
+
if (aiLabel && /*#__PURE__*/isValidElement(aiLabel)) {
|
14
|
+
var normalizedAILabel = /*#__PURE__*/React__default.cloneElement(aiLabel, {
|
15
|
+
size: 'mini',
|
16
|
+
ref: ref
|
17
|
+
});
|
18
|
+
return normalizedAILabel;
|
19
|
+
}
|
20
|
+
return null;
|
21
|
+
});
|
22
|
+
DatagridAILabel.propTypes = {
|
23
|
+
/**
|
24
|
+
* Specify the AI AILabel to be displayed
|
25
|
+
*/
|
26
|
+
aiLabel: PropTypes.node
|
27
|
+
};
|
28
|
+
|
29
|
+
export { DatagridAILabel };
|
@@ -128,7 +128,8 @@ export interface DataGridHeader<T extends object = any> extends ColumnInstance,
|
|
128
128
|
[x: string]: any;
|
129
129
|
}): unknown;
|
130
130
|
isAction?: boolean;
|
131
|
-
slug?:
|
131
|
+
slug?: ReactNode;
|
132
|
+
aiLabel?: ReactNode;
|
132
133
|
}
|
133
134
|
export interface DataGridHeaderGroup<T extends object = any> extends HeaderGroup<T>, UseResizeColumnsColumnProps<T> {
|
134
135
|
}
|
@@ -18,9 +18,9 @@ var useDefaultStringRenderer = function useDefaultStringRenderer(hooks) {
|
|
18
18
|
className: cx("".concat(blockClass, "__defaultStringRenderer"), _defineProperty({}, "".concat(blockClass, "__defaultStringRenderer--multiline"), ((_tableProps$column = tableProps.column) === null || _tableProps$column === void 0 ? void 0 : _tableProps$column.multiLineWrap) || (tableProps === null || tableProps === void 0 ? void 0 : tableProps.multiLineWrapAll)))
|
19
19
|
}, tableProps.value);
|
20
20
|
};
|
21
|
-
var HeaderRenderer = function HeaderRenderer(header, slug) {
|
21
|
+
var HeaderRenderer = function HeaderRenderer(header, slug, aiLabel) {
|
22
22
|
return /*#__PURE__*/React__default.createElement("div", {
|
23
|
-
className: cx("".concat(blockClass, "__defaultStringRenderer"), _defineProperty({}, "".concat(blockClass, "__defaultStringRenderer--slug"), slug && /*#__PURE__*/React__default.isValidElement(slug))),
|
23
|
+
className: cx("".concat(blockClass, "__defaultStringRenderer"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__defaultStringRenderer--slug"), slug && /*#__PURE__*/React__default.isValidElement(slug)), "".concat(blockClass, "__defaultStringRenderer--ai-label"), aiLabel && /*#__PURE__*/React__default.isValidElement(aiLabel))),
|
24
24
|
key: typeof header === 'string' ? header : ''
|
25
25
|
}, header);
|
26
26
|
};
|
@@ -29,7 +29,7 @@ var useDefaultStringRenderer = function useDefaultStringRenderer(hooks) {
|
|
29
29
|
return _objectSpread2(_objectSpread2({
|
30
30
|
Cell: StringRenderer
|
31
31
|
}, column), {}, {
|
32
|
-
Header: column.HeaderRenderer || HeaderRenderer(column.Header, column.slug)
|
32
|
+
Header: column.HeaderRenderer || HeaderRenderer(column.Header, column.slug, column.aiLabel)
|
33
33
|
});
|
34
34
|
});
|
35
35
|
return _toConsumableArray(columnsWithDefaultCells);
|
@@ -12,7 +12,7 @@ import { pkg, carbon } from '../../settings.js';
|
|
12
12
|
import { Button } from '@carbon/react';
|
13
13
|
import { ArrowsVertical, ArrowDown, ArrowUp } from '@carbon/react/icons';
|
14
14
|
import { SelectAll } from './Datagrid/DatagridSelectAll.js';
|
15
|
-
import {
|
15
|
+
import { DatagridAILabel } from './Datagrid/addons/AiLabel/DatagridAiLabel.js';
|
16
16
|
|
17
17
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
18
18
|
var getNewSortOrder = function getNewSortOrder(currentOrder) {
|
@@ -78,9 +78,9 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
78
78
|
descendingSortableLabelText = instance.descendingSortableLabelText,
|
79
79
|
defaultSortableLabelText = instance.defaultSortableLabelText;
|
80
80
|
var onSortClick = function onSortClick(event, column) {
|
81
|
-
var
|
81
|
+
var aiLabel = event.target.classList.contains("".concat(carbon.prefix, "--slug")) || event.target.closest(".".concat(carbon.prefix, "--slug"));
|
82
82
|
// Do not continue with sorting if we find a slug
|
83
|
-
if (
|
83
|
+
if (aiLabel) {
|
84
84
|
event.stopPropagation();
|
85
85
|
return;
|
86
86
|
}
|
@@ -136,9 +136,9 @@ var useSortableColumns = function useSortableColumns(hooks) {
|
|
136
136
|
},
|
137
137
|
kind: "ghost",
|
138
138
|
renderIcon: function renderIcon(props) {
|
139
|
-
var _headerProp$column;
|
140
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(
|
141
|
-
|
139
|
+
var _headerProp$column, _headerProp$column2;
|
140
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(DatagridAILabel, {
|
141
|
+
aiLabel: (headerProp === null || headerProp === void 0 || (_headerProp$column = headerProp.column) === null || _headerProp$column === void 0 ? void 0 : _headerProp$column.aiLabel) || (headerProp === null || headerProp === void 0 || (_headerProp$column2 = headerProp.column) === null || _headerProp$column2 === void 0 ? void 0 : _headerProp$column2.slug)
|
142
142
|
}), icon(headerProp === null || headerProp === void 0 ? void 0 : headerProp.column, props));
|
143
143
|
},
|
144
144
|
id: column === null || column === void 0 ? void 0 : column.id,
|
@@ -13,6 +13,10 @@ export interface ExpressiveCardProps extends PropsWithChildren {
|
|
13
13
|
* Icons that are displayed on card. Refer to design documentation for implementation guidelines. Note- href will supersede onClick
|
14
14
|
*/
|
15
15
|
actionIcons?: ActionIcon[];
|
16
|
+
/**
|
17
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
18
|
+
*/
|
19
|
+
aiLabel?: ReactNode | boolean;
|
16
20
|
/**
|
17
21
|
* Content that shows in the body of the card
|
18
22
|
*/
|
@@ -87,6 +91,7 @@ export interface ExpressiveCardProps extends PropsWithChildren {
|
|
87
91
|
/**
|
88
92
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
89
93
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
94
|
+
* @deprecated please use the `aiLabel` prop
|
90
95
|
*/
|
91
96
|
slug?: ReactNode | boolean;
|
92
97
|
/**
|
@@ -36,6 +36,10 @@ ExpressiveCard.propTypes = {
|
|
36
36
|
iconDescription: PropTypes.string,
|
37
37
|
href: PropTypes.string
|
38
38
|
})),
|
39
|
+
/**
|
40
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
41
|
+
*/
|
42
|
+
aiLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),
|
39
43
|
/**
|
40
44
|
* Content that shows in the body of the card
|
41
45
|
*/
|
@@ -114,6 +118,7 @@ ExpressiveCard.propTypes = {
|
|
114
118
|
/**
|
115
119
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
116
120
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
121
|
+
* @deprecated please use the `aiLabel` prop
|
117
122
|
*/
|
118
123
|
slug: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),
|
119
124
|
/**
|
@@ -21,6 +21,10 @@ export interface ProductiveCardProps extends PropsWithChildren {
|
|
21
21
|
* Icons that are displayed on card. Refer to design documentation for implementation guidelines. Note- href will supersede onClick
|
22
22
|
*/
|
23
23
|
actionIcons?: ActionIcon[];
|
24
|
+
/**
|
25
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
26
|
+
*/
|
27
|
+
aiLabel?: ReactNode | boolean;
|
24
28
|
/**
|
25
29
|
* Determines if the action icons are on the top or bottom of the card
|
26
30
|
*/
|
@@ -104,6 +108,7 @@ export interface ProductiveCardProps extends PropsWithChildren {
|
|
104
108
|
/**
|
105
109
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
106
110
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
111
|
+
* @deprecated please use the `aiLabel` prop
|
107
112
|
*/
|
108
113
|
slug?: ReactNode | boolean;
|
109
114
|
/**
|
@@ -48,6 +48,10 @@ ProductiveCard.propTypes = {
|
|
48
48
|
* Determines if the action icons are on the top or bottom of the card
|
49
49
|
*/
|
50
50
|
actionsPlacement: PropTypes.oneOf(['top', 'bottom']),
|
51
|
+
/**
|
52
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
53
|
+
*/
|
54
|
+
aiLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.bool]),
|
51
55
|
/**
|
52
56
|
* Content that shows in the body of the card
|
53
57
|
*/
|
@@ -57,10 +57,14 @@ interface CardProp extends PropsWithChildren {
|
|
57
57
|
sequence?: number;
|
58
58
|
iconDescription?: string;
|
59
59
|
/**
|
60
|
-
* **Experimental?** For all cases a `Slug` component can be provided.
|
61
60
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
61
|
+
* @deprecated please use the `aiLabel` prop
|
62
62
|
*/
|
63
63
|
slug?: ReactNode | boolean;
|
64
|
+
/**
|
65
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
66
|
+
*/
|
67
|
+
aiLabel?: ReactNode | boolean;
|
64
68
|
status?: 'complete' | 'incomplete';
|
65
69
|
title?: ReactNode;
|
66
70
|
titleSize?: 'default' | 'large';
|
@@ -18,7 +18,7 @@ var CardFooter = require('./CardFooter.js');
|
|
18
18
|
var settings = require('../../settings.js');
|
19
19
|
|
20
20
|
var _Incomplete, _CheckmarkOutline;
|
21
|
-
var _excluded = ["actionIcons", "actionsPlacement", "metadata", "children", "className", "clickZone", "description", "disabled", "footerActionIcon", "getStarted", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "overflowAriaLabel", "onSecondaryButtonClick", "pictogram", "primaryButtonDisabled", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonPlacement", "primaryButtonText", "productive", "secondaryButtonDisabled", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonPlacement", "secondaryButtonText", "slug", "status", "sequence", "title", "titleSize", "iconDescription"],
|
21
|
+
var _excluded = ["actionIcons", "actionsPlacement", "aiLabel", "metadata", "children", "className", "clickZone", "description", "disabled", "footerActionIcon", "getStarted", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "overflowAriaLabel", "onSecondaryButtonClick", "pictogram", "primaryButtonDisabled", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonPlacement", "primaryButtonText", "productive", "secondaryButtonDisabled", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonPlacement", "secondaryButtonText", "slug", "status", "sequence", "title", "titleSize", "iconDescription"],
|
22
22
|
_excluded2 = ["id"],
|
23
23
|
_excluded3 = ["id", "icon", "onClick", "iconDescription", "href"];
|
24
24
|
var componentName = 'Card';
|
@@ -27,6 +27,7 @@ var Card = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
27
27
|
actionIcons = _ref$actionIcons === void 0 ? Object.freeze([]) : _ref$actionIcons,
|
28
28
|
_ref$actionsPlacement = _ref.actionsPlacement,
|
29
29
|
actionsPlacement = _ref$actionsPlacement === void 0 ? 'bottom' : _ref$actionsPlacement,
|
30
|
+
aiLabel = _ref.aiLabel,
|
30
31
|
_ref$metadata = _ref.metadata,
|
31
32
|
metadata = _ref$metadata === void 0 ? Object.freeze([]) : _ref$metadata,
|
32
33
|
children = _ref.children,
|
@@ -168,7 +169,7 @@ var Card = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
168
169
|
var clickable = hasClickEvent && !productive || hasClickEvent && productive && clickZone === 'one';
|
169
170
|
var cardProps = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rest), {}, {
|
170
171
|
ref: ref,
|
171
|
-
className: cx(blockClass, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__disabled"), disabled), "".concat(blockClass, "__get-started"), getStarted), "".concat(blockClass, "__productive"), productive), "".concat(blockClass, "__clickable"), clickable), "".concat(blockClass, "__media-left"), mediaPosition === 'left'), "".concat(blockClass, "--has-slug"), !!slug), className)
|
172
|
+
className: cx(blockClass, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__disabled"), disabled), "".concat(blockClass, "__get-started"), getStarted), "".concat(blockClass, "__productive"), productive), "".concat(blockClass, "__clickable"), clickable), "".concat(blockClass, "__media-left"), mediaPosition === 'left'), "".concat(blockClass, "--has-slug"), !!slug), "".concat(blockClass, "--has-ai-label"), !!aiLabel), className)
|
172
173
|
}, clickable && clickableProps);
|
173
174
|
return cardProps;
|
174
175
|
};
|
@@ -184,6 +185,7 @@ var Card = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
184
185
|
var getHeaderProps = function getHeaderProps() {
|
185
186
|
return {
|
186
187
|
actions: actionsPlacement === 'top' ? getActions() : '',
|
188
|
+
aiLabel: aiLabel,
|
187
189
|
noActionIcons: getIcons().length > 0 && actionsPlacement === 'top' ? false : true,
|
188
190
|
actionsPlacement: actionsPlacement,
|
189
191
|
onPrimaryButtonClick: onPrimaryButtonClick,
|
@@ -267,6 +269,10 @@ Card.propTypes = {
|
|
267
269
|
href: index.default.string
|
268
270
|
})),
|
269
271
|
actionsPlacement: index.default.oneOf(['top', 'bottom']),
|
272
|
+
/**
|
273
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
274
|
+
*/
|
275
|
+
aiLabel: index.default.oneOfType([index.default.node, index.default.bool]),
|
270
276
|
children: index.default.node,
|
271
277
|
className: index.default.string,
|
272
278
|
clickZone: index.default.oneOf(['one', 'two', 'three']),
|
@@ -318,6 +324,7 @@ Card.propTypes = {
|
|
318
324
|
/**
|
319
325
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
320
326
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
327
|
+
* @deprecated please use the `aiLabel` prop
|
321
328
|
*/
|
322
329
|
slug: index.default.oneOfType([index.default.node, index.default.bool]),
|
323
330
|
status: index.default.oneOf(['complete', 'incomplete']),
|
@@ -1,7 +1,11 @@
|
|
1
1
|
import React, { ReactNode } from 'react';
|
2
2
|
import PropTypes from 'prop-types';
|
3
3
|
interface CardHeaderProps {
|
4
|
-
actions?: ReactNode
|
4
|
+
actions?: ReactNode;
|
5
|
+
/**
|
6
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
7
|
+
*/
|
8
|
+
aiLabel?: ReactNode | boolean;
|
5
9
|
description?: ReactNode;
|
6
10
|
hasActions?: boolean;
|
7
11
|
/**
|
@@ -25,16 +29,21 @@ interface CardHeaderProps {
|
|
25
29
|
/**
|
26
30
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
27
31
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
32
|
+
* @deprecated please use the `aiLabel` prop
|
28
33
|
*/
|
29
34
|
slug?: ReactNode;
|
30
35
|
title?: ReactNode;
|
31
36
|
titleSize?: 'default' | 'large';
|
32
37
|
}
|
33
38
|
export declare const CardHeader: {
|
34
|
-
({ actions, noActionIcons, onPrimaryButtonClick, onSecondaryButtonClick, primaryButtonIcon, primaryButtonPlacement, primaryButtonText, primaryButtonDisabled, description, hasActions, inClickableCard, label, secondaryButtonDisabled, secondaryButtonHref, secondaryButtonIcon, secondaryButtonPlacement, secondaryButtonText, slug, title, titleSize, }: CardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
39
|
+
({ actions, aiLabel, noActionIcons, onPrimaryButtonClick, onSecondaryButtonClick, primaryButtonIcon, primaryButtonPlacement, primaryButtonText, primaryButtonDisabled, description, hasActions, inClickableCard, label, secondaryButtonDisabled, secondaryButtonHref, secondaryButtonIcon, secondaryButtonPlacement, secondaryButtonText, slug, title, titleSize, }: CardHeaderProps): import("react/jsx-runtime").JSX.Element;
|
35
40
|
/**@ts-ignore */
|
36
41
|
propTypes: {
|
37
42
|
actions: PropTypes.Requireable<NonNullable<any[] | PropTypes.ReactNodeLike>>;
|
43
|
+
/**
|
44
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
45
|
+
*/
|
46
|
+
aiLabel: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
38
47
|
description: PropTypes.Requireable<NonNullable<object | PropTypes.ReactNodeLike>>;
|
39
48
|
hasActions: PropTypes.Requireable<boolean>;
|
40
49
|
/**
|
@@ -58,6 +67,7 @@ export declare const CardHeader: {
|
|
58
67
|
/**
|
59
68
|
* **Experimental:** For all cases a `Slug` component can be provided.
|
60
69
|
* Clickable tiles only accept a boolean value of true and display a hollow slug.
|
70
|
+
* @deprecated please use the `aiLabel` prop
|
61
71
|
*/
|
62
72
|
slug: PropTypes.Requireable<NonNullable<PropTypes.ReactNodeLike>>;
|
63
73
|
title: PropTypes.Requireable<NonNullable<object | PropTypes.ReactNodeLike>>;
|