@carbon/ibm-products 1.3.0 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +1766 -1701
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-without-carbon-released-only.css +32 -41
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +2 -2
- package/css/index-without-carbon.css +228 -163
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index.css +1767 -1702
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- package/es/components/APIKeyModal/APIKeyModal.js +25 -29
- package/es/components/ActionBar/ActionBar.js +4 -1
- package/es/components/AddSelect/AddSelect.js +65 -19
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +19 -15
- package/es/components/CancelableTextEdit/CancelableTextEdit.js +60 -22
- package/es/components/CreateFullPage/CreateFullPage.js +78 -259
- package/es/components/CreateFullPage/CreateFullPageStep.js +58 -14
- package/es/components/CreateFullPage/index.js +1 -2
- package/es/components/CreateInfluencer/CreateInfluencer.js +23 -225
- package/es/components/CreateTearsheet/CreateTearsheet.js +69 -146
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +59 -16
- package/es/components/CreateTearsheet/index.js +0 -1
- package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +66 -27
- package/es/components/ExportModal/ExportModal.js +4 -2
- package/es/components/ImportModal/ImportModal.js +2 -1
- package/es/components/InlineEdit/InlineEdit.js +224 -0
- package/es/components/InlineEdit/index.js +7 -0
- package/es/components/MultiAddSelect/MultiAddSelect.js +16 -0
- package/es/components/MultiAddSelect/index.js +1 -0
- package/es/components/OptionsTile/OptionsTile.js +36 -15
- package/es/components/PageHeader/PageHeader.js +54 -33
- package/es/components/PageHeader/PageHeaderTitle.js +78 -7
- package/es/components/PageHeader/PageHeaderUtils.js +21 -2
- package/es/components/RemoveModal/RemoveModal.js +4 -2
- package/es/components/SingleAddSelect/SingleAddSelect.js +15 -0
- package/es/components/SingleAddSelect/index.js +1 -0
- package/es/components/TagSet/TagSet.js +4 -1
- package/es/components/Toolbar/Toolbar.js +69 -8
- package/es/components/index.js +4 -2
- package/es/global/js/hooks/useCreateComponentFocus.js +15 -19
- package/es/global/js/hooks/useCreateComponentStepChange.js +44 -74
- package/es/global/js/hooks/useValidCreateStepCount.js +4 -7
- package/es/global/js/package-settings.js +4 -2
- package/lib/components/APIKeyModal/APIKeyModal.js +25 -29
- package/lib/components/ActionBar/ActionBar.js +4 -1
- package/lib/components/AddSelect/AddSelect.js +64 -19
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +18 -14
- package/lib/components/CancelableTextEdit/CancelableTextEdit.js +61 -22
- package/lib/components/CreateFullPage/CreateFullPage.js +78 -259
- package/lib/components/CreateFullPage/CreateFullPageStep.js +61 -14
- package/lib/components/CreateFullPage/index.js +1 -9
- package/lib/components/CreateInfluencer/CreateInfluencer.js +21 -236
- package/lib/components/CreateTearsheet/CreateTearsheet.js +71 -148
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +61 -15
- package/lib/components/CreateTearsheet/index.js +0 -8
- package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +67 -35
- package/lib/components/ExportModal/ExportModal.js +4 -2
- package/lib/components/ImportModal/ImportModal.js +2 -1
- package/lib/components/InlineEdit/InlineEdit.js +242 -0
- package/lib/components/InlineEdit/index.js +13 -0
- package/lib/components/MultiAddSelect/MultiAddSelect.js +37 -0
- package/lib/components/MultiAddSelect/index.js +13 -0
- package/lib/components/OptionsTile/OptionsTile.js +36 -15
- package/lib/components/PageHeader/PageHeader.js +54 -33
- package/lib/components/PageHeader/PageHeaderTitle.js +87 -9
- package/lib/components/PageHeader/PageHeaderUtils.js +21 -2
- package/lib/components/RemoveModal/RemoveModal.js +4 -2
- package/lib/components/SingleAddSelect/SingleAddSelect.js +36 -0
- package/lib/components/SingleAddSelect/index.js +13 -0
- package/lib/components/TagSet/TagSet.js +4 -1
- package/lib/components/Toolbar/Toolbar.js +69 -6
- package/lib/components/index.js +25 -9
- package/lib/global/js/hooks/useCreateComponentFocus.js +15 -19
- package/lib/global/js/hooks/useCreateComponentStepChange.js +44 -74
- package/lib/global/js/hooks/useValidCreateStepCount.js +4 -7
- package/lib/global/js/package-settings.js +4 -2
- package/package.json +8 -8
- package/scss/components/AddSelect/_add-select.scss +14 -3
- package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +19 -15
- package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +141 -70
- package/scss/components/CreateFullPage/_create-full-page.scss +4 -11
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +4 -8
- package/scss/components/InlineEdit/_index.scss +8 -0
- package/scss/components/InlineEdit/_inline-edit.scss +44 -0
- package/scss/components/InlineEdit/_storybook-styles.scss +15 -0
- package/scss/components/MultiAddSelect/_index.scss +1 -0
- package/scss/components/MultiAddSelect/_multi-add-select.scss +1 -0
- package/scss/components/MultiAddSelect/_storybook-styles.scss +6 -0
- package/scss/components/PageHeader/_page-header.scss +14 -4
- package/scss/components/SingleAddSelect/_index.scss +1 -0
- package/scss/components/SingleAddSelect/_single-add-select.scss +1 -0
- package/scss/components/SingleAddSelect/_storybook-styles.scss +6 -0
- package/scss/components/_index.scss +3 -1
- package/es/components/CreateFullPage/CreateFullPageSection.js +0 -53
- package/es/components/CreateFullPage/constants.js +0 -8
- package/es/components/CreateTearsheet/CreateTearsheetSection.js +0 -83
- package/es/components/CreateTearsheet/constants.js +0 -8
- package/es/components/CreateTearsheet/preview-components/MultiStepWithSectionsTearsheet.js +0 -327
- package/es/global/js/utils/hasValidType.js +0 -94
- package/lib/components/CreateFullPage/CreateFullPageSection.js +0 -74
- package/lib/components/CreateFullPage/constants.js +0 -16
- package/lib/components/CreateTearsheet/CreateTearsheetSection.js +0 -105
- package/lib/components/CreateTearsheet/constants.js +0 -17
- package/lib/components/CreateTearsheet/preview-components/MultiStepWithSectionsTearsheet.js +0 -354
- package/lib/global/js/utils/hasValidType.js +0 -110
@@ -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
|
-
|
45
|
-
size = _ref
|
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(
|
51
|
+
var _useState = useState(open),
|
52
52
|
_useState2 = _slicedToArray(_useState, 2),
|
53
|
-
|
54
|
-
|
53
|
+
isOpen = _useState2[0],
|
54
|
+
setIsOpen = _useState2[1];
|
55
55
|
|
56
|
-
var _useState3 = useState(
|
56
|
+
var _useState3 = useState(open),
|
57
57
|
_useState4 = _slicedToArray(_useState3, 2),
|
58
|
-
|
59
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
153
|
+
setIsOpen(false);
|
139
154
|
}
|
140
155
|
}
|
141
156
|
|
142
157
|
function toggle(e) {
|
143
158
|
e.preventDefault();
|
144
159
|
|
145
|
-
if (
|
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:
|
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,
|
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); //
|
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; //
|
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];
|
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 &&
|
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, (
|
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"), (
|
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
|
-
})) :
|
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 (
|
514
|
-
var 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 (
|
550
|
-
var 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 (
|
590
|
-
var 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 (
|
621
|
-
var withoutBackground =
|
622
|
-
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 (
|
643
|
-
var withoutBackground =
|
644
|
-
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 (
|
716
|
-
var 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
|
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,
|
@@ -1,7 +1,12 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
import _extends from "@babel/runtime/helpers/extends";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
+
var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "editDescription", "editableLabel", "revertDescription", "saveDescription"];
|
2
5
|
import React from 'react';
|
6
|
+
import PropTypes from 'prop-types';
|
3
7
|
import cx from 'classnames';
|
4
8
|
import { SkeletonText } from 'carbon-components-react';
|
9
|
+
import { InlineEdit } from '../';
|
5
10
|
/**
|
6
11
|
*
|
7
12
|
* Utility component used by Page Header
|
@@ -14,14 +19,21 @@ export var PageHeaderTitle = function PageHeaderTitle(_ref) {
|
|
14
19
|
title = _ref.title;
|
15
20
|
var titleInnards; // eslint-disable-next-line
|
16
21
|
// debugger;
|
17
|
-
// eslint-disable-next-line react/prop-types
|
18
22
|
|
19
23
|
var text = title.text,
|
20
24
|
content = title.content,
|
21
25
|
loading = title.loading,
|
22
26
|
icon = title.icon,
|
23
|
-
asText = title.asText
|
27
|
+
asText = title.asText,
|
28
|
+
onChange = title.onChange,
|
29
|
+
editDescription = title.editDescription,
|
30
|
+
editableLabel = title.editableLabel,
|
31
|
+
revertDescription = title.revertDescription,
|
32
|
+
saveDescription = title.saveDescription,
|
33
|
+
rest = _objectWithoutProperties(title, _excluded);
|
34
|
+
|
24
35
|
var titleText;
|
36
|
+
var isEditable = !!onChange;
|
25
37
|
|
26
38
|
if (text || !content) {
|
27
39
|
if (text === undefined && typeof title === 'string') {
|
@@ -32,18 +44,77 @@ export var PageHeaderTitle = function PageHeaderTitle(_ref) {
|
|
32
44
|
var TitleIcon = icon;
|
33
45
|
titleInnards = /*#__PURE__*/React.createElement(React.Fragment, null, icon && !loading ? /*#__PURE__*/React.createElement(TitleIcon, {
|
34
46
|
className: "".concat(blockClass, "__title-icon")
|
35
|
-
}) : null, /*#__PURE__*/React.createElement(
|
36
|
-
title: !loading ? asText : null
|
37
|
-
}, loading ? /*#__PURE__*/React.createElement(SkeletonText, {
|
47
|
+
}) : null, loading ? /*#__PURE__*/React.createElement(SkeletonText, {
|
38
48
|
className: "".concat(blockClass, "__title-skeleton")
|
39
|
-
}) :
|
49
|
+
}) : isEditable ? /*#__PURE__*/React.createElement(InlineEdit, _extends({
|
50
|
+
hideLabel: true,
|
51
|
+
value: text,
|
52
|
+
editDescription: editDescription,
|
53
|
+
onChange: onChange,
|
54
|
+
labelText: editableLabel,
|
55
|
+
revertDescription: revertDescription,
|
56
|
+
saveDescription: saveDescription
|
57
|
+
}, rest)) : /*#__PURE__*/React.createElement("span", {
|
58
|
+
title: !loading ? asText : null
|
59
|
+
}, text));
|
40
60
|
} else {
|
41
61
|
titleInnards = content;
|
42
62
|
titleText = asText;
|
43
63
|
}
|
44
64
|
|
45
65
|
return /*#__PURE__*/React.createElement("div", {
|
46
|
-
className: cx("".concat(blockClass, "__title"), _defineProperty({}, "".concat(blockClass, "__title--fades"), hasBreadcrumbRow)),
|
66
|
+
className: cx("".concat(blockClass, "__title"), _defineProperty({}, "".concat(blockClass, "__title--editable"), isEditable), _defineProperty({}, "".concat(blockClass, "__title--fades"), hasBreadcrumbRow)),
|
47
67
|
title: titleText
|
48
68
|
}, titleInnards);
|
69
|
+
};
|
70
|
+
export var inlineEditRequired = function inlineEditRequired(_ref2) {
|
71
|
+
var onChange = _ref2.onChange;
|
72
|
+
return !!onChange;
|
73
|
+
};
|
74
|
+
PageHeaderTitle.propTypes = {
|
75
|
+
// passed from page header
|
76
|
+
blockClass: PropTypes.string.isRequired,
|
77
|
+
|
78
|
+
/**
|
79
|
+
* controlled from within page header
|
80
|
+
*/
|
81
|
+
hasBreadcrumbRow: PropTypes.bool,
|
82
|
+
|
83
|
+
/**
|
84
|
+
* An optional page title supplied as a string or object with the following attributes: text, icon, loading
|
85
|
+
*
|
86
|
+
* Can be supplied either as:
|
87
|
+
* - String
|
88
|
+
* - Object containing
|
89
|
+
* - text: title string
|
90
|
+
* - icon: optional icon
|
91
|
+
* - loading: boolean shows loading indicator if true
|
92
|
+
* - onChange: function to process edits only supply if in place edit is desired
|
93
|
+
* - editDescription: description for edit button
|
94
|
+
* - editableLabel: label for edit required if onChange supplied
|
95
|
+
* - revertDescription: description for edit revert button
|
96
|
+
* - saveDescription: description for edit save button
|
97
|
+
* - 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.
|
98
|
+
* - content: title or name of current location shown in main part of page header
|
99
|
+
* - breadcrumbContent: version of content used in the breadcrumb on scroll. If not supplied
|
100
|
+
* - asText: String based representation of the title
|
101
|
+
*/
|
102
|
+
title: PropTypes.oneOfType([PropTypes.shape({
|
103
|
+
// Update docgen if changed
|
104
|
+
text: PropTypes.string.isRequired,
|
105
|
+
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
106
|
+
loading: PropTypes.bool,
|
107
|
+
// inline edit version properties
|
108
|
+
editDescription: PropTypes.string.isRequired.if(inlineEditRequired),
|
109
|
+
editableLabel: PropTypes.string.isRequired.if(inlineEditRequired),
|
110
|
+
id: PropTypes.string.isRequired.if(inlineEditRequired),
|
111
|
+
onChange: PropTypes.func,
|
112
|
+
revertDescription: PropTypes.string.isRequired.if(inlineEditRequired),
|
113
|
+
saveDescription: PropTypes.string.isRequired.if(inlineEditRequired) // Update docgen if changed
|
114
|
+
|
115
|
+
}), PropTypes.string, PropTypes.shape({
|
116
|
+
content: PropTypes.node.isRequired,
|
117
|
+
breadcrumbContent: PropTypes.node,
|
118
|
+
asText: PropTypes.string.isRequired
|
119
|
+
})])
|
49
120
|
};
|
@@ -22,10 +22,12 @@ export var blockClass = "".concat(pkg.prefix, "--page-header");
|
|
22
22
|
* @param {{}} offsetTopMeasuringRef
|
23
23
|
* @param {{}} navigation
|
24
24
|
* @param {boolean} disableBreadcrumbScroll
|
25
|
+
* @param {boolean} hasActionBar
|
26
|
+
* @param {boolean} widthIsNarrow
|
25
27
|
* @param {()} setMetrics
|
26
28
|
*/
|
27
29
|
|
28
|
-
export var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(headerRef, offsetTopMeasuringRef, navigation, disableBreadcrumbScroll, setMetrics) {
|
30
|
+
export var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(headerRef, offsetTopMeasuringRef, navigation, disableBreadcrumbScroll, hasActionBar, widthIsNarrow, setMetrics) {
|
29
31
|
var dynamicRefs = {};
|
30
32
|
|
31
33
|
var getDynamicRef = function getDynamicRef(selector) {
|
@@ -60,6 +62,7 @@ export var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(
|
|
60
62
|
var subtitleRowEl = getDynamicRef(".".concat(blockClass, "__subtitle-row"));
|
61
63
|
var availableRowEl = getDynamicRef(".".concat(blockClass, "__available-row"));
|
62
64
|
var navigationRowEl = getDynamicRef(".".concat(blockClass, "__navigation-row"));
|
65
|
+
var pageActionsEl = getDynamicRef(".".concat(blockClass, "__page-actions"));
|
63
66
|
/* istanbul ignore next */
|
64
67
|
|
65
68
|
update.headerHeight = headerRef.current ? headerRef.current.clientHeight : 0;
|
@@ -81,7 +84,8 @@ export var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(
|
|
81
84
|
update.breadcrumbRowWidth = breadcrumbRowEl ? breadcrumbRowEl.offsetWidth : 0;
|
82
85
|
/* istanbul ignore next */
|
83
86
|
|
84
|
-
update.breadcrumbTitleHeight = breadcrumbTitleEl ? breadcrumbTitleEl.clientHeight
|
87
|
+
update.breadcrumbTitleHeight = breadcrumbTitleEl ? breadcrumbTitleEl.offsetHeight // clientHeight returns 0 when window small
|
88
|
+
: 1;
|
85
89
|
/* istanbul ignore next */
|
86
90
|
|
87
91
|
update.titleRowHeight = titleRowEl ? titleRowEl.clientHeight : 0;
|
@@ -102,9 +106,19 @@ export var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(
|
|
102
106
|
update.headerTopValue += update.navigationRowHeight;
|
103
107
|
}
|
104
108
|
|
109
|
+
if (!hasActionBar && !widthIsNarrow) {
|
110
|
+
// Add difference between $spacing-08 and $spacing-07 to ensure space below breadcrumb is correct on scroll
|
111
|
+
// $spacing-07 is used as size for breadcrumb when no action bar otherwise $spacing-08
|
112
|
+
update.headerTopValue += 8;
|
113
|
+
}
|
114
|
+
|
105
115
|
if (disableBreadcrumbScroll || !navigation) {
|
106
116
|
// adjust sticky top if no navigation or breadcrumb is to stay on screen
|
107
117
|
update.headerTopValue += update.breadcrumbRowHeight;
|
118
|
+
} else {
|
119
|
+
if (navigation && !widthIsNarrow) {
|
120
|
+
update.headerTopValue -= 8;
|
121
|
+
}
|
108
122
|
}
|
109
123
|
|
110
124
|
if (window) {
|
@@ -125,6 +139,11 @@ export var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(
|
|
125
139
|
if (titleRowEl) {
|
126
140
|
val = parseFloat(window.getComputedStyle(titleRowEl).getPropertyValue('margin-top'), 10);
|
127
141
|
update.titleRowSpaceAbove = isNaN(val) ? 0 : val;
|
142
|
+
|
143
|
+
if (pageActionsEl) {
|
144
|
+
val = parseFloat(window.getComputedStyle(pageActionsEl).getPropertyValue('margin-top'), 10);
|
145
|
+
update.pageActionsSpaceAbove = titleRowEl.clientHeight - pageActionsEl.clientHeight + update.titleRowSpaceAbove - (isNaN(val) ? 0 : val);
|
146
|
+
}
|
128
147
|
}
|
129
148
|
} else {
|
130
149
|
update.breadcrumbRowSpaceBelow = 0;
|
@@ -88,11 +88,13 @@ export var RemoveModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
88
88
|
labelText: inputLabelText,
|
89
89
|
placeholder: inputPlaceholderText,
|
90
90
|
onChange: onChangeHandler,
|
91
|
-
value: userInput
|
91
|
+
value: userInput,
|
92
|
+
"data-modal-primary-focus": true
|
92
93
|
})), /*#__PURE__*/React.createElement(ModalFooter, null, /*#__PURE__*/React.createElement(Button, {
|
93
94
|
type: "button",
|
94
95
|
kind: "secondary",
|
95
|
-
onClick: onClose
|
96
|
+
onClick: onClose,
|
97
|
+
"data-modal-primary-focus": !textConfirmation
|
96
98
|
}, secondaryButtonText), /*#__PURE__*/React.createElement(Button, {
|
97
99
|
type: "submit",
|
98
100
|
kind: "danger",
|
@@ -0,0 +1,15 @@
|
|
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 = 'SingleAddSelect';
|
8
|
+
export var SingleAddSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
9
|
+
return /*#__PURE__*/React.createElement(AddSelect, _extends({}, props, {
|
10
|
+
ref: ref
|
11
|
+
}, getDevtoolsProps(componentName)));
|
12
|
+
});
|
13
|
+
SingleAddSelect = pkg.checkComponentEnabled(SingleAddSelect, componentName);
|
14
|
+
SingleAddSelect.propTypes = {};
|
15
|
+
SingleAddSelect.displayName = componentName;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { SingleAddSelect } from './SingleAddSelect';
|
@@ -3,7 +3,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
5
|
var _excluded = ["align", "className", "maxVisible", "overflowAlign", "overflowClassName", "overflowDirection", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags"],
|
6
|
-
_excluded2 = ["label"],
|
6
|
+
_excluded2 = ["label", "id"],
|
7
7
|
_excluded3 = ["label"];
|
8
8
|
|
9
9
|
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; }
|
@@ -84,6 +84,7 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
84
84
|
|
85
85
|
setHiddenSizingTags(tags && tags.length > 0 ? tags.map(function (_ref2, index) {
|
86
86
|
var label = _ref2.label,
|
87
|
+
id = _ref2.id,
|
87
88
|
other = _objectWithoutProperties(_ref2, _excluded2);
|
88
89
|
|
89
90
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -93,6 +94,8 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
93
94
|
return newSizingTags[index] = el;
|
94
95
|
}
|
95
96
|
}, /*#__PURE__*/React.createElement(Tag, _extends({}, other, {
|
97
|
+
// ensure id is not duplicated
|
98
|
+
"data-original-id": id,
|
96
99
|
filter: false
|
97
100
|
}), label));
|
98
101
|
}) : []);
|