@carbon/ibm-products 1.23.0 → 1.25.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/components/Datagrid/styles/datagrid.css +83 -11
- package/css/components/Datagrid/styles/datagrid.css.map +1 -1
- package/css/components/Datagrid/styles/index.css +83 -15
- package/css/components/Datagrid/styles/index.css.map +1 -1
- package/css/components/Datagrid/styles/useExpandedRow.css +0 -3
- package/css/components/Datagrid/styles/useExpandedRow.css.map +1 -1
- package/css/index-full-carbon.css +263 -60
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -7
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +41 -43
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -7
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +263 -60
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -7
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +263 -60
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -7
- package/css/index.min.css.map +1 -1
- package/es/components/AddSelect/AddSelect.js +5 -7
- package/es/components/AddSelect/AddSelectBody.js +6 -10
- package/es/components/AddSelect/AddSelectColumn.js +4 -1
- package/es/components/AddSelect/AddSelectFilter.js +1 -1
- package/es/components/AddSelect/AddSelectList.js +1 -1
- package/es/components/AddSelect/AddSelectMetaPanel.js +8 -7
- package/es/components/AddSelect/AddSelectSidebar.js +4 -26
- package/es/components/AddSelect/AddSelectSort.js +2 -0
- package/es/components/Card/Card.js +1 -1
- package/es/components/Datagrid/Datagrid/Datagrid.js +17 -12
- package/es/components/Datagrid/Datagrid/DatagridRow.js +4 -2
- package/es/components/Datagrid/useExpandedRow.js +5 -12
- package/es/components/Datagrid/useOnRowClick.js +10 -3
- package/es/components/EditFullPage/EditFullPage.js +79 -0
- package/es/components/EditFullPage/index.js +7 -0
- package/es/components/EditTearsheet/EditTearsheet.js +205 -0
- package/es/components/EditTearsheet/EditTearsheetForm.js +103 -0
- package/es/components/EditTearsheet/index.js +8 -0
- package/es/components/EditTearsheet/preview-components/MultiFormEditTearsheet.js +230 -0
- package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.js +79 -0
- package/es/components/EditTearsheetNarrow/index.js +7 -0
- package/es/components/EmptyStates/EmptyStateContent.js +2 -1
- package/es/components/ImportModal/ImportModal.js +10 -2
- package/es/components/WebTerminal/WebTerminal.js +30 -16
- package/es/components/WebTerminal/WebTerminalContentWrapper.js +8 -10
- package/es/components/WebTerminal/hooks/index.js +45 -0
- package/es/components/WebTerminal/index.js +2 -1
- package/es/components/WebTerminal/preview-components/Navigation.js +6 -10
- package/es/components/index.js +5 -2
- package/es/global/js/package-settings.js +5 -1
- package/lib/components/AddSelect/AddSelect.js +5 -7
- package/lib/components/AddSelect/AddSelectBody.js +6 -10
- package/lib/components/AddSelect/AddSelectColumn.js +3 -1
- package/lib/components/AddSelect/AddSelectFilter.js +1 -1
- package/lib/components/AddSelect/AddSelectList.js +1 -1
- package/lib/components/AddSelect/AddSelectMetaPanel.js +8 -7
- package/lib/components/AddSelect/AddSelectSidebar.js +3 -26
- package/lib/components/AddSelect/AddSelectSort.js +2 -0
- package/lib/components/Card/Card.js +1 -1
- package/lib/components/Datagrid/Datagrid/Datagrid.js +17 -12
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +3 -1
- package/lib/components/Datagrid/useExpandedRow.js +5 -20
- package/lib/components/Datagrid/useOnRowClick.js +10 -3
- package/lib/components/EditFullPage/EditFullPage.js +85 -0
- package/lib/components/EditFullPage/index.js +13 -0
- package/lib/components/EditTearsheet/EditTearsheet.js +229 -0
- package/lib/components/EditTearsheet/EditTearsheetForm.js +122 -0
- package/lib/components/EditTearsheet/index.js +21 -0
- package/lib/components/EditTearsheet/preview-components/MultiFormEditTearsheet.js +254 -0
- package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.js +85 -0
- package/lib/components/EditTearsheetNarrow/index.js +13 -0
- package/lib/components/EmptyStates/EmptyStateContent.js +2 -1
- package/lib/components/ImportModal/ImportModal.js +11 -2
- package/lib/components/WebTerminal/WebTerminal.js +31 -15
- package/lib/components/WebTerminal/WebTerminalContentWrapper.js +9 -9
- package/lib/components/WebTerminal/hooks/index.js +69 -0
- package/lib/components/WebTerminal/index.js +15 -1
- package/lib/components/WebTerminal/preview-components/Navigation.js +6 -10
- package/lib/components/index.js +37 -1
- package/lib/global/js/package-settings.js +5 -1
- package/package.json +12 -12
- package/scss/components/Cascade/_cascade.scss +1 -1
- package/scss/components/CreateInfluencer/_create-influencer.scss +2 -0
- package/scss/components/Datagrid/_datagrid.scss +0 -1
- package/scss/components/Datagrid/_storybook-styles.scss +53 -0
- package/scss/components/Datagrid/styles/datagrid.scss +93 -12
- package/scss/components/Datagrid/styles/useExpandedRow.scss +0 -6
- package/scss/components/EditFullPage/_edit-full-page.scss +34 -0
- package/scss/components/EditFullPage/_index.scss +8 -0
- package/scss/components/EditFullPage/_storybook-styles.scss +10 -0
- package/scss/components/EditTearsheet/_edit-tearsheet.scss +132 -0
- package/scss/components/EditTearsheet/_index.scss +8 -0
- package/scss/components/EditTearsheet/_storybook-styles.scss +55 -0
- package/scss/components/EditTearsheetNarrow/_edit-tearsheet-narrow.scss +34 -0
- package/scss/components/EditTearsheetNarrow/_index.scss +8 -0
- package/scss/components/EditTearsheetNarrow/_storybook-styles.scss +10 -0
- package/scss/components/EmptyStates/_empty-state.scss +16 -9
- package/scss/components/InlineEdit/_inline-edit.scss +8 -20
- package/scss/components/NotificationsPanel/_notifications-panel.scss +1 -0
- package/scss/components/PageHeader/_page-header.scss +3 -1
- package/scss/components/StatusIcon/_status-icon.scss +1 -1
- package/scss/components/Tearsheet/_tearsheet.scss +2 -2
- package/scss/components/WebTerminal/_web-terminal.scss +2 -1
- package/scss/components/_index.scss +3 -0
@@ -22,6 +22,7 @@ export var AddSelectMetaPanel = function AddSelectMetaPanel(_ref) {
|
|
22
22
|
}, /*#__PURE__*/React.createElement("p", {
|
23
23
|
className: "".concat(blockClass, "-title")
|
24
24
|
}, title), /*#__PURE__*/React.createElement(Button, {
|
25
|
+
className: "".concat(blockClass, "-close"),
|
25
26
|
renderIcon: Close16,
|
26
27
|
iconDescription: closeIconDescription,
|
27
28
|
tooltipPosition: "left",
|
@@ -32,23 +33,23 @@ export var AddSelectMetaPanel = function AddSelectMetaPanel(_ref) {
|
|
32
33
|
size: "sm"
|
33
34
|
})), /*#__PURE__*/isValidElement(meta) ? meta : meta.map(function (entry) {
|
34
35
|
return /*#__PURE__*/React.createElement("div", {
|
35
|
-
key: entry.id,
|
36
|
+
key: entry === null || entry === void 0 ? void 0 : entry.id,
|
36
37
|
className: "".concat(blockClass, "-entry")
|
37
38
|
}, /*#__PURE__*/React.createElement("p", {
|
38
39
|
className: "".concat(blockClass, "-entry-title")
|
39
|
-
}, entry.title), /*#__PURE__*/React.createElement("p", {
|
40
|
+
}, entry === null || entry === void 0 ? void 0 : entry.title), /*#__PURE__*/React.createElement("p", {
|
40
41
|
className: "".concat(blockClass, "-entry-body")
|
41
|
-
}, entry.value));
|
42
|
+
}, entry === null || entry === void 0 ? void 0 : entry.value));
|
42
43
|
}));
|
43
44
|
};
|
44
45
|
AddSelectMetaPanel.propTypes = {
|
45
|
-
closeIconDescription: PropTypes.string,
|
46
|
+
closeIconDescription: PropTypes.string.isRequired,
|
46
47
|
meta: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.shape({
|
47
48
|
id: PropTypes.string,
|
48
49
|
title: PropTypes.string,
|
49
50
|
value: PropTypes.string
|
50
|
-
})), PropTypes.node]),
|
51
|
-
setDisplayMetaPanel: PropTypes.func,
|
52
|
-
title: PropTypes.string
|
51
|
+
})), PropTypes.node]).isRequired,
|
52
|
+
setDisplayMetaPanel: PropTypes.func.isRequired,
|
53
|
+
title: PropTypes.string.isRequired
|
53
54
|
};
|
54
55
|
AddSelectMetaPanel.displayName = componentName;
|
@@ -7,8 +7,7 @@ var _excluded = ["meta", "icon", "avatar"];
|
|
7
7
|
// LICENSE file in the root directory of this source tree.
|
8
8
|
//
|
9
9
|
import React from 'react';
|
10
|
-
import { Tag, Accordion, AccordionItem
|
11
|
-
import { SubtractAlt32 } from '@carbon/icons-react';
|
10
|
+
import { Tag, Accordion, AccordionItem } from 'carbon-components-react';
|
12
11
|
import PropTypes from 'prop-types';
|
13
12
|
import { NoDataEmptyState } from '../../components/EmptyStates/NoDataEmptyState';
|
14
13
|
import { pkg } from '../../settings';
|
@@ -28,19 +27,10 @@ export var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
28
27
|
multiSelection = _ref.multiSelection,
|
29
28
|
noSelectionDescription = _ref.noSelectionDescription,
|
30
29
|
noSelectionTitle = _ref.noSelectionTitle,
|
31
|
-
|
32
|
-
setDisplayMetaPanel = _ref.setDisplayMetaPanel,
|
33
|
-
setMultiSelection = _ref.setMultiSelection;
|
30
|
+
setDisplayMetaPanel = _ref.setDisplayMetaPanel;
|
34
31
|
var hasModifiers = (modifiers === null || modifiers === void 0 ? void 0 : (_modifiers$options = modifiers.options) === null || _modifiers$options === void 0 ? void 0 : _modifiers$options.length) > 0;
|
35
32
|
var hasSelections = multiSelection.length > 0;
|
36
33
|
|
37
|
-
var handleItemRemove = function handleItemRemove(id) {
|
38
|
-
var newSelections = multiSelection.filter(function (v) {
|
39
|
-
return v !== id;
|
40
|
-
});
|
41
|
-
setMultiSelection(newSelections);
|
42
|
-
};
|
43
|
-
|
44
34
|
var getNewItem = function getNewItem(item) {
|
45
35
|
// certain properties should not be displayed in the sidebar
|
46
36
|
// eslint-disable-next-line no-unused-vars
|
@@ -74,17 +64,7 @@ export var AddSelectSidebar = function AddSelectSidebar(_ref) {
|
|
74
64
|
className: "".concat(blockClass, "-selected-item-subtitle")
|
75
65
|
}, item.subtitle)), hasModifiers && /*#__PURE__*/React.createElement("div", null, appliedModifiers.find(function (modifier) {
|
76
66
|
return modifier.id === item.id;
|
77
|
-
})[modifiers.id])
|
78
|
-
renderIcon: SubtractAlt32,
|
79
|
-
iconDescription: removeIconDescription,
|
80
|
-
hasIconOnly: true,
|
81
|
-
onClick: function onClick() {
|
82
|
-
return handleItemRemove(item.id);
|
83
|
-
},
|
84
|
-
kind: "ghost",
|
85
|
-
className: "".concat(blockClass, "-item-remove-button"),
|
86
|
-
size: "sm"
|
87
|
-
}));
|
67
|
+
})[modifiers.id]));
|
88
68
|
};
|
89
69
|
|
90
70
|
if (Object.keys(displayMetalPanel).length !== 0) {
|
@@ -140,8 +120,6 @@ AddSelectSidebar.propTypes = {
|
|
140
120
|
multiSelection: PropTypes.array,
|
141
121
|
noSelectionDescription: PropTypes.string,
|
142
122
|
noSelectionTitle: PropTypes.string,
|
143
|
-
|
144
|
-
setDisplayMetaPanel: PropTypes.func,
|
145
|
-
setMultiSelection: PropTypes.func
|
123
|
+
setDisplayMetaPanel: PropTypes.func
|
146
124
|
};
|
147
125
|
AddSelectSidebar.displayName = componentName;
|
@@ -41,10 +41,12 @@ export var AddSelectSort = function AddSelectSort(_ref) {
|
|
41
41
|
return /*#__PURE__*/React.createElement("div", {
|
42
42
|
className: blockClass
|
43
43
|
}, sortByOpts.length > 0 && /*#__PURE__*/React.createElement(OverflowMenu, {
|
44
|
+
className: "".concat(blockClass, "_overflow"),
|
44
45
|
renderIcon: ArrowsVertical32,
|
45
46
|
flipped: true
|
46
47
|
}, sortByOpts.map(function (opt) {
|
47
48
|
return /*#__PURE__*/React.createElement(OverflowMenuItem, {
|
49
|
+
className: "".concat(blockClass, "_overflow-item"),
|
48
50
|
key: opt.id,
|
49
51
|
itemText: opt.itemText,
|
50
52
|
onClick: function onClick() {
|
@@ -89,7 +89,7 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
89
89
|
var getActions = function getActions() {
|
90
90
|
if (overflowActions.length > 0) {
|
91
91
|
var pos = actionsPlacement === 'top' ? 'bottom' : 'top';
|
92
|
-
var size = actionsPlacement === 'top' ? 'sm' : '
|
92
|
+
var size = actionsPlacement === 'top' ? 'sm' : 'md';
|
93
93
|
return /*#__PURE__*/React.createElement(OverflowMenu, {
|
94
94
|
size: size,
|
95
95
|
direction: pos,
|
@@ -46,28 +46,33 @@ export var Datagrid = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
46
46
|
_datagridState$vertic = datagridState.verticalAlign,
|
47
47
|
verticalAlign = _datagridState$vertic === void 0 ? 'center' : _datagridState$vertic,
|
48
48
|
variableRowHeight = datagridState.variableRowHeight,
|
49
|
-
className = datagridState.className
|
49
|
+
className = datagridState.className,
|
50
|
+
gridTitle = datagridState.gridTitle,
|
51
|
+
gridDescription = datagridState.gridDescription,
|
52
|
+
useDenseHeader = datagridState.useDenseHeader;
|
50
53
|
var rows = DatagridPagination && datagridState.page || datagridState.rows;
|
51
54
|
var dataGrid = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContainer, {
|
52
|
-
className: cx("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '')
|
53
|
-
|
54
|
-
|
55
|
+
className: cx("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : ''),
|
56
|
+
title: gridTitle,
|
57
|
+
description: gridDescription
|
58
|
+
}, /*#__PURE__*/React.createElement(DatagridToolbar, datagridState), /*#__PURE__*/React.createElement("div", {
|
59
|
+
className: "".concat(blockClass, "__table-container")
|
60
|
+
}, leftPanel && leftPanel.isOpen && /*#__PURE__*/React.createElement("div", {
|
61
|
+
className: "".concat(blockClass, "__datagridLeftPanel")
|
62
|
+
}, leftPanel.panelContent), /*#__PURE__*/React.createElement(Table, _extends({}, getTableProps(), {
|
63
|
+
className: cx(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className)
|
55
64
|
}), /*#__PURE__*/React.createElement(DatagridHead, datagridState), /*#__PURE__*/React.createElement(DatagridBody, _extends({}, datagridState, {
|
56
65
|
rows: rows
|
57
|
-
})))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/React.createElement(CustomizeColumnsModal, {
|
66
|
+
}))))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/React.createElement(CustomizeColumnsModal, {
|
58
67
|
instance: datagridState
|
59
68
|
}));
|
60
69
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
61
70
|
id: tableId,
|
62
71
|
ref: ref,
|
63
72
|
className: cx(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"), !isFetching && rows.length === 0 ? "".concat(blockClass, "__empty-state") : '')
|
64
|
-
}, getDevtoolsProps(componentName)),
|
65
|
-
className: "".concat(blockClass, "
|
66
|
-
}, leftPanel
|
67
|
-
className: "".concat(blockClass, "__datagridLeftPanel")
|
68
|
-
}, leftPanel.panelContent), /*#__PURE__*/React.createElement("div", {
|
69
|
-
className: "".concat(blockClass, "__datagridWithPanel")
|
70
|
-
}, dataGrid)), leftPanel === undefined && dataGrid);
|
73
|
+
}, getDevtoolsProps(componentName)), leftPanel && /*#__PURE__*/React.createElement("div", {
|
74
|
+
className: "".concat(blockClass, "__datagridWithPanel ").concat(blockClass, "__displayFlex ").concat(blockClass, "__leftPanel-position")
|
75
|
+
}, dataGrid), leftPanel === undefined && dataGrid);
|
71
76
|
}); // Return a placeholder if not released and not enabled by feature flag
|
72
77
|
|
73
78
|
Datagrid = pkg.checkComponentEnabled(Datagrid, componentName); // The display name of the component, used by React. Note that displayName
|
@@ -15,15 +15,17 @@ import React from 'react';
|
|
15
15
|
import { DataTable, SkeletonText } from 'carbon-components-react';
|
16
16
|
import { selectionColumnId } from '../common-column-ids';
|
17
17
|
import cx from 'classnames';
|
18
|
-
import { pkg } from '../../../settings';
|
18
|
+
import { pkg, carbon } from '../../../settings';
|
19
19
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
20
20
|
var TableRow = DataTable.TableRow,
|
21
21
|
TableCell = DataTable.TableCell; // eslint-disable-next-line react/prop-types
|
22
22
|
|
23
23
|
var DatagridRow = function DatagridRow(datagridState) {
|
24
|
+
var _cx;
|
25
|
+
|
24
26
|
var row = datagridState.row;
|
25
27
|
return /*#__PURE__*/React.createElement(TableRow, _extends({
|
26
|
-
className: cx("".concat(blockClass, "__carbon-row"),
|
28
|
+
className: cx("".concat(blockClass, "__carbon-row"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__carbon-row-expanded"), row.isExpanded), _defineProperty(_cx, "".concat(carbon.prefix, "--data-table--selected"), row.isSelected), _cx))
|
27
29
|
}, row.getRowProps(), {
|
28
30
|
key: row.id,
|
29
31
|
onMouseEnter: function onMouseEnter(event) {
|
@@ -12,25 +12,17 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
12
12
|
* US Government Users Restricted Rights - Use, duplication or disclosure
|
13
13
|
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
14
14
|
*/
|
15
|
-
import
|
15
|
+
import { useState } from 'react';
|
16
16
|
import DatagridExpandedRow from './Datagrid/DatagridExpandedRow';
|
17
17
|
import useRowExpander from './useRowExpander';
|
18
|
-
import { pkg } from '../../settings';
|
19
|
-
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
20
|
-
|
21
|
-
var expansionRenderer = function expansionRenderer(_ref) {
|
22
|
-
var row = _ref.row;
|
23
|
-
return /*#__PURE__*/React.createElement("div", {
|
24
|
-
className: "".concat(blockClass, "__expanded-row-content")
|
25
|
-
}, "Content for ", row.id);
|
26
|
-
};
|
27
18
|
|
28
19
|
var useExpandedRow = function useExpandedRow(hooks) {
|
29
20
|
useRowExpander(hooks);
|
30
21
|
|
31
22
|
var useInstance = function useInstance(instance) {
|
32
23
|
var rows = instance.rows,
|
33
|
-
expandedContentHeight = instance.expandedContentHeight
|
24
|
+
expandedContentHeight = instance.expandedContentHeight,
|
25
|
+
ExpandedRowContentComponent = instance.ExpandedRowContentComponent;
|
34
26
|
|
35
27
|
var _useState = useState({}),
|
36
28
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -45,7 +37,8 @@ var useExpandedRow = function useExpandedRow(hooks) {
|
|
45
37
|
return _objectSpread(_objectSpread({}, row), {}, {
|
46
38
|
canExpand: row.original && !row.original.notExpandable,
|
47
39
|
expandedContentHeight: expandedRowsHeight[row.index] || expandedContentHeight,
|
48
|
-
RowRenderer: DatagridExpandedRow(row.RowRenderer, expansionRenderer)
|
40
|
+
// RowRenderer: DatagridExpandedRow(row.RowRenderer, expansionRenderer),
|
41
|
+
RowRenderer: DatagridExpandedRow(row.RowRenderer, ExpandedRowContentComponent)
|
49
42
|
});
|
50
43
|
});
|
51
44
|
Object.assign(instance, {
|
@@ -6,16 +6,23 @@
|
|
6
6
|
* restricted by GSA ADP Schedule Contract with IBM Corp.
|
7
7
|
*/
|
8
8
|
var useOnRowClick = function useOnRowClick(hooks) {
|
9
|
-
var useInstance = function useInstance(
|
10
|
-
var onRowClick =
|
9
|
+
var useInstance = function useInstance(rowInstance) {
|
10
|
+
var onRowClick = rowInstance.onRowClick;
|
11
11
|
|
12
12
|
var getRowProps = function getRowProps(props, datagridState) {
|
13
13
|
var isFetching = datagridState.isFetching,
|
14
|
-
row = datagridState.row
|
14
|
+
row = datagridState.row,
|
15
|
+
instance = datagridState.instance;
|
16
|
+
var id = row.id,
|
17
|
+
toggleRowSelected = row.toggleRowSelected;
|
15
18
|
|
16
19
|
var onClick = function onClick() {
|
17
20
|
if (!isFetching && onRowClick) {
|
18
21
|
onRowClick(row);
|
22
|
+
instance.selectedFlatRows && instance.selectedFlatRows.map(function (toggleRow) {
|
23
|
+
return toggleRow.toggleRowSelected(false);
|
24
|
+
});
|
25
|
+
toggleRowSelected(id, true);
|
19
26
|
}
|
20
27
|
};
|
21
28
|
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["children", "className"];
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Copyright IBM Corp. 2022, 2022
|
7
|
+
*
|
8
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
10
|
+
*/
|
11
|
+
// Import portions of React that are needed.
|
12
|
+
import React from 'react'; // Other standard imports.
|
13
|
+
|
14
|
+
import PropTypes from 'prop-types';
|
15
|
+
import cx from 'classnames';
|
16
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
17
|
+
import { pkg
|
18
|
+
/*, carbon */
|
19
|
+
} from '../../settings'; // Carbon and package components we use.
|
20
|
+
|
21
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
22
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
23
|
+
|
24
|
+
var blockClass = "".concat(pkg.prefix, "--edit-full-page");
|
25
|
+
var componentName = 'EditFullPage'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
26
|
+
// Default values can be included here and then assigned to the prop params,
|
27
|
+
// e.g. prop = defaults.prop,
|
28
|
+
// This gathers default values together neatly and ensures non-primitive
|
29
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
30
|
+
// Note that default values are not required for props that are 'required',
|
31
|
+
// nor for props where the component can apply undefined values reasonably.
|
32
|
+
// Default values should be provided when the component needs to make a choice
|
33
|
+
// or assumption when a prop is not supplied.
|
34
|
+
// Default values for props
|
35
|
+
// const defaults = {
|
36
|
+
// /* TODO: add defaults for relevant props if needed */
|
37
|
+
// };
|
38
|
+
|
39
|
+
/**
|
40
|
+
* TODO: A description of the component.
|
41
|
+
*/
|
42
|
+
|
43
|
+
export var EditFullPage = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
44
|
+
var children = _ref.children,
|
45
|
+
className = _ref.className,
|
46
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
47
|
+
|
48
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
49
|
+
className: cx(blockClass, // Apply the block class to the main HTML element
|
50
|
+
className, // Apply any supplied class names to the main HTML element.
|
51
|
+
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
52
|
+
{// switched classes dependant on props or state
|
53
|
+
// example: [`${blockClass}__here-if-small`]: size === 'sm',
|
54
|
+
}),
|
55
|
+
ref: ref,
|
56
|
+
role: "main"
|
57
|
+
}, getDevtoolsProps(componentName)), children);
|
58
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
59
|
+
|
60
|
+
EditFullPage = pkg.checkComponentEnabled(EditFullPage, componentName); // The display name of the component, used by React. Note that displayName
|
61
|
+
// is used in preference to relying on function.name.
|
62
|
+
|
63
|
+
EditFullPage.displayName = componentName; // The types and DocGen commentary for the component props,
|
64
|
+
// in alphabetical order (for consistency).
|
65
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
66
|
+
|
67
|
+
EditFullPage.propTypes = {
|
68
|
+
/**
|
69
|
+
* Provide the contents of the EditFullPage.
|
70
|
+
*/
|
71
|
+
children: PropTypes.node.isRequired,
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Provide an optional class to be applied to the containing node.
|
75
|
+
*/
|
76
|
+
className: PropTypes.string
|
77
|
+
/* TODO: add types and DocGen for all props. */
|
78
|
+
|
79
|
+
};
|
@@ -0,0 +1,205 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
+
var _excluded = ["cancelButtonText", "children", "className", "description", "influencerWidth", "label", "onClose", "open", "submitButtonText", "title", "verticalPosition", "onHandleModalClick"];
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Copyright IBM Corp. 2022, 2022
|
8
|
+
*
|
9
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
11
|
+
*/
|
12
|
+
import React, { forwardRef, useState, useRef, createContext } from 'react';
|
13
|
+
import PropTypes from 'prop-types';
|
14
|
+
import cx from 'classnames';
|
15
|
+
import { Grid, Form, SideNav, SideNavItems, SideNavMenuItem } from 'carbon-components-react';
|
16
|
+
import { pkg } from '../../settings';
|
17
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
18
|
+
import { TearsheetShell } from '../Tearsheet/TearsheetShell';
|
19
|
+
var componentName = 'EditTearsheet';
|
20
|
+
var blockClass = "".concat(pkg.prefix, "--tearsheet-edit"); // This is a general context for the forms container
|
21
|
+
// containing information about the state of the container
|
22
|
+
// and providing some callback methods for forms to use
|
23
|
+
|
24
|
+
export var FormContext = /*#__PURE__*/createContext(null); // This is a context supplied separately to each form in the container
|
25
|
+
// to let it know what number it is in the sequence of forms
|
26
|
+
|
27
|
+
export var FormNumberContext = /*#__PURE__*/createContext(0); // Default values for props
|
28
|
+
|
29
|
+
var defaults = {
|
30
|
+
verticalPosition: 'normal',
|
31
|
+
influencerWidth: 'narrow'
|
32
|
+
};
|
33
|
+
export var EditTearsheet = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
34
|
+
var cancelButtonText = _ref.cancelButtonText,
|
35
|
+
children = _ref.children,
|
36
|
+
className = _ref.className,
|
37
|
+
description = _ref.description,
|
38
|
+
_ref$influencerWidth = _ref.influencerWidth,
|
39
|
+
influencerWidth = _ref$influencerWidth === void 0 ? defaults.influencerWidth : _ref$influencerWidth,
|
40
|
+
label = _ref.label,
|
41
|
+
onClose = _ref.onClose,
|
42
|
+
open = _ref.open,
|
43
|
+
submitButtonText = _ref.submitButtonText,
|
44
|
+
title = _ref.title,
|
45
|
+
_ref$verticalPosition = _ref.verticalPosition,
|
46
|
+
verticalPosition = _ref$verticalPosition === void 0 ? defaults.verticalPosition : _ref$verticalPosition,
|
47
|
+
onHandleModalClick = _ref.onHandleModalClick,
|
48
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
49
|
+
|
50
|
+
var _useState = useState(0),
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
52
|
+
currentForm = _useState2[0],
|
53
|
+
setCurrentForm = _useState2[1];
|
54
|
+
|
55
|
+
var contentRef = useRef();
|
56
|
+
|
57
|
+
var handleCurrentForm = function handleCurrentForm(form) {
|
58
|
+
setCurrentForm(form);
|
59
|
+
};
|
60
|
+
|
61
|
+
var sideNavItems = [{
|
62
|
+
label: 'Topic Name'
|
63
|
+
}, {
|
64
|
+
label: 'Location'
|
65
|
+
}, {
|
66
|
+
label: 'Partitions'
|
67
|
+
}, {
|
68
|
+
label: 'Message retention'
|
69
|
+
}];
|
70
|
+
var influencer = /*#__PURE__*/React.createElement("div", {
|
71
|
+
className: "tearsheet-stories__dummy-influencer-block"
|
72
|
+
}, /*#__PURE__*/React.createElement(SideNav, {
|
73
|
+
"aria-label": "Side navigation",
|
74
|
+
className: "".concat(blockClass, "__side-nav"),
|
75
|
+
expanded: true,
|
76
|
+
isFixedNav: false
|
77
|
+
}, /*#__PURE__*/React.createElement(SideNavItems, null, sideNavItems.map(function (item, index) {
|
78
|
+
return /*#__PURE__*/React.createElement(SideNavMenuItem, {
|
79
|
+
key: index,
|
80
|
+
onClick: function onClick() {
|
81
|
+
return handleCurrentForm(index);
|
82
|
+
},
|
83
|
+
isActive: currentForm === index
|
84
|
+
}, item.label);
|
85
|
+
}))));
|
86
|
+
return /*#__PURE__*/React.createElement(TearsheetShell, _extends({}, rest, getDevtoolsProps(componentName), {
|
87
|
+
actions: [{
|
88
|
+
label: submitButtonText,
|
89
|
+
onClick: onHandleModalClick,
|
90
|
+
kind: 'primary'
|
91
|
+
}, {
|
92
|
+
label: cancelButtonText,
|
93
|
+
onClick: onHandleModalClick,
|
94
|
+
kind: 'secondary'
|
95
|
+
}],
|
96
|
+
className: cx(blockClass, className),
|
97
|
+
description: description,
|
98
|
+
hasCloseIcon: false,
|
99
|
+
influencer: influencer,
|
100
|
+
influencerPosition: "left",
|
101
|
+
influencerWidth: influencerWidth,
|
102
|
+
label: label,
|
103
|
+
onClose: onClose,
|
104
|
+
open: open,
|
105
|
+
size: "wide",
|
106
|
+
title: title,
|
107
|
+
verticalPosition: verticalPosition,
|
108
|
+
ref: ref
|
109
|
+
}), /*#__PURE__*/React.createElement("div", {
|
110
|
+
className: "".concat(blockClass, "__content"),
|
111
|
+
ref: contentRef,
|
112
|
+
role: "main"
|
113
|
+
}, /*#__PURE__*/React.createElement(Grid, null, /*#__PURE__*/React.createElement(Form, null, /*#__PURE__*/React.createElement(FormContext.Provider, {
|
114
|
+
value: {
|
115
|
+
currentForm: currentForm
|
116
|
+
}
|
117
|
+
}, React.Children.map(children, function (child, index) {
|
118
|
+
return /*#__PURE__*/React.createElement(FormNumberContext.Provider, {
|
119
|
+
value: index
|
120
|
+
}, child);
|
121
|
+
}))))));
|
122
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
123
|
+
|
124
|
+
EditTearsheet = pkg.checkComponentEnabled(EditTearsheet, componentName); // The display name of the component, used by React. Note that displayName
|
125
|
+
// is used in preference to relying on function.name.
|
126
|
+
|
127
|
+
EditTearsheet.displayName = componentName; // Note that the descriptions here should be kept in sync with those for the
|
128
|
+
// corresponding props for TearsheetNarrow and TearsheetShell components.
|
129
|
+
|
130
|
+
EditTearsheet.propTypes = {
|
131
|
+
/**
|
132
|
+
* The cancel button text
|
133
|
+
*/
|
134
|
+
cancelButtonText: PropTypes.string,
|
135
|
+
|
136
|
+
/**
|
137
|
+
* The main content of the tearsheet
|
138
|
+
*/
|
139
|
+
children: PropTypes.node,
|
140
|
+
|
141
|
+
/**
|
142
|
+
* An optional class or classes to be added to the outermost element.
|
143
|
+
*/
|
144
|
+
className: PropTypes.string,
|
145
|
+
|
146
|
+
/**
|
147
|
+
* A description of the flow, displayed in the header area of the tearsheet.
|
148
|
+
*/
|
149
|
+
description: PropTypes.node,
|
150
|
+
|
151
|
+
/**
|
152
|
+
* The content for the influencer section of the tearsheet, displayed
|
153
|
+
* alongside the main content. This is typically a menu, or filter, or
|
154
|
+
* progress indicator, or similar.
|
155
|
+
*/
|
156
|
+
influencer: PropTypes.element,
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Used to set the size of the influencer
|
160
|
+
*/
|
161
|
+
influencerWidth: PropTypes.oneOf(['narrow', 'wide']),
|
162
|
+
|
163
|
+
/**
|
164
|
+
* A label for the tearsheet, displayed in the header area of the tearsheet
|
165
|
+
* to maintain context for the tearsheet (e.g. as the title changes from page
|
166
|
+
* to page of a multi-page task).
|
167
|
+
*/
|
168
|
+
label: PropTypes.node,
|
169
|
+
|
170
|
+
/**
|
171
|
+
* An optional handler that is called when the user closes the tearsheet (by
|
172
|
+
* clicking the close button, if enabled, or clicking outside, if enabled).
|
173
|
+
* Returning `false` here prevents the modal from closing.
|
174
|
+
*/
|
175
|
+
onClose: PropTypes.func,
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Specifies whether the tearsheet is currently open.
|
179
|
+
*/
|
180
|
+
onHandleModalClick: PropTypes.func,
|
181
|
+
|
182
|
+
/**
|
183
|
+
* Specifies whether the tearsheet is currently open.
|
184
|
+
*/
|
185
|
+
open: PropTypes.bool,
|
186
|
+
|
187
|
+
/**
|
188
|
+
* The submit button text
|
189
|
+
*/
|
190
|
+
submitButtonText: PropTypes.string,
|
191
|
+
|
192
|
+
/**
|
193
|
+
* The main title of the tearsheet, displayed in the header area.
|
194
|
+
*/
|
195
|
+
title: PropTypes.node,
|
196
|
+
|
197
|
+
/**
|
198
|
+
* The position of the top of tearsheet in the viewport. The 'normal'
|
199
|
+
* position (the default) is a short distance down from the top of the
|
200
|
+
* viewport, leaving room at the top for a global header bar to show through
|
201
|
+
* from below. The 'lower' position provides a little extra room at the top
|
202
|
+
* to allow an action bar navigation or breadcrumbs to also show through.
|
203
|
+
*/
|
204
|
+
verticalPosition: PropTypes.oneOf(['normal', 'lower'])
|
205
|
+
};
|
@@ -0,0 +1,103 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
+
var _excluded = ["children", "className", "description", "fieldsetLegendText", "hasFieldset", "subtitle", "title"];
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Copyright IBM Corp. 2022, 2022
|
8
|
+
*
|
9
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
10
|
+
* LICENSE file in the root directory of this source tree.
|
11
|
+
*/
|
12
|
+
import React, { forwardRef, useContext } from 'react';
|
13
|
+
import PropTypes from 'prop-types';
|
14
|
+
import cx from 'classnames';
|
15
|
+
import { Column, FormGroup, Row } from 'carbon-components-react';
|
16
|
+
import { FormContext, FormNumberContext } from './EditTearsheet';
|
17
|
+
import { pkg } from '../../settings';
|
18
|
+
import pconsole from '../../global/js/utils/pconsole';
|
19
|
+
var componentName = 'EditTearsheetForm';
|
20
|
+
var blockClass = "".concat(pkg.prefix, "--tearsheet-edit__form"); // Default values for props
|
21
|
+
|
22
|
+
var defaults = {
|
23
|
+
hasFieldset: true
|
24
|
+
};
|
25
|
+
export var EditTearsheetForm = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
26
|
+
var _cx;
|
27
|
+
|
28
|
+
var children = _ref.children,
|
29
|
+
className = _ref.className,
|
30
|
+
description = _ref.description,
|
31
|
+
fieldsetLegendText = _ref.fieldsetLegendText,
|
32
|
+
_ref$hasFieldset = _ref.hasFieldset,
|
33
|
+
hasFieldset = _ref$hasFieldset === void 0 ? defaults.hasFieldset : _ref$hasFieldset,
|
34
|
+
subtitle = _ref.subtitle,
|
35
|
+
title = _ref.title,
|
36
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
37
|
+
|
38
|
+
var formContext = useContext(FormContext);
|
39
|
+
var formNumber = useContext(FormNumberContext);
|
40
|
+
return formContext ? /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
41
|
+
className: cx(blockClass, className, (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__form--hidden-form"), formNumber !== (formContext === null || formContext === void 0 ? void 0 : formContext.currentForm)), _defineProperty(_cx, "".concat(blockClass, "__form--visible-form"), formNumber === (formContext === null || formContext === void 0 ? void 0 : formContext.currentForm)), _cx)),
|
42
|
+
ref: ref
|
43
|
+
}), /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
|
44
|
+
xlg: 12,
|
45
|
+
lg: 12,
|
46
|
+
md: 8,
|
47
|
+
sm: 8
|
48
|
+
}, /*#__PURE__*/React.createElement("h4", {
|
49
|
+
className: "".concat(blockClass, "--title")
|
50
|
+
}, title), subtitle && /*#__PURE__*/React.createElement("h6", {
|
51
|
+
className: "".concat(blockClass, "--subtitle")
|
52
|
+
}, subtitle), description && /*#__PURE__*/React.createElement("p", {
|
53
|
+
className: "".concat(blockClass, "--description")
|
54
|
+
}, description))), hasFieldset ? /*#__PURE__*/React.createElement(FormGroup, {
|
55
|
+
legendText: fieldsetLegendText,
|
56
|
+
className: "".concat(blockClass, "--fieldset")
|
57
|
+
}, children) : children) : pconsole.warn("You have tried using a ".concat(componentName, " component outside of a EditTearsheet. This is not allowed. ").concat(componentName, "s should always be children of the EditTearsheet"));
|
58
|
+
}); // Return a placeholder if not released and not enabled by feature flag
|
59
|
+
|
60
|
+
EditTearsheetForm = pkg.checkComponentEnabled(EditTearsheetForm, componentName);
|
61
|
+
EditTearsheetForm.propTypes = {
|
62
|
+
/**
|
63
|
+
* Content that shows in the tearsheet form
|
64
|
+
*/
|
65
|
+
children: PropTypes.node,
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Sets an optional className to be added to the tearsheet form
|
69
|
+
*/
|
70
|
+
className: PropTypes.string,
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Sets an optional description on the form component
|
74
|
+
*/
|
75
|
+
description: PropTypes.string,
|
76
|
+
|
77
|
+
/**
|
78
|
+
* This is the required legend text that appears above a fieldset html element for accessibility purposes.
|
79
|
+
* You can set the `hasFieldset` prop to false if you have multiple fieldset elements or want to control the children of your Full Page's form content.
|
80
|
+
* Otherwise, use CSS to hide/remove this label text.
|
81
|
+
*/
|
82
|
+
fieldsetLegendText: PropTypes.string.isRequired.if(function (_ref2) {
|
83
|
+
var hasFieldset = _ref2.hasFieldset;
|
84
|
+
return !!hasFieldset;
|
85
|
+
}),
|
86
|
+
|
87
|
+
/**
|
88
|
+
* This optional prop will render your form content inside of a fieldset html element
|
89
|
+
* and is defaulted to true.
|
90
|
+
* You can set this prop to `false` if you have multiple fieldset elements or want to control the children of your Full Page's form content.
|
91
|
+
*/
|
92
|
+
hasFieldset: PropTypes.bool,
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Sets an optional subtitle on the form component
|
96
|
+
*/
|
97
|
+
subtitle: PropTypes.string,
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Sets the title text for a tearsheet form
|
101
|
+
*/
|
102
|
+
title: PropTypes.node.isRequired
|
103
|
+
};
|