@carbon/ibm-products 1.25.1 → 1.31.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (157) hide show
  1. package/css/index-full-carbon.css +562 -88
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -3
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +942 -23
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +3 -3
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +561 -87
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +3 -3
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +562 -88
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +3 -3
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/AddSelect/AddSelect.js +0 -3
  18. package/es/components/AddSelect/AddSelectBody.js +20 -3
  19. package/es/components/AddSelect/AddSelectBreadcrumbs.js +11 -3
  20. package/es/components/AddSelect/AddSelectColumn.js +4 -3
  21. package/es/components/AddSelect/AddSelectFilter.js +4 -3
  22. package/es/components/AddSelect/AddSelectList.js +40 -14
  23. package/es/components/Card/Card.js +16 -6
  24. package/es/components/Card/CardFooter.js +3 -1
  25. package/es/components/Card/CardHeader.js +20 -1
  26. package/es/components/DataSpreadsheet/DataSpreadsheet.js +62 -11
  27. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
  28. package/es/components/DataSpreadsheet/utils/handleCellDeletion.js +31 -0
  29. package/es/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
  30. package/es/components/Datagrid/Datagrid/Datagrid.js +10 -38
  31. package/es/components/Datagrid/Datagrid/DatagridContent.js +106 -0
  32. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +10 -3
  33. package/es/components/Datagrid/Datagrid/DatagridToolbar.js +139 -11
  34. package/es/components/Datagrid/Datagrid/DraggableElement.js +5 -1
  35. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +5 -40
  36. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +35 -10
  37. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +61 -24
  38. package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +3 -2
  39. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +63 -0
  40. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +1 -0
  41. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +459 -0
  42. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +1 -0
  43. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +112 -0
  44. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +27 -0
  45. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +1 -0
  46. package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +31 -0
  47. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +19 -0
  48. package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +197 -0
  49. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +6 -5
  50. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
  51. package/es/components/Datagrid/index.js +3 -1
  52. package/es/components/Datagrid/useActionsColumn.js +31 -6
  53. package/es/components/Datagrid/useColumnOrder.js +8 -0
  54. package/es/components/Datagrid/useCustomizeColumns.js +5 -0
  55. package/es/components/Datagrid/useDefaultStringRenderer.js +4 -1
  56. package/es/components/Datagrid/useDisableSelectRows.js +6 -2
  57. package/es/components/Datagrid/useInlineEdit.js +71 -0
  58. package/es/components/Datagrid/useRowSize.js +17 -6
  59. package/es/components/Datagrid/useSelectRows.js +14 -4
  60. package/es/components/Datagrid/useStickyColumn.js +14 -0
  61. package/es/components/Datagrid/utils/getInlineEditColumns.js +121 -0
  62. package/es/components/Datagrid/utils/makeData.js +18 -2
  63. package/es/components/ImportModal/ImportModal.js +2 -2
  64. package/es/components/InlineEdit/InlineEdit.js +4 -2
  65. package/es/components/ProductiveCard/ProductiveCard.js +5 -0
  66. package/es/components/WebTerminal/WebTerminal.js +1 -1
  67. package/es/components/WebTerminal/WebTerminalContentWrapper.js +1 -1
  68. package/es/components/WebTerminal/hooks/index.js +6 -0
  69. package/es/components/WebTerminal/index.js +6 -0
  70. package/es/components/WebTerminal/preview-components/Navigation.js +6 -0
  71. package/es/components/WebTerminal/preview-components/documentationLinks.js +6 -0
  72. package/es/components/WebTerminal/preview-components/index.js +7 -0
  73. package/es/components/index.js +1 -1
  74. package/es/global/js/hooks/useClickOutside.js +1 -1
  75. package/es/global/js/package-settings.js +3 -3
  76. package/es/global/js/utils/rangeWithCallback.js +13 -0
  77. package/es/global/js/utils/uuidv4.spec.js +4 -0
  78. package/lib/components/AddSelect/AddSelect.js +0 -4
  79. package/lib/components/AddSelect/AddSelectBody.js +20 -3
  80. package/lib/components/AddSelect/AddSelectBreadcrumbs.js +14 -3
  81. package/lib/components/AddSelect/AddSelectColumn.js +3 -2
  82. package/lib/components/AddSelect/AddSelectFilter.js +3 -2
  83. package/lib/components/AddSelect/AddSelectList.js +39 -13
  84. package/lib/components/Card/Card.js +16 -6
  85. package/lib/components/Card/CardFooter.js +3 -1
  86. package/lib/components/Card/CardHeader.js +21 -1
  87. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +62 -10
  88. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +7 -0
  89. package/lib/components/DataSpreadsheet/utils/handleCellDeletion.js +42 -0
  90. package/lib/components/DataSpreadsheet/utils/handleMultipleKeys.js +1 -1
  91. package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -45
  92. package/lib/components/Datagrid/Datagrid/DatagridContent.js +138 -0
  93. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -3
  94. package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +148 -9
  95. package/lib/components/Datagrid/Datagrid/DraggableElement.js +5 -1
  96. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Actions.js +12 -41
  97. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +47 -25
  98. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsModal.js +59 -23
  99. package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ModalWrapper.js +3 -2
  100. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/InlineEditButton.js +79 -0
  101. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditButton/index.js +13 -0
  102. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +483 -0
  103. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/index.js +13 -0
  104. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/InlineEditContext.js +129 -0
  105. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/getCellIdAsObject.js +36 -0
  106. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/index.js +19 -0
  107. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditContext/returnUpdatedActiveCell.js +42 -0
  108. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridFocus.js +28 -0
  109. package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +204 -0
  110. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeDropdown.js +6 -5
  111. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -2
  112. package/lib/components/Datagrid/index.js +17 -1
  113. package/lib/components/Datagrid/useActionsColumn.js +31 -6
  114. package/lib/components/Datagrid/useColumnOrder.js +17 -0
  115. package/lib/components/Datagrid/useCustomizeColumns.js +5 -0
  116. package/lib/components/Datagrid/useDefaultStringRenderer.js +5 -1
  117. package/lib/components/Datagrid/useDisableSelectRows.js +6 -2
  118. package/lib/components/Datagrid/useInlineEdit.js +85 -0
  119. package/lib/components/Datagrid/useRowSize.js +18 -13
  120. package/lib/components/Datagrid/useSelectRows.js +13 -3
  121. package/lib/components/Datagrid/useStickyColumn.js +14 -0
  122. package/lib/components/Datagrid/utils/getInlineEditColumns.js +133 -0
  123. package/lib/components/Datagrid/utils/makeData.js +18 -2
  124. package/lib/components/ImportModal/ImportModal.js +2 -2
  125. package/lib/components/InlineEdit/InlineEdit.js +4 -2
  126. package/lib/components/ProductiveCard/ProductiveCard.js +5 -0
  127. package/lib/components/WebTerminal/hooks/index.js +6 -0
  128. package/lib/components/WebTerminal/preview-components/Navigation.js +6 -0
  129. package/lib/components/WebTerminal/preview-components/documentationLinks.js +6 -0
  130. package/lib/components/index.js +12 -0
  131. package/lib/global/js/hooks/useClickOutside.js +1 -1
  132. package/lib/global/js/package-settings.js +3 -3
  133. package/lib/global/js/utils/rangeWithCallback.js +22 -0
  134. package/lib/global/js/utils/uuidv4.spec.js +4 -0
  135. package/package.json +13 -13
  136. package/scss/components/AddSelect/_add-select.scss +126 -28
  137. package/scss/components/Card/_card.scss +1 -0
  138. package/scss/components/Cascade/_cascade.scss +1 -1
  139. package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -0
  140. package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +18 -1
  141. package/scss/components/Datagrid/_datagrid.scss +5 -0
  142. package/scss/components/Datagrid/_storybook-styles.scss +1 -1
  143. package/scss/components/Datagrid/styles/_datagrid.scss +81 -12
  144. package/scss/components/Datagrid/styles/_draggableElement.scss +26 -9
  145. package/scss/components/Datagrid/styles/_index.scss +1 -0
  146. package/scss/components/Datagrid/styles/_useInlineEdit.scss +211 -0
  147. package/scss/components/Datagrid/styles/_useStickyColumn.scss +24 -2
  148. package/scss/components/Datagrid/styles/addons/_CustomizeColumnsModal.scss +44 -6
  149. package/scss/components/InlineEdit/_inline-edit.scss +1 -1
  150. package/scss/components/NotificationsPanel/_notifications-panel.scss +5 -6
  151. package/scss/components/ProductiveCard/_productive-card.scss +39 -0
  152. package/scss/components/RemoveModal/_remove-modal.scss +0 -4
  153. package/scss/components/SidePanel/_side-panel.scss +4 -6
  154. package/scss/components/WebTerminal/_index.scss +7 -0
  155. package/scss/components/WebTerminal/_storybook-styles.scss +7 -0
  156. package/scss/components/WebTerminal/_web-terminal.scss +13 -0
  157. package/scss/components/_index-released-only.scss +1 -0
@@ -12,7 +12,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
12
12
  // LICENSE file in the root directory of this source tree.
13
13
  //
14
14
  import React, { useState } from 'react';
15
- import { Button, ButtonSet, Dropdown, TextInput, Tag } from 'carbon-components-react';
15
+ import { Button, ButtonSet, Dropdown, Search, Tag } from 'carbon-components-react';
16
16
  import cx from 'classnames';
17
17
  import PropTypes from 'prop-types';
18
18
  import { Filter16 } from '@carbon/icons-react';
@@ -93,7 +93,7 @@ export var AddSelectFilter = function AddSelectFilter(_ref) {
93
93
  var dirtyInput = Object.keys(filters).length > 0;
94
94
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
95
95
  className: "".concat(blockClass, "-search")
96
- }, /*#__PURE__*/React.createElement(TextInput, {
96
+ }, /*#__PURE__*/React.createElement(Search, {
97
97
  id: "temp-id",
98
98
  labelText: inputLabel,
99
99
  placeholder: inputPlaceholder,
@@ -108,7 +108,8 @@ export var AddSelectFilter = function AddSelectFilter(_ref) {
108
108
  },
109
109
  iconDescription: iconDescription,
110
110
  className: filterBtnClassnames,
111
- size: "md"
111
+ size: "lg",
112
+ tooltipPosition: "left"
112
113
  }), open && /*#__PURE__*/React.createElement("div", {
113
114
  className: blockClass
114
115
  }, /*#__PURE__*/React.createElement("div", {
@@ -7,7 +7,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
7
7
  // LICENSE file in the root directory of this source tree.
8
8
  //
9
9
  import React from 'react';
10
- import { Button, Checkbox, RadioButton, StructuredListRow, StructuredListWrapper, StructuredListBody, StructuredListCell, Dropdown } from 'carbon-components-react';
10
+ import { Button, Checkbox, RadioButton, StructuredListRow, StructuredListWrapper, StructuredListBody, Dropdown } from 'carbon-components-react';
11
11
  import { ChevronRight16, View16 } from '@carbon/icons-react';
12
12
  import PropTypes from 'prop-types';
13
13
  import cx from 'classnames';
@@ -19,6 +19,7 @@ export var AddSelectList = function AddSelectList(_ref) {
19
19
  var _modifiers$options;
20
20
 
21
21
  var appliedModifiers = _ref.appliedModifiers,
22
+ displayMetalPanel = _ref.displayMetalPanel,
22
23
  filteredItems = _ref.filteredItems,
23
24
  metaIconDescription = _ref.metaIconDescription,
24
25
  modifiers = _ref.modifiers,
@@ -38,8 +39,8 @@ export var AddSelectList = function AddSelectList(_ref) {
38
39
  setSingleSelection(value);
39
40
  };
40
41
 
41
- var handleMultiSelection = function handleMultiSelection(id, checked) {
42
- if (checked) {
42
+ var handleMultiSelection = function handleMultiSelection(value, id) {
43
+ if (value) {
43
44
  var newValues = [].concat(_toConsumableArray(multiSelection), [id]);
44
45
  setMultiSelection(newValues);
45
46
  } else {
@@ -58,7 +59,11 @@ export var AddSelectList = function AddSelectList(_ref) {
58
59
  };
59
60
 
60
61
  var isSelected = function isSelected(id) {
61
- return multiSelection.includes(id);
62
+ if (multi) {
63
+ return multiSelection.includes(id);
64
+ }
65
+
66
+ return id === singleSelection;
62
67
  };
63
68
 
64
69
  var getAvatarProps = function getAvatarProps(_ref3) {
@@ -94,30 +99,53 @@ export var AddSelectList = function AddSelectList(_ref) {
94
99
  setAppliedModifiers(modifiersClone);
95
100
  };
96
101
 
102
+ var metaPanelHandler = function metaPanelHandler(item) {
103
+ if (item.meta) {
104
+ setDisplayMetaPanel(item);
105
+ }
106
+ };
107
+
108
+ var isInMetaPanel = function isInMetaPanel(id) {
109
+ return id === (displayMetalPanel === null || displayMetalPanel === void 0 ? void 0 : displayMetalPanel.id);
110
+ };
111
+
97
112
  return /*#__PURE__*/React.createElement("div", {
98
- className: "".concat(blockClass, "-wrapper")
113
+ className: cx("".concat(blockClass, "-wrapper"), _defineProperty({}, "".concat(blockClass, "-wrapper-multi"), multi))
99
114
  }, /*#__PURE__*/React.createElement(StructuredListWrapper, {
100
115
  selection: true,
101
116
  className: "".concat(blockClass)
102
117
  }, /*#__PURE__*/React.createElement(StructuredListBody, null, filteredItems.map(function (item) {
118
+ var _cx2;
119
+
103
120
  return /*#__PURE__*/React.createElement(StructuredListRow, {
104
121
  key: item.id,
105
- className: cx("".concat(blockClass, "-row"), _defineProperty({}, "".concat(blockClass, "-row-selected"), isSelected(item.id)))
106
- }, /*#__PURE__*/React.createElement(StructuredListCell, {
122
+ className: cx("".concat(blockClass, "-row"), (_cx2 = {}, _defineProperty(_cx2, "".concat(blockClass, "-row-selected"), isSelected(item.id)), _defineProperty(_cx2, "".concat(blockClass, "-row-meta-selected"), isInMetaPanel(item.id)), _cx2)),
123
+ onClick: function onClick(evt) {
124
+ return metaPanelHandler(item, evt);
125
+ }
126
+ }, /*#__PURE__*/React.createElement("div", {
107
127
  className: "".concat(blockClass, "-cell")
108
128
  }, /*#__PURE__*/React.createElement("div", {
109
129
  className: "".concat(blockClass, "-cell-wrapper")
110
130
  }, multi ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
111
131
  className: "".concat(blockClass, "-checkbox")
132
+ },
133
+ /*#__PURE__*/
134
+ // hacky way to prevent checkbox from triggering the meta onclick handler
135
+ // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
136
+ React.createElement("div", {
137
+ onClick: function onClick(event) {
138
+ return event.stopPropagation();
139
+ }
112
140
  }, /*#__PURE__*/React.createElement(Checkbox, {
113
- onChange: function onChange(checked) {
114
- return handleMultiSelection(item.id, checked);
141
+ onChange: function onChange(value, id) {
142
+ return handleMultiSelection(value, id);
115
143
  },
116
144
  labelText: item.title,
117
145
  id: item.id,
118
146
  checked: isSelected(item.id),
119
147
  className: "".concat(blockClass, "-checkbox-wrapper")
120
- }), /*#__PURE__*/React.createElement("div", {
148
+ })), /*#__PURE__*/React.createElement("div", {
121
149
  className: "".concat(blockClass, "-checkbox-label-wrapper")
122
150
  }, item.avatar && /*#__PURE__*/React.createElement(UserProfileImage, getAvatarProps(item.avatar)), item.icon && /*#__PURE__*/React.createElement("div", {
123
151
  className: "".concat(blockClass, "-cell-icon")
@@ -149,7 +177,7 @@ export var AddSelectList = function AddSelectList(_ref) {
149
177
  onChange: function onChange() {
150
178
  return handleSingleSelection(item.id);
151
179
  },
152
- selected: item.id === singleSelection
180
+ checked: isSelected(item.id)
153
181
  }), item.children && /*#__PURE__*/React.createElement(Button, {
154
182
  className: "".concat(blockClass, "-view-children"),
155
183
  renderIcon: ChevronRight16,
@@ -171,9 +199,6 @@ export var AddSelectList = function AddSelectList(_ref) {
171
199
  tooltipPosition: "left",
172
200
  tooltipAlignment: "center",
173
201
  hasIconOnly: true,
174
- onClick: function onClick() {
175
- return setDisplayMetaPanel(item);
176
- },
177
202
  kind: "ghost",
178
203
  size: "sm"
179
204
  })))));
@@ -181,6 +206,7 @@ export var AddSelectList = function AddSelectList(_ref) {
181
206
  };
182
207
  AddSelectList.propTypes = {
183
208
  appliedModifiers: PropTypes.array,
209
+ displayMetalPanel: PropTypes.object,
184
210
  filteredItems: PropTypes.array,
185
211
  metaIconDescription: PropTypes.string,
186
212
  modifiers: PropTypes.object,
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _extends from "@babel/runtime/helpers/extends";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["actionIcons", "actionsPlacement", "children", "className", "clickZone", "description", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "onSecondaryButtonClick", "pictogram", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonText", "productive", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonText", "title", "titleSize"],
4
+ var _excluded = ["actionIcons", "actionsPlacement", "children", "className", "clickZone", "description", "label", "media", "mediaPosition", "onClick", "onKeyDown", "onPrimaryButtonClick", "overflowActions", "onSecondaryButtonClick", "pictogram", "primaryButtonHref", "primaryButtonIcon", "primaryButtonKind", "primaryButtonPlacement", "primaryButtonText", "productive", "secondaryButtonHref", "secondaryButtonIcon", "secondaryButtonKind", "secondaryButtonText", "title", "titleSize"],
5
5
  _excluded2 = ["id"],
6
6
  _excluded3 = ["id", "icon", "onClick", "iconDescription", "onKeyDown", "href"];
7
7
 
@@ -31,6 +31,7 @@ var defaults = {
31
31
  mediaPosition: 'top',
32
32
  overflowActions: Object.freeze([]),
33
33
  primaryButtonKind: 'primary',
34
+ primaryButtonPlacement: 'bottom',
34
35
  productive: false,
35
36
  secondaryButtonKind: 'secondary',
36
37
  titleSize: 'default'
@@ -60,6 +61,8 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
60
61
  primaryButtonIcon = _ref.primaryButtonIcon,
61
62
  _ref$primaryButtonKin = _ref.primaryButtonKind,
62
63
  primaryButtonKind = _ref$primaryButtonKin === void 0 ? defaults.primaryButtonKind : _ref$primaryButtonKin,
64
+ _ref$primaryButtonPla = _ref.primaryButtonPlacement,
65
+ primaryButtonPlacement = _ref$primaryButtonPla === void 0 ? defaults.primaryButtonPlacement : _ref$primaryButtonPla,
63
66
  primaryButtonText = _ref.primaryButtonText,
64
67
  _ref$productive = _ref.productive,
65
68
  productive = _ref$productive === void 0 ? defaults.productive : _ref$productive,
@@ -74,9 +77,9 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
74
77
  rest = _objectWithoutProperties(_ref, _excluded);
75
78
 
76
79
  var blockClass = "".concat(pkg.prefix, "--card");
77
- var hasActions = actionIcons.length > 0 || overflowActions.length > 0;
80
+ var hasActions = actionIcons.length > 0 || overflowActions.length > 0 || primaryButtonText && primaryButtonPlacement === 'top';
78
81
  var hasFooterActions = hasActions && actionsPlacement === 'bottom';
79
- var hasFooterButton = !!secondaryButtonText || !!primaryButtonText;
82
+ var hasFooterButton = !!secondaryButtonText || !!primaryButtonText && primaryButtonPlacement === 'bottom';
80
83
  var hasBottomBar = hasFooterActions || hasFooterButton;
81
84
  var hasClickEvent = !!onClick || !!onKeyDown;
82
85
  var clickableProps = {
@@ -177,10 +180,15 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
177
180
 
178
181
  var getHeaderProps = function getHeaderProps() {
179
182
  return {
180
- actions: getActions(),
183
+ actions: actionsPlacement === 'top' ? getActions() : '',
184
+ noActionIcons: actionIcons.length > 0 && actionsPlacement === 'top' ? false : true,
181
185
  actionsPlacement: actionsPlacement,
186
+ onPrimaryButtonClick: onPrimaryButtonClick,
187
+ primaryButtonIcon: primaryButtonIcon,
188
+ primaryButtonPlacement: primaryButtonPlacement,
189
+ primaryButtonText: primaryButtonText,
182
190
  description: description,
183
- hasActions: hasActions && actionsPlacement === 'top',
191
+ hasActions: hasActions,
184
192
  label: label,
185
193
  title: title,
186
194
  titleSize: titleSize
@@ -199,7 +207,7 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
199
207
 
200
208
  var getFooterProps = function getFooterProps() {
201
209
  return {
202
- actions: getActions(),
210
+ actions: actionsPlacement === 'bottom' ? getActions() : '',
203
211
  actionsPlacement: actionsPlacement,
204
212
  hasActions: hasFooterActions,
205
213
  hasButton: hasFooterButton,
@@ -208,6 +216,7 @@ export var Card = /*#__PURE__*/forwardRef(function (_ref, ref) {
208
216
  primaryButtonHref: primaryButtonHref,
209
217
  primaryButtonIcon: primaryButtonIcon,
210
218
  primaryButtonKind: primaryButtonKind,
219
+ primaryButtonPlacement: primaryButtonPlacement,
211
220
  primaryButtonText: primaryButtonText,
212
221
  productive: productive,
213
222
  secondaryButtonHref: secondaryButtonHref,
@@ -256,6 +265,7 @@ Card.propTypes = {
256
265
  primaryButtonHref: PropTypes.string,
257
266
  primaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
258
267
  primaryButtonKind: PropTypes.oneOf(['primary', 'ghost']),
268
+ primaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
259
269
  primaryButtonText: PropTypes.node,
260
270
  productive: PropTypes.bool,
261
271
  secondaryButtonHref: PropTypes.string,
@@ -28,6 +28,7 @@ export var CardFooter = function CardFooter(_ref) {
28
28
  primaryButtonIcon = _ref.primaryButtonIcon,
29
29
  _ref$primaryButtonKin = _ref.primaryButtonKind,
30
30
  primaryButtonKind = _ref$primaryButtonKin === void 0 ? defaults.primaryButtonKind : _ref$primaryButtonKin,
31
+ primaryButtonPlacement = _ref.primaryButtonPlacement,
31
32
  primaryButtonText = _ref.primaryButtonText,
32
33
  _ref$productive = _ref.productive,
33
34
  productive = _ref$productive === void 0 ? defaults.productive : _ref$productive,
@@ -47,7 +48,7 @@ export var CardFooter = function CardFooter(_ref) {
47
48
  size: "field",
48
49
  renderIcon: secondaryButtonIcon,
49
50
  href: secondaryButtonHref
50
- }, secondaryButtonText), primaryButtonText && /*#__PURE__*/React.createElement(Button, {
51
+ }, secondaryButtonText), primaryButtonText && primaryButtonPlacement === 'bottom' && /*#__PURE__*/React.createElement(Button, {
51
52
  kind: productive ? 'ghost' : primaryButtonKind,
52
53
  onClick: onPrimaryButtonClick,
53
54
  size: "field",
@@ -66,6 +67,7 @@ CardFooter.propTypes = {
66
67
  primaryButtonHref: PropTypes.string,
67
68
  primaryButtonIcon: PropTypes.string,
68
69
  primaryButtonKind: PropTypes.oneOf(['primary', 'ghost']),
70
+ primaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
69
71
  primaryButtonText: PropTypes.string,
70
72
  productive: PropTypes.bool,
71
73
  secondaryButtonHref: PropTypes.string,
@@ -9,6 +9,7 @@ import React from 'react';
9
9
  import cx from 'classnames';
10
10
  import PropTypes from 'prop-types';
11
11
  import { pkg } from '../../settings';
12
+ import { Button } from 'carbon-components-react';
12
13
  var componentName = 'CardHeader';
13
14
  var defaults = {
14
15
  hasActions: false,
@@ -18,6 +19,11 @@ export var CardHeader = function CardHeader(_ref) {
18
19
  var _cx;
19
20
 
20
21
  var actions = _ref.actions,
22
+ noActionIcons = _ref.noActionIcons,
23
+ onPrimaryButtonClick = _ref.onPrimaryButtonClick,
24
+ primaryButtonIcon = _ref.primaryButtonIcon,
25
+ primaryButtonPlacement = _ref.primaryButtonPlacement,
26
+ primaryButtonText = _ref.primaryButtonText,
21
27
  description = _ref.description,
22
28
  _ref$hasActions = _ref.hasActions,
23
29
  hasActions = _ref$hasActions === void 0 ? defaults.hasActions : _ref$hasActions,
@@ -28,6 +34,8 @@ export var CardHeader = function CardHeader(_ref) {
28
34
  var blockClass = "".concat(pkg.prefix, "--card");
29
35
  var headerClass = "".concat(blockClass, "__header");
30
36
  var headerClasses = cx(headerClass, (_cx = {}, _defineProperty(_cx, "".concat(headerClass, "-label-only"), label && !title && !description), _defineProperty(_cx, "".concat(headerClass, "-has-label"), !!label), _defineProperty(_cx, "".concat(blockClass, "__title-lg"), titleSize === 'large'), _cx));
37
+ var actionGhostButton = "".concat(blockClass, "__actions-header-ghost-button");
38
+ var actionGhostButtonClass = cx(actionGhostButton, _defineProperty({}, "".concat(actionGhostButton, "--only"), noActionIcons));
31
39
  return /*#__PURE__*/React.createElement("div", {
32
40
  className: headerClasses
33
41
  }, /*#__PURE__*/React.createElement("div", {
@@ -42,13 +50,24 @@ export var CardHeader = function CardHeader(_ref) {
42
50
  className: "".concat(blockClass, "__description")
43
51
  }, description)), hasActions && /*#__PURE__*/React.createElement("div", {
44
52
  className: "".concat(blockClass, "__actions ").concat(blockClass, "__actions-header")
45
- }, actions)));
53
+ }, actions, primaryButtonText && primaryButtonPlacement === 'top' && /*#__PURE__*/React.createElement(Button, {
54
+ kind: "ghost",
55
+ size: "small",
56
+ renderIcon: primaryButtonIcon,
57
+ onClick: onPrimaryButtonClick,
58
+ className: actionGhostButtonClass
59
+ }, primaryButtonText))));
46
60
  };
47
61
  CardHeader.propTypes = {
48
62
  actions: PropTypes.oneOfType([PropTypes.array, PropTypes.node]),
49
63
  description: PropTypes.string,
50
64
  hasActions: PropTypes.bool,
51
65
  label: PropTypes.string,
66
+ noActionIcons: PropTypes.bool,
67
+ onPrimaryButtonClick: PropTypes.func,
68
+ primaryButtonIcon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
69
+ primaryButtonPlacement: PropTypes.oneOf(['top', 'bottom']),
70
+ primaryButtonText: PropTypes.string,
52
71
  title: PropTypes.string,
53
72
  titleSize: PropTypes.oneOf(['default', 'large'])
54
73
  };
@@ -3,7 +3,7 @@ import _typeof from "@babel/runtime/helpers/typeof";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
6
- var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "totalVisibleColumns"];
6
+ var _excluded = ["cellSize", "className", "columns", "data", "defaultEmptyRowCount", "onDataUpdate", "id", "onActiveCellChange", "onSelectionAreaChange", "selectAllAriaLabel", "spreadsheetAriaLabel", "theme", "totalVisibleColumns"];
7
7
 
8
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
9
9
 
@@ -39,7 +39,8 @@ import { removeCellSelections } from './utils/removeCellSelections';
39
39
  import { selectAllCells } from './utils/selectAllCells';
40
40
  import { handleEditSubmit } from './utils/handleEditSubmit';
41
41
  import { handleActiveCellInSelectionEnter } from './utils/handleActiveCellInSelectionEnter';
42
- import { handleActiveCellInSelectionTab } from './utils/handleActiveCellInSelectionTab'; // cspell:words rowcount colcount
42
+ import { handleActiveCellInSelectionTab } from './utils/handleActiveCellInSelectionTab';
43
+ import { handleCellDeletion } from './utils/handleCellDeletion'; // cspell:words rowcount colcount
43
44
  // The block part of our conventional BEM class names (blockClass__E--M).
44
45
 
45
46
  var blockClass = "".concat(pkg.prefix, "--data-spreadsheet");
@@ -52,13 +53,16 @@ var defaults = {
52
53
  defaultEmptyRowCount: 16,
53
54
  onDataUpdate: Object.freeze(function () {}),
54
55
  onActiveCellChange: Object.freeze(function () {}),
55
- onSelectionAreaChange: Object.freeze(function () {})
56
+ onSelectionAreaChange: Object.freeze(function () {}),
57
+ theme: 'light'
56
58
  };
57
59
  /**
58
60
  * DataSpreadsheet: used to organize and display large amounts of structured data, separated by columns and rows in a grid-like format.
59
61
  */
60
62
 
61
63
  export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
64
+ var _cx;
65
+
62
66
  var _ref$cellSize = _ref.cellSize,
63
67
  cellSize = _ref$cellSize === void 0 ? defaults.cellSize : _ref$cellSize,
64
68
  className = _ref.className,
@@ -75,6 +79,9 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
75
79
  onActiveCellChange = _ref$onActiveCellChan === void 0 ? defaults.onActiveCellChange : _ref$onActiveCellChan,
76
80
  _ref$onSelectionAreaC = _ref.onSelectionAreaChange,
77
81
  onSelectionAreaChange = _ref$onSelectionAreaC === void 0 ? defaults.onSelectionAreaChange : _ref$onSelectionAreaC,
82
+ selectAllAriaLabel = _ref.selectAllAriaLabel,
83
+ spreadsheetAriaLabel = _ref.spreadsheetAriaLabel,
84
+ theme = _ref.theme,
78
85
  totalVisibleColumns = _ref.totalVisibleColumns,
79
86
  rest = _objectWithoutProperties(_ref, _excluded);
80
87
 
@@ -182,11 +189,11 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
182
189
  visibleColumns = _useTable.visibleColumns; // Update the spreadsheet data after editing a cell
183
190
 
184
191
 
185
- var updateData = useCallback(function (rowIndex, columnId) {
192
+ var updateData = useCallback(function (rowIndex, columnId, newValue) {
186
193
  onDataUpdate(function (prev) {
187
194
  return prev.map(function (row, index) {
188
195
  if (index === rowIndex) {
189
- return _objectSpread(_objectSpread({}, prev[rowIndex]), {}, _defineProperty({}, columnId, cellEditorValue));
196
+ return _objectSpread(_objectSpread({}, prev[rowIndex]), {}, _defineProperty({}, columnId, cellEditorValue || newValue));
190
197
  }
191
198
 
192
199
  return row;
@@ -374,13 +381,34 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
374
381
  setCurrentMatcher: setCurrentMatcher,
375
382
  usingMac: usingMac
376
383
  });
377
- } // Allow arrow key navigation if there are less than two activeKeys OR
378
- // if one of the activeCellCoordinates is in a header position
384
+ }
379
385
 
386
+ var deleteParams = {
387
+ selectionAreas: selectionAreas,
388
+ currentMatcher: currentMatcher,
389
+ rows: rows,
390
+ setActiveCellContent: setActiveCellContent,
391
+ updateData: updateData
392
+ }; // Allow arrow key navigation if there are less than two activeKeys OR
393
+ // if one of the activeCellCoordinates is in a header position
380
394
 
381
395
  if (keysPressedList.length < 2 && !includesShift(keysPressedList) || activeCellCoordinates.row === 'header' || activeCellCoordinates.column === 'header') {
382
396
  switch (key) {
397
+ // Backspace
398
+ case 'Backspace':
399
+ {
400
+ handleCellDeletion(deleteParams);
401
+ break;
402
+ }
403
+ // Delete
404
+
405
+ case 'Delete':
406
+ {
407
+ handleCellDeletion(deleteParams);
408
+ break;
409
+ }
383
410
  // Enter
411
+
384
412
  case 'Enter':
385
413
  {
386
414
  handleActiveCellInSelectionEnter({
@@ -578,7 +606,7 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
578
606
  }
579
607
  }
580
608
  }
581
- }, [activeCellInsideSelectionArea, updateActiveCellCoordinates, handleInitialArrowPress, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, isEditing, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac]);
609
+ }, [activeCellInsideSelectionArea, updateActiveCellCoordinates, handleInitialArrowPress, activeCellCoordinates, removeActiveCell, columns, rows, spreadsheetRef, currentMatcher, isEditing, removeCellEditor, selectionAreas, handleHomeEndKey, keysPressedList, usingMac, updateData]);
582
610
 
583
611
  var startEditMode = function startEditMode() {
584
612
  setIsEditing(true);
@@ -614,6 +642,11 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
614
642
  }
615
643
 
616
644
  return;
645
+ }; // Mouse up on active cell
646
+
647
+
648
+ var handleActiveCellMouseUp = function handleActiveCellMouseUp() {
649
+ setClickAndHoldActive(false);
617
650
  }; // Mouse down on active cell
618
651
 
619
652
 
@@ -752,12 +785,13 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
752
785
  }
753
786
  }, [spreadsheetRef, currentMatcher]);
754
787
  return /*#__PURE__*/React.createElement("div", _extends({}, rest, getTableProps(), getDevtoolsProps(componentName), {
755
- className: cx(blockClass, className, "".concat(blockClass, "--interactive-cell-element"), _defineProperty({}, "".concat(blockClass, "__container-has-focus"), containerHasFocus)),
788
+ className: cx(blockClass, className, "".concat(blockClass, "--interactive-cell-element"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__container-has-focus"), containerHasFocus), _defineProperty(_cx, "".concat(blockClass, "__").concat(theme), theme === 'dark'), _cx)),
756
789
  ref: spreadsheetRef,
757
790
  role: "grid",
758
791
  tabIndex: 0,
759
792
  "aria-rowcount": (rows === null || rows === void 0 ? void 0 : rows.length) || 0,
760
793
  "aria-colcount": (columns === null || columns === void 0 ? void 0 : columns.length) || 0,
794
+ "aria-label": spreadsheetAriaLabel,
761
795
  onKeyDown: handleKeyPress,
762
796
  onFocus: function onFocus() {
763
797
  return setContainerHasFocus(true);
@@ -783,7 +817,8 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
783
817
  updateActiveCellCoordinates: updateActiveCellCoordinates,
784
818
  setHeaderCellHoldActive: setHeaderCellHoldActive,
785
819
  headerCellHoldActive: headerCellHoldActive,
786
- visibleColumns: visibleColumns
820
+ visibleColumns: visibleColumns,
821
+ selectAllAriaLabel: selectAllAriaLabel
787
822
  }), /*#__PURE__*/React.createElement(DataSpreadsheetBody, {
788
823
  activeCellCoordinates: activeCellCoordinates,
789
824
  ref: spreadsheetRef,
@@ -818,6 +853,7 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
818
853
  visibleColumns: visibleColumns
819
854
  }), /*#__PURE__*/React.createElement("button", {
820
855
  onMouseDown: handleActiveCellMouseDown,
856
+ onMouseUp: handleActiveCellMouseUp,
821
857
  onClick: handleActiveCellClick,
822
858
  onKeyDown: handleActiveCellKeyDown,
823
859
  onDoubleClick: handleActiveCellDoubleClick,
@@ -846,7 +882,7 @@ export var DataSpreadsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref)
846
882
  },
847
883
  ref: cellEditorRef,
848
884
  labelText: "",
849
- "aria-labelledby": activeCellCoordinates ? "#".concat(blockClass, "__cell--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) : null,
885
+ "aria-labelledby": activeCellCoordinates ? "".concat(blockClass, "__cell--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "--").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) : null,
850
886
  className: cx("".concat(blockClass, "__cell-editor"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__cell-editor--").concat(cellSize), _defineProperty({}, "".concat(blockClass, "__cell-editor--active"), isEditing))
851
887
  }), /*#__PURE__*/React.createElement("pre", {
852
888
  "aria-hidden": true,
@@ -913,6 +949,21 @@ DataSpreadsheet.propTypes = {
913
949
  */
914
950
  onSelectionAreaChange: PropTypes.func,
915
951
 
952
+ /**
953
+ * The aria label applied to the Select all button
954
+ */
955
+ selectAllAriaLabel: PropTypes.string.isRequired,
956
+
957
+ /**
958
+ * The aria label applied to the Data spreadsheet component
959
+ */
960
+ spreadsheetAriaLabel: PropTypes.string.isRequired,
961
+
962
+ /**
963
+ * The theme the DataSpreadsheet should use (only used to render active cell/selection area colors on dark theme)
964
+ */
965
+ theme: PropTypes.oneOf(['light', 'dark']),
966
+
916
967
  /**
917
968
  * The total number of columns to be initially visible, additional columns will be rendered and
918
969
  * visible via horizontal scrollbar
@@ -43,6 +43,7 @@ export var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref)
43
43
  updateActiveCellCoordinates = _ref.updateActiveCellCoordinates,
44
44
  setHeaderCellHoldActive = _ref.setHeaderCellHoldActive,
45
45
  headerCellHoldActive = _ref.headerCellHoldActive,
46
+ selectAllAriaLabel = _ref.selectAllAriaLabel,
46
47
  visibleColumns = _ref.visibleColumns;
47
48
 
48
49
  var _useState = useState(0),
@@ -175,6 +176,7 @@ export var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref)
175
176
  "data-column-index": "header",
176
177
  type: "button",
177
178
  tabIndex: -1,
179
+ "aria-label": selectAllAriaLabel,
178
180
  onClick: handleSelectAllClick,
179
181
  className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__th--select-all"), _defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header'))
180
182
  }, "\xA0")), headerGroup.headers.map(function (column, index) {
@@ -258,6 +260,11 @@ DataSpreadsheetHeader.propTypes = {
258
260
  */
259
261
  scrollBarSize: PropTypes.number,
260
262
 
263
+ /**
264
+ * The aria label applied to the Select all button
265
+ */
266
+ selectAllAriaLabel: PropTypes.string.isRequired,
267
+
261
268
  /**
262
269
  * All of the cell selection area items
263
270
  */
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2022
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
+ import { deepCloneObject } from '../../../global/js/utils/deepCloneObject';
8
+ import { rangeWithCallback } from '../../../global/js/utils/rangeWithCallback';
9
+ export var handleCellDeletion = function handleCellDeletion(_ref) {
10
+ var selectionAreas = _ref.selectionAreas,
11
+ currentMatcher = _ref.currentMatcher,
12
+ rows = _ref.rows,
13
+ setActiveCellContent = _ref.setActiveCellContent,
14
+ updateData = _ref.updateData;
15
+ var selectionAreaClone = deepCloneObject(selectionAreas);
16
+ var indexOfCurrentSelectionArea = selectionAreaClone.findIndex(function (item) {
17
+ return item.matcher === currentMatcher;
18
+ });
19
+ var selectionAreaToEmptyContents = selectionAreaClone[indexOfCurrentSelectionArea];
20
+ var lowestColumnIndex = Math.min(selectionAreaToEmptyContents.point1.column, selectionAreaToEmptyContents.point2.column);
21
+ var greatestColumnIndex = Math.max(selectionAreaToEmptyContents.point1.column, selectionAreaToEmptyContents.point2.column);
22
+ var lowestRowIndex = Math.min(selectionAreaToEmptyContents.point1.row, selectionAreaToEmptyContents.point2.row);
23
+ var greatestRowIndex = Math.max(selectionAreaToEmptyContents.point1.row, selectionAreaToEmptyContents.point2.row);
24
+ rangeWithCallback(lowestColumnIndex, greatestColumnIndex, function (columnIndex) {
25
+ rangeWithCallback(lowestRowIndex, greatestRowIndex, function (rowIndex) {
26
+ var cellProps = rows[rowIndex].cells[columnIndex];
27
+ updateData(rowIndex, cellProps === null || cellProps === void 0 ? void 0 : cellProps.column.id, '');
28
+ });
29
+ });
30
+ setActiveCellContent(null);
31
+ };
@@ -288,7 +288,7 @@ export var handleMultipleKeys = function handleMultipleKeys(_ref) {
288
288
  } else {
289
289
  setTimeout(function () {
290
290
  updateToLastCell();
291
- }, 1);
291
+ }, 1000);
292
292
  }
293
293
  }
294
294
  };
@@ -1,5 +1,4 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
3
  var _excluded = ["datagridState"];
5
4
 
@@ -11,21 +10,15 @@ var _excluded = ["datagridState"];
11
10
  */
12
11
  import React from 'react';
13
12
  import PropTypes from 'prop-types';
14
- import { DataTable } from 'carbon-components-react';
15
13
  import cx from 'classnames';
16
- import DatagridHead from './DatagridHead';
17
- import DatagridBody from './DatagridBody';
18
- import DatagridToolbar from './DatagridToolbar';
19
14
  import { getDevtoolsProps } from '../../../global/js/utils/devtools';
20
15
  import { pkg } from '../../../settings';
21
16
  import pconsole from '../../../global/js/utils/pconsole';
17
+ import { InlineEditProvider } from './addons/InlineEdit/InlineEditContext';
18
+ import { DatagridContent } from './DatagridContent';
22
19
  var blockClass = "".concat(pkg.prefix, "--datagrid");
23
20
  var componentName = 'Datagrid';
24
- var TableContainer = DataTable.TableContainer,
25
- Table = DataTable.Table;
26
21
  export var Datagrid = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
27
- var _getTableProps;
28
-
29
22
  var datagridState = _ref.datagridState,
30
23
  rest = _objectWithoutProperties(_ref, _excluded);
31
24
 
@@ -34,45 +27,24 @@ export var Datagrid = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
34
27
  return null;
35
28
  }
36
29
 
37
- var _datagridState$getTab = datagridState.getTableProps,
38
- getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
39
- withVirtualScroll = datagridState.withVirtualScroll,
30
+ var withVirtualScroll = datagridState.withVirtualScroll,
40
31
  DatagridPagination = datagridState.DatagridPagination,
41
32
  isFetching = datagridState.isFetching,
42
33
  tableId = datagridState.tableId,
43
- CustomizeColumnsModal = datagridState.CustomizeColumnsModal,
44
34
  leftPanel = datagridState.leftPanel,
45
- fullHeightDatagrid = datagridState.fullHeightDatagrid,
46
- _datagridState$vertic = datagridState.verticalAlign,
47
- verticalAlign = _datagridState$vertic === void 0 ? 'center' : _datagridState$vertic,
48
- variableRowHeight = datagridState.variableRowHeight,
49
- className = datagridState.className,
50
- gridTitle = datagridState.gridTitle,
51
- gridDescription = datagridState.gridDescription,
52
- useDenseHeader = datagridState.useDenseHeader;
35
+ className = datagridState.className;
53
36
  var rows = DatagridPagination && datagridState.page || datagridState.rows;
54
- var dataGrid = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContainer, {
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)
64
- }), /*#__PURE__*/React.createElement(DatagridHead, datagridState), /*#__PURE__*/React.createElement(DatagridBody, _extends({}, datagridState, {
65
- rows: rows
66
- }))))), (rows === null || rows === void 0 ? void 0 : rows.length) > 0 && !isFetching && DatagridPagination && DatagridPagination(datagridState), CustomizeColumnsModal && /*#__PURE__*/React.createElement(CustomizeColumnsModal, {
67
- instance: datagridState
68
- }));
69
- return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
37
+ return /*#__PURE__*/React.createElement(InlineEditProvider, null, /*#__PURE__*/React.createElement("div", _extends({}, rest, {
70
38
  id: tableId,
71
39
  ref: ref,
72
40
  className: cx(className, blockClass, withVirtualScroll ? "".concat(blockClass, "__datagridWrap") : "".concat(blockClass, "__datagridWrap-simple"), !isFetching && rows.length === 0 ? "".concat(blockClass, "__empty-state") : '')
73
41
  }, getDevtoolsProps(componentName)), leftPanel && /*#__PURE__*/React.createElement("div", {
74
42
  className: "".concat(blockClass, "__datagridWithPanel ").concat(blockClass, "__displayFlex ").concat(blockClass, "__leftPanel-position")
75
- }, dataGrid), leftPanel === undefined && dataGrid);
43
+ }, /*#__PURE__*/React.createElement(DatagridContent, {
44
+ datagridState: datagridState
45
+ })), leftPanel === undefined && /*#__PURE__*/React.createElement(DatagridContent, {
46
+ datagridState: datagridState
47
+ })));
76
48
  }); // Return a placeholder if not released and not enabled by feature flag
77
49
 
78
50
  Datagrid = pkg.checkComponentEnabled(Datagrid, componentName); // The display name of the component, used by React. Note that displayName