@carbon/ibm-products 1.3.0 → 1.6.1
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +5102 -4711
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +9 -3
- package/css/index-full-carbon.min.css.map +1 -0
- package/css/index-without-carbon-released-only.css +189 -108
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -3
- package/css/index-without-carbon-released-only.min.css.map +1 -0
- package/css/index-without-carbon.css +619 -236
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +9 -3
- package/css/index-without-carbon.min.css.map +1 -0
- package/css/index.css +950 -567
- package/css/index.css.map +1 -1
- package/css/index.min.css +9 -3
- package/css/index.min.css.map +1 -0
- package/es/components/APIKeyModal/APIKeyModal.js +25 -29
- package/es/components/ActionBar/ActionBar.js +4 -1
- package/es/components/ActionSet/ActionSet.js +22 -10
- package/es/components/ActionSet/actions.js +25 -17
- package/es/components/AddSelect/AddSelect.js +141 -53
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +56 -0
- package/es/components/AddSelect/AddSelectList.js +94 -0
- package/es/components/AddSelect/AddSelectSidebar.js +78 -0
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +24 -17
- package/es/components/CancelableTextEdit/CancelableTextEdit.js +62 -24
- package/es/components/Card/Card.js +6 -4
- package/es/components/CreateFullPage/CreateFullPage.js +102 -258
- package/es/components/CreateFullPage/CreateFullPageStep.js +65 -13
- package/es/components/CreateFullPage/index.js +1 -2
- package/es/components/CreateInfluencer/CreateInfluencer.js +40 -220
- package/es/components/CreateTearsheet/CreateTearsheet.js +95 -146
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +70 -20
- package/es/components/CreateTearsheet/index.js +0 -1
- package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +87 -28
- package/es/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +8 -6
- package/es/components/EmptyStates/EmptyState.js +1 -1
- package/es/components/EmptyStates/EmptyStateContent.js +2 -2
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
- package/es/components/ExportModal/ExportModal.js +41 -12
- package/es/components/ImportModal/ImportModal.js +2 -1
- package/es/components/InlineEdit/InlineEdit.js +397 -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/NotificationsPanel/NotificationsPanel.js +16 -3
- package/es/components/OptionsTile/OptionsTile.js +36 -15
- package/es/components/PageHeader/PageHeader.js +59 -35
- package/es/components/PageHeader/PageHeaderTitle.js +82 -7
- package/es/components/PageHeader/PageHeaderUtils.js +21 -2
- package/es/components/RemoveModal/RemoveModal.js +4 -2
- package/es/components/SidePanel/SidePanel.js +33 -16
- 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/Tearsheet/Tearsheet.js +1 -1
- package/es/components/Tearsheet/TearsheetNarrow.js +1 -1
- package/es/components/Tearsheet/TearsheetShell.js +1 -1
- package/es/components/Toolbar/Toolbar.js +69 -8
- package/es/components/WebTerminal/WebTerminal.js +1 -1
- package/es/components/index.js +4 -2
- package/es/global/js/hooks/index.js +1 -0
- package/es/global/js/hooks/useCreateComponentFocus.js +15 -19
- package/es/global/js/hooks/useCreateComponentStepChange.js +69 -79
- package/es/global/js/hooks/useResetCreateComponent.js +7 -4
- package/es/global/js/hooks/useRetrieveStepData.js +51 -0
- package/es/global/js/hooks/useValidCreateStepCount.js +4 -7
- package/es/global/js/package-settings.js +4 -2
- package/es/global/js/utils/lastIndexInArray.js +26 -0
- package/es/settings.js +0 -5
- package/lib/components/APIKeyModal/APIKeyModal.js +25 -29
- package/lib/components/ActionBar/ActionBar.js +4 -1
- package/lib/components/ActionSet/ActionSet.js +22 -10
- package/lib/components/ActionSet/actions.js +25 -17
- package/lib/components/AddSelect/AddSelect.js +141 -50
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +71 -0
- package/lib/components/AddSelect/AddSelectList.js +112 -0
- package/lib/components/AddSelect/AddSelectSidebar.js +89 -0
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +23 -16
- package/lib/components/CancelableTextEdit/CancelableTextEdit.js +62 -23
- package/lib/components/Card/Card.js +6 -4
- package/lib/components/CreateFullPage/CreateFullPage.js +102 -258
- package/lib/components/CreateFullPage/CreateFullPageStep.js +68 -13
- package/lib/components/CreateFullPage/index.js +1 -9
- package/lib/components/CreateInfluencer/CreateInfluencer.js +38 -231
- package/lib/components/CreateTearsheet/CreateTearsheet.js +97 -148
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +72 -19
- package/lib/components/CreateTearsheet/index.js +0 -8
- package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +86 -34
- package/lib/components/CreateTearsheet/preview-components/MultiStepWithIntro.js +8 -6
- package/lib/components/EmptyStates/EmptyState.js +1 -1
- package/lib/components/EmptyStates/EmptyStateContent.js +2 -2
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -1
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -1
- package/lib/components/ExportModal/ExportModal.js +38 -11
- package/lib/components/ImportModal/ImportModal.js +2 -1
- package/lib/components/InlineEdit/InlineEdit.js +413 -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/NotificationsPanel/NotificationsPanel.js +13 -1
- package/lib/components/OptionsTile/OptionsTile.js +36 -15
- package/lib/components/PageHeader/PageHeader.js +59 -35
- package/lib/components/PageHeader/PageHeaderTitle.js +91 -9
- package/lib/components/PageHeader/PageHeaderUtils.js +21 -2
- package/lib/components/RemoveModal/RemoveModal.js +4 -2
- package/lib/components/SidePanel/SidePanel.js +33 -16
- 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/Tearsheet/Tearsheet.js +1 -1
- package/lib/components/Tearsheet/TearsheetNarrow.js +1 -1
- package/lib/components/Tearsheet/TearsheetShell.js +1 -1
- package/lib/components/Toolbar/Toolbar.js +69 -6
- package/lib/components/WebTerminal/WebTerminal.js +1 -1
- package/lib/components/index.js +25 -9
- package/lib/global/js/hooks/index.js +8 -0
- package/lib/global/js/hooks/useCreateComponentFocus.js +15 -19
- package/lib/global/js/hooks/useCreateComponentStepChange.js +69 -79
- package/lib/global/js/hooks/useResetCreateComponent.js +7 -4
- package/lib/global/js/hooks/useRetrieveStepData.js +62 -0
- package/lib/global/js/hooks/useValidCreateStepCount.js +4 -7
- package/lib/global/js/package-settings.js +4 -2
- package/lib/global/js/utils/lastIndexInArray.js +35 -0
- package/lib/settings.js +0 -6
- package/package.json +24 -24
- package/scss/components/AddSelect/_add-select.scss +53 -8
- package/scss/components/BreadcrumbWithOverflow/_breadcrumb-with-overflow.scss +19 -15
- package/scss/components/BreadcrumbWithOverflow/_index.scss +1 -1
- package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +142 -70
- package/scss/components/CancelableTextEdit/_storybook-styles.scss +0 -7
- package/scss/components/CreateFullPage/_create-full-page.scss +4 -11
- package/scss/components/CreateInfluencer/_create-influencer.scss +4 -4
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +6 -10
- package/scss/components/CreateTearsheetNarrow/_storybook-styles.scss +0 -6
- package/scss/components/EditSidePanel/_storybook-styles.scss +0 -8
- package/scss/components/InlineEdit/_index.scss +8 -0
- package/scss/components/InlineEdit/_inline-edit.scss +320 -0
- package/scss/components/InlineEdit/_storybook-styles.scss +21 -0
- package/scss/components/LoadingBar/_storybook-styles.scss +0 -5
- 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/NotificationsPanel/_notifications-panel.scss +2 -2
- package/scss/components/OptionsTile/_storybook-styles.scss +0 -7
- package/scss/components/PageHeader/_index.scss +1 -1
- package/scss/components/PageHeader/_page-header.scss +18 -5
- package/scss/components/ProductiveCard/_productive-card.scss +0 -4
- package/scss/components/SidePanel/_side-panel.scss +15 -6
- 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/StatusIcon/_index.scss +1 -1
- package/scss/components/StatusIcon/_status-icon.scss +6 -4
- package/scss/components/TagSet/_index.scss +1 -1
- package/scss/components/UserProfileImage/_index.scss +1 -1
- package/scss/components/UserProfileImage/_user-profile-image.scss +2 -2
- package/scss/components/WebTerminal/_web-terminal.scss +2 -2
- package/scss/components/_index.scss +3 -1
- package/scss/global/styles/_project-settings.scss +5 -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/generated/feature-flags/feature-flags.js +0 -15
- 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/generated/feature-flags/feature-flags.js +0 -22
- package/lib/global/js/utils/hasValidType.js +0 -110
- package/scss/generated/feature-flags/_feature-flags.scss +0 -19
@@ -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,19 @@ 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 || breadcrumbItemForTitle), _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))
|
362
|
-
}, breadcrumbs ? /*#__PURE__*/React.createElement(BreadcrumbWithOverflow, {
|
368
|
+
className: cx("".concat(blockClass, "__breadcrumb-column"), _defineProperty({}, "".concat(blockClass, "__breadcrumb-column--background"), !!breadcrumbs || hasActionBar || widthIsNarrow))
|
369
|
+
}, breadcrumbs || breadcrumbItemForTitle ? /*#__PURE__*/React.createElement(BreadcrumbWithOverflow, {
|
363
370
|
className: "".concat(blockClass, "__breadcrumb"),
|
364
371
|
noTrailingSlash: !!title,
|
365
372
|
overflowAriaLabel: breadcrumbOverflowAriaLabel,
|
366
|
-
breadcrumbs: breadcrumbs
|
373
|
+
breadcrumbs: breadcrumbs && breadcrumbItemForTitle ? breadcrumbs.concat(breadcrumbItemForTitle) : breadcrumbItemForTitle ? [breadcrumbItemForTitle] : breadcrumbs // breadcrumbs may be null or undefined
|
374
|
+
|
367
375
|
}) : null), /*#__PURE__*/React.createElement(Column, {
|
368
|
-
className: cx(["".concat(blockClass, "__action-bar-column ").concat(blockClass, "__action-bar-column--background"), (
|
376
|
+
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
377
|
}, /*#__PURE__*/React.createElement("div", {
|
370
378
|
className: "".concat(blockClass, "__action-bar-column-content"),
|
371
379
|
ref: sizingContainerRef
|
@@ -379,8 +387,8 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
379
387
|
className: "".concat(blockClass, "__action-bar"),
|
380
388
|
onWidthChange: handleActionBarWidthChange,
|
381
389
|
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))
|
390
|
+
})) : widthIsNarrow && thePageActions(true, pageActionsInBreadcrumbRow))))) : null, !collapseTitle && (title || pageActions) ? /*#__PURE__*/React.createElement(Row, {
|
391
|
+
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
392
|
}, /*#__PURE__*/React.createElement(Column, {
|
385
393
|
className: "".concat(blockClass, "__title-column")
|
386
394
|
}, title ? /*#__PURE__*/React.createElement(PageHeaderTitle, {
|
@@ -510,8 +518,8 @@ PageHeader.propTypes = _objectSpread({
|
|
510
518
|
*
|
511
519
|
* NOTE: This prop is required if actionBarItems are supplied
|
512
520
|
*/
|
513
|
-
actionBarOverflowAriaLabel: PropTypes.string.isRequired.if(function (
|
514
|
-
var actionBarItems =
|
521
|
+
actionBarOverflowAriaLabel: PropTypes.string.isRequired.if(function (_ref9) {
|
522
|
+
var actionBarItems = _ref9.actionBarItems;
|
515
523
|
return actionBarItems && actionBarItems.length > 0;
|
516
524
|
}),
|
517
525
|
|
@@ -546,8 +554,8 @@ PageHeader.propTypes = _objectSpread({
|
|
546
554
|
* If the user supplies breadcrumbs then this property is required.
|
547
555
|
* It is used in an overflow menu when there is insufficient space to display all breadcrumbs inline.
|
548
556
|
*/
|
549
|
-
breadcrumbOverflowAriaLabel: PropTypes.string.isRequired.if(function (
|
550
|
-
var breadcrumbs =
|
557
|
+
breadcrumbOverflowAriaLabel: PropTypes.string.isRequired.if(function (_ref10) {
|
558
|
+
var breadcrumbs = _ref10.breadcrumbs;
|
551
559
|
return breadcrumbs && breadcrumbs.length > 0;
|
552
560
|
}),
|
553
561
|
|
@@ -586,8 +594,8 @@ PageHeader.propTypes = _objectSpread({
|
|
586
594
|
/**
|
587
595
|
* A text version of the `label` for display, required if `label` is not a string.
|
588
596
|
*/
|
589
|
-
title: PropTypes.string.isRequired.if(function (
|
590
|
-
var label =
|
597
|
+
title: PropTypes.string.isRequired.if(function (_ref11) {
|
598
|
+
var label = _ref11.label;
|
591
599
|
return typeof label !== 'string';
|
592
600
|
})
|
593
601
|
})),
|
@@ -617,9 +625,9 @@ PageHeader.propTypes = _objectSpread({
|
|
617
625
|
* If `hasCollapseHeaderToggle` is set and `withoutBackground` is unset/falsy then assistive text is
|
618
626
|
* required for both the expend and collapse states of the button component used.
|
619
627
|
*/
|
620
|
-
collapseHeaderIconDescription: PropTypes.string.isRequired.if(function (
|
621
|
-
var withoutBackground =
|
622
|
-
hasCollapseHeaderToggle =
|
628
|
+
collapseHeaderIconDescription: PropTypes.string.isRequired.if(function (_ref12) {
|
629
|
+
var withoutBackground = _ref12.withoutBackground,
|
630
|
+
hasCollapseHeaderToggle = _ref12.hasCollapseHeaderToggle;
|
623
631
|
return !withoutBackground && hasCollapseHeaderToggle;
|
624
632
|
}),
|
625
633
|
|
@@ -639,9 +647,9 @@ PageHeader.propTypes = _objectSpread({
|
|
639
647
|
* If `hasCollapseHeaderToggle` is set and `withoutBackground` is unset/falsy then assistive text is
|
640
648
|
* required for both the expend and collapse states of the button component used.
|
641
649
|
*/
|
642
|
-
expandHeaderIconDescription: PropTypes.string.isRequired.if(function (
|
643
|
-
var withoutBackground =
|
644
|
-
hasCollapseHeaderToggle =
|
650
|
+
expandHeaderIconDescription: PropTypes.string.isRequired.if(function (_ref13) {
|
651
|
+
var withoutBackground = _ref13.withoutBackground,
|
652
|
+
hasCollapseHeaderToggle = _ref13.hasCollapseHeaderToggle;
|
645
653
|
return !withoutBackground && hasCollapseHeaderToggle;
|
646
654
|
}),
|
647
655
|
|
@@ -712,8 +720,8 @@ PageHeader.propTypes = _objectSpread({
|
|
712
720
|
*
|
713
721
|
* NOTE: This prop is required if pageActions are supplied
|
714
722
|
*/
|
715
|
-
pageActionsOverflowLabel: PropTypes.node.isRequired.if(function (
|
716
|
-
var pageActions =
|
723
|
+
pageActionsOverflowLabel: PropTypes.node.isRequired.if(function (_ref14) {
|
724
|
+
var pageActions = _ref14.pageActions;
|
717
725
|
return pageActions && pageActions.length > 0 && !pageActions.content;
|
718
726
|
}),
|
719
727
|
|
@@ -759,6 +767,11 @@ PageHeader.propTypes = _objectSpread({
|
|
759
767
|
* - text: title string
|
760
768
|
* - icon: optional icon
|
761
769
|
* - loading: boolean shows loading indicator if true
|
770
|
+
* - onChange: function to process the live value (React change === HTML Input)
|
771
|
+
* - onSave: function to process a confirmed change
|
772
|
+
* - editableLabel: label for edit required if onChange supplied
|
773
|
+
* - cancelDescription: label for edit cancel button
|
774
|
+
* - saveDescription: label for edit save button
|
762
775
|
* - 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
776
|
* - content: title or name of current location shown in main part of page header
|
764
777
|
* - breadcrumbContent: version of content used in the breadcrumb on scroll. If not supplied
|
@@ -768,7 +781,18 @@ PageHeader.propTypes = _objectSpread({
|
|
768
781
|
// Update docgen if changed
|
769
782
|
text: PropTypes.string.isRequired,
|
770
783
|
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
771
|
-
loading: PropTypes.bool
|
784
|
+
loading: PropTypes.bool,
|
785
|
+
// inline edit version properties
|
786
|
+
editableLabel: PropTypes.string,
|
787
|
+
// .isRequired.if(inlineEditRequired),
|
788
|
+
id: PropTypes.string,
|
789
|
+
// .isRequired.if(inlineEditRequired),
|
790
|
+
onChange: PropTypes.func,
|
791
|
+
onSave: PropTypes.func,
|
792
|
+
cancelDescription: PropTypes.string,
|
793
|
+
//.isRequired.if(inlineEditRequired),
|
794
|
+
saveDescription: PropTypes.string //.isRequired.if(inlineEditRequired),
|
795
|
+
// Update docgen if changed
|
772
796
|
|
773
797
|
}), PropTypes.string, PropTypes.shape({
|
774
798
|
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", "onSave", "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,22 @@ 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
|
+
onSave = title.onSave,
|
30
|
+
editDescription = title.editDescription,
|
31
|
+
editableLabel = title.editableLabel,
|
32
|
+
revertDescription = title.revertDescription,
|
33
|
+
saveDescription = title.saveDescription,
|
34
|
+
rest = _objectWithoutProperties(title, _excluded);
|
35
|
+
|
24
36
|
var titleText;
|
37
|
+
var isEditable = !!onSave;
|
25
38
|
|
26
39
|
if (text || !content) {
|
27
40
|
if (text === undefined && typeof title === 'string') {
|
@@ -32,18 +45,80 @@ export var PageHeaderTitle = function PageHeaderTitle(_ref) {
|
|
32
45
|
var TitleIcon = icon;
|
33
46
|
titleInnards = /*#__PURE__*/React.createElement(React.Fragment, null, icon && !loading ? /*#__PURE__*/React.createElement(TitleIcon, {
|
34
47
|
className: "".concat(blockClass, "__title-icon")
|
35
|
-
}) : null, /*#__PURE__*/React.createElement(
|
36
|
-
title: !loading ? asText : null
|
37
|
-
}, loading ? /*#__PURE__*/React.createElement(SkeletonText, {
|
48
|
+
}) : null, loading ? /*#__PURE__*/React.createElement(SkeletonText, {
|
38
49
|
className: "".concat(blockClass, "__title-skeleton")
|
39
|
-
}) :
|
50
|
+
}) : isEditable ? /*#__PURE__*/React.createElement(InlineEdit, _extends({
|
51
|
+
hideLabel: true,
|
52
|
+
value: text,
|
53
|
+
editDescription: editDescription,
|
54
|
+
onChange: onChange,
|
55
|
+
onSave: onSave,
|
56
|
+
labelText: editableLabel,
|
57
|
+
revertDescription: revertDescription,
|
58
|
+
saveDescription: saveDescription
|
59
|
+
}, rest)) : /*#__PURE__*/React.createElement("span", {
|
60
|
+
title: !loading ? asText : null
|
61
|
+
}, text));
|
40
62
|
} else {
|
41
63
|
titleInnards = content;
|
42
64
|
titleText = asText;
|
43
65
|
}
|
44
66
|
|
45
67
|
return /*#__PURE__*/React.createElement("div", {
|
46
|
-
className: cx("".concat(blockClass, "__title"), _defineProperty({}, "".concat(blockClass, "__title--fades"), hasBreadcrumbRow)),
|
68
|
+
className: cx("".concat(blockClass, "__title"), _defineProperty({}, "".concat(blockClass, "__title--editable"), isEditable), _defineProperty({}, "".concat(blockClass, "__title--fades"), hasBreadcrumbRow)),
|
47
69
|
title: titleText
|
48
70
|
}, titleInnards);
|
71
|
+
};
|
72
|
+
export var inlineEditRequired = function inlineEditRequired(_ref2) {
|
73
|
+
var onSave = _ref2.onSave;
|
74
|
+
return !!onSave;
|
75
|
+
};
|
76
|
+
PageHeaderTitle.propTypes = {
|
77
|
+
// passed from page header
|
78
|
+
blockClass: PropTypes.string.isRequired,
|
79
|
+
|
80
|
+
/**
|
81
|
+
* controlled from within page header
|
82
|
+
*/
|
83
|
+
hasBreadcrumbRow: PropTypes.bool,
|
84
|
+
|
85
|
+
/**
|
86
|
+
* An optional page title supplied as a string or object with the following attributes: text, icon, loading
|
87
|
+
*
|
88
|
+
* Can be supplied either as:
|
89
|
+
* - String
|
90
|
+
* - Object containing
|
91
|
+
* - text: title string
|
92
|
+
* - icon: optional icon
|
93
|
+
* - loading: boolean shows loading indicator if true
|
94
|
+
* - onChange: function to process the live value (React change === HTML Input)
|
95
|
+
* - onSave: function to process a confirmed change
|
96
|
+
* - editDescription: description for edit button
|
97
|
+
* - editableLabel: label for edit required if onSave supplied
|
98
|
+
* - revertDescription: description for edit revert button
|
99
|
+
* - saveDescription: description for edit save button
|
100
|
+
* - 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.
|
101
|
+
* - content: title or name of current location shown in main part of page header
|
102
|
+
* - breadcrumbContent: version of content used in the breadcrumb on scroll. If not supplied
|
103
|
+
* - asText: String based representation of the title
|
104
|
+
*/
|
105
|
+
title: PropTypes.oneOfType([PropTypes.shape({
|
106
|
+
// Update docgen if changed
|
107
|
+
text: PropTypes.string.isRequired,
|
108
|
+
icon: PropTypes.oneOfType([PropTypes.func, PropTypes.object]),
|
109
|
+
loading: PropTypes.bool,
|
110
|
+
// inline edit version properties
|
111
|
+
editDescription: PropTypes.string.isRequired.if(inlineEditRequired),
|
112
|
+
editableLabel: PropTypes.string.isRequired.if(inlineEditRequired),
|
113
|
+
id: PropTypes.string.isRequired.if(inlineEditRequired),
|
114
|
+
onChange: PropTypes.func,
|
115
|
+
onSave: PropTypes.func,
|
116
|
+
revertDescription: PropTypes.string.isRequired.if(inlineEditRequired),
|
117
|
+
saveDescription: PropTypes.string.isRequired.if(inlineEditRequired) // Update docgen if changed
|
118
|
+
|
119
|
+
}), PropTypes.string, PropTypes.shape({
|
120
|
+
content: PropTypes.node.isRequired,
|
121
|
+
breadcrumbContent: PropTypes.node,
|
122
|
+
asText: PropTypes.string.isRequired
|
123
|
+
})])
|
49
124
|
};
|
@@ -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",
|
@@ -89,8 +89,12 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
89
89
|
var sidePanelInnerRef = useRef();
|
90
90
|
var sidePanelCloseRef = useRef();
|
91
91
|
var previousState = usePreviousValue({
|
92
|
-
size: size
|
93
|
-
|
92
|
+
size: size,
|
93
|
+
open: open
|
94
|
+
});
|
95
|
+
var reducedMotion = window && window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
|
96
|
+
matches: true
|
97
|
+
}; // scroll panel to top going between steps
|
94
98
|
|
95
99
|
useEffect(function () {
|
96
100
|
var panelRef = ref || sidePanelRef;
|
@@ -169,7 +173,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
169
173
|
|
170
174
|
|
171
175
|
useEffect(function () {
|
172
|
-
if (open && animateTitle && animationComplete && title && title.length) {
|
176
|
+
if (open && animateTitle && animationComplete && title && title.length && !reducedMotion.matches) {
|
173
177
|
var _document$querySelect2, _document$querySelect3, _document$querySelect4;
|
174
178
|
|
175
179
|
var sidePanelOuter = document.querySelector("#".concat(blockClass, "-outer"));
|
@@ -261,7 +265,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
261
265
|
_sidePanelOuter === null || _sidePanelOuter === void 0 ? void 0 : _sidePanelOuter.style.setProperty("--".concat(blockClass, "--subtitle-container-height"), "".concat(_sidePanelSubtitleElementHeight, "px"));
|
262
266
|
_sidePanelOuter === null || _sidePanelOuter === void 0 ? void 0 : _sidePanelOuter.style.setProperty("--".concat(blockClass, "--action-bar-container-height"), "".concat(sidePanelActionBarElementHeight, "px"));
|
263
267
|
}
|
264
|
-
}, [open, animateTitle, animationComplete, shouldRender, panelHeight, title, size]); // click outside functionality if `includeOverlay` prop is set
|
268
|
+
}, [open, animateTitle, animationComplete, shouldRender, panelHeight, title, size, reducedMotion.matches]); // click outside functionality if `includeOverlay` prop is set
|
265
269
|
|
266
270
|
useEffect(function () {
|
267
271
|
var handleOutsideClick = function handleOutsideClick(event) {
|
@@ -287,7 +291,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
287
291
|
return function () {
|
288
292
|
document.removeEventListener('click', handleOutsideClick);
|
289
293
|
};
|
290
|
-
}, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, ref]); // initialize the side panel to open
|
294
|
+
}, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, ref, onUnmount]); // initialize the side panel to open
|
291
295
|
|
292
296
|
useEffect(function () {
|
293
297
|
if (open) {
|
@@ -297,14 +301,21 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
297
301
|
|
298
302
|
var onAnimationEnd = function onAnimationEnd() {
|
299
303
|
if (!open) {
|
300
|
-
onUnmount
|
304
|
+
onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
|
301
305
|
setRender(false);
|
302
306
|
}
|
303
307
|
|
304
308
|
setAnimationComplete(true);
|
305
|
-
}; //
|
309
|
+
}; // Set the internal state `animationComplete` to true if
|
310
|
+
// prefers reduced motion is true
|
306
311
|
|
307
312
|
|
313
|
+
useEffect(function () {
|
314
|
+
if (reducedMotion.matches) {
|
315
|
+
setAnimationComplete(true);
|
316
|
+
}
|
317
|
+
}, [reducedMotion.matches]); // initializes the side panel to open
|
318
|
+
|
308
319
|
var _onAnimationStart = function onAnimationStart(event) {
|
309
320
|
event.persist();
|
310
321
|
var isPanelTarget = event.target.id === "".concat(blockClass, "-outer");
|
@@ -325,7 +336,13 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
325
336
|
pageContentElement.style.marginLeft = 0;
|
326
337
|
}
|
327
338
|
}
|
328
|
-
}, [open, placement, selectorPageContent, slideIn]);
|
339
|
+
}, [open, placement, selectorPageContent, slideIn]);
|
340
|
+
useEffect(function () {
|
341
|
+
if (!open && previousState !== null && previousState !== void 0 && previousState.open && reducedMotion.matches) {
|
342
|
+
setRender(false);
|
343
|
+
onUnmount === null || onUnmount === void 0 ? void 0 : onUnmount();
|
344
|
+
}
|
345
|
+
}, [open, onUnmount, reducedMotion.matches, previousState === null || previousState === void 0 ? void 0 : previousState.open]); // used to set margins of content for slide in panel version
|
329
346
|
|
330
347
|
useEffect(function () {
|
331
348
|
if (shouldRender && slideIn) {
|
@@ -333,15 +350,15 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
333
350
|
|
334
351
|
if (placement && placement === 'right' && pageContentElement) {
|
335
352
|
pageContentElement.style.marginRight = 0;
|
336
|
-
pageContentElement.style.transition = "margin-right ".concat(moderate02);
|
353
|
+
pageContentElement.style.transition = !reducedMotion.matches ? "margin-right ".concat(moderate02) : null;
|
337
354
|
pageContentElement.style.marginRight = SIDE_PANEL_SIZES[size];
|
338
355
|
} else if (pageContentElement) {
|
339
356
|
pageContentElement.style.marginLeft = 0;
|
340
|
-
pageContentElement.style.transition = "margin-left ".concat(moderate02);
|
357
|
+
pageContentElement.style.transition = !reducedMotion.matches ? "margin-left ".concat(moderate02) : null;
|
341
358
|
pageContentElement.style.marginLeft = SIDE_PANEL_SIZES[size];
|
342
359
|
}
|
343
360
|
}
|
344
|
-
}, [slideIn, selectorPageContent, placement, shouldRender, size]); // adds focus trap functionality
|
361
|
+
}, [slideIn, selectorPageContent, placement, shouldRender, size, reducedMotion.matches]); // adds focus trap functionality
|
345
362
|
|
346
363
|
/* istanbul ignore next */
|
347
364
|
|
@@ -368,7 +385,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
368
385
|
var _cx, _cx2;
|
369
386
|
|
370
387
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
371
|
-
className: cx("".concat(blockClass, "__title-container"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__on-detail-step"), currentStep > 0), _defineProperty(_cx, "".concat(blockClass, "__on-detail-step-without-title"), currentStep > 0 && !title), _defineProperty(_cx, "".concat(blockClass, "__title-container--no-title-animation"), !animateTitle), _defineProperty(_cx, "".concat(blockClass, "__title-container-is-animating"), !animationComplete || !open), _defineProperty(_cx, "".concat(blockClass, "__title-container-without-title"), !title), _cx))
|
388
|
+
className: cx("".concat(blockClass, "__title-container"), (_cx = {}, _defineProperty(_cx, "".concat(blockClass, "__on-detail-step"), currentStep > 0), _defineProperty(_cx, "".concat(blockClass, "__on-detail-step-without-title"), currentStep > 0 && !title), _defineProperty(_cx, "".concat(blockClass, "__title-container--no-title-animation"), !animateTitle), _defineProperty(_cx, "".concat(blockClass, "__title-container-is-animating"), !animationComplete || !open), _defineProperty(_cx, "".concat(blockClass, "__title-container-without-title"), !title), _defineProperty(_cx, "".concat(blockClass, "__title-container--reduced-motion"), reducedMotion.matches), _cx))
|
372
389
|
}, currentStep > 0 && /*#__PURE__*/React.createElement(Button, {
|
373
390
|
"aria-label": navigationBackIconDescription,
|
374
391
|
kind: "ghost",
|
@@ -426,7 +443,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
426
443
|
className: "".concat(blockClass, "__title-text"),
|
427
444
|
title: title,
|
428
445
|
"aria-hidden": false
|
429
|
-
}, title), animateTitle && title && title.length && /*#__PURE__*/React.createElement("h2", {
|
446
|
+
}, title), animateTitle && title && title.length && !reducedMotion.matches && /*#__PURE__*/React.createElement("h2", {
|
430
447
|
className: "".concat(blockClass, "__collapsed-title-text"),
|
431
448
|
title: title,
|
432
449
|
"aria-hidden": true
|
@@ -443,7 +460,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
443
460
|
id: "".concat(blockClass, "-outer"),
|
444
461
|
className: mainPanelClassNames,
|
445
462
|
style: {
|
446
|
-
animation: "".concat(open ? placement === 'right' ? "
|
463
|
+
animation: !reducedMotion.matches ? "".concat(open ? placement === 'right' ? "side-panel-entrance-right ".concat(moderate02) : "side-panel-entrance-left ".concat(moderate02) : placement === 'right' ? "side-panel-exit-right ".concat(moderate02) : "side-panel-exit-left ".concat(moderate02)) : null
|
447
464
|
},
|
448
465
|
onAnimationEnd: onAnimationEnd,
|
449
466
|
onAnimationStart: function onAnimationStart(event) {
|
@@ -476,7 +493,7 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
476
493
|
ref: sidePanelOverlayRef,
|
477
494
|
className: "".concat(blockClass, "__overlay"),
|
478
495
|
style: {
|
479
|
-
animation: "".concat(open ? "
|
496
|
+
animation: !reducedMotion.matches ? "".concat(open ? "side-panel-overlay-entrance ".concat(moderate02) : "side-panel-overlay-exit ".concat(moderate02)) : null
|
480
497
|
}
|
481
498
|
}));
|
482
499
|
}); // Return a placeholder if not released and not enabled by feature flag
|
@@ -508,7 +525,7 @@ SidePanel.propTypes = {
|
|
508
525
|
* See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
|
509
526
|
*/
|
510
527
|
actions: allPropTypes([ActionSet.validateActions(), PropTypes.arrayOf(PropTypes.shape(_objectSpread(_objectSpread({}, Button.propTypes), {}, {
|
511
|
-
kind: PropTypes.oneOf(['ghost', 'secondary', 'primary']),
|
528
|
+
kind: PropTypes.oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
|
512
529
|
label: PropTypes.string,
|
513
530
|
loading: PropTypes.bool,
|
514
531
|
// we duplicate this Button prop to improve the DocGen here
|
@@ -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
|
}) : []);
|
@@ -82,7 +82,7 @@ Tearsheet.propTypes = _objectSpread({
|
|
82
82
|
actions: allPropTypes([ActionSet.validateActions(function () {
|
83
83
|
return 'max';
|
84
84
|
}), PropTypes.arrayOf(PropTypes.shape(_objectSpread(_objectSpread({}, Button.propTypes), {}, {
|
85
|
-
kind: PropTypes.oneOf(['ghost', 'secondary', 'primary']),
|
85
|
+
kind: PropTypes.oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
|
86
86
|
label: PropTypes.string,
|
87
87
|
loading: PropTypes.bool,
|
88
88
|
// we duplicate this Button prop to improve the DocGen here
|
@@ -78,7 +78,7 @@ TearsheetNarrow.propTypes = _objectSpread({
|
|
78
78
|
actions: allPropTypes([ActionSet.validateActions(function () {
|
79
79
|
return 'lg';
|
80
80
|
}), PropTypes.arrayOf(PropTypes.shape(_objectSpread(_objectSpread({}, Button.propTypes), {}, {
|
81
|
-
kind: PropTypes.oneOf(['ghost', 'secondary', 'primary']),
|
81
|
+
kind: PropTypes.oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
|
82
82
|
label: PropTypes.string,
|
83
83
|
loading: PropTypes.bool,
|
84
84
|
// we duplicate this Button prop to improve the DocGen here
|
@@ -281,7 +281,7 @@ TearsheetShell.propTypes = _objectSpread({
|
|
281
281
|
actions: PropTypes.arrayOf( // NB we don't include the validator here, as the component wrapping this
|
282
282
|
// one should ensure appropriate validation is done.
|
283
283
|
PropTypes.shape(_objectSpread(_objectSpread({}, Button.propTypes), {}, {
|
284
|
-
kind: PropTypes.oneOf(['ghost', 'secondary', 'primary']),
|
284
|
+
kind: PropTypes.oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
|
285
285
|
label: PropTypes.string,
|
286
286
|
loading: PropTypes.bool,
|
287
287
|
// we duplicate this Button prop to improve the DocGen here
|