@carbon/ibm-products 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/css/index-full-carbon.css +206 -44
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +3 -3
  4. package/css/index-without-carbon-released-only.css +31 -27
  5. package/css/index-without-carbon-released-only.css.map +1 -1
  6. package/css/index-without-carbon-released-only.min.css +3 -3
  7. package/css/index-without-carbon.css +193 -39
  8. package/css/index-without-carbon.css.map +1 -1
  9. package/css/index-without-carbon.min.css +3 -3
  10. package/css/index.css +195 -41
  11. package/css/index.css.map +1 -1
  12. package/css/index.min.css +3 -3
  13. package/es/components/AddSelect/AddSelect.js +106 -65
  14. package/es/components/AddSelect/AddSelectBreadcrumbs.js +56 -0
  15. package/es/components/AddSelect/AddSelectList.js +94 -0
  16. package/es/components/AddSelect/AddSelectSidebar.js +46 -0
  17. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +5 -2
  18. package/es/components/CancelableTextEdit/CancelableTextEdit.js +2 -2
  19. package/es/components/Card/Card.js +6 -4
  20. package/es/components/InlineEdit/InlineEdit.js +223 -74
  21. package/es/components/NotificationsPanel/NotificationsPanel.js +16 -3
  22. package/es/components/PageHeader/PageHeader.js +7 -4
  23. package/es/components/PageHeader/PageHeaderTitle.js +10 -6
  24. package/es/components/SidePanel/SidePanel.js +32 -15
  25. package/es/components/WebTerminal/WebTerminal.js +1 -1
  26. package/es/settings.js +0 -5
  27. package/lib/components/AddSelect/AddSelect.js +110 -65
  28. package/lib/components/AddSelect/AddSelectBreadcrumbs.js +71 -0
  29. package/lib/components/AddSelect/AddSelectList.js +112 -0
  30. package/lib/components/AddSelect/AddSelectSidebar.js +63 -0
  31. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +5 -2
  32. package/lib/components/CancelableTextEdit/CancelableTextEdit.js +1 -1
  33. package/lib/components/Card/Card.js +6 -4
  34. package/lib/components/InlineEdit/InlineEdit.js +219 -72
  35. package/lib/components/NotificationsPanel/NotificationsPanel.js +13 -1
  36. package/lib/components/PageHeader/PageHeader.js +7 -4
  37. package/lib/components/PageHeader/PageHeaderTitle.js +10 -6
  38. package/lib/components/SidePanel/SidePanel.js +32 -15
  39. package/lib/components/WebTerminal/WebTerminal.js +1 -1
  40. package/lib/settings.js +0 -6
  41. package/package.json +12 -12
  42. package/scss/components/AddSelect/_add-select.scss +24 -0
  43. package/scss/components/BreadcrumbWithOverflow/_index.scss +1 -1
  44. package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +1 -0
  45. package/scss/components/CreateInfluencer/_create-influencer.scss +4 -4
  46. package/scss/components/CreateTearsheet/_create-tearsheet.scss +2 -2
  47. package/scss/components/InlineEdit/_inline-edit.scss +210 -9
  48. package/scss/components/InlineEdit/_storybook-styles.scss +13 -0
  49. package/scss/components/NotificationsPanel/_notifications-panel.scss +2 -2
  50. package/scss/components/PageHeader/_index.scss +1 -1
  51. package/scss/components/PageHeader/_page-header.scss +1 -1
  52. package/scss/components/ProductiveCard/_productive-card.scss +0 -4
  53. package/scss/components/SidePanel/_side-panel.scss +15 -6
  54. package/scss/components/StatusIcon/_index.scss +1 -1
  55. package/scss/components/TagSet/_index.scss +1 -1
  56. package/scss/components/UserProfileImage/_index.scss +1 -1
  57. package/scss/components/WebTerminal/_web-terminal.scss +2 -2
  58. package/scss/global/styles/_project-settings.scss +5 -1
  59. package/es/generated/feature-flags/feature-flags.js +0 -15
  60. package/lib/generated/feature-flags/feature-flags.js +0 -22
  61. package/scss/generated/feature-flags/_feature-flags.scss +0 -19
@@ -360,9 +360,12 @@ BreadcrumbWithOverflow.propTypes = {
360
360
  noTrailingSlash: _propTypes.default.bool,
361
361
 
362
362
  /**
363
- * overflowAriaLabel label for open close button overflow used for action bar items that do nto fit.
363
+ * overflowAriaLabel label for open close button overflow used for breadcrumb items that do not fit.
364
364
  */
365
- overflowAriaLabel: _propTypes.default.string.isRequired
365
+ overflowAriaLabel: _propTypes.default.string.isRequired.if(function (_ref6) {
366
+ var breadcrumbs = _ref6.breadcrumbs;
367
+ return breadcrumbs.length > 1;
368
+ })
366
369
  };
367
370
  BreadcrumbWithOverflow.defaultProps = {
368
371
  noTrailingSlash: false
@@ -149,7 +149,7 @@ var CancelableTextEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref,
149
149
  hasIconOnly: true,
150
150
  iconDescription: revertDescription,
151
151
  onClick: handleRevert,
152
- renderIcon: _iconsReact.Reset16
152
+ renderIcon: _iconsReact.Close16
153
153
  }), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
154
154
  className: "".concat(blockClass, "__save"),
155
155
  kind: "ghost",
@@ -30,7 +30,8 @@ var _CardFooter = require("./CardFooter");
30
30
  var _settings = require("../../settings");
31
31
 
32
32
  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"],
33
- _excluded2 = ["id"];
33
+ _excluded2 = ["id"],
34
+ _excluded3 = ["id", "icon", "onClick", "iconDescription", "onKeyDown", "href"];
34
35
 
35
36
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
36
37
 
@@ -105,10 +106,11 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
105
106
  onClick = _ref3.onClick,
106
107
  iconDescription = _ref3.iconDescription,
107
108
  onKeyDown = _ref3.onKeyDown,
108
- href = _ref3.href;
109
+ href = _ref3.href,
110
+ rest = (0, _objectWithoutProperties2.default)(_ref3, _excluded3);
109
111
 
110
112
  if (productive) {
111
- return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
113
+ return /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({}, rest, {
112
114
  key: id,
113
115
  renderIcon: Icon,
114
116
  hasIconOnly: true,
@@ -117,7 +119,7 @@ var Card = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
117
119
  iconDescription: iconDescription,
118
120
  kind: "ghost",
119
121
  href: href
120
- });
122
+ }));
121
123
  }
122
124
 
123
125
  if (href) {
@@ -27,22 +27,16 @@ var _devtools = require("../../global/js/utils/devtools");
27
27
 
28
28
  var _settings = require("../../settings");
29
29
 
30
- var _ = require("../");
31
-
32
30
  var _carbonComponentsReact = require("carbon-components-react");
33
31
 
34
32
  var _iconsReact = require("@carbon/icons-react");
35
33
 
36
- var _excluded = ["className", "disabled", "editDescription", "id", "inline", "invalid", "invalidText", "labelText", "onChange", "onInput", "onRevert", "revertDescription", "saveDescription", "saveDisabled", "size", "value", "warn", "warnText"];
34
+ var _excluded = ["cancelDescription", "className", "disabled", "editDescription", "editVisibleOnHoverOnly", "id", "invalid", "invalidText", "labelText", "light", "onCancel", "onSave", "onChange", "saveDescription", "saveDisabled", "size", "value", "warn", "warnText"];
37
35
 
38
36
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
39
37
 
40
38
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
39
 
42
- 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; }
43
-
44
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
45
-
46
40
  // The block part of our conventional BEM class names (blockClass__E--M).
47
41
  var blockClass = "".concat(_settings.pkg.prefix, "--inline-edit");
48
42
  var componentName = 'InlineEdit'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
@@ -51,19 +45,22 @@ var componentName = 'InlineEdit'; // NOTE: the component SCSS is not imported he
51
45
  * TODO: A description of the component.
52
46
  */
53
47
 
54
- var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
55
- var className = _ref.className,
48
+ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, refIn) {
49
+ var _cx, _cx2;
50
+
51
+ var cancelDescription = _ref.cancelDescription,
52
+ className = _ref.className,
56
53
  disabled = _ref.disabled,
57
54
  editDescription = _ref.editDescription,
55
+ editVisibleOnHoverOnly = _ref.editVisibleOnHoverOnly,
58
56
  id = _ref.id,
59
- inline = _ref.inline,
60
57
  invalid = _ref.invalid,
61
58
  invalidText = _ref.invalidText,
62
59
  labelText = _ref.labelText,
60
+ light = _ref.light,
61
+ onCancel = _ref.onCancel,
62
+ onSave = _ref.onSave,
63
63
  onChange = _ref.onChange,
64
- onInput = _ref.onInput,
65
- onRevert = _ref.onRevert,
66
- revertDescription = _ref.revertDescription,
67
64
  saveDescription = _ref.saveDescription,
68
65
  saveDisabled = _ref.saveDisabled,
69
66
  size = _ref.size,
@@ -71,63 +68,208 @@ var InlineEdit = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
71
68
  warn = _ref.warn,
72
69
  warnText = _ref.warnText,
73
70
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
71
+ var refInput = (0, _react.useRef)(null);
72
+ var localRef = (0, _react.useRef)(null);
73
+ var ref = refIn || localRef;
74
74
 
75
75
  var _useState = (0, _react.useState)(false),
76
76
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
77
77
  editing = _useState2[0],
78
78
  setEditing = _useState2[1];
79
79
 
80
- var handleEdit = function handleEdit() {
81
- return setEditing(function (prev) {
82
- return !prev;
83
- });
80
+ var _useState3 = (0, _react.useState)(value),
81
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
82
+ internalValue = _useState4[0],
83
+ setInternalValue = _useState4[1];
84
+
85
+ var showValidationText = invalid || warn;
86
+ var validationText = invalidText || warnText;
87
+ var validationIcon = showValidationText ? invalid ? /*#__PURE__*/_react.default.createElement(_iconsReact.WarningFilled16, null) : /*#__PURE__*/_react.default.createElement(_iconsReact.WarningAltFilled16, null) : null;
88
+
89
+ var handleEdit = function handleEdit(ev) {
90
+ if (!disabled) {
91
+ var rightOfInput = ev.currentTarget.classList.contains("".concat(blockClass, "__edit")) || ev.target.classList.contains("".concat(blockClass, "__controls"));
92
+ var leftOfInput = ev.currentTarget = ev.target.classList.contains("".concat(blockClass)); // clicking on the content editable element should not set either of these to true
93
+
94
+ if (rightOfInput || leftOfInput) {
95
+ setEditing(true);
96
+ setTimeout(function () {
97
+ refInput.current.focus(); // select all the content
98
+
99
+ document.getSelection().selectAllChildren(refInput.current);
100
+
101
+ if (rightOfInput) {
102
+ document.getSelection().collapseToEnd();
103
+ refInput.current.scrollLeft = 9999; // never going to get there but ensures at end.
104
+ } else {
105
+ document.getSelection().collapseToStart();
106
+ refInput.current.scrollLeft = 0; // scroll to start
107
+ }
108
+ }, 0);
109
+ }
110
+ }
111
+ };
112
+
113
+ var handleFocus = function handleFocus(ev) {
114
+ if (!editing && ev.target.classList.contains("".concat(blockClass, "__input"))) {
115
+ // console.log(editing);
116
+ setEditing(true);
117
+ }
84
118
  };
85
119
 
86
- var handleChange = function handleChange(val) {
120
+ var handleSave = function handleSave() {
87
121
  setEditing(false);
88
- onChange(val);
122
+ document.getSelection().removeAllRanges();
123
+
124
+ if (onSave) {
125
+ onSave(refInput.current.innerText);
126
+ }
127
+ };
128
+
129
+ var handlePaste = function handlePaste(ev) {
130
+ ev.preventDefault(); // Get clipboard as plain text
131
+
132
+ var text = (ev.clipboardData || window.clipboardData).getData('text/plain'); // remove \n
133
+
134
+ var sanitizedText = text.replaceAll(/\n/g, '') // remove carriage returns
135
+ .replaceAll(/\t/g, ' '); // replace tab with two spaces
136
+
137
+ if (document.queryCommandSupported('insertText')) {
138
+ document.execCommand('insertText', false, sanitizedText);
139
+ } else {
140
+ // Insert text at the current position of caret
141
+ var range = document.getSelection().getRangeAt(0);
142
+ range.deleteContents();
143
+ var textNode = document.createTextNode(sanitizedText);
144
+ range.insertNode(textNode); // move selection end of textNode
145
+
146
+ range.selectNodeContents(textNode);
147
+ range.collapse(false); // remove existing range
148
+
149
+ var selection = document.getSelection();
150
+ selection.removeAllRanges(); // set the new range
151
+
152
+ selection.addRange(range);
153
+ }
89
154
  };
90
155
 
91
- var handleRevert = function handleRevert() {
156
+ var handleInput = function handleInput() {
157
+ setInternalValue(refInput.current.innerText);
158
+
159
+ if (onChange) {
160
+ onChange(refInput.current.innerText);
161
+ }
162
+ };
163
+
164
+ var handleCancel = function handleCancel() {
165
+ refInput.current.innerText = value;
166
+ handleInput(value);
92
167
  setEditing(false);
93
- onRevert(value);
168
+ document.getSelection().removeAllRanges();
169
+
170
+ if (onCancel) {
171
+ onCancel(value);
172
+ }
94
173
  };
95
174
 
96
- var stdProps = _objectSpread(_objectSpread({}, rest), {}, {
97
- className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
98
- className, // Apply any supplied class names to the main HTML element.
99
- (0, _defineProperty2.default)({}, "".concat(blockClass, "--editing"), editing)),
100
- id: id,
101
- size: size,
102
- ref: ref
103
- }, (0, _devtools.getDevtoolsProps)(componentName));
104
-
105
- return editing ? /*#__PURE__*/_react.default.createElement(_.CancelableTextEdit, (0, _extends2.default)({}, stdProps, {
106
- hideLabel: true,
107
- inline: inline,
108
- invalid: invalid,
109
- invalidText: invalidText,
110
- labelText: labelText,
111
- onChange: handleChange,
112
- onInput: onInput,
113
- onRevert: handleRevert,
114
- revertDescription: revertDescription,
115
- saveDescription: saveDescription,
116
- saveDisabled: saveDisabled,
117
- value: value,
118
- warn: warn,
119
- warnText: warnText
120
- })) : /*#__PURE__*/_react.default.createElement("div", stdProps, /*#__PURE__*/_react.default.createElement("div", {
121
- className: "".concat(blockClass, "__value")
122
- }, value), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
123
- className: "".concat(blockClass, "__button ").concat(_settings.carbon.prefix, "--btn--md"),
124
- kind: "ghost",
125
- hasIconOnly: true,
126
- iconDescription: editDescription,
127
- onClick: handleEdit,
128
- renderIcon: disabled ? _iconsReact.EditOff16 : _iconsReact.Edit16,
129
- disabled: disabled
130
- }));
175
+ var handleBlur = function handleBlur(ev) {
176
+ if (!ref.current.contains(ev.relatedTarget)) {
177
+ setEditing(false);
178
+ handleSave();
179
+ }
180
+ };
181
+
182
+ var handleKeyDown = function handleKeyDown(ev) {
183
+ if (ev.key === 'Enter') {
184
+ ev.preventDefault();
185
+ refInput.current.blur(); // will cause save
186
+ }
187
+ };
188
+ /*
189
+ The HTML is structured as follows:
190
+ <container>
191
+ <!-- margin left of input to match Carbon -->
192
+ <content-editable>
193
+ <-- margin right of input space for controls -->
194
+ <controls>
195
+ </container>
196
+ NOTE:
197
+ - An input is not used as this would not permit a heading tag e.g. <h2>.
198
+ - Some padding is added to the left 16px standard for a Carbon text input
199
+ - The controls are position absolute with a margin to on the input to reserve space. Using inline-flex
200
+ - does not measure space properly for the input otherwise.
201
+ - The content editable is not expected to change size when buttons are added, to ensure the text does not move space
202
+ is reserved up front for buttons and invalid icon. Mostly this is only noticed if the width of the component is not 100%.
203
+ which can be shown by setting inlineEditFullWidth to false in storybook.
204
+ In making content-editable behave like an input of type text we have to account for.
205
+ - Enforcing a single line
206
+ - Pasting of non-text e.g. html or text with carriage returns
207
+ - The padding and border not hiding typed in text.
208
+ - Placing the cursor at the start or end depending on area clicked (before for left-padding)
209
+ */
210
+
211
+
212
+ var controlsAnimation = true;
213
+ return (
214
+ /*#__PURE__*/
215
+ // eslint-disable-next-line
216
+ _react.default.createElement("div", {
217
+ className: (0, _classnames.default)(blockClass, // Apply the block class to the main HTML element
218
+ className, // Apply any supplied class names to the main HTML element.
219
+ "".concat(blockClass, "--").concat(size), (_cx = {}, (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--editing"), editing), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--invalid"), invalid), (0, _defineProperty2.default)(_cx, "".concat(blockClass, "--light"), light), _cx)),
220
+ onClick: handleEdit // disabled eslint for click handler
221
+ ,
222
+ onBlur: handleBlur,
223
+ ref: ref
224
+ }, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, (0, _devtools.getDevtoolsProps)(componentName), {
225
+ id: id,
226
+ size: size,
227
+ className: "".concat(blockClass, "__input"),
228
+ contentEditable: true,
229
+ "aria-label": labelText,
230
+ role: "textbox",
231
+ tabIndex: "0",
232
+ onFocus: handleFocus,
233
+ onInput: handleInput,
234
+ onKeyDown: handleKeyDown,
235
+ onPaste: handlePaste,
236
+ suppressContentEditableWarning: true,
237
+ ref: refInput
238
+ }), value), refInput.current && refInput.current.innerText.length === 0 && /*#__PURE__*/_react.default.createElement("div", {
239
+ className: "".concat(blockClass, "__placeholder")
240
+ }, labelText), showValidationText && validationText.length > 0 && /*#__PURE__*/_react.default.createElement("div", {
241
+ className: "".concat(blockClass, "__validation-text")
242
+ }, validationText), /*#__PURE__*/_react.default.createElement("div", {
243
+ className: "".concat(blockClass, "__validation-icon")
244
+ }, validationIcon), /*#__PURE__*/_react.default.createElement("div", {
245
+ className: (0, _classnames.default)("".concat(blockClass, "__controls"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__controls--animation"), controlsAnimation), (0, _defineProperty2.default)(_cx2, "".concat(blockClass, "__controls--saveable"), invalid || saveDisabled || refInput.current && value !== internalValue), _cx2))
246
+ }, editing ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
247
+ className: "".concat(blockClass, "__cancel"),
248
+ kind: "ghost",
249
+ hasIconOnly: true,
250
+ iconDescription: cancelDescription,
251
+ onClick: handleCancel,
252
+ renderIcon: _iconsReact.Close16
253
+ }), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
254
+ className: "".concat(blockClass, "__save"),
255
+ kind: "ghost",
256
+ hasIconOnly: true,
257
+ iconDescription: saveDescription,
258
+ onClick: handleSave,
259
+ renderIcon: _iconsReact.Checkmark16,
260
+ disabled: invalid || saveDisabled || value === internalValue
261
+ })) : /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
262
+ "aria-hidden": "true",
263
+ className: (0, _classnames.default)("".concat(blockClass, "__edit"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__edit--hover-visible"), editVisibleOnHoverOnly)),
264
+ kind: "ghost",
265
+ hasIconOnly: true,
266
+ iconDescription: editDescription,
267
+ onClick: handleEdit,
268
+ renderIcon: disabled ? _iconsReact.EditOff16 : _iconsReact.Edit16,
269
+ disabled: disabled,
270
+ tabIndex: -1
271
+ })))
272
+ );
131
273
  }); // Return a placeholder if not released and not enabled by feature flag
132
274
 
133
275
 
@@ -140,6 +282,11 @@ InlineEdit.displayName = componentName; // The types and DocGen commentary for t
140
282
  // See https://www.npmjs.com/package/prop-types#usage.
141
283
 
142
284
  InlineEdit.propTypes = {
285
+ /**
286
+ * label for cancel button
287
+ */
288
+ cancelDescription: _propTypes.default.string.isRequired,
289
+
143
290
  /**
144
291
  * Provide an optional class to be applied to the containing node.
145
292
  */
@@ -156,16 +303,15 @@ InlineEdit.propTypes = {
156
303
  editDescription: _propTypes.default.string.isRequired,
157
304
 
158
305
  /**
159
- * ID for inline edit
306
+ * In some scenarios the edit icon only needs to be shown on hover. These cases are where continual visibility of
307
+ * the edit icon is redundant. E.g. a spreadsheet a property panel.
160
308
  */
161
- id: _propTypes.default.string,
162
-
163
- /* TODO: add types and DocGen for all props. */
309
+ editVisibleOnHoverOnly: _propTypes.default.bool,
164
310
 
165
311
  /**
166
- * inline variant
167
- */
168
- inline: _propTypes.default.bool,
312
+ * ID for inline edit
313
+ */
314
+ id: _propTypes.default.string,
169
315
 
170
316
  /**
171
317
  * set invalid state for input
@@ -183,24 +329,24 @@ InlineEdit.propTypes = {
183
329
  labelText: _propTypes.default.string,
184
330
 
185
331
  /**
186
- * method called on change event
332
+ * change background to light version (mimic React TextInput)
187
333
  */
188
- onChange: _propTypes.default.func,
334
+ light: _propTypes.default.bool,
189
335
 
190
336
  /**
191
- * method called on input event
337
+ * method called on cancel event
192
338
  */
193
- onInput: _propTypes.default.func,
339
+ onCancel: _propTypes.default.func,
194
340
 
195
341
  /**
196
- * method called on revert event
342
+ * method called on input event (it's a React thing onChange behaves like on input)
197
343
  */
198
- onRevert: _propTypes.default.func,
344
+ onChange: _propTypes.default.func,
199
345
 
200
346
  /**
201
- * label for revert button
347
+ * method called on change event
202
348
  */
203
- revertDescription: _propTypes.default.string.isRequired,
349
+ onSave: _propTypes.default.func,
204
350
 
205
351
  /**
206
352
  * label for save button
@@ -237,6 +383,7 @@ InlineEdit.propTypes = {
237
383
  // component needs to make a choice or assumption when a prop is not supplied.
238
384
 
239
385
  InlineEdit.defaultProps = {
240
- /* TODO: add defaults for relevant props. */
386
+ light: true,
387
+ // defaults to true to reflect design
241
388
  size: 'md'
242
389
  };
@@ -95,6 +95,12 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
95
95
  allNotifications = _useState4[0],
96
96
  setAllNotifications = _useState4[1];
97
97
 
98
+ var previousState = (0, _hooks.usePreviousValue)({
99
+ open: open
100
+ });
101
+ var reducedMotion = window && window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
102
+ matches: true
103
+ };
98
104
  (0, _react.useEffect)(function () {
99
105
  // Set the notifications passed to the state within this component
100
106
  setAllNotifications(data);
@@ -114,6 +120,12 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
114
120
  !open && setRender(false);
115
121
  };
116
122
 
123
+ (0, _react.useEffect)(function () {
124
+ if (!open && previousState !== null && previousState !== void 0 && previousState.open && reducedMotion.matches) {
125
+ setRender(false);
126
+ }
127
+ }, [open, reducedMotion.matches, previousState === null || previousState === void 0 ? void 0 : previousState.open]);
128
+
117
129
  var sortChronologically = function sortChronologically(arr) {
118
130
  if (!arr || arr && !arr.length) {
119
131
  return;
@@ -253,7 +265,7 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
253
265
  id: blockClass,
254
266
  className: (0, _classnames.default)(blockClass, className, "".concat(blockClass, "__container")),
255
267
  style: {
256
- animation: "".concat(open ? 'fadeIn 250ms' : 'fadeOut 250ms')
268
+ animation: !reducedMotion.matches ? "".concat(open ? 'fade-in 250ms' : 'fade-out 250ms') : null
257
269
  },
258
270
  onAnimationEnd: onAnimationEnd,
259
271
  ref: ref || notificationPanelRef
@@ -391,16 +391,17 @@ var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
391
391
  }, /*#__PURE__*/_react.default.createElement("div", {
392
392
  className: "".concat(_PageHeaderUtils.blockClass, "__non-navigation-row-content")
393
393
  }, hasBreadcrumbRow ? /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Row, {
394
- className: (0, _classnames.default)("".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--next-to-tabs"), nextToTabsCheck()), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--has-breadcrumbs"), breadcrumbs), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--has-action-bar"), hasActionBar || widthIsNarrow), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__has-page-actions-without-action-bar"), !hasActionBar && !widthIsNarrow && pageActions), _cx2))
394
+ className: (0, _classnames.default)("".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--next-to-tabs"), nextToTabsCheck()), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--has-breadcrumbs"), breadcrumbs || breadcrumbItemForTitle), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--has-action-bar"), hasActionBar || widthIsNarrow), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__has-page-actions-without-action-bar"), !hasActionBar && !widthIsNarrow && pageActions), _cx2))
395
395
  }, /*#__PURE__*/_react.default.createElement("div", {
396
396
  className: "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--container")
397
397
  }, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Column, {
398
398
  className: (0, _classnames.default)("".concat(_PageHeaderUtils.blockClass, "__breadcrumb-column"), (0, _defineProperty2.default)({}, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-column--background"), !!breadcrumbs || hasActionBar || widthIsNarrow))
399
- }, breadcrumbs ? /*#__PURE__*/_react.default.createElement(_BreadcrumbWithOverflow.BreadcrumbWithOverflow, {
399
+ }, breadcrumbs || breadcrumbItemForTitle ? /*#__PURE__*/_react.default.createElement(_BreadcrumbWithOverflow.BreadcrumbWithOverflow, {
400
400
  className: "".concat(_PageHeaderUtils.blockClass, "__breadcrumb"),
401
401
  noTrailingSlash: !!title,
402
402
  overflowAriaLabel: breadcrumbOverflowAriaLabel,
403
- breadcrumbs: breadcrumbs ? breadcrumbItemForTitle ? breadcrumbs.concat(breadcrumbItemForTitle) : breadcrumbs : null
403
+ breadcrumbs: breadcrumbs && breadcrumbItemForTitle ? breadcrumbs.concat(breadcrumbItemForTitle) : breadcrumbItemForTitle ? [breadcrumbItemForTitle] : breadcrumbs // breadcrumbs may be null or undefined
404
+
404
405
  }) : null), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Column, {
405
406
  className: (0, _classnames.default)(["".concat(_PageHeaderUtils.blockClass, "__action-bar-column ").concat(_PageHeaderUtils.blockClass, "__action-bar-column--background"), (_ref7 = {}, (0, _defineProperty2.default)(_ref7, "".concat(_PageHeaderUtils.blockClass, "__action-bar-column--has-page-actions"), pageActions), (0, _defineProperty2.default)(_ref7, "".concat(_PageHeaderUtils.blockClass, "__action-bar-column--influenced-by-collapse-button"), spaceForCollapseButton), _ref7)])
406
407
  }, /*#__PURE__*/_react.default.createElement("div", {
@@ -799,7 +800,8 @@ PageHeader.propTypes = _objectSpread({
799
800
  * - text: title string
800
801
  * - icon: optional icon
801
802
  * - loading: boolean shows loading indicator if true
802
- * - onChange: function to process edits only supply if in place edit is desired
803
+ * - onChange: function to process the live value (React change === HTML Input)
804
+ * - onSave: function to process a confirmed change
803
805
  * - editableLabel: label for edit required if onChange supplied
804
806
  * - revertDescription: label for edit revert button
805
807
  * - saveDescription: label for edit save button
@@ -819,6 +821,7 @@ PageHeader.propTypes = _objectSpread({
819
821
  id: _propTypes.default.string,
820
822
  // .isRequired.if(inlineEditRequired),
821
823
  onChange: _propTypes.default.func,
824
+ onSave: _propTypes.default.func,
822
825
  revertDescription: _propTypes.default.string,
823
826
  //.isRequired.if(inlineEditRequired),
824
827
  saveDescription: _propTypes.default.string //.isRequired.if(inlineEditRequired),
@@ -23,7 +23,7 @@ var _carbonComponentsReact = require("carbon-components-react");
23
23
 
24
24
  var _ = require("../");
25
25
 
26
- var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "editDescription", "editableLabel", "revertDescription", "saveDescription"];
26
+ var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "onSave", "editDescription", "editableLabel", "revertDescription", "saveDescription"];
27
27
 
28
28
  /**
29
29
  *
@@ -43,13 +43,14 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
43
43
  icon = title.icon,
44
44
  asText = title.asText,
45
45
  onChange = title.onChange,
46
+ onSave = title.onSave,
46
47
  editDescription = title.editDescription,
47
48
  editableLabel = title.editableLabel,
48
49
  revertDescription = title.revertDescription,
49
50
  saveDescription = title.saveDescription,
50
51
  rest = (0, _objectWithoutProperties2.default)(title, _excluded);
51
52
  var titleText;
52
- var isEditable = !!onChange;
53
+ var isEditable = !!onSave;
53
54
 
54
55
  if (text || !content) {
55
56
  if (text === undefined && typeof title === 'string') {
@@ -67,6 +68,7 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
67
68
  value: text,
68
69
  editDescription: editDescription,
69
70
  onChange: onChange,
71
+ onSave: onSave,
70
72
  labelText: editableLabel,
71
73
  revertDescription: revertDescription,
72
74
  saveDescription: saveDescription
@@ -87,8 +89,8 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
87
89
  exports.PageHeaderTitle = PageHeaderTitle;
88
90
 
89
91
  var inlineEditRequired = function inlineEditRequired(_ref2) {
90
- var onChange = _ref2.onChange;
91
- return !!onChange;
92
+ var onSave = _ref2.onSave;
93
+ return !!onSave;
92
94
  };
93
95
 
94
96
  exports.inlineEditRequired = inlineEditRequired;
@@ -110,9 +112,10 @@ PageHeaderTitle.propTypes = {
110
112
  * - text: title string
111
113
  * - icon: optional icon
112
114
  * - loading: boolean shows loading indicator if true
113
- * - onChange: function to process edits only supply if in place edit is desired
115
+ * - onChange: function to process the live value (React change === HTML Input)
116
+ * - onSave: function to process a confirmed change
114
117
  * - editDescription: description for edit button
115
- * - editableLabel: label for edit required if onChange supplied
118
+ * - editableLabel: label for edit required if onSave supplied
116
119
  * - revertDescription: description for edit revert button
117
120
  * - saveDescription: description for edit save button
118
121
  * - Object containing user defined contents. These must fit within the area defined for the title in both main part of the header and the breadcrumb.
@@ -130,6 +133,7 @@ PageHeaderTitle.propTypes = {
130
133
  editableLabel: _propTypes.default.string.isRequired.if(inlineEditRequired),
131
134
  id: _propTypes.default.string.isRequired.if(inlineEditRequired),
132
135
  onChange: _propTypes.default.func,
136
+ onSave: _propTypes.default.func,
133
137
  revertDescription: _propTypes.default.string.isRequired.if(inlineEditRequired),
134
138
  saveDescription: _propTypes.default.string.isRequired.if(inlineEditRequired) // Update docgen if changed
135
139