@carbon/ibm-products 1.2.4 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (138) hide show
  1. package/css/index-full-carbon.css +662 -313
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +2 -2
  4. package/css/index-without-carbon-released-only.css +156 -81
  5. package/css/index-without-carbon-released-only.css.map +1 -1
  6. package/css/index-without-carbon-released-only.min.css +2 -2
  7. package/css/index-without-carbon.css +393 -81
  8. package/css/index-without-carbon.css.map +1 -1
  9. package/css/index-without-carbon.min.css +2 -2
  10. package/css/index.css +615 -81
  11. package/css/index.css.map +1 -1
  12. package/css/index.min.css +2 -2
  13. package/es/components/APIKeyModal/APIKeyModal.js +25 -29
  14. package/es/components/ActionBar/ActionBar.js +4 -1
  15. package/es/components/ActionSet/ActionSet.js +22 -10
  16. package/es/components/ActionSet/actions.js +25 -17
  17. package/es/components/AddSelect/AddSelect.js +157 -0
  18. package/es/components/AddSelect/index.js +7 -0
  19. package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +19 -15
  20. package/es/components/CancelableTextEdit/CancelableTextEdit.js +245 -0
  21. package/es/components/{CreateTearsheet/constants.js → CancelableTextEdit/index.js} +1 -2
  22. package/es/components/CreateFullPage/CreateFullPage.js +102 -258
  23. package/es/components/CreateFullPage/CreateFullPageStep.js +65 -13
  24. package/es/components/CreateFullPage/index.js +1 -2
  25. package/es/components/CreateInfluencer/CreateInfluencer.js +40 -220
  26. package/es/components/CreateTearsheet/CreateTearsheet.js +95 -146
  27. package/es/components/CreateTearsheet/CreateTearsheetStep.js +70 -20
  28. package/es/components/CreateTearsheet/index.js +0 -1
  29. package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +87 -28
  30. package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +8 -6
  31. package/es/components/ExportModal/ExportModal.js +41 -12
  32. package/es/components/ImportModal/ImportModal.js +2 -1
  33. package/es/components/InlineEdit/InlineEdit.js +224 -0
  34. package/es/components/InlineEdit/index.js +7 -0
  35. package/es/components/MultiAddSelect/MultiAddSelect.js +16 -0
  36. package/es/components/MultiAddSelect/index.js +1 -0
  37. package/es/components/OptionsTile/OptionsTile.js +36 -15
  38. package/es/components/PageHeader/PageHeader.js +54 -33
  39. package/es/components/PageHeader/PageHeaderTitle.js +78 -7
  40. package/es/components/PageHeader/PageHeaderUtils.js +21 -2
  41. package/es/components/RemoveModal/RemoveModal.js +4 -2
  42. package/es/components/SidePanel/SidePanel.js +1 -1
  43. package/es/components/SingleAddSelect/SingleAddSelect.js +15 -0
  44. package/es/components/SingleAddSelect/index.js +1 -0
  45. package/es/components/TagSet/TagSet.js +4 -1
  46. package/es/components/Tearsheet/Tearsheet.js +1 -1
  47. package/es/components/Tearsheet/TearsheetNarrow.js +1 -1
  48. package/es/components/Tearsheet/TearsheetShell.js +1 -1
  49. package/es/components/Toolbar/Toolbar.js +69 -8
  50. package/es/components/index.js +5 -1
  51. package/es/global/js/hooks/index.js +1 -0
  52. package/es/global/js/hooks/useCreateComponentFocus.js +15 -19
  53. package/es/global/js/hooks/useCreateComponentStepChange.js +69 -79
  54. package/es/global/js/hooks/useResetCreateComponent.js +7 -4
  55. package/es/global/js/hooks/useRetrieveStepData.js +51 -0
  56. package/es/global/js/hooks/useValidCreateStepCount.js +4 -7
  57. package/es/global/js/package-settings.js +5 -1
  58. package/es/global/js/utils/lastIndexInArray.js +26 -0
  59. package/es/global/js/utils/story-helper.js +1 -1
  60. package/lib/components/APIKeyModal/APIKeyModal.js +25 -29
  61. package/lib/components/ActionBar/ActionBar.js +4 -1
  62. package/lib/components/ActionSet/ActionSet.js +22 -10
  63. package/lib/components/ActionSet/actions.js +25 -17
  64. package/lib/components/AddSelect/AddSelect.js +178 -0
  65. package/lib/components/AddSelect/index.js +13 -0
  66. package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +18 -14
  67. package/lib/components/CancelableTextEdit/CancelableTextEdit.js +265 -0
  68. package/lib/components/CancelableTextEdit/index.js +13 -0
  69. package/lib/components/CreateFullPage/CreateFullPage.js +102 -258
  70. package/lib/components/CreateFullPage/CreateFullPageStep.js +68 -13
  71. package/lib/components/CreateFullPage/index.js +1 -9
  72. package/lib/components/CreateInfluencer/CreateInfluencer.js +38 -231
  73. package/lib/components/CreateTearsheet/CreateTearsheet.js +97 -148
  74. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +72 -19
  75. package/lib/components/CreateTearsheet/index.js +0 -8
  76. package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +86 -34
  77. package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +8 -6
  78. package/lib/components/ExportModal/ExportModal.js +38 -11
  79. package/lib/components/ImportModal/ImportModal.js +2 -1
  80. package/lib/components/InlineEdit/InlineEdit.js +242 -0
  81. package/lib/components/InlineEdit/index.js +13 -0
  82. package/lib/components/MultiAddSelect/MultiAddSelect.js +37 -0
  83. package/lib/components/MultiAddSelect/index.js +13 -0
  84. package/lib/components/OptionsTile/OptionsTile.js +36 -15
  85. package/lib/components/PageHeader/PageHeader.js +54 -33
  86. package/lib/components/PageHeader/PageHeaderTitle.js +87 -9
  87. package/lib/components/PageHeader/PageHeaderUtils.js +21 -2
  88. package/lib/components/RemoveModal/RemoveModal.js +4 -2
  89. package/lib/components/SidePanel/SidePanel.js +1 -1
  90. package/lib/components/SingleAddSelect/SingleAddSelect.js +36 -0
  91. package/lib/components/SingleAddSelect/index.js +13 -0
  92. package/lib/components/TagSet/TagSet.js +4 -1
  93. package/lib/components/Tearsheet/Tearsheet.js +1 -1
  94. package/lib/components/Tearsheet/TearsheetNarrow.js +1 -1
  95. package/lib/components/Tearsheet/TearsheetShell.js +1 -1
  96. package/lib/components/Toolbar/Toolbar.js +69 -6
  97. package/lib/components/index.js +33 -1
  98. package/lib/global/js/hooks/index.js +8 -0
  99. package/lib/global/js/hooks/useCreateComponentFocus.js +15 -19
  100. package/lib/global/js/hooks/useCreateComponentStepChange.js +69 -79
  101. package/lib/global/js/hooks/useResetCreateComponent.js +7 -4
  102. package/lib/global/js/hooks/useRetrieveStepData.js +62 -0
  103. package/lib/global/js/hooks/useValidCreateStepCount.js +4 -7
  104. package/lib/global/js/package-settings.js +5 -1
  105. package/lib/global/js/utils/lastIndexInArray.js +35 -0
  106. package/lib/global/js/utils/story-helper.js +1 -1
  107. package/package.json +22 -22
  108. package/scss/components/AddSelect/_add-select.scss +84 -0
  109. package/scss/components/AddSelect/_index.scss +10 -0
  110. package/scss/components/AddSelect/_storybook-styles.scss +6 -0
  111. package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +19 -15
  112. package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +211 -0
  113. package/{es/components/CreateFullPage/constants.js → scss/components/CancelableTextEdit/_index.scss} +2 -2
  114. package/scss/components/CancelableTextEdit/_storybook-styles.scss +15 -0
  115. package/scss/components/CreateFullPage/_create-full-page.scss +4 -11
  116. package/scss/components/CreateTearsheet/_create-tearsheet.scss +4 -8
  117. package/scss/components/InlineEdit/_index.scss +8 -0
  118. package/scss/components/InlineEdit/_inline-edit.scss +44 -0
  119. package/scss/components/InlineEdit/_storybook-styles.scss +15 -0
  120. package/scss/components/MultiAddSelect/_index.scss +1 -0
  121. package/scss/components/MultiAddSelect/_multi-add-select.scss +1 -0
  122. package/scss/components/MultiAddSelect/_storybook-styles.scss +6 -0
  123. package/scss/components/PageHeader/_page-header.scss +14 -4
  124. package/scss/components/SingleAddSelect/_index.scss +1 -0
  125. package/scss/components/SingleAddSelect/_single-add-select.scss +1 -0
  126. package/scss/components/SingleAddSelect/_storybook-styles.scss +6 -0
  127. package/scss/components/StatusIcon/_status-icon.scss +2 -0
  128. package/scss/components/_index.scss +4 -0
  129. package/es/components/CreateFullPage/CreateFullPageSection.js +0 -53
  130. package/es/components/CreateTearsheet/CreateTearsheetSection.js +0 -83
  131. package/es/components/CreateTearsheet/preview-components/MultiStepWithSectionsTearsheet.js +0 -327
  132. package/es/global/js/utils/hasValidType.js +0 -94
  133. package/lib/components/CreateFullPage/CreateFullPageSection.js +0 -74
  134. package/lib/components/CreateFullPage/constants.js +0 -16
  135. package/lib/components/CreateTearsheet/CreateTearsheetSection.js +0 -105
  136. package/lib/components/CreateTearsheet/constants.js +0 -17
  137. package/lib/components/CreateTearsheet/preview-components/MultiStepWithSectionsTearsheet.js +0 -354
  138. package/lib/global/js/utils/hasValidType.js +0 -110
@@ -0,0 +1,224 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
+ var _excluded = ["className", "disabled", "editDescription", "id", "inline", "invalid", "invalidText", "labelText", "onChange", "onInput", "onRevert", "revertDescription", "saveDescription", "saveDisabled", "size", "value", "warn", "warnText"];
6
+
7
+ 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; }
8
+
9
+ 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) { _defineProperty(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; }
10
+
11
+ /**
12
+ * Copyright IBM Corp. 2022, 2022
13
+ *
14
+ * This source code is licensed under the Apache-2.0 license found in the
15
+ * LICENSE file in the root directory of this source tree.
16
+ */
17
+ // Import portions of React that are needed.
18
+ import React, { useState } from 'react'; // Other standard imports.
19
+
20
+ import PropTypes from 'prop-types';
21
+ import cx from 'classnames';
22
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
23
+ import { pkg, carbon } from '../../settings'; // Carbon and package components we use.
24
+
25
+ /* TODO: @import(s) of carbon components and other package components. */
26
+
27
+ import { CancelableTextEdit } from '../';
28
+ import { Button } from 'carbon-components-react';
29
+ import { Edit16, EditOff16 } from '@carbon/icons-react'; // The block part of our conventional BEM class names (blockClass__E--M).
30
+
31
+ var blockClass = "".concat(pkg.prefix, "--inline-edit");
32
+ var componentName = 'InlineEdit'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
33
+
34
+ /**
35
+ * TODO: A description of the component.
36
+ */
37
+
38
+ export var InlineEdit = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
39
+ var className = _ref.className,
40
+ disabled = _ref.disabled,
41
+ editDescription = _ref.editDescription,
42
+ id = _ref.id,
43
+ inline = _ref.inline,
44
+ invalid = _ref.invalid,
45
+ invalidText = _ref.invalidText,
46
+ labelText = _ref.labelText,
47
+ onChange = _ref.onChange,
48
+ onInput = _ref.onInput,
49
+ onRevert = _ref.onRevert,
50
+ revertDescription = _ref.revertDescription,
51
+ saveDescription = _ref.saveDescription,
52
+ saveDisabled = _ref.saveDisabled,
53
+ size = _ref.size,
54
+ value = _ref.value,
55
+ warn = _ref.warn,
56
+ warnText = _ref.warnText,
57
+ rest = _objectWithoutProperties(_ref, _excluded);
58
+
59
+ var _useState = useState(false),
60
+ _useState2 = _slicedToArray(_useState, 2),
61
+ editing = _useState2[0],
62
+ setEditing = _useState2[1];
63
+
64
+ var handleEdit = function handleEdit() {
65
+ return setEditing(function (prev) {
66
+ return !prev;
67
+ });
68
+ };
69
+
70
+ var handleChange = function handleChange(val) {
71
+ setEditing(false);
72
+ onChange(val);
73
+ };
74
+
75
+ var handleRevert = function handleRevert() {
76
+ setEditing(false);
77
+ onRevert(value);
78
+ };
79
+
80
+ var stdProps = _objectSpread(_objectSpread({}, rest), {}, {
81
+ className: cx(blockClass, // Apply the block class to the main HTML element
82
+ className, // Apply any supplied class names to the main HTML element.
83
+ _defineProperty({}, "".concat(blockClass, "--editing"), editing)),
84
+ id: id,
85
+ size: size,
86
+ ref: ref
87
+ }, getDevtoolsProps(componentName));
88
+
89
+ return editing ? /*#__PURE__*/React.createElement(CancelableTextEdit, _extends({}, stdProps, {
90
+ hideLabel: true,
91
+ inline: inline,
92
+ invalid: invalid,
93
+ invalidText: invalidText,
94
+ labelText: labelText,
95
+ onChange: handleChange,
96
+ onInput: onInput,
97
+ onRevert: handleRevert,
98
+ revertDescription: revertDescription,
99
+ saveDescription: saveDescription,
100
+ saveDisabled: saveDisabled,
101
+ value: value,
102
+ warn: warn,
103
+ warnText: warnText
104
+ })) : /*#__PURE__*/React.createElement("div", stdProps, /*#__PURE__*/React.createElement("div", {
105
+ className: "".concat(blockClass, "__value")
106
+ }, value), /*#__PURE__*/React.createElement(Button, {
107
+ className: "".concat(blockClass, "__button ").concat(carbon.prefix, "--btn--md"),
108
+ kind: "ghost",
109
+ hasIconOnly: true,
110
+ iconDescription: editDescription,
111
+ onClick: handleEdit,
112
+ renderIcon: disabled ? EditOff16 : Edit16,
113
+ disabled: disabled
114
+ }));
115
+ }); // Return a placeholder if not released and not enabled by feature flag
116
+
117
+ InlineEdit = pkg.checkComponentEnabled(InlineEdit, componentName); // The display name of the component, used by React. Note that displayName
118
+ // is used in preference to relying on function.name.
119
+
120
+ InlineEdit.displayName = componentName; // The types and DocGen commentary for the component props,
121
+ // in alphabetical order (for consistency).
122
+ // See https://www.npmjs.com/package/prop-types#usage.
123
+
124
+ InlineEdit.propTypes = {
125
+ /**
126
+ * Provide an optional class to be applied to the containing node.
127
+ */
128
+ className: PropTypes.string,
129
+
130
+ /**
131
+ * disable edit
132
+ */
133
+ disabled: PropTypes.bool,
134
+
135
+ /**
136
+ * Label for the edit button
137
+ */
138
+ editDescription: PropTypes.string.isRequired,
139
+
140
+ /**
141
+ * ID for inline edit
142
+ */
143
+ id: PropTypes.string,
144
+
145
+ /* TODO: add types and DocGen for all props. */
146
+
147
+ /**
148
+ * inline variant
149
+ */
150
+ inline: PropTypes.bool,
151
+
152
+ /**
153
+ * set invalid state for input
154
+ */
155
+ invalid: PropTypes.bool,
156
+
157
+ /**
158
+ * text shown when invalid is true
159
+ */
160
+ invalidText: PropTypes.string,
161
+
162
+ /**
163
+ * label for text input
164
+ */
165
+ labelText: PropTypes.string,
166
+
167
+ /**
168
+ * method called on change event
169
+ */
170
+ onChange: PropTypes.func,
171
+
172
+ /**
173
+ * method called on input event
174
+ */
175
+ onInput: PropTypes.func,
176
+
177
+ /**
178
+ * method called on revert event
179
+ */
180
+ onRevert: PropTypes.func,
181
+
182
+ /**
183
+ * label for revert button
184
+ */
185
+ revertDescription: PropTypes.string.isRequired,
186
+
187
+ /**
188
+ * label for save button
189
+ */
190
+ saveDescription: PropTypes.string.isRequired,
191
+
192
+ /**
193
+ * disabled state of the save button
194
+ */
195
+ saveDisabled: PropTypes.bool,
196
+
197
+ /**
198
+ * vertical size of control
199
+ */
200
+ size: PropTypes.oneOf(['sm', 'md', 'lg']),
201
+
202
+ /**
203
+ * initial/unedited value
204
+ */
205
+ value: PropTypes.string,
206
+
207
+ /**
208
+ * set warn state for input
209
+ */
210
+ warn: PropTypes.bool,
211
+
212
+ /**
213
+ * text shown when warn true
214
+ */
215
+ warnText: PropTypes.string
216
+ }; // Default values for component props. Default values are not required for
217
+ // props that are required, nor for props where the component can apply
218
+ // 'undefined' values reasonably. Default values should be provided when the
219
+ // component needs to make a choice or assumption when a prop is not supplied.
220
+
221
+ InlineEdit.defaultProps = {
222
+ /* TODO: add defaults for relevant props. */
223
+ size: 'md'
224
+ };
@@ -0,0 +1,7 @@
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
+ export { InlineEdit } from './InlineEdit';
@@ -0,0 +1,16 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import React, { forwardRef } from 'react'; // import PropTypes from 'prop-types';
3
+
4
+ import { AddSelect } from '../AddSelect';
5
+ import { getDevtoolsProps } from '../../global/js/utils/devtools';
6
+ import { pkg } from '../../settings';
7
+ var componentName = 'MultiAddSelect';
8
+ export var MultiAddSelect = /*#__PURE__*/forwardRef(function (props, ref) {
9
+ return /*#__PURE__*/React.createElement(AddSelect, _extends({}, props, {
10
+ multi: true,
11
+ ref: ref
12
+ }, getDevtoolsProps(componentName)));
13
+ });
14
+ MultiAddSelect = pkg.checkComponentEnabled(MultiAddSelect, componentName);
15
+ MultiAddSelect.propTypes = {};
16
+ MultiAddSelect.displayName = componentName;
@@ -0,0 +1 @@
1
+ export { MultiAddSelect } from './MultiAddSelect';
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["children", "className", "enabled", "heading", "headingId", "invalid", "invalidText", "locked", "lockedText", "onToggle", "size", "summary", "warn", "warnText"];
5
+ var _excluded = ["children", "className", "enabled", "heading", "headingId", "invalid", "invalidText", "locked", "lockedText", "onToggle", "open", "size", "summary", "warn", "warnText"];
6
6
 
7
7
  /**
8
8
  * Copyright IBM Corp. 2021, 2021
@@ -41,22 +41,27 @@ export var OptionsTile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
41
41
  locked = _ref.locked,
42
42
  lockedText = _ref.lockedText,
43
43
  onToggle = _ref.onToggle,
44
- _ref$size = _ref.size,
45
- size = _ref$size === void 0 ? 'xl' : _ref$size,
44
+ open = _ref.open,
45
+ size = _ref.size,
46
46
  summary = _ref.summary,
47
47
  warn = _ref.warn,
48
48
  warnText = _ref.warnText,
49
49
  rest = _objectWithoutProperties(_ref, _excluded);
50
50
 
51
- var _useState = useState(false),
51
+ var _useState = useState(open),
52
52
  _useState2 = _slicedToArray(_useState, 2),
53
- open = _useState2[0],
54
- setOpen = _useState2[1];
53
+ isOpen = _useState2[0],
54
+ setIsOpen = _useState2[1];
55
55
 
56
- var _useState3 = useState(false),
56
+ var _useState3 = useState(open),
57
57
  _useState4 = _slicedToArray(_useState3, 2),
58
- closing = _useState4[0],
59
- setClosing = _useState4[1];
58
+ prevIsOpen = _useState4[0],
59
+ setPrevIsOpen = _useState4[1];
60
+
61
+ var _useState5 = useState(false),
62
+ _useState6 = _slicedToArray(_useState5, 2),
63
+ closing = _useState6[0],
64
+ setClosing = _useState6[1];
60
65
 
61
66
  var detailsRef = useRef(null);
62
67
  var contentRef = useRef(null);
@@ -70,9 +75,19 @@ export var OptionsTile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
70
75
  matches: true
71
76
  };
72
77
 
78
+ if (open !== prevIsOpen) {
79
+ if (isOpen && !open) {
80
+ collapse();
81
+ } else if (!isOpen && open) {
82
+ expand();
83
+ }
84
+
85
+ setPrevIsOpen(open);
86
+ }
87
+
73
88
  function expand() {
74
89
  if (detailsRef.current && contentRef.current && !reducedMotion.matches) {
75
- setOpen(true);
90
+ setIsOpen(true);
76
91
  detailsRef.current.open = true;
77
92
 
78
93
  var _getComputedStyle = getComputedStyle(contentRef.current),
@@ -98,7 +113,7 @@ export var OptionsTile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
98
113
  });
99
114
  } else {
100
115
  // in case the refs are not set or the user prefers reduced motion, skip the animation
101
- setOpen(true);
116
+ setIsOpen(true);
102
117
  }
103
118
  }
104
119
 
@@ -127,7 +142,7 @@ export var OptionsTile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
127
142
  });
128
143
 
129
144
  var callback = function callback() {
130
- setOpen(false);
145
+ setIsOpen(false);
131
146
  setClosing(false);
132
147
  };
133
148
 
@@ -135,14 +150,14 @@ export var OptionsTile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
135
150
  animation.oncancel = callback;
136
151
  } else {
137
152
  // in case the ref is not set or the user prefers reduced motion, skip the animation
138
- setOpen(false);
153
+ setIsOpen(false);
139
154
  }
140
155
  }
141
156
 
142
157
  function toggle(e) {
143
158
  e.preventDefault();
144
159
 
145
- if (open) {
160
+ if (isOpen) {
146
161
  collapse();
147
162
  } else {
148
163
  expand();
@@ -199,7 +214,7 @@ export var OptionsTile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
199
214
  size: "sm",
200
215
  disabled: isLocked
201
216
  })), isExpandable ? /*#__PURE__*/React.createElement("details", {
202
- open: open,
217
+ open: isOpen,
203
218
  ref: detailsRef
204
219
  }, /*#__PURE__*/React.createElement("summary", {
205
220
  className: "".concat(blockClass, "__header"),
@@ -277,6 +292,11 @@ OptionsTile.propTypes = {
277
292
  */
278
293
  onToggle: PropTypes.func,
279
294
 
295
+ /**
296
+ * Whether the OptionsTile is in open state.
297
+ */
298
+ open: PropTypes.bool,
299
+
280
300
  /**
281
301
  * Define the size of the OptionsTile.
282
302
  */
@@ -302,5 +322,6 @@ OptionsTile.propTypes = {
302
322
  // component needs to make a choice or assumption when a prop is not supplied.
303
323
 
304
324
  OptionsTile.defaultProps = {
325
+ open: false,
305
326
  size: 'xl'
306
327
  };
@@ -33,7 +33,7 @@ var componentName = 'PageHeader';
33
33
  import { blockClass, utilCheckUpdateVerticalSpace, utilGetBreadcrumbItemForTitle, utilSetCollapsed } from './PageHeaderUtils';
34
34
  import { PageHeaderTitle } from './PageHeaderTitle';
35
35
  export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
36
- var _withoutBackground, _ref5, _cx2, _ref6, _cx4, _cx7;
36
+ var _withoutBackground, _ref6, _cx2, _ref7, _cx4, _cx7;
37
37
 
38
38
  var actionBarItems = _ref.actionBarItems,
39
39
  actionBarMenuOptionsClass = _ref.actionBarMenuOptionsClass,
@@ -83,17 +83,17 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
83
83
  var localHeaderRef = useRef(null);
84
84
  var headerRef = ref || localHeaderRef;
85
85
  var sizingContainerRef = useRef();
86
- var offsetTopMeasuringRef = useRef(null); // utility functions
87
-
88
- var checkUpdateVerticalSpace = function checkUpdateVerticalSpace() {
89
- return utilCheckUpdateVerticalSpace(headerRef, offsetTopMeasuringRef, navigation, disableBreadcrumbScroll, setMetrics);
90
- }; // state based on props only
91
-
86
+ var offsetTopMeasuringRef = useRef(null); // state based on props only
92
87
 
93
88
  var hasActionBar = actionBarItems && actionBarItems.length > 0;
94
- var hasBreadcrumbRow = breadcrumbs || actionBarItems; // NOTE: The buffer is used to add space between the bottom of the header and the last content
89
+ var hasBreadcrumbRow = !!breadcrumbs || !!actionBarItems; // utility functions
90
+
91
+ var checkUpdateVerticalSpace = function checkUpdateVerticalSpace() {
92
+ return utilCheckUpdateVerticalSpace(headerRef, offsetTopMeasuringRef, navigation, disableBreadcrumbScroll, hasActionBar, widthIsNarrow, setMetrics);
93
+ }; // NOTE: The buffer is used to add space between the bottom of the header and the last content
95
94
  // Not pre-collapsed and (subtitle or children)
96
95
 
96
+
97
97
  var lastRowBufferActive = (title || pageActions) && !collapseTitle || subtitle || children; // state based on scroll/resize based effects
98
98
 
99
99
  var _useState5 = useState(false),
@@ -144,7 +144,12 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
144
144
  var _useState23 = useState(false),
145
145
  _useState24 = _slicedToArray(_useState23, 2),
146
146
  fullyCollapsed = _useState24[0],
147
- setFullyCollapsed = _useState24[1]; // handlers
147
+ setFullyCollapsed = _useState24[1];
148
+
149
+ var _useState25 = useState(false),
150
+ _useState26 = _slicedToArray(_useState25, 2),
151
+ widthIsNarrow = _useState26[0],
152
+ setWidthIsNarrow = _useState26[1]; // handlers
148
153
 
149
154
 
150
155
  var handleActionBarWidthChange = function handleActionBarWidthChange(_ref2) {
@@ -216,8 +221,8 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
216
221
  // Determine the location of the pageAction buttons
217
222
 
218
223
  /* istanbul ignore next */
219
- setPageActionsInBreadcrumbRow(collapseTitle || scrollYValue > metrics.titleRowSpaceAbove && hasActionBar);
220
- }, [hasActionBar, metrics.breadcrumbRowSpaceBelow, metrics.titleRowSpaceAbove, collapseTitle, scrollYValue]);
224
+ setPageActionsInBreadcrumbRow(collapseTitle || hasActionBar && scrollYValue > metrics.titleRowSpaceAbove || widthIsNarrow && scrollYValue > metrics.pageActionsSpaceAbove);
225
+ }, [hasActionBar, metrics.breadcrumbRowSpaceBelow, metrics.titleRowSpaceAbove, metrics.pageActionsSpaceAbove, collapseTitle, scrollYValue, widthIsNarrow]);
221
226
  useEffect(function () {
222
227
  // Assesses the size of the action bar and page action area and their required
223
228
  // space before setting their sizes
@@ -279,9 +284,11 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
279
284
  document.documentElement.style.setProperty("--".concat(blockClass, "--tagset-tooltip-offset"), "".concat(tagsetTooltipOffset, "px"));
280
285
  setScrollYValue(current.scrollY);
281
286
  }, [metrics.headerHeight, metrics.headerTopValue, metrics.headerOffset, disableBreadcrumbScroll]);
282
- useWindowResize(function () {
287
+ useWindowResize(function (_ref5) {
288
+ var current = _ref5.current;
283
289
  // on window resize and other updates some values may have changed
284
290
  checkUpdateVerticalSpace();
291
+ setWidthIsNarrow(current.innerWidth < 672); // small (below medium) media query
285
292
  }, [actionBarItems, children, breadcrumbs, disableBreadcrumbScroll, navigation, pageActions, subtitle, tags, title]);
286
293
  useEffect(function () {
287
294
  checkUpdateVerticalSpace(); // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -344,7 +351,7 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
344
351
  className: "".concat(blockClass, "--offset-top-measuring-element"),
345
352
  ref: offsetTopMeasuringRef
346
353
  }), /*#__PURE__*/React.createElement("section", _extends({}, rest, {
347
- className: cx([blockClass, "".concat(blockClass, "--no-margins-below-row"), className, (_ref5 = {}, _defineProperty(_ref5, "".concat(blockClass, "--has-navigation"), navigation || tags), _defineProperty(_ref5, "".concat(blockClass, "--has-navigation-tags-only"), !navigation && tags), _ref5)]),
354
+ className: cx([blockClass, "".concat(blockClass, "--no-margins-below-row"), className, (_ref6 = {}, _defineProperty(_ref6, "".concat(blockClass, "--has-navigation"), navigation || tags), _defineProperty(_ref6, "".concat(blockClass, "--has-navigation-tags-only"), !navigation && tags), _ref6)]),
348
355
  style: pageHeaderStyles,
349
356
  ref: headerRef
350
357
  }, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(Grid, {
@@ -354,18 +361,18 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
354
361
  }, /*#__PURE__*/React.createElement("div", {
355
362
  className: "".concat(blockClass, "__non-navigation-row-content")
356
363
  }, hasBreadcrumbRow ? /*#__PURE__*/React.createElement(Row, {
357
- className: cx("".concat(blockClass, "__breadcrumb-row"), (_cx2 = {}, _defineProperty(_cx2, "".concat(blockClass, "__breadcrumb-row--next-to-tabs"), nextToTabsCheck()), _defineProperty(_cx2, "".concat(blockClass, "__breadcrumb-row--has-breadcrumbs"), breadcrumbs), _defineProperty(_cx2, "".concat(blockClass, "__breadcrumb-row--has-action-bar"), hasActionBar), _defineProperty(_cx2, "".concat(blockClass, "__has-page-actions-without-action-bar"), !hasActionBar && pageActions), _cx2))
364
+ className: cx("".concat(blockClass, "__breadcrumb-row"), (_cx2 = {}, _defineProperty(_cx2, "".concat(blockClass, "__breadcrumb-row--next-to-tabs"), nextToTabsCheck()), _defineProperty(_cx2, "".concat(blockClass, "__breadcrumb-row--has-breadcrumbs"), breadcrumbs), _defineProperty(_cx2, "".concat(blockClass, "__breadcrumb-row--has-action-bar"), hasActionBar || widthIsNarrow), _defineProperty(_cx2, "".concat(blockClass, "__has-page-actions-without-action-bar"), !hasActionBar && !widthIsNarrow && pageActions), _cx2))
358
365
  }, /*#__PURE__*/React.createElement("div", {
359
366
  className: "".concat(blockClass, "__breadcrumb-row--container")
360
367
  }, /*#__PURE__*/React.createElement(Column, {
361
- className: cx("".concat(blockClass, "__breadcrumb-column"), _defineProperty({}, "".concat(blockClass, "__breadcrumb-column--background"), !!breadcrumbs || hasActionBar))
368
+ className: cx("".concat(blockClass, "__breadcrumb-column"), _defineProperty({}, "".concat(blockClass, "__breadcrumb-column--background"), !!breadcrumbs || hasActionBar || widthIsNarrow))
362
369
  }, breadcrumbs ? /*#__PURE__*/React.createElement(BreadcrumbWithOverflow, {
363
370
  className: "".concat(blockClass, "__breadcrumb"),
364
371
  noTrailingSlash: !!title,
365
372
  overflowAriaLabel: breadcrumbOverflowAriaLabel,
366
373
  breadcrumbs: breadcrumbs ? breadcrumbItemForTitle ? breadcrumbs.concat(breadcrumbItemForTitle) : breadcrumbs : null
367
374
  }) : null), /*#__PURE__*/React.createElement(Column, {
368
- className: cx(["".concat(blockClass, "__action-bar-column ").concat(blockClass, "__action-bar-column--background"), (_ref6 = {}, _defineProperty(_ref6, "".concat(blockClass, "__action-bar-column--has-page-actions"), pageActions), _defineProperty(_ref6, "".concat(blockClass, "__action-bar-column--influenced-by-collapse-button"), spaceForCollapseButton), _ref6)])
375
+ className: cx(["".concat(blockClass, "__action-bar-column ").concat(blockClass, "__action-bar-column--background"), (_ref7 = {}, _defineProperty(_ref7, "".concat(blockClass, "__action-bar-column--has-page-actions"), pageActions), _defineProperty(_ref7, "".concat(blockClass, "__action-bar-column--influenced-by-collapse-button"), spaceForCollapseButton), _ref7)])
369
376
  }, /*#__PURE__*/React.createElement("div", {
370
377
  className: "".concat(blockClass, "__action-bar-column-content"),
371
378
  ref: sizingContainerRef
@@ -379,8 +386,8 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
379
386
  className: "".concat(blockClass, "__action-bar"),
380
387
  onWidthChange: handleActionBarWidthChange,
381
388
  rightAlign: true
382
- })) : null)))) : null, !collapseTitle && (title || pageActions) ? /*#__PURE__*/React.createElement(Row, {
383
- className: cx("".concat(blockClass, "__title-row"), (_cx4 = {}, _defineProperty(_cx4, "".concat(blockClass, "__title-row--no-breadcrumb-row"), !hasBreadcrumbRow), _defineProperty(_cx4, "".concat(blockClass, "__title-row--under-action-bar"), hasActionBar), _defineProperty(_cx4, "".concat(blockClass, "__title-row--has-page-actions"), !!pageActions), _defineProperty(_cx4, "".concat(blockClass, "__title-row--sticky"), !!pageActions && !actionBarItems && hasBreadcrumbRow), _cx4))
389
+ })) : widthIsNarrow && thePageActions(true, pageActionsInBreadcrumbRow))))) : null, !collapseTitle && (title || pageActions) ? /*#__PURE__*/React.createElement(Row, {
390
+ className: cx("".concat(blockClass, "__title-row"), (_cx4 = {}, _defineProperty(_cx4, "".concat(blockClass, "__title-row--no-breadcrumb-row"), !hasBreadcrumbRow), _defineProperty(_cx4, "".concat(blockClass, "__title-row--under-action-bar"), hasActionBar || widthIsNarrow), _defineProperty(_cx4, "".concat(blockClass, "__title-row--has-page-actions"), !!pageActions), _defineProperty(_cx4, "".concat(blockClass, "__title-row--sticky"), !!pageActions && !actionBarItems && hasBreadcrumbRow), _cx4))
384
391
  }, /*#__PURE__*/React.createElement(Column, {
385
392
  className: "".concat(blockClass, "__title-column")
386
393
  }, title ? /*#__PURE__*/React.createElement(PageHeaderTitle, {
@@ -510,8 +517,8 @@ PageHeader.propTypes = _objectSpread({
510
517
  *
511
518
  * NOTE: This prop is required if actionBarItems are supplied
512
519
  */
513
- actionBarOverflowAriaLabel: PropTypes.string.isRequired.if(function (_ref8) {
514
- var actionBarItems = _ref8.actionBarItems;
520
+ actionBarOverflowAriaLabel: PropTypes.string.isRequired.if(function (_ref9) {
521
+ var actionBarItems = _ref9.actionBarItems;
515
522
  return actionBarItems && actionBarItems.length > 0;
516
523
  }),
517
524
 
@@ -546,8 +553,8 @@ PageHeader.propTypes = _objectSpread({
546
553
  * If the user supplies breadcrumbs then this property is required.
547
554
  * It is used in an overflow menu when there is insufficient space to display all breadcrumbs inline.
548
555
  */
549
- breadcrumbOverflowAriaLabel: PropTypes.string.isRequired.if(function (_ref9) {
550
- var breadcrumbs = _ref9.breadcrumbs;
556
+ breadcrumbOverflowAriaLabel: PropTypes.string.isRequired.if(function (_ref10) {
557
+ var breadcrumbs = _ref10.breadcrumbs;
551
558
  return breadcrumbs && breadcrumbs.length > 0;
552
559
  }),
553
560
 
@@ -586,8 +593,8 @@ PageHeader.propTypes = _objectSpread({
586
593
  /**
587
594
  * A text version of the `label` for display, required if `label` is not a string.
588
595
  */
589
- title: PropTypes.string.isRequired.if(function (_ref10) {
590
- var label = _ref10.label;
596
+ title: PropTypes.string.isRequired.if(function (_ref11) {
597
+ var label = _ref11.label;
591
598
  return typeof label !== 'string';
592
599
  })
593
600
  })),
@@ -617,9 +624,9 @@ PageHeader.propTypes = _objectSpread({
617
624
  * If `hasCollapseHeaderToggle` is set and `withoutBackground` is unset/falsy then assistive text is
618
625
  * required for both the expend and collapse states of the button component used.
619
626
  */
620
- collapseHeaderIconDescription: PropTypes.string.isRequired.if(function (_ref11) {
621
- var withoutBackground = _ref11.withoutBackground,
622
- hasCollapseHeaderToggle = _ref11.hasCollapseHeaderToggle;
627
+ collapseHeaderIconDescription: PropTypes.string.isRequired.if(function (_ref12) {
628
+ var withoutBackground = _ref12.withoutBackground,
629
+ hasCollapseHeaderToggle = _ref12.hasCollapseHeaderToggle;
623
630
  return !withoutBackground && hasCollapseHeaderToggle;
624
631
  }),
625
632
 
@@ -639,9 +646,9 @@ PageHeader.propTypes = _objectSpread({
639
646
  * If `hasCollapseHeaderToggle` is set and `withoutBackground` is unset/falsy then assistive text is
640
647
  * required for both the expend and collapse states of the button component used.
641
648
  */
642
- expandHeaderIconDescription: PropTypes.string.isRequired.if(function (_ref12) {
643
- var withoutBackground = _ref12.withoutBackground,
644
- hasCollapseHeaderToggle = _ref12.hasCollapseHeaderToggle;
649
+ expandHeaderIconDescription: PropTypes.string.isRequired.if(function (_ref13) {
650
+ var withoutBackground = _ref13.withoutBackground,
651
+ hasCollapseHeaderToggle = _ref13.hasCollapseHeaderToggle;
645
652
  return !withoutBackground && hasCollapseHeaderToggle;
646
653
  }),
647
654
 
@@ -712,8 +719,8 @@ PageHeader.propTypes = _objectSpread({
712
719
  *
713
720
  * NOTE: This prop is required if pageActions are supplied
714
721
  */
715
- pageActionsOverflowLabel: PropTypes.node.isRequired.if(function (_ref13) {
716
- var pageActions = _ref13.pageActions;
722
+ pageActionsOverflowLabel: PropTypes.node.isRequired.if(function (_ref14) {
723
+ var pageActions = _ref14.pageActions;
717
724
  return pageActions && pageActions.length > 0 && !pageActions.content;
718
725
  }),
719
726
 
@@ -759,6 +766,10 @@ PageHeader.propTypes = _objectSpread({
759
766
  * - text: title string
760
767
  * - icon: optional icon
761
768
  * - loading: boolean shows loading indicator if true
769
+ * - onChange: function to process edits only supply if in place edit is desired
770
+ * - editableLabel: label for edit required if onChange supplied
771
+ * - revertDescription: label for edit revert button
772
+ * - saveDescription: label for edit save button
762
773
  * - 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.
763
774
  * - content: title or name of current location shown in main part of page header
764
775
  * - breadcrumbContent: version of content used in the breadcrumb on scroll. If not supplied
@@ -768,7 +779,17 @@ PageHeader.propTypes = _objectSpread({
768
779
  // Update docgen if changed
769
780
  text: PropTypes.string.isRequired,
770
781
  icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
771
- loading: PropTypes.bool // Update docgen if changed
782
+ loading: PropTypes.bool,
783
+ // inline edit version properties
784
+ editableLabel: PropTypes.string,
785
+ // .isRequired.if(inlineEditRequired),
786
+ id: PropTypes.string,
787
+ // .isRequired.if(inlineEditRequired),
788
+ onChange: PropTypes.func,
789
+ revertDescription: PropTypes.string,
790
+ //.isRequired.if(inlineEditRequired),
791
+ saveDescription: PropTypes.string //.isRequired.if(inlineEditRequired),
792
+ // Update docgen if changed
772
793
 
773
794
  }), PropTypes.string, PropTypes.shape({
774
795
  content: PropTypes.node.isRequired,