@carbon/ibm-products 1.7.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +227 -5762
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +5 -5
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +46 -3426
- 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 -1
- package/css/index-without-carbon.css +195 -4028
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +5 -5
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +195 -4029
- package/css/index.css.map +1 -1
- package/css/index.min.css +5 -5
- package/css/index.min.css.map +1 -1
- package/es/components/APIKeyModal/APIKeyModal.js +10 -13
- package/es/components/ActionBar/ActionBar.js +0 -3
- package/es/components/ActionBar/ActionBarItem.js +2 -6
- package/es/components/ActionSet/ActionSet.js +10 -12
- package/es/components/AddSelect/AddSelect.js +120 -25
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +4 -4
- package/es/components/AddSelect/AddSelectColumn.js +58 -0
- package/es/components/AddSelect/AddSelectList.js +67 -8
- package/es/components/AddSelect/AddSelectSidebar.js +7 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
- package/es/components/ButtonMenu/ButtonMenu.js +7 -5
- package/es/components/ButtonMenu/ButtonMenuItem.js +1 -2
- package/es/components/Card/Card.js +31 -21
- package/es/components/Card/CardFooter.js +14 -10
- package/es/components/Card/CardHeader.js +8 -6
- package/es/components/Cascade/Cascade.js +5 -4
- package/es/components/ComboButton/ComboButton.js +0 -4
- package/es/components/ComboButton/ComboButtonItem/index.js +0 -5
- package/es/components/CreateFullPage/CreateFullPageStep.js +15 -8
- package/es/components/CreateModal/CreateModal.js +1 -4
- package/es/components/CreateTearsheet/CreateTearsheet.js +10 -11
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +18 -14
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +563 -80
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +366 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +81 -0
- package/es/components/DataSpreadsheet/checkActiveHeaderCell.js +34 -0
- package/es/components/DataSpreadsheet/createActiveCellFn.js +47 -0
- package/es/components/DataSpreadsheet/createCellSelectionArea.js +45 -0
- package/es/components/DataSpreadsheet/getCellSize.js +30 -0
- package/es/components/EditSidePanel/EditSidePanel.js +9 -10
- package/es/components/EmptyStates/EmptyState.js +7 -6
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -8
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -8
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -8
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -8
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -8
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -8
- package/es/components/ExampleComponent/ExampleComponent.js +12 -13
- package/es/components/ExportModal/ExportModal.js +13 -9
- package/es/components/ExpressiveCard/ExpressiveCard.js +0 -8
- package/es/components/ImportModal/ImportModal.js +7 -5
- package/es/components/InlineEdit/InlineEdit.js +44 -46
- package/es/components/LoadingBar/LoadingBar.js +13 -17
- package/es/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -4
- package/es/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -5
- package/es/components/ModifiedTabs/ModifiedTabs.js +24 -18
- package/es/components/NotificationsPanel/NotificationsPanel.js +109 -86
- package/es/components/OptionsTile/OptionsTile.js +17 -10
- package/es/components/PageHeader/PageHeader.js +58 -47
- package/es/components/PageHeader/PageHeaderUtils.js +3 -7
- package/es/components/ProductiveCard/ProductiveCard.js +23 -12
- package/es/components/RemoveModal/RemoveModal.js +0 -3
- package/es/components/SidePanel/SidePanel.js +22 -17
- package/es/components/TagSet/TagSet.js +25 -12
- package/es/components/TagSet/TagSetModal.js +16 -12
- package/es/components/TagSet/TagSetOverflow.js +21 -13
- package/es/components/Tearsheet/Tearsheet.js +27 -18
- package/es/components/Tearsheet/TearsheetNarrow.js +18 -15
- package/es/components/Toolbar/ToolbarButton.js +0 -3
- package/es/components/UserProfileImage/UserProfileImage.js +2 -1
- package/es/components/WebTerminal/WebTerminal.js +17 -18
- package/es/components/index.js +0 -1
- package/es/global/js/hooks/index.js +1 -0
- package/es/global/js/hooks/useActiveElement.js +27 -0
- package/es/global/js/utils/DisplayBox.js +31 -0
- package/es/global/js/utils/Wrap.js +7 -5
- package/es/global/js/utils/deepCloneObject.js +26 -0
- package/lib/components/APIKeyModal/APIKeyModal.js +10 -13
- package/lib/components/ActionBar/ActionBar.js +0 -3
- package/lib/components/ActionBar/ActionBarItem.js +2 -6
- package/lib/components/ActionSet/ActionSet.js +10 -12
- package/lib/components/AddSelect/AddSelect.js +118 -24
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +2 -3
- package/lib/components/AddSelect/AddSelectColumn.js +79 -0
- package/lib/components/AddSelect/AddSelectList.js +65 -8
- package/lib/components/AddSelect/AddSelectSidebar.js +7 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
- package/lib/components/ButtonMenu/ButtonMenu.js +7 -5
- package/lib/components/ButtonMenu/ButtonMenuItem.js +1 -2
- package/lib/components/Card/Card.js +31 -21
- package/lib/components/Card/CardFooter.js +14 -10
- package/lib/components/Card/CardHeader.js +8 -6
- package/lib/components/Cascade/Cascade.js +5 -4
- package/lib/components/ComboButton/ComboButton.js +0 -4
- package/lib/components/ComboButton/ComboButtonItem/index.js +0 -5
- package/lib/components/CreateFullPage/CreateFullPageStep.js +17 -14
- package/lib/components/CreateModal/CreateModal.js +1 -4
- package/lib/components/CreateTearsheet/CreateTearsheet.js +10 -11
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +20 -20
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +567 -77
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +391 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +99 -0
- package/lib/components/DataSpreadsheet/checkActiveHeaderCell.js +45 -0
- package/lib/components/DataSpreadsheet/createActiveCellFn.js +58 -0
- package/lib/components/DataSpreadsheet/createCellSelectionArea.js +56 -0
- package/lib/components/DataSpreadsheet/getCellSize.js +39 -0
- package/lib/components/EditSidePanel/EditSidePanel.js +9 -10
- package/lib/components/EmptyStates/EmptyState.js +9 -8
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +3 -7
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +3 -7
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +3 -7
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +3 -7
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +3 -7
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +3 -7
- package/lib/components/ExampleComponent/ExampleComponent.js +12 -13
- package/lib/components/ExportModal/ExportModal.js +13 -9
- package/lib/components/ExpressiveCard/ExpressiveCard.js +0 -8
- package/lib/components/ImportModal/ImportModal.js +7 -5
- package/lib/components/InlineEdit/InlineEdit.js +43 -45
- package/lib/components/LoadingBar/LoadingBar.js +13 -17
- package/lib/components/ModifiedTabs/ModifiedTabLabelNew.js +0 -4
- package/lib/components/ModifiedTabs/ModifiedTabLabelWithClose.js +0 -5
- package/lib/components/ModifiedTabs/ModifiedTabs.js +24 -18
- package/lib/components/NotificationsPanel/NotificationsPanel.js +109 -86
- package/lib/components/OptionsTile/OptionsTile.js +17 -10
- package/lib/components/PageHeader/PageHeader.js +56 -46
- package/lib/components/PageHeader/PageHeaderUtils.js +3 -7
- package/lib/components/ProductiveCard/ProductiveCard.js +24 -18
- package/lib/components/RemoveModal/RemoveModal.js +0 -3
- package/lib/components/SidePanel/SidePanel.js +22 -17
- package/lib/components/TagSet/TagSet.js +26 -12
- package/lib/components/TagSet/TagSetModal.js +17 -13
- package/lib/components/TagSet/TagSetOverflow.js +24 -19
- package/lib/components/Tearsheet/Tearsheet.js +26 -17
- package/lib/components/Tearsheet/TearsheetNarrow.js +18 -15
- package/lib/components/Toolbar/ToolbarButton.js +0 -3
- package/lib/components/UserProfileImage/UserProfileImage.js +2 -1
- package/lib/components/WebTerminal/WebTerminal.js +17 -18
- package/lib/components/index.js +0 -8
- package/lib/global/js/hooks/index.js +8 -0
- package/lib/global/js/hooks/useActiveElement.js +39 -0
- package/lib/global/js/utils/DisplayBox.js +46 -0
- package/lib/global/js/utils/Wrap.js +7 -5
- package/lib/global/js/utils/deepCloneObject.js +37 -0
- package/package.json +18 -18
- package/scss/components/{CancelableTextEdit/_index.scss → ActionBar/_storybook-styles.scss} +2 -2
- package/scss/components/ActionSet/_storybook-styles.scss +1 -3
- package/scss/components/AddSelect/_add-select.scss +83 -14
- package/scss/components/{CancelableTextEdit → BreadcrumbWithOverflow}/_storybook-styles.scss +2 -2
- package/scss/components/ButtonSetWithOverflow/_storybook-styles.scss +8 -0
- package/scss/components/CreateInfluencer/_create-influencer.scss +2 -0
- package/scss/components/CreateModal/_create-modal.scss +1 -0
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +1 -0
- package/scss/components/CreateTearsheetNarrow/_create-tearsheet-narrow.scss +1 -0
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +53 -7
- package/scss/components/InlineEdit/_inline-edit.scss +36 -15
- package/scss/components/InlineEdit/_storybook-styles.scss +2 -0
- package/scss/components/LoadingBar/_loading-bar.scss +13 -0
- package/scss/components/NotificationsPanel/_notifications-panel.scss +3 -0
- package/scss/components/PageHeader/_page-header.scss +2 -0
- package/scss/components/SidePanel/_side-panel.scss +11 -4
- package/scss/components/StatusIcon/_status-icon.scss +1 -0
- package/scss/components/TagSet/_storybook-styles.scss +8 -0
- package/scss/components/Tearsheet/_tearsheet.scss +1 -2
- package/scss/components/UserProfileImage/_user-profile-image.scss +9 -0
- package/scss/components/WebTerminal/_web-terminal.scss +2 -0
- package/scss/components/_index.scss +0 -1
- package/scss/global/styles/_display-box.scss +62 -0
- package/es/components/CancelableTextEdit/CancelableTextEdit.js +0 -245
- package/es/components/CancelableTextEdit/index.js +0 -7
- package/lib/components/CancelableTextEdit/CancelableTextEdit.js +0 -265
- package/lib/components/CancelableTextEdit/index.js +0 -13
- package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +0 -212
@@ -10,13 +10,31 @@ import { Tabs, Tab } from 'carbon-components-react';
|
|
10
10
|
import { ModifiedTabLabelWithClose } from './ModifiedTabLabelWithClose';
|
11
11
|
import { ModifiedTabLabelNew } from './ModifiedTabLabelNew';
|
12
12
|
import { pkg } from '../../settings';
|
13
|
-
var componentName = 'ModifiedTabs';
|
13
|
+
var componentName = 'ModifiedTabs'; // Default values for props
|
14
|
+
|
15
|
+
var defaults = {
|
16
|
+
tabs: [{
|
17
|
+
id: 'tab-1',
|
18
|
+
label: 'Tab 1',
|
19
|
+
content: /*#__PURE__*/React.createElement("div", null, "Iam am the content of tab 1."),
|
20
|
+
unsavedContent: false
|
21
|
+
}],
|
22
|
+
newTabLabel: 'New tab',
|
23
|
+
newTabContent: 'Your new tab will be here soon',
|
24
|
+
onNewTab: undefined,
|
25
|
+
onCloseTab: undefined
|
26
|
+
};
|
14
27
|
export var ModifiedTabs = function ModifiedTabs(_ref) {
|
15
|
-
var tabs = _ref.tabs,
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
28
|
+
var _ref$tabs = _ref.tabs,
|
29
|
+
tabs = _ref$tabs === void 0 ? defaults.tabs : _ref$tabs,
|
30
|
+
_ref$newTabLabel = _ref.newTabLabel,
|
31
|
+
newTabLabel = _ref$newTabLabel === void 0 ? defaults.newTabLabel : _ref$newTabLabel,
|
32
|
+
_ref$newTabContent = _ref.newTabContent,
|
33
|
+
newTabContent = _ref$newTabContent === void 0 ? defaults.newTabContent : _ref$newTabContent,
|
34
|
+
_ref$onNewTab = _ref.onNewTab,
|
35
|
+
onNewTab = _ref$onNewTab === void 0 ? defaults.onNewTab : _ref$onNewTab,
|
36
|
+
_ref$onCloseTab = _ref.onCloseTab,
|
37
|
+
onCloseTab = _ref$onCloseTab === void 0 ? defaults.onCloseTab : _ref$onCloseTab;
|
20
38
|
|
21
39
|
var handleNewTab = function handleNewTab() {
|
22
40
|
if (onNewTab) {
|
@@ -98,16 +116,4 @@ ModifiedTabs.propTypes = {
|
|
98
116
|
*/
|
99
117
|
tabs: PropTypes.array
|
100
118
|
};
|
101
|
-
ModifiedTabs.defaultProps = {
|
102
|
-
tabs: [{
|
103
|
-
id: 'tab-1',
|
104
|
-
label: 'Tab 1',
|
105
|
-
content: /*#__PURE__*/React.createElement("div", null, "Iam am the content of tab 1."),
|
106
|
-
unsavedContent: false
|
107
|
-
}],
|
108
|
-
newTabLabel: 'New tab',
|
109
|
-
newTabContent: 'Your new tab will be here soon',
|
110
|
-
onNewTab: undefined,
|
111
|
-
onCloseTab: undefined
|
112
|
-
};
|
113
119
|
ModifiedTabs.displayName = componentName;
|
@@ -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 = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "
|
5
|
+
var _excluded = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "hourAgoText", "hoursAgoText", "minuteAgoText", "minutesAgoText", "monthAgoText", "monthsAgoText", "nowText", "onClickOutside", "onDismissAllNotifications", "onDismissSingleNotification", "onDoNotDisturbChange", "onSettingsClick", "onViewAllClick", "open", "previousLabel", "readLessLabel", "readMoreLabel", "secondsAgoText", "settingsIconDescription", "title", "todayLabel", "viewAllLabel", "yearAgoText", "yearsAgoText", "yesterdayAtText", "yesterdayLabel"];
|
6
6
|
|
7
7
|
/**
|
8
8
|
* Copyright IBM Corp. 2020, 2022
|
@@ -26,42 +26,121 @@ import { ErrorFilled16, WarningAltFilled16, CheckmarkFilled16, InformationSquare
|
|
26
26
|
import { usePreviousValue } from '../../global/js/hooks'; // The block part of our conventional BEM class names (blockClass__E--M).
|
27
27
|
|
28
28
|
var componentName = 'NotificationsPanel';
|
29
|
-
var blockClass = "".concat(pkg.prefix, "--notifications-panel");
|
29
|
+
var blockClass = "".concat(pkg.prefix, "--notifications-panel"); // Default values for props
|
30
|
+
|
31
|
+
var defaults = {
|
32
|
+
daysAgoText: function daysAgoText(value) {
|
33
|
+
return "".concat(value, " days ago");
|
34
|
+
},
|
35
|
+
dismissAllLabel: 'Dismiss all',
|
36
|
+
dismissSingleNotificationIconDescription: 'Dismiss',
|
37
|
+
doNotDisturbLabel: 'Do not disturb',
|
38
|
+
emptyStateLabel: 'You do not have any notifications',
|
39
|
+
hourAgoText: function hourAgoText(value) {
|
40
|
+
return "".concat(value, " hour ago");
|
41
|
+
},
|
42
|
+
hoursAgoText: function hoursAgoText(value) {
|
43
|
+
return "".concat(value, " hours ago");
|
44
|
+
},
|
45
|
+
minuteAgoText: function minuteAgoText(value) {
|
46
|
+
return "".concat(value, " minute ago");
|
47
|
+
},
|
48
|
+
minutesAgoText: function minutesAgoText(value) {
|
49
|
+
return "".concat(value, " minutes ago");
|
50
|
+
},
|
51
|
+
monthAgoText: function monthAgoText(value) {
|
52
|
+
return "".concat(value, " month ago");
|
53
|
+
},
|
54
|
+
monthsAgoText: function monthsAgoText(value) {
|
55
|
+
return "".concat(value, " months ago");
|
56
|
+
},
|
57
|
+
nowText: 'Now',
|
58
|
+
onDismissAllNotifications: function onDismissAllNotifications() {},
|
59
|
+
onDismissSingleNotification: function onDismissSingleNotification() {},
|
60
|
+
previousLabel: 'Previous',
|
61
|
+
readLessLabel: 'Read less',
|
62
|
+
readMoreLabel: 'Read more',
|
63
|
+
secondsAgoText: function secondsAgoText(value) {
|
64
|
+
return "".concat(value, " seconds ago");
|
65
|
+
},
|
66
|
+
settingsIconDescription: 'Settings',
|
67
|
+
title: 'Notifications',
|
68
|
+
todayLabel: 'Today',
|
69
|
+
viewAllLabel: function viewAllLabel(value) {
|
70
|
+
return "View all (".concat(value, ")");
|
71
|
+
},
|
72
|
+
yearAgoText: function yearAgoText(value) {
|
73
|
+
return "".concat(value, " year ago");
|
74
|
+
},
|
75
|
+
yearsAgoText: function yearsAgoText(value) {
|
76
|
+
return "".concat(value, " years ago");
|
77
|
+
},
|
78
|
+
yesterdayAtText: function yesterdayAtText(value) {
|
79
|
+
return "Yesterday at ".concat(value);
|
80
|
+
},
|
81
|
+
yesterdayLabel: 'Yesterday'
|
82
|
+
};
|
30
83
|
export var NotificationsPanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
31
84
|
var className = _ref.className,
|
32
85
|
data = _ref.data,
|
33
|
-
daysAgoText = _ref.daysAgoText,
|
34
|
-
|
35
|
-
|
86
|
+
_ref$daysAgoText = _ref.daysAgoText,
|
87
|
+
daysAgoText = _ref$daysAgoText === void 0 ? defaults.daysAgoText : _ref$daysAgoText,
|
88
|
+
_ref$dismissAllLabel = _ref.dismissAllLabel,
|
89
|
+
dismissAllLabel = _ref$dismissAllLabel === void 0 ? defaults.dismissAllLabel : _ref$dismissAllLabel,
|
90
|
+
_ref$dismissSingleNot = _ref.dismissSingleNotificationIconDescription,
|
91
|
+
dismissSingleNotificationIconDescription = _ref$dismissSingleNot === void 0 ? defaults.dismissSingleNotificationIconDescription : _ref$dismissSingleNot,
|
36
92
|
doNotDisturbDefaultToggled = _ref.doNotDisturbDefaultToggled,
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
93
|
+
_ref$doNotDisturbLabe = _ref.doNotDisturbLabel,
|
94
|
+
doNotDisturbLabel = _ref$doNotDisturbLabe === void 0 ? defaults.doNotDisturbLabel : _ref$doNotDisturbLabe,
|
95
|
+
_ref$emptyStateLabel = _ref.emptyStateLabel,
|
96
|
+
emptyStateLabel = _ref$emptyStateLabel === void 0 ? defaults.emptyStateLabel : _ref$emptyStateLabel,
|
97
|
+
_ref$hourAgoText = _ref.hourAgoText,
|
98
|
+
hourAgoText = _ref$hourAgoText === void 0 ? defaults.hourAgoText : _ref$hourAgoText,
|
99
|
+
_ref$hoursAgoText = _ref.hoursAgoText,
|
100
|
+
hoursAgoText = _ref$hoursAgoText === void 0 ? defaults.hoursAgoText : _ref$hoursAgoText,
|
101
|
+
_ref$minuteAgoText = _ref.minuteAgoText,
|
102
|
+
minuteAgoText = _ref$minuteAgoText === void 0 ? defaults.minuteAgoText : _ref$minuteAgoText,
|
103
|
+
_ref$minutesAgoText = _ref.minutesAgoText,
|
104
|
+
minutesAgoText = _ref$minutesAgoText === void 0 ? defaults.minutesAgoText : _ref$minutesAgoText,
|
105
|
+
_ref$monthAgoText = _ref.monthAgoText,
|
106
|
+
monthAgoText = _ref$monthAgoText === void 0 ? defaults.monthAgoText : _ref$monthAgoText,
|
107
|
+
_ref$monthsAgoText = _ref.monthsAgoText,
|
108
|
+
monthsAgoText = _ref$monthsAgoText === void 0 ? defaults.monthsAgoText : _ref$monthsAgoText,
|
109
|
+
_ref$nowText = _ref.nowText,
|
110
|
+
nowText = _ref$nowText === void 0 ? defaults.nowText : _ref$nowText,
|
46
111
|
onClickOutside = _ref.onClickOutside,
|
47
|
-
|
48
|
-
|
112
|
+
_ref$onDismissAllNoti = _ref.onDismissAllNotifications,
|
113
|
+
onDismissAllNotifications = _ref$onDismissAllNoti === void 0 ? defaults.onDismissAllNotifications : _ref$onDismissAllNoti,
|
114
|
+
_ref$onDismissSingleN = _ref.onDismissSingleNotification,
|
115
|
+
onDismissSingleNotification = _ref$onDismissSingleN === void 0 ? defaults.onDismissSingleNotification : _ref$onDismissSingleN,
|
49
116
|
onDoNotDisturbChange = _ref.onDoNotDisturbChange,
|
50
117
|
onSettingsClick = _ref.onSettingsClick,
|
51
118
|
onViewAllClick = _ref.onViewAllClick,
|
52
119
|
open = _ref.open,
|
53
|
-
previousLabel = _ref.previousLabel,
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
120
|
+
_ref$previousLabel = _ref.previousLabel,
|
121
|
+
previousLabel = _ref$previousLabel === void 0 ? defaults.previousLabel : _ref$previousLabel,
|
122
|
+
_ref$readLessLabel = _ref.readLessLabel,
|
123
|
+
readLessLabel = _ref$readLessLabel === void 0 ? defaults.readLessLabel : _ref$readLessLabel,
|
124
|
+
_ref$readMoreLabel = _ref.readMoreLabel,
|
125
|
+
readMoreLabel = _ref$readMoreLabel === void 0 ? defaults.readMoreLabel : _ref$readMoreLabel,
|
126
|
+
_ref$secondsAgoText = _ref.secondsAgoText,
|
127
|
+
secondsAgoText = _ref$secondsAgoText === void 0 ? defaults.secondsAgoText : _ref$secondsAgoText,
|
128
|
+
_ref$settingsIconDesc = _ref.settingsIconDescription,
|
129
|
+
settingsIconDescription = _ref$settingsIconDesc === void 0 ? defaults.settingsIconDescription : _ref$settingsIconDesc,
|
130
|
+
_ref$title = _ref.title,
|
131
|
+
title = _ref$title === void 0 ? defaults.title : _ref$title,
|
132
|
+
_ref$todayLabel = _ref.todayLabel,
|
133
|
+
todayLabel = _ref$todayLabel === void 0 ? defaults.todayLabel : _ref$todayLabel,
|
134
|
+
_ref$viewAllLabel = _ref.viewAllLabel,
|
135
|
+
viewAllLabel = _ref$viewAllLabel === void 0 ? defaults.viewAllLabel : _ref$viewAllLabel,
|
136
|
+
_ref$yearAgoText = _ref.yearAgoText,
|
137
|
+
yearAgoText = _ref$yearAgoText === void 0 ? defaults.yearAgoText : _ref$yearAgoText,
|
138
|
+
_ref$yearsAgoText = _ref.yearsAgoText,
|
139
|
+
yearsAgoText = _ref$yearsAgoText === void 0 ? defaults.yearsAgoText : _ref$yearsAgoText,
|
140
|
+
_ref$yesterdayAtText = _ref.yesterdayAtText,
|
141
|
+
yesterdayAtText = _ref$yesterdayAtText === void 0 ? defaults.yesterdayAtText : _ref$yesterdayAtText,
|
142
|
+
_ref$yesterdayLabel = _ref.yesterdayLabel,
|
143
|
+
yesterdayLabel = _ref$yesterdayLabel === void 0 ? defaults.yesterdayLabel : _ref$yesterdayLabel,
|
65
144
|
rest = _objectWithoutProperties(_ref, _excluded);
|
66
145
|
|
67
146
|
var notificationPanelRef = useRef();
|
@@ -415,12 +494,12 @@ NotificationsPanel.propTypes = {
|
|
415
494
|
/**
|
416
495
|
* Function that will dismiss all notifications
|
417
496
|
*/
|
418
|
-
onDismissAllNotifications: PropTypes.func
|
497
|
+
onDismissAllNotifications: PropTypes.func,
|
419
498
|
|
420
499
|
/**
|
421
500
|
* Function that will dismiss a single notification
|
422
501
|
*/
|
423
|
-
onDismissSingleNotification: PropTypes.func
|
502
|
+
onDismissSingleNotification: PropTypes.func,
|
424
503
|
|
425
504
|
/**
|
426
505
|
* Function that returns the current selected value of the disable notification toggle
|
@@ -501,60 +580,4 @@ NotificationsPanel.propTypes = {
|
|
501
580
|
* Sets the yesterday label text
|
502
581
|
*/
|
503
582
|
yesterdayLabel: PropTypes.string
|
504
|
-
}; // Default values for component props. Default values are not required for
|
505
|
-
// props that are required, nor for props where the component can apply
|
506
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
507
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
508
|
-
|
509
|
-
NotificationsPanel.defaultProps = {
|
510
|
-
daysAgoText: function daysAgoText(value) {
|
511
|
-
return "".concat(value, " days ago");
|
512
|
-
},
|
513
|
-
dismissAllLabel: 'Dismiss all',
|
514
|
-
dismissSingleNotificationIconDescription: 'Dismiss',
|
515
|
-
doNotDisturbLabel: 'Do not disturb',
|
516
|
-
emptyStateLabel: 'You do not have any notifications',
|
517
|
-
hourAgoText: function hourAgoText(value) {
|
518
|
-
return "".concat(value, " hour ago");
|
519
|
-
},
|
520
|
-
hoursAgoText: function hoursAgoText(value) {
|
521
|
-
return "".concat(value, " hours ago");
|
522
|
-
},
|
523
|
-
minuteAgoText: function minuteAgoText(value) {
|
524
|
-
return "".concat(value, " minute ago");
|
525
|
-
},
|
526
|
-
minutesAgoText: function minutesAgoText(value) {
|
527
|
-
return "".concat(value, " minutes ago");
|
528
|
-
},
|
529
|
-
monthAgoText: function monthAgoText(value) {
|
530
|
-
return "".concat(value, " month ago");
|
531
|
-
},
|
532
|
-
monthsAgoText: function monthsAgoText(value) {
|
533
|
-
return "".concat(value, " months ago");
|
534
|
-
},
|
535
|
-
nowText: 'Now',
|
536
|
-
onDismissAllNotifications: function onDismissAllNotifications() {},
|
537
|
-
onDismissSingleNotification: function onDismissSingleNotification() {},
|
538
|
-
previousLabel: 'Previous',
|
539
|
-
readLessLabel: 'Read less',
|
540
|
-
readMoreLabel: 'Read more',
|
541
|
-
secondsAgoText: function secondsAgoText(value) {
|
542
|
-
return "".concat(value, " seconds ago");
|
543
|
-
},
|
544
|
-
settingsIconDescription: 'Settings',
|
545
|
-
title: 'Notifications',
|
546
|
-
todayLabel: 'Today',
|
547
|
-
viewAllLabel: function viewAllLabel(value) {
|
548
|
-
return "View all (".concat(value, ")");
|
549
|
-
},
|
550
|
-
yearsAgoText: function yearsAgoText(value) {
|
551
|
-
return "".concat(value, " years ago");
|
552
|
-
},
|
553
|
-
yearAgoText: function yearAgoText(value) {
|
554
|
-
return "".concat(value, " year ago");
|
555
|
-
},
|
556
|
-
yesterdayLabel: 'Yesterday',
|
557
|
-
yesterdayAtText: function yesterdayAtText(value) {
|
558
|
-
return "Yesterday at ".concat(value);
|
559
|
-
}
|
560
583
|
};
|
@@ -25,7 +25,11 @@ import * as carbonMotion from '@carbon/motion'; // The block part of our convent
|
|
25
25
|
|
26
26
|
var blockClass = "".concat(pkg.prefix, "--options-tile");
|
27
27
|
var componentName = 'OptionsTile'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
28
|
+
// Default values for props
|
28
29
|
|
30
|
+
var defaults = {
|
31
|
+
size: 'xl'
|
32
|
+
};
|
29
33
|
/**
|
30
34
|
* TODO: A description of the component.
|
31
35
|
*/
|
@@ -42,7 +46,8 @@ export var OptionsTile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
42
46
|
lockedText = _ref.lockedText,
|
43
47
|
onToggle = _ref.onToggle,
|
44
48
|
open = _ref.open,
|
45
|
-
size = _ref.size,
|
49
|
+
_ref$size = _ref.size,
|
50
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
46
51
|
summary = _ref.summary,
|
47
52
|
warn = _ref.warn,
|
48
53
|
warnText = _ref.warnText,
|
@@ -180,9 +185,19 @@ export var OptionsTile = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
180
185
|
} else if (locked) {
|
181
186
|
Icon = Locked16;
|
182
187
|
summaryClasses.push("".concat(blockClass, "__summary--locked"));
|
188
|
+
|
189
|
+
if (!text) {
|
190
|
+
text = lockedText;
|
191
|
+
}
|
192
|
+
}
|
193
|
+
|
194
|
+
var hasValidationState = invalid || warn || locked;
|
195
|
+
var summaryHidden = !hasValidationState && enabled === false;
|
196
|
+
|
197
|
+
if (summaryHidden) {
|
198
|
+
summaryClasses.push("".concat(blockClass, "__summary--hidden"));
|
183
199
|
}
|
184
200
|
|
185
|
-
var summaryHidden = enabled === false;
|
186
201
|
return /*#__PURE__*/React.createElement("div", {
|
187
202
|
className: "".concat(blockClass, "__title")
|
188
203
|
}, /*#__PURE__*/React.createElement("h6", {
|
@@ -316,12 +331,4 @@ OptionsTile.propTypes = {
|
|
316
331
|
* Provide a text explaining why the OptionsTile is in warning state.
|
317
332
|
*/
|
318
333
|
warnText: PropTypes.string
|
319
|
-
}; // Default values for component props. Default values are not required for
|
320
|
-
// props that are required, nor for props where the component can apply
|
321
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
322
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
323
|
-
|
324
|
-
OptionsTile.defaultProps = {
|
325
|
-
open: false,
|
326
|
-
size: 'xl'
|
327
334
|
};
|
@@ -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 = ["actionBarItems", "actionBarMenuOptionsClass", "actionBarOverflowAriaLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTitle", "hasBackgroundAlways", "breadcrumbOverflowAriaLabel", "breadcrumbs", "children", "className", "collapseHeader", "collapseHeaderIconDescription", "collapseTitle", "disableBreadcrumbScroll", "expandHeaderIconDescription", "fullWidthGrid", "hasCollapseHeaderToggle", "narrowGrid", "navigation", "pageActions", "pageActionsOverflowLabel", "pageActionsMenuOptionsClass", "showAllTagsLabel", "subtitle", "tags", "title", "withoutBackground"];
|
5
|
+
var _excluded = ["actionBarItems", "actionBarMenuOptionsClass", "actionBarOverflowAriaLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTitle", "hasBackgroundAlways", "breadcrumbOverflowAriaLabel", "breadcrumbs", "children", "className", "collapseHeader", "collapseHeaderIconDescription", "collapseTitle", "disableBreadcrumbScroll", "enableBreadcrumbScroll", "expandHeaderIconDescription", "fullWidthGrid", "hasCollapseHeaderToggle", "narrowGrid", "navigation", "pageActions", "pageActionsOverflowLabel", "pageActionsMenuOptionsClass", "showAllTagsLabel", "subtitle", "tags", "title", "withoutBackground"];
|
6
6
|
|
7
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
8
|
|
@@ -20,6 +20,7 @@ import { layout05, baseFontSize } from '@carbon/layout';
|
|
20
20
|
import cx from 'classnames';
|
21
21
|
import { useResizeDetector } from 'react-resize-detector';
|
22
22
|
import { Grid, Column, Row, Button, Tag } from 'carbon-components-react';
|
23
|
+
import { breakpoints } from '@carbon/layout';
|
23
24
|
import { useWindowResize, useNearestScroll } from '../../global/js/hooks';
|
24
25
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
25
26
|
import { deprecateProp, prepareProps } from '../../global/js/utils/props-helper';
|
@@ -31,9 +32,14 @@ import { ButtonSetWithOverflow } from '../ButtonSetWithOverflow';
|
|
31
32
|
import { ChevronUp16 } from '@carbon/icons-react';
|
32
33
|
var componentName = 'PageHeader';
|
33
34
|
import { blockClass, utilCheckUpdateVerticalSpace, utilGetBreadcrumbItemForTitle, utilSetCollapsed } from './PageHeaderUtils';
|
34
|
-
import { PageHeaderTitle } from './PageHeaderTitle';
|
35
|
+
import { PageHeaderTitle } from './PageHeaderTitle'; // Default values for props
|
36
|
+
|
37
|
+
var defaults = {
|
38
|
+
fullWidthGrid: false,
|
39
|
+
narrowGrid: false
|
40
|
+
};
|
35
41
|
export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
36
|
-
var _withoutBackground,
|
42
|
+
var _withoutBackground, _ref2, _ref7, _cx2, _ref8, _cx4, _cx7;
|
37
43
|
|
38
44
|
var actionBarItems = _ref.actionBarItems,
|
39
45
|
actionBarMenuOptionsClass = _ref.actionBarMenuOptionsClass,
|
@@ -49,11 +55,14 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
49
55
|
collapseHeader = _ref.collapseHeader,
|
50
56
|
collapseHeaderIconDescription = _ref.collapseHeaderIconDescription,
|
51
57
|
collapseTitle = _ref.collapseTitle,
|
52
|
-
|
58
|
+
deprecated_disableBreadcrumbScroll = _ref.disableBreadcrumbScroll,
|
59
|
+
in_enableBreadcrumbScroll = _ref.enableBreadcrumbScroll,
|
53
60
|
expandHeaderIconDescription = _ref.expandHeaderIconDescription,
|
54
|
-
fullWidthGrid = _ref.fullWidthGrid,
|
61
|
+
_ref$fullWidthGrid = _ref.fullWidthGrid,
|
62
|
+
fullWidthGrid = _ref$fullWidthGrid === void 0 ? defaults.fullWidthGrid : _ref$fullWidthGrid,
|
55
63
|
hasCollapseHeaderToggle = _ref.hasCollapseHeaderToggle,
|
56
|
-
narrowGrid = _ref.narrowGrid,
|
64
|
+
_ref$narrowGrid = _ref.narrowGrid,
|
65
|
+
narrowGrid = _ref$narrowGrid === void 0 ? defaults.narrowGrid : _ref$narrowGrid,
|
57
66
|
navigation = _ref.navigation,
|
58
67
|
pageActions = _ref.pageActions,
|
59
68
|
pageActionsOverflowLabel = _ref.pageActionsOverflowLabel,
|
@@ -86,10 +95,11 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
86
95
|
var offsetTopMeasuringRef = useRef(null); // state based on props only
|
87
96
|
|
88
97
|
var hasActionBar = actionBarItems && actionBarItems.length > 0;
|
89
|
-
var hasBreadcrumbRow = !!breadcrumbs || !!actionBarItems;
|
98
|
+
var hasBreadcrumbRow = !!breadcrumbs || !!actionBarItems;
|
99
|
+
var enableBreadcrumbScroll = (_ref2 = in_enableBreadcrumbScroll !== null && in_enableBreadcrumbScroll !== void 0 ? in_enableBreadcrumbScroll : !deprecated_disableBreadcrumbScroll) !== null && _ref2 !== void 0 ? _ref2 : false; // utility functions
|
90
100
|
|
91
101
|
var checkUpdateVerticalSpace = function checkUpdateVerticalSpace() {
|
92
|
-
return utilCheckUpdateVerticalSpace(headerRef, offsetTopMeasuringRef, navigation,
|
102
|
+
return utilCheckUpdateVerticalSpace(headerRef, offsetTopMeasuringRef, navigation, enableBreadcrumbScroll, hasActionBar, widthIsNarrow, setMetrics);
|
93
103
|
}; // NOTE: The buffer is used to add space between the bottom of the header and the last content
|
94
104
|
// Not pre-collapsed and (subtitle or children)
|
95
105
|
|
@@ -152,9 +162,9 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
152
162
|
setWidthIsNarrow = _useState26[1]; // handlers
|
153
163
|
|
154
164
|
|
155
|
-
var handleActionBarWidthChange = function handleActionBarWidthChange(
|
156
|
-
var minWidth =
|
157
|
-
maxWidth =
|
165
|
+
var handleActionBarWidthChange = function handleActionBarWidthChange(_ref3) {
|
166
|
+
var minWidth = _ref3.minWidth,
|
167
|
+
maxWidth = _ref3.maxWidth;
|
158
168
|
|
159
169
|
/* don't know how to test resize */
|
160
170
|
|
@@ -167,9 +177,9 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
167
177
|
setActionBarMinWidth(minWidth);
|
168
178
|
};
|
169
179
|
|
170
|
-
var handlePageActionWidthChange = function handlePageActionWidthChange(
|
171
|
-
var minWidth =
|
172
|
-
maxWidth =
|
180
|
+
var handlePageActionWidthChange = function handlePageActionWidthChange(_ref4) {
|
181
|
+
var minWidth = _ref4.minWidth,
|
182
|
+
maxWidth = _ref4.maxWidth;
|
173
183
|
|
174
184
|
/* don't know how to test resize */
|
175
185
|
|
@@ -265,10 +275,10 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
265
275
|
return _objectSpread(_objectSpread({}, prev), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, "--".concat(blockClass, "--height-px"), "".concat(metrics.headerHeight, "px")), _defineProperty(_objectSpread3, "--".concat(blockClass, "--width-px"), "".concat(metrics.headerWidth, "px")), _defineProperty(_objectSpread3, "--".concat(blockClass, "--header-top"), "".concat(metrics.headerTopValue + metrics.headerOffset, "px")), _defineProperty(_objectSpread3, "--".concat(blockClass, "--breadcrumb-title-visibility"), scrollYValue > 0 ? 'visible' : 'hidden'), _defineProperty(_objectSpread3, "--".concat(blockClass, "--scroll"), "".concat(scrollYValue)), _defineProperty(_objectSpread3, "--".concat(blockClass, "--breadcrumb-title-top"), "".concat(Math.max(0, metrics.breadcrumbTitleHeight + metrics.titleRowSpaceAbove - scrollYValue), "px")), _defineProperty(_objectSpread3, "--".concat(blockClass, "--breadcrumb-title-opacity"), "".concat(Math.min(1, Math.max(0, (scrollYValue - (metrics.titleRowSpaceAbove || 0)) / (metrics.breadcrumbTitleHeight || 1) // don't want to divide by zero
|
266
276
|
)))), _defineProperty(_objectSpread3, "--".concat(blockClass, "--breadcrumb-row-width-px"), "".concat(metrics.breadcrumbRowWidth, "px")), _objectSpread3));
|
267
277
|
});
|
268
|
-
}, [headerRef,
|
278
|
+
}, [headerRef, enableBreadcrumbScroll, metrics, metrics.breadcrumbRowHeight, metrics.breadcrumbRowSpaceBelow, metrics.breadcrumbTitleHeight, metrics.breadcrumbRowWidth, metrics.headerHeight, metrics.headerWidth, metrics.headerOffset, metrics.headerTopValue, metrics.navigationRowHeight, navigation, scrollYValue, tags]);
|
269
279
|
useNearestScroll(headerRef, // on scroll or various layout changes check updates if needed
|
270
|
-
function (
|
271
|
-
var current =
|
280
|
+
function (_ref5) {
|
281
|
+
var current = _ref5.current;
|
272
282
|
setPageHeaderStyles(function (prev) {
|
273
283
|
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, "--".concat(blockClass, "--breadcrumb-top"), "".concat(metrics.headerOffset, "px")));
|
274
284
|
});
|
@@ -283,13 +293,13 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
283
293
|
document.documentElement.style.setProperty("--".concat(blockClass, "--tagset-tooltip-position"), fullyCollapsed ? 'fixed' : 'absolute');
|
284
294
|
document.documentElement.style.setProperty("--".concat(blockClass, "--tagset-tooltip-offset"), "".concat(tagsetTooltipOffset, "px"));
|
285
295
|
setScrollYValue(current.scrollY);
|
286
|
-
}, [metrics.headerHeight, metrics.headerTopValue, metrics.headerOffset,
|
287
|
-
useWindowResize(function (
|
288
|
-
var current =
|
296
|
+
}, [metrics.headerHeight, metrics.headerTopValue, metrics.headerOffset, enableBreadcrumbScroll]);
|
297
|
+
useWindowResize(function (_ref6) {
|
298
|
+
var current = _ref6.current;
|
289
299
|
// on window resize and other updates some values may have changed
|
290
300
|
checkUpdateVerticalSpace();
|
291
|
-
setWidthIsNarrow(current.innerWidth <
|
292
|
-
}, [actionBarItems, children, breadcrumbs,
|
301
|
+
setWidthIsNarrow(current.innerWidth < breakpoints.md.width); // small (below medium) media query
|
302
|
+
}, [actionBarItems, children, breadcrumbs, enableBreadcrumbScroll, navigation, pageActions, subtitle, tags, title]);
|
293
303
|
useEffect(function () {
|
294
304
|
checkUpdateVerticalSpace(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
295
305
|
}, [fullWidthGrid, narrowGrid]);
|
@@ -327,7 +337,7 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
327
337
|
|
328
338
|
var nextToTabsCheck = function nextToTabsCheck() {
|
329
339
|
/* istanbul ignore next */
|
330
|
-
return
|
340
|
+
return enableBreadcrumbScroll && !actionBarItems && scrollYValue + metrics.headerTopValue >= 0;
|
331
341
|
};
|
332
342
|
|
333
343
|
useEffect(function () {
|
@@ -351,7 +361,7 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
351
361
|
className: "".concat(blockClass, "--offset-top-measuring-element"),
|
352
362
|
ref: offsetTopMeasuringRef
|
353
363
|
}), /*#__PURE__*/React.createElement("section", _extends({}, rest, {
|
354
|
-
className: cx([blockClass, "".concat(blockClass, "--no-margins-below-row"), className, (
|
364
|
+
className: cx([blockClass, "".concat(blockClass, "--no-margins-below-row"), className, (_ref7 = {}, _defineProperty(_ref7, "".concat(blockClass, "--has-navigation"), navigation || tags), _defineProperty(_ref7, "".concat(blockClass, "--has-navigation-tags-only"), !navigation && tags), _ref7)]),
|
355
365
|
style: pageHeaderStyles,
|
356
366
|
ref: headerRef
|
357
367
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(Grid, {
|
@@ -373,7 +383,7 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
373
383
|
breadcrumbs: breadcrumbs && breadcrumbItemForTitle ? breadcrumbs.concat(breadcrumbItemForTitle) : breadcrumbItemForTitle ? [breadcrumbItemForTitle] : breadcrumbs // breadcrumbs may be null or undefined
|
374
384
|
|
375
385
|
}) : null), /*#__PURE__*/React.createElement(Column, {
|
376
|
-
className: cx(["".concat(blockClass, "__action-bar-column ").concat(blockClass, "__action-bar-column--background"), (
|
386
|
+
className: cx(["".concat(blockClass, "__action-bar-column ").concat(blockClass, "__action-bar-column--background"), (_ref8 = {}, _defineProperty(_ref8, "".concat(blockClass, "__action-bar-column--has-page-actions"), pageActions), _defineProperty(_ref8, "".concat(blockClass, "__action-bar-column--influenced-by-collapse-button"), spaceForCollapseButton), _ref8)])
|
377
387
|
}, /*#__PURE__*/React.createElement("div", {
|
378
388
|
className: "".concat(blockClass, "__action-bar-column-content"),
|
379
389
|
ref: sizingContainerRef
|
@@ -418,7 +428,7 @@ export var PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
418
428
|
showAllTagsLabel: showAllTagsLabel,
|
419
429
|
tags: tags,
|
420
430
|
overflowClassName: "".concat(blockClass, "__navigation-tags-overflow")
|
421
|
-
}))) : null), // this navigation pushes the breadcrumb off or settles underneath it depending on
|
431
|
+
}))) : null), // this navigation pushes the breadcrumb off or settles underneath it depending on enableBreadcrumbScroll
|
422
432
|
navigation ? /*#__PURE__*/React.createElement(Row, {
|
423
433
|
className: cx("".concat(blockClass, "__navigation-row"), (_cx7 = {}, _defineProperty(_cx7, "".concat(blockClass, "__navigation-row--spacing-above-06"), !!navigation), _defineProperty(_cx7, "".concat(blockClass, "__navigation-row--has-tags"), tags), _cx7))
|
424
434
|
}, /*#__PURE__*/React.createElement(Column, {
|
@@ -490,6 +500,11 @@ var TYPES = {
|
|
490
500
|
};
|
491
501
|
var tagTypes = Object.keys(TYPES);
|
492
502
|
export var deprecatedProps = {
|
503
|
+
/**
|
504
|
+
* **Deprecated** see property `enableBreadcrumbScroll`
|
505
|
+
*/
|
506
|
+
disableBreadcrumbScroll: deprecateProp(PropTypes.bool, 'Property replaced by `enableBreadcrumbScroll`'),
|
507
|
+
|
493
508
|
/**
|
494
509
|
* **Deprecated** see property `withoutBackground`
|
495
510
|
*/
|
@@ -518,8 +533,8 @@ PageHeader.propTypes = _objectSpread({
|
|
518
533
|
*
|
519
534
|
* NOTE: This prop is required if actionBarItems are supplied
|
520
535
|
*/
|
521
|
-
actionBarOverflowAriaLabel: PropTypes.string.isRequired.if(function (
|
522
|
-
var actionBarItems =
|
536
|
+
actionBarOverflowAriaLabel: PropTypes.string.isRequired.if(function (_ref10) {
|
537
|
+
var actionBarItems = _ref10.actionBarItems;
|
523
538
|
return actionBarItems && actionBarItems.length > 0;
|
524
539
|
}),
|
525
540
|
|
@@ -554,8 +569,8 @@ PageHeader.propTypes = _objectSpread({
|
|
554
569
|
* If the user supplies breadcrumbs then this property is required.
|
555
570
|
* It is used in an overflow menu when there is insufficient space to display all breadcrumbs inline.
|
556
571
|
*/
|
557
|
-
breadcrumbOverflowAriaLabel: PropTypes.string.isRequired.if(function (
|
558
|
-
var breadcrumbs =
|
572
|
+
breadcrumbOverflowAriaLabel: PropTypes.string.isRequired.if(function (_ref11) {
|
573
|
+
var breadcrumbs = _ref11.breadcrumbs;
|
559
574
|
return breadcrumbs && breadcrumbs.length > 0;
|
560
575
|
}),
|
561
576
|
|
@@ -594,8 +609,8 @@ PageHeader.propTypes = _objectSpread({
|
|
594
609
|
/**
|
595
610
|
* A text version of the `label` for display, required if `label` is not a string.
|
596
611
|
*/
|
597
|
-
title: PropTypes.string.isRequired.if(function (
|
598
|
-
var label =
|
612
|
+
title: PropTypes.string.isRequired.if(function (_ref12) {
|
613
|
+
var label = _ref12.label;
|
599
614
|
return typeof label !== 'string';
|
600
615
|
})
|
601
616
|
})),
|
@@ -625,9 +640,9 @@ PageHeader.propTypes = _objectSpread({
|
|
625
640
|
* If `hasCollapseHeaderToggle` is set and `withoutBackground` is unset/falsy then assistive text is
|
626
641
|
* required for both the expend and collapse states of the button component used.
|
627
642
|
*/
|
628
|
-
collapseHeaderIconDescription: PropTypes.string.isRequired.if(function (
|
629
|
-
var withoutBackground =
|
630
|
-
hasCollapseHeaderToggle =
|
643
|
+
collapseHeaderIconDescription: PropTypes.string.isRequired.if(function (_ref13) {
|
644
|
+
var withoutBackground = _ref13.withoutBackground,
|
645
|
+
hasCollapseHeaderToggle = _ref13.hasCollapseHeaderToggle;
|
631
646
|
return !withoutBackground && hasCollapseHeaderToggle;
|
632
647
|
}),
|
633
648
|
|
@@ -638,18 +653,18 @@ PageHeader.propTypes = _objectSpread({
|
|
638
653
|
collapseTitle: PropTypes.bool,
|
639
654
|
|
640
655
|
/**
|
641
|
-
* Standard
|
642
|
-
*
|
656
|
+
* Standard keeps the breadcrumb on the page. This option allows the breadcrumb
|
657
|
+
* to scroll off
|
643
658
|
*/
|
644
|
-
|
659
|
+
enableBreadcrumbScroll: PropTypes.bool,
|
645
660
|
|
646
661
|
/**
|
647
662
|
* If `hasCollapseHeaderToggle` is set and `withoutBackground` is unset/falsy then assistive text is
|
648
663
|
* required for both the expend and collapse states of the button component used.
|
649
664
|
*/
|
650
|
-
expandHeaderIconDescription: PropTypes.string.isRequired.if(function (
|
651
|
-
var withoutBackground =
|
652
|
-
hasCollapseHeaderToggle =
|
665
|
+
expandHeaderIconDescription: PropTypes.string.isRequired.if(function (_ref14) {
|
666
|
+
var withoutBackground = _ref14.withoutBackground,
|
667
|
+
hasCollapseHeaderToggle = _ref14.hasCollapseHeaderToggle;
|
653
668
|
return !withoutBackground && hasCollapseHeaderToggle;
|
654
669
|
}),
|
655
670
|
|
@@ -720,8 +735,8 @@ PageHeader.propTypes = _objectSpread({
|
|
720
735
|
*
|
721
736
|
* NOTE: This prop is required if pageActions are supplied
|
722
737
|
*/
|
723
|
-
pageActionsOverflowLabel: PropTypes.node.isRequired.if(function (
|
724
|
-
var pageActions =
|
738
|
+
pageActionsOverflowLabel: PropTypes.node.isRequired.if(function (_ref15) {
|
739
|
+
var pageActions = _ref15.pageActions;
|
725
740
|
return pageActions && pageActions.length > 0 && !pageActions.content;
|
726
741
|
}),
|
727
742
|
|
@@ -806,8 +821,4 @@ PageHeader.propTypes = _objectSpread({
|
|
806
821
|
*/
|
807
822
|
withoutBackground: PropTypes.bool
|
808
823
|
}, deprecatedProps);
|
809
|
-
PageHeader.defaultProps = {
|
810
|
-
fullWidthGrid: false,
|
811
|
-
narrowGrid: false
|
812
|
-
};
|
813
824
|
PageHeader.displayName = componentName;
|
@@ -21,13 +21,13 @@ export var blockClass = "".concat(pkg.prefix, "--page-header");
|
|
21
21
|
* @param {{}} headerRef
|
22
22
|
* @param {{}} offsetTopMeasuringRef
|
23
23
|
* @param {{}} navigation
|
24
|
-
* @param {boolean}
|
24
|
+
* @param {boolean} enableBreadcrumbScroll
|
25
25
|
* @param {boolean} hasActionBar
|
26
26
|
* @param {boolean} widthIsNarrow
|
27
27
|
* @param {()} setMetrics
|
28
28
|
*/
|
29
29
|
|
30
|
-
export var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(headerRef, offsetTopMeasuringRef, navigation,
|
30
|
+
export var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(headerRef, offsetTopMeasuringRef, navigation, enableBreadcrumbScroll, hasActionBar, widthIsNarrow, setMetrics) {
|
31
31
|
var dynamicRefs = {};
|
32
32
|
|
33
33
|
var getDynamicRef = function getDynamicRef(selector) {
|
@@ -112,13 +112,9 @@ export var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(
|
|
112
112
|
update.headerTopValue += 8;
|
113
113
|
}
|
114
114
|
|
115
|
-
if (
|
115
|
+
if (!enableBreadcrumbScroll || !navigation) {
|
116
116
|
// adjust sticky top if no navigation or breadcrumb is to stay on screen
|
117
117
|
update.headerTopValue += update.breadcrumbRowHeight;
|
118
|
-
} else {
|
119
|
-
if (navigation && !widthIsNarrow) {
|
120
|
-
update.headerTopValue -= 8;
|
121
|
-
}
|
122
118
|
}
|
123
119
|
|
124
120
|
if (window) {
|