@carbon/ibm-products 1.5.0 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +389 -139
- 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 +33 -27
- 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 +330 -133
- 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 +332 -135
- 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 +10 -13
- package/es/components/ActionBar/ActionBar.js +0 -3
- package/es/components/ActionBar/ActionBarItem.js +2 -6
- package/es/components/ActionSet/ActionSet.js +11 -13
- package/es/components/AddSelect/AddSelect.js +122 -72
- package/es/components/AddSelect/AddSelectBreadcrumbs.js +56 -0
- package/es/components/AddSelect/AddSelectList.js +94 -0
- package/es/components/AddSelect/AddSelectSidebar.js +110 -0
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +5 -5
- package/es/components/ButtonMenu/ButtonMenu.js +6 -4
- package/es/components/ButtonMenu/ButtonMenuItem.js +1 -2
- package/es/components/Card/Card.js +37 -25
- 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 +414 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +138 -0
- package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +64 -0
- package/es/components/DataSpreadsheet/createActiveCellFn.js +45 -0
- package/es/components/DataSpreadsheet/generateData.js +47 -0
- package/es/components/DataSpreadsheet/getCellSize.js +30 -0
- package/es/components/{CancelableTextEdit → DataSpreadsheet}/index.js +2 -2
- package/es/components/EditSidePanel/EditSidePanel.js +9 -10
- package/es/components/EmptyStates/EmptyState.js +8 -7
- package/es/components/EmptyStates/EmptyStateContent.js +2 -2
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +5 -9
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +5 -9
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +5 -9
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +5 -9
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +5 -9
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +5 -9
- 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 +256 -88
- 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 +125 -89
- package/es/components/OptionsTile/OptionsTile.js +6 -9
- package/es/components/PageHeader/PageHeader.js +19 -13
- package/es/components/PageHeader/PageHeaderTitle.js +10 -6
- package/es/components/ProductiveCard/ProductiveCard.js +23 -12
- package/es/components/RemoveModal/RemoveModal.js +0 -3
- package/es/components/SidePanel/SidePanel.js +54 -32
- package/es/components/TagSet/TagSet.js +13 -9
- 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/Tearsheet/TearsheetShell.js +3 -4
- package/es/components/Toolbar/ToolbarButton.js +0 -3
- package/es/components/WebTerminal/WebTerminal.js +18 -19
- package/es/components/index.js +2 -2
- package/es/global/js/hooks/index.js +1 -0
- package/es/global/js/hooks/useActiveElement.js +27 -0
- package/es/global/js/package-settings.js +2 -1
- package/es/global/js/utils/Wrap.js +7 -5
- package/es/global/js/utils/getScrollbarWidth.js +14 -0
- package/es/settings.js +0 -5
- 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 +11 -13
- package/lib/components/AddSelect/AddSelect.js +126 -72
- package/lib/components/AddSelect/AddSelectBreadcrumbs.js +71 -0
- package/lib/components/AddSelect/AddSelectList.js +112 -0
- package/lib/components/AddSelect/AddSelectSidebar.js +122 -0
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +5 -5
- package/lib/components/ButtonMenu/ButtonMenu.js +6 -4
- package/lib/components/ButtonMenu/ButtonMenuItem.js +1 -2
- package/lib/components/Card/Card.js +37 -25
- 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 +438 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +161 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +80 -0
- package/lib/components/DataSpreadsheet/createActiveCellFn.js +56 -0
- package/lib/components/DataSpreadsheet/generateData.js +58 -0
- package/lib/components/DataSpreadsheet/getCellSize.js +39 -0
- package/lib/components/DataSpreadsheet/index.js +13 -0
- package/lib/components/EditSidePanel/EditSidePanel.js +9 -10
- package/lib/components/EmptyStates/EmptyState.js +10 -9
- package/lib/components/EmptyStates/EmptyStateContent.js +2 -2
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +4 -8
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +4 -8
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +4 -8
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +4 -8
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +4 -8
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +4 -8
- 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 +253 -87
- 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 +122 -87
- package/lib/components/OptionsTile/OptionsTile.js +6 -9
- package/lib/components/PageHeader/PageHeader.js +18 -12
- package/lib/components/PageHeader/PageHeaderTitle.js +10 -6
- package/lib/components/ProductiveCard/ProductiveCard.js +24 -18
- package/lib/components/RemoveModal/RemoveModal.js +0 -3
- package/lib/components/SidePanel/SidePanel.js +54 -32
- package/lib/components/TagSet/TagSet.js +13 -9
- 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/Tearsheet/TearsheetShell.js +2 -3
- package/lib/components/Toolbar/ToolbarButton.js +0 -3
- package/lib/components/WebTerminal/WebTerminal.js +18 -19
- package/lib/components/index.js +8 -8
- package/lib/global/js/hooks/index.js +8 -0
- package/lib/global/js/hooks/useActiveElement.js +39 -0
- package/lib/global/js/package-settings.js +2 -1
- package/lib/global/js/utils/Wrap.js +7 -5
- package/lib/global/js/utils/getScrollbarWidth.js +23 -0
- package/lib/settings.js +0 -6
- package/package.json +25 -23
- package/scss/components/AddSelect/_add-select.scss +59 -5
- package/scss/components/BreadcrumbWithOverflow/_index.scss +1 -1
- package/scss/components/CreateInfluencer/_create-influencer.scss +4 -4
- package/scss/components/CreateTearsheet/_create-tearsheet.scss +2 -2
- package/scss/components/CreateTearsheetNarrow/_storybook-styles.scss +0 -6
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +102 -0
- package/scss/components/{CancelableTextEdit → DataSpreadsheet}/_index.scss +2 -2
- package/scss/components/DataSpreadsheet/_storybook-styles.scss +6 -0
- package/scss/components/EditSidePanel/_storybook-styles.scss +0 -8
- package/scss/components/InlineEdit/_inline-edit.scss +293 -10
- package/scss/components/InlineEdit/_storybook-styles.scss +12 -6
- package/scss/components/LoadingBar/_storybook-styles.scss +0 -5
- 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 +4 -1
- package/scss/components/ProductiveCard/_productive-card.scss +0 -4
- package/scss/components/SidePanel/_side-panel.scss +15 -6
- package/scss/components/StatusIcon/_index.scss +1 -1
- package/scss/components/StatusIcon/_status-icon.scss +4 -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 +1 -1
- package/scss/global/styles/_project-settings.scss +5 -1
- package/es/components/CancelableTextEdit/CancelableTextEdit.js +0 -245
- package/es/generated/feature-flags/feature-flags.js +0 -15
- package/lib/components/CancelableTextEdit/CancelableTextEdit.js +0 -265
- package/lib/components/CancelableTextEdit/index.js +0 -13
- package/lib/generated/feature-flags/feature-flags.js +0 -22
- package/scss/components/CancelableTextEdit/_cancelable-text-edit.scss +0 -211
- package/scss/components/CancelableTextEdit/_storybook-styles.scss +0 -15
- package/scss/generated/feature-flags/_feature-flags.scss +0 -19
@@ -35,7 +35,13 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
35
35
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
36
36
|
var blockClass = "".concat(_settings.pkg.prefix, "--loading-bar");
|
37
37
|
var componentName = 'LoadingBar'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
38
|
+
// Default values for props
|
38
39
|
|
40
|
+
var defaults = {
|
41
|
+
active: true,
|
42
|
+
percentage: undefined,
|
43
|
+
ariaLabel: 'Active loading indicator'
|
44
|
+
};
|
39
45
|
/**
|
40
46
|
* The LoadingBar component provides a way to communicate the loading state to users.
|
41
47
|
* It is intended to fill the space of where it's used, and should persist until the
|
@@ -52,11 +58,14 @@ var componentName = 'LoadingBar'; // NOTE: the component SCSS is not imported he
|
|
52
58
|
var LoadingBar = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
53
59
|
var _cx2, _cx3;
|
54
60
|
|
55
|
-
var active = _ref.active,
|
56
|
-
|
61
|
+
var _ref$active = _ref.active,
|
62
|
+
active = _ref$active === void 0 ? defaults.active : _ref$active,
|
63
|
+
_ref$ariaLabel = _ref.ariaLabel,
|
64
|
+
ariaLabel = _ref$ariaLabel === void 0 ? defaults.ariaLabel : _ref$ariaLabel,
|
57
65
|
className = _ref.className,
|
58
66
|
id = _ref.id,
|
59
|
-
percentage = _ref.percentage,
|
67
|
+
_ref$percentage = _ref.percentage,
|
68
|
+
percentage = _ref$percentage === void 0 ? defaults.percentage : _ref$percentage,
|
60
69
|
percentageIndicatorText = _ref.percentageIndicatorText,
|
61
70
|
showPercentageIndicator = _ref.showPercentageIndicator,
|
62
71
|
small = _ref.small,
|
@@ -122,7 +131,7 @@ LoadingBar.propTypes = {
|
|
122
131
|
/**
|
123
132
|
* Specify whether you want the loading bar indicator to be active or not
|
124
133
|
*/
|
125
|
-
active: _propTypes.default.bool
|
134
|
+
active: _propTypes.default.bool,
|
126
135
|
|
127
136
|
/**
|
128
137
|
* Specify a ariaLabel that would be used to best describe the active loading state
|
@@ -158,17 +167,4 @@ LoadingBar.propTypes = {
|
|
158
167
|
* Specify whether you would like the small variant of this component
|
159
168
|
*/
|
160
169
|
small: _propTypes.default.bool
|
161
|
-
}; // Default values for component props. Default values are not required for
|
162
|
-
// props that are required, nor for props where the component can apply
|
163
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
164
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
165
|
-
|
166
|
-
LoadingBar.defaultProps = {
|
167
|
-
/* add defaults for relevant props. */
|
168
|
-
active: true,
|
169
|
-
small: false,
|
170
|
-
percentage: undefined,
|
171
|
-
showPercentageIndicator: false,
|
172
|
-
percentageIndicatorText: undefined,
|
173
|
-
ariaLabel: 'Active loading indicator'
|
174
170
|
};
|
@@ -60,9 +60,4 @@ ModifiedTabLabelWithClose.propTypes = {
|
|
60
60
|
* unsavedContent indicates tab contents have not been saved
|
61
61
|
*/
|
62
62
|
unsavedContent: _propTypes.default.bool
|
63
|
-
};
|
64
|
-
ModifiedTabLabelWithClose.defaultProps = {
|
65
|
-
unsavedContent: false,
|
66
|
-
label: '',
|
67
|
-
onClose: undefined
|
68
63
|
};
|
@@ -31,14 +31,32 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
31
31
|
// This source code is licensed under the Apache-2.0 license found in the
|
32
32
|
// LICENSE file in the root directory of this source tree.
|
33
33
|
//
|
34
|
-
var componentName = 'ModifiedTabs';
|
34
|
+
var componentName = 'ModifiedTabs'; // Default values for props
|
35
|
+
|
36
|
+
var defaults = {
|
37
|
+
tabs: [{
|
38
|
+
id: 'tab-1',
|
39
|
+
label: 'Tab 1',
|
40
|
+
content: /*#__PURE__*/_react.default.createElement("div", null, "Iam am the content of tab 1."),
|
41
|
+
unsavedContent: false
|
42
|
+
}],
|
43
|
+
newTabLabel: 'New tab',
|
44
|
+
newTabContent: 'Your new tab will be here soon',
|
45
|
+
onNewTab: undefined,
|
46
|
+
onCloseTab: undefined
|
47
|
+
};
|
35
48
|
|
36
49
|
var ModifiedTabs = function ModifiedTabs(_ref) {
|
37
|
-
var tabs = _ref.tabs,
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
50
|
+
var _ref$tabs = _ref.tabs,
|
51
|
+
tabs = _ref$tabs === void 0 ? defaults.tabs : _ref$tabs,
|
52
|
+
_ref$newTabLabel = _ref.newTabLabel,
|
53
|
+
newTabLabel = _ref$newTabLabel === void 0 ? defaults.newTabLabel : _ref$newTabLabel,
|
54
|
+
_ref$newTabContent = _ref.newTabContent,
|
55
|
+
newTabContent = _ref$newTabContent === void 0 ? defaults.newTabContent : _ref$newTabContent,
|
56
|
+
_ref$onNewTab = _ref.onNewTab,
|
57
|
+
onNewTab = _ref$onNewTab === void 0 ? defaults.onNewTab : _ref$onNewTab,
|
58
|
+
_ref$onCloseTab = _ref.onCloseTab,
|
59
|
+
onCloseTab = _ref$onCloseTab === void 0 ? defaults.onCloseTab : _ref$onCloseTab;
|
42
60
|
|
43
61
|
var handleNewTab = function handleNewTab() {
|
44
62
|
if (onNewTab) {
|
@@ -122,16 +140,4 @@ ModifiedTabs.propTypes = {
|
|
122
140
|
*/
|
123
141
|
tabs: _propTypes.default.array
|
124
142
|
};
|
125
|
-
ModifiedTabs.defaultProps = {
|
126
|
-
tabs: [{
|
127
|
-
id: 'tab-1',
|
128
|
-
label: 'Tab 1',
|
129
|
-
content: /*#__PURE__*/_react.default.createElement("div", null, "Iam am the content of tab 1."),
|
130
|
-
unsavedContent: false
|
131
|
-
}],
|
132
|
-
newTabLabel: 'New tab',
|
133
|
-
newTabContent: 'Your new tab will be here soon',
|
134
|
-
onNewTab: undefined,
|
135
|
-
onCloseTab: undefined
|
136
|
-
};
|
137
143
|
ModifiedTabs.displayName = componentName;
|
@@ -37,7 +37,7 @@ var _carbonComponentsReact = require("carbon-components-react");
|
|
37
37
|
|
38
38
|
var _iconsReact = require("@carbon/icons-react");
|
39
39
|
|
40
|
-
var _excluded = ["className", "data", "daysAgoText", "dismissAllLabel", "dismissSingleNotificationIconDescription", "doNotDisturbDefaultToggled", "doNotDisturbLabel", "emptyStateLabel", "
|
40
|
+
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"];
|
41
41
|
|
42
42
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
43
43
|
|
@@ -45,43 +45,122 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
45
45
|
|
46
46
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
47
47
|
var componentName = 'NotificationsPanel';
|
48
|
-
var blockClass = "".concat(_settings.pkg.prefix, "--notifications-panel");
|
48
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--notifications-panel"); // Default values for props
|
49
|
+
|
50
|
+
var defaults = {
|
51
|
+
daysAgoText: function daysAgoText(value) {
|
52
|
+
return "".concat(value, " days ago");
|
53
|
+
},
|
54
|
+
dismissAllLabel: 'Dismiss all',
|
55
|
+
dismissSingleNotificationIconDescription: 'Dismiss',
|
56
|
+
doNotDisturbLabel: 'Do not disturb',
|
57
|
+
emptyStateLabel: 'You do not have any notifications',
|
58
|
+
hourAgoText: function hourAgoText(value) {
|
59
|
+
return "".concat(value, " hour ago");
|
60
|
+
},
|
61
|
+
hoursAgoText: function hoursAgoText(value) {
|
62
|
+
return "".concat(value, " hours ago");
|
63
|
+
},
|
64
|
+
minuteAgoText: function minuteAgoText(value) {
|
65
|
+
return "".concat(value, " minute ago");
|
66
|
+
},
|
67
|
+
minutesAgoText: function minutesAgoText(value) {
|
68
|
+
return "".concat(value, " minutes ago");
|
69
|
+
},
|
70
|
+
monthAgoText: function monthAgoText(value) {
|
71
|
+
return "".concat(value, " month ago");
|
72
|
+
},
|
73
|
+
monthsAgoText: function monthsAgoText(value) {
|
74
|
+
return "".concat(value, " months ago");
|
75
|
+
},
|
76
|
+
nowText: 'Now',
|
77
|
+
onDismissAllNotifications: function onDismissAllNotifications() {},
|
78
|
+
onDismissSingleNotification: function onDismissSingleNotification() {},
|
79
|
+
previousLabel: 'Previous',
|
80
|
+
readLessLabel: 'Read less',
|
81
|
+
readMoreLabel: 'Read more',
|
82
|
+
secondsAgoText: function secondsAgoText(value) {
|
83
|
+
return "".concat(value, " seconds ago");
|
84
|
+
},
|
85
|
+
settingsIconDescription: 'Settings',
|
86
|
+
title: 'Notifications',
|
87
|
+
todayLabel: 'Today',
|
88
|
+
viewAllLabel: function viewAllLabel(value) {
|
89
|
+
return "View all (".concat(value, ")");
|
90
|
+
},
|
91
|
+
yearAgoText: function yearAgoText(value) {
|
92
|
+
return "".concat(value, " year ago");
|
93
|
+
},
|
94
|
+
yearsAgoText: function yearsAgoText(value) {
|
95
|
+
return "".concat(value, " years ago");
|
96
|
+
},
|
97
|
+
yesterdayAtText: function yesterdayAtText(value) {
|
98
|
+
return "Yesterday at ".concat(value);
|
99
|
+
},
|
100
|
+
yesterdayLabel: 'Yesterday'
|
101
|
+
};
|
49
102
|
|
50
103
|
var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
51
104
|
var className = _ref.className,
|
52
105
|
data = _ref.data,
|
53
|
-
daysAgoText = _ref.daysAgoText,
|
54
|
-
|
55
|
-
|
106
|
+
_ref$daysAgoText = _ref.daysAgoText,
|
107
|
+
daysAgoText = _ref$daysAgoText === void 0 ? defaults.daysAgoText : _ref$daysAgoText,
|
108
|
+
_ref$dismissAllLabel = _ref.dismissAllLabel,
|
109
|
+
dismissAllLabel = _ref$dismissAllLabel === void 0 ? defaults.dismissAllLabel : _ref$dismissAllLabel,
|
110
|
+
_ref$dismissSingleNot = _ref.dismissSingleNotificationIconDescription,
|
111
|
+
dismissSingleNotificationIconDescription = _ref$dismissSingleNot === void 0 ? defaults.dismissSingleNotificationIconDescription : _ref$dismissSingleNot,
|
56
112
|
doNotDisturbDefaultToggled = _ref.doNotDisturbDefaultToggled,
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
113
|
+
_ref$doNotDisturbLabe = _ref.doNotDisturbLabel,
|
114
|
+
doNotDisturbLabel = _ref$doNotDisturbLabe === void 0 ? defaults.doNotDisturbLabel : _ref$doNotDisturbLabe,
|
115
|
+
_ref$emptyStateLabel = _ref.emptyStateLabel,
|
116
|
+
emptyStateLabel = _ref$emptyStateLabel === void 0 ? defaults.emptyStateLabel : _ref$emptyStateLabel,
|
117
|
+
_ref$hourAgoText = _ref.hourAgoText,
|
118
|
+
hourAgoText = _ref$hourAgoText === void 0 ? defaults.hourAgoText : _ref$hourAgoText,
|
119
|
+
_ref$hoursAgoText = _ref.hoursAgoText,
|
120
|
+
hoursAgoText = _ref$hoursAgoText === void 0 ? defaults.hoursAgoText : _ref$hoursAgoText,
|
121
|
+
_ref$minuteAgoText = _ref.minuteAgoText,
|
122
|
+
minuteAgoText = _ref$minuteAgoText === void 0 ? defaults.minuteAgoText : _ref$minuteAgoText,
|
123
|
+
_ref$minutesAgoText = _ref.minutesAgoText,
|
124
|
+
minutesAgoText = _ref$minutesAgoText === void 0 ? defaults.minutesAgoText : _ref$minutesAgoText,
|
125
|
+
_ref$monthAgoText = _ref.monthAgoText,
|
126
|
+
monthAgoText = _ref$monthAgoText === void 0 ? defaults.monthAgoText : _ref$monthAgoText,
|
127
|
+
_ref$monthsAgoText = _ref.monthsAgoText,
|
128
|
+
monthsAgoText = _ref$monthsAgoText === void 0 ? defaults.monthsAgoText : _ref$monthsAgoText,
|
129
|
+
_ref$nowText = _ref.nowText,
|
130
|
+
nowText = _ref$nowText === void 0 ? defaults.nowText : _ref$nowText,
|
66
131
|
onClickOutside = _ref.onClickOutside,
|
67
|
-
|
68
|
-
|
132
|
+
_ref$onDismissAllNoti = _ref.onDismissAllNotifications,
|
133
|
+
onDismissAllNotifications = _ref$onDismissAllNoti === void 0 ? defaults.onDismissAllNotifications : _ref$onDismissAllNoti,
|
134
|
+
_ref$onDismissSingleN = _ref.onDismissSingleNotification,
|
135
|
+
onDismissSingleNotification = _ref$onDismissSingleN === void 0 ? defaults.onDismissSingleNotification : _ref$onDismissSingleN,
|
69
136
|
onDoNotDisturbChange = _ref.onDoNotDisturbChange,
|
70
137
|
onSettingsClick = _ref.onSettingsClick,
|
71
138
|
onViewAllClick = _ref.onViewAllClick,
|
72
139
|
open = _ref.open,
|
73
|
-
previousLabel = _ref.previousLabel,
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
140
|
+
_ref$previousLabel = _ref.previousLabel,
|
141
|
+
previousLabel = _ref$previousLabel === void 0 ? defaults.previousLabel : _ref$previousLabel,
|
142
|
+
_ref$readLessLabel = _ref.readLessLabel,
|
143
|
+
readLessLabel = _ref$readLessLabel === void 0 ? defaults.readLessLabel : _ref$readLessLabel,
|
144
|
+
_ref$readMoreLabel = _ref.readMoreLabel,
|
145
|
+
readMoreLabel = _ref$readMoreLabel === void 0 ? defaults.readMoreLabel : _ref$readMoreLabel,
|
146
|
+
_ref$secondsAgoText = _ref.secondsAgoText,
|
147
|
+
secondsAgoText = _ref$secondsAgoText === void 0 ? defaults.secondsAgoText : _ref$secondsAgoText,
|
148
|
+
_ref$settingsIconDesc = _ref.settingsIconDescription,
|
149
|
+
settingsIconDescription = _ref$settingsIconDesc === void 0 ? defaults.settingsIconDescription : _ref$settingsIconDesc,
|
150
|
+
_ref$title = _ref.title,
|
151
|
+
title = _ref$title === void 0 ? defaults.title : _ref$title,
|
152
|
+
_ref$todayLabel = _ref.todayLabel,
|
153
|
+
todayLabel = _ref$todayLabel === void 0 ? defaults.todayLabel : _ref$todayLabel,
|
154
|
+
_ref$viewAllLabel = _ref.viewAllLabel,
|
155
|
+
viewAllLabel = _ref$viewAllLabel === void 0 ? defaults.viewAllLabel : _ref$viewAllLabel,
|
156
|
+
_ref$yearAgoText = _ref.yearAgoText,
|
157
|
+
yearAgoText = _ref$yearAgoText === void 0 ? defaults.yearAgoText : _ref$yearAgoText,
|
158
|
+
_ref$yearsAgoText = _ref.yearsAgoText,
|
159
|
+
yearsAgoText = _ref$yearsAgoText === void 0 ? defaults.yearsAgoText : _ref$yearsAgoText,
|
160
|
+
_ref$yesterdayAtText = _ref.yesterdayAtText,
|
161
|
+
yesterdayAtText = _ref$yesterdayAtText === void 0 ? defaults.yesterdayAtText : _ref$yesterdayAtText,
|
162
|
+
_ref$yesterdayLabel = _ref.yesterdayLabel,
|
163
|
+
yesterdayLabel = _ref$yesterdayLabel === void 0 ? defaults.yesterdayLabel : _ref$yesterdayLabel,
|
85
164
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
86
165
|
var notificationPanelRef = (0, _react.useRef)();
|
87
166
|
|
@@ -95,6 +174,12 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
|
|
95
174
|
allNotifications = _useState4[0],
|
96
175
|
setAllNotifications = _useState4[1];
|
97
176
|
|
177
|
+
var previousState = (0, _hooks.usePreviousValue)({
|
178
|
+
open: open
|
179
|
+
});
|
180
|
+
var reducedMotion = window && window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
|
181
|
+
matches: true
|
182
|
+
};
|
98
183
|
(0, _react.useEffect)(function () {
|
99
184
|
// Set the notifications passed to the state within this component
|
100
185
|
setAllNotifications(data);
|
@@ -114,6 +199,12 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
|
|
114
199
|
!open && setRender(false);
|
115
200
|
};
|
116
201
|
|
202
|
+
(0, _react.useEffect)(function () {
|
203
|
+
if (!open && previousState !== null && previousState !== void 0 && previousState.open && reducedMotion.matches) {
|
204
|
+
setRender(false);
|
205
|
+
}
|
206
|
+
}, [open, reducedMotion.matches, previousState === null || previousState === void 0 ? void 0 : previousState.open]);
|
207
|
+
|
117
208
|
var sortChronologically = function sortChronologically(arr) {
|
118
209
|
if (!arr || arr && !arr.length) {
|
119
210
|
return;
|
@@ -253,7 +344,7 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
|
|
253
344
|
id: blockClass,
|
254
345
|
className: (0, _classnames.default)(blockClass, className, "".concat(blockClass, "__container")),
|
255
346
|
style: {
|
256
|
-
animation: "".concat(open ? '
|
347
|
+
animation: !reducedMotion.matches ? "".concat(open ? 'fade-in 250ms' : 'fade-out 250ms') : null
|
257
348
|
},
|
258
349
|
onAnimationEnd: onAnimationEnd,
|
259
350
|
ref: ref || notificationPanelRef
|
@@ -424,12 +515,12 @@ NotificationsPanel.propTypes = {
|
|
424
515
|
/**
|
425
516
|
* Function that will dismiss all notifications
|
426
517
|
*/
|
427
|
-
onDismissAllNotifications: _propTypes.default.func
|
518
|
+
onDismissAllNotifications: _propTypes.default.func,
|
428
519
|
|
429
520
|
/**
|
430
521
|
* Function that will dismiss a single notification
|
431
522
|
*/
|
432
|
-
onDismissSingleNotification: _propTypes.default.func
|
523
|
+
onDismissSingleNotification: _propTypes.default.func,
|
433
524
|
|
434
525
|
/**
|
435
526
|
* Function that returns the current selected value of the disable notification toggle
|
@@ -510,60 +601,4 @@ NotificationsPanel.propTypes = {
|
|
510
601
|
* Sets the yesterday label text
|
511
602
|
*/
|
512
603
|
yesterdayLabel: _propTypes.default.string
|
513
|
-
}; // Default values for component props. Default values are not required for
|
514
|
-
// props that are required, nor for props where the component can apply
|
515
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
516
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
517
|
-
|
518
|
-
NotificationsPanel.defaultProps = {
|
519
|
-
daysAgoText: function daysAgoText(value) {
|
520
|
-
return "".concat(value, " days ago");
|
521
|
-
},
|
522
|
-
dismissAllLabel: 'Dismiss all',
|
523
|
-
dismissSingleNotificationIconDescription: 'Dismiss',
|
524
|
-
doNotDisturbLabel: 'Do not disturb',
|
525
|
-
emptyStateLabel: 'You do not have any notifications',
|
526
|
-
hourAgoText: function hourAgoText(value) {
|
527
|
-
return "".concat(value, " hour ago");
|
528
|
-
},
|
529
|
-
hoursAgoText: function hoursAgoText(value) {
|
530
|
-
return "".concat(value, " hours ago");
|
531
|
-
},
|
532
|
-
minuteAgoText: function minuteAgoText(value) {
|
533
|
-
return "".concat(value, " minute ago");
|
534
|
-
},
|
535
|
-
minutesAgoText: function minutesAgoText(value) {
|
536
|
-
return "".concat(value, " minutes ago");
|
537
|
-
},
|
538
|
-
monthAgoText: function monthAgoText(value) {
|
539
|
-
return "".concat(value, " month ago");
|
540
|
-
},
|
541
|
-
monthsAgoText: function monthsAgoText(value) {
|
542
|
-
return "".concat(value, " months ago");
|
543
|
-
},
|
544
|
-
nowText: 'Now',
|
545
|
-
onDismissAllNotifications: function onDismissAllNotifications() {},
|
546
|
-
onDismissSingleNotification: function onDismissSingleNotification() {},
|
547
|
-
previousLabel: 'Previous',
|
548
|
-
readLessLabel: 'Read less',
|
549
|
-
readMoreLabel: 'Read more',
|
550
|
-
secondsAgoText: function secondsAgoText(value) {
|
551
|
-
return "".concat(value, " seconds ago");
|
552
|
-
},
|
553
|
-
settingsIconDescription: 'Settings',
|
554
|
-
title: 'Notifications',
|
555
|
-
todayLabel: 'Today',
|
556
|
-
viewAllLabel: function viewAllLabel(value) {
|
557
|
-
return "View all (".concat(value, ")");
|
558
|
-
},
|
559
|
-
yearsAgoText: function yearsAgoText(value) {
|
560
|
-
return "".concat(value, " years ago");
|
561
|
-
},
|
562
|
-
yearAgoText: function yearAgoText(value) {
|
563
|
-
return "".concat(value, " year ago");
|
564
|
-
},
|
565
|
-
yesterdayLabel: 'Yesterday',
|
566
|
-
yesterdayAtText: function yesterdayAtText(value) {
|
567
|
-
return "Yesterday at ".concat(value);
|
568
|
-
}
|
569
604
|
};
|
@@ -44,7 +44,11 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
44
44
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
45
45
|
var blockClass = "".concat(_settings.pkg.prefix, "--options-tile");
|
46
46
|
var componentName = 'OptionsTile'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
47
|
+
// Default values for props
|
47
48
|
|
49
|
+
var defaults = {
|
50
|
+
size: 'xl'
|
51
|
+
};
|
48
52
|
/**
|
49
53
|
* TODO: A description of the component.
|
50
54
|
*/
|
@@ -61,7 +65,8 @@ var OptionsTile = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
61
65
|
lockedText = _ref.lockedText,
|
62
66
|
onToggle = _ref.onToggle,
|
63
67
|
open = _ref.open,
|
64
|
-
size = _ref.size,
|
68
|
+
_ref$size = _ref.size,
|
69
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
65
70
|
summary = _ref.summary,
|
66
71
|
warn = _ref.warn,
|
67
72
|
warnText = _ref.warnText,
|
@@ -337,12 +342,4 @@ OptionsTile.propTypes = {
|
|
337
342
|
* Provide a text explaining why the OptionsTile is in warning state.
|
338
343
|
*/
|
339
344
|
warnText: _propTypes.default.string
|
340
|
-
}; // Default values for component props. Default values are not required for
|
341
|
-
// props that are required, nor for props where the component can apply
|
342
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
343
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
344
|
-
|
345
|
-
OptionsTile.defaultProps = {
|
346
|
-
open: false,
|
347
|
-
size: 'xl'
|
348
345
|
};
|
@@ -62,6 +62,11 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
62
62
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
63
63
|
|
64
64
|
var componentName = 'PageHeader';
|
65
|
+
// Default values for props
|
66
|
+
var defaults = {
|
67
|
+
fullWidthGrid: false,
|
68
|
+
narrowGrid: false
|
69
|
+
};
|
65
70
|
|
66
71
|
var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
67
72
|
var _withoutBackground, _ref6, _cx2, _ref7, _cx4, _cx7;
|
@@ -82,9 +87,11 @@ var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
82
87
|
collapseTitle = _ref.collapseTitle,
|
83
88
|
disableBreadcrumbScroll = _ref.disableBreadcrumbScroll,
|
84
89
|
expandHeaderIconDescription = _ref.expandHeaderIconDescription,
|
85
|
-
fullWidthGrid = _ref.fullWidthGrid,
|
90
|
+
_ref$fullWidthGrid = _ref.fullWidthGrid,
|
91
|
+
fullWidthGrid = _ref$fullWidthGrid === void 0 ? defaults.fullWidthGrid : _ref$fullWidthGrid,
|
86
92
|
hasCollapseHeaderToggle = _ref.hasCollapseHeaderToggle,
|
87
|
-
narrowGrid = _ref.narrowGrid,
|
93
|
+
_ref$narrowGrid = _ref.narrowGrid,
|
94
|
+
narrowGrid = _ref$narrowGrid === void 0 ? defaults.narrowGrid : _ref$narrowGrid,
|
88
95
|
navigation = _ref.navigation,
|
89
96
|
pageActions = _ref.pageActions,
|
90
97
|
pageActionsOverflowLabel = _ref.pageActionsOverflowLabel,
|
@@ -391,16 +398,17 @@ var PageHeader = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
391
398
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
392
399
|
className: "".concat(_PageHeaderUtils.blockClass, "__non-navigation-row-content")
|
393
400
|
}, hasBreadcrumbRow ? /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Row, {
|
394
|
-
className: (0, _classnames.default)("".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--next-to-tabs"), nextToTabsCheck()), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--has-breadcrumbs"), breadcrumbs), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--has-action-bar"), hasActionBar || widthIsNarrow), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__has-page-actions-without-action-bar"), !hasActionBar && !widthIsNarrow && pageActions), _cx2))
|
401
|
+
className: (0, _classnames.default)("".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row"), (_cx2 = {}, (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--next-to-tabs"), nextToTabsCheck()), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--has-breadcrumbs"), breadcrumbs || breadcrumbItemForTitle), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--has-action-bar"), hasActionBar || widthIsNarrow), (0, _defineProperty2.default)(_cx2, "".concat(_PageHeaderUtils.blockClass, "__has-page-actions-without-action-bar"), !hasActionBar && !widthIsNarrow && pageActions), _cx2))
|
395
402
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
396
403
|
className: "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-row--container")
|
397
404
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Column, {
|
398
405
|
className: (0, _classnames.default)("".concat(_PageHeaderUtils.blockClass, "__breadcrumb-column"), (0, _defineProperty2.default)({}, "".concat(_PageHeaderUtils.blockClass, "__breadcrumb-column--background"), !!breadcrumbs || hasActionBar || widthIsNarrow))
|
399
|
-
}, breadcrumbs ? /*#__PURE__*/_react.default.createElement(_BreadcrumbWithOverflow.BreadcrumbWithOverflow, {
|
406
|
+
}, breadcrumbs || breadcrumbItemForTitle ? /*#__PURE__*/_react.default.createElement(_BreadcrumbWithOverflow.BreadcrumbWithOverflow, {
|
400
407
|
className: "".concat(_PageHeaderUtils.blockClass, "__breadcrumb"),
|
401
408
|
noTrailingSlash: !!title,
|
402
409
|
overflowAriaLabel: breadcrumbOverflowAriaLabel,
|
403
|
-
breadcrumbs: breadcrumbs
|
410
|
+
breadcrumbs: breadcrumbs && breadcrumbItemForTitle ? breadcrumbs.concat(breadcrumbItemForTitle) : breadcrumbItemForTitle ? [breadcrumbItemForTitle] : breadcrumbs // breadcrumbs may be null or undefined
|
411
|
+
|
404
412
|
}) : null), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Column, {
|
405
413
|
className: (0, _classnames.default)(["".concat(_PageHeaderUtils.blockClass, "__action-bar-column ").concat(_PageHeaderUtils.blockClass, "__action-bar-column--background"), (_ref7 = {}, (0, _defineProperty2.default)(_ref7, "".concat(_PageHeaderUtils.blockClass, "__action-bar-column--has-page-actions"), pageActions), (0, _defineProperty2.default)(_ref7, "".concat(_PageHeaderUtils.blockClass, "__action-bar-column--influenced-by-collapse-button"), spaceForCollapseButton), _ref7)])
|
406
414
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
@@ -799,9 +807,10 @@ PageHeader.propTypes = _objectSpread({
|
|
799
807
|
* - text: title string
|
800
808
|
* - icon: optional icon
|
801
809
|
* - loading: boolean shows loading indicator if true
|
802
|
-
* - onChange: function to process
|
810
|
+
* - onChange: function to process the live value (React change === HTML Input)
|
811
|
+
* - onSave: function to process a confirmed change
|
803
812
|
* - editableLabel: label for edit required if onChange supplied
|
804
|
-
* -
|
813
|
+
* - cancelDescription: label for edit cancel button
|
805
814
|
* - saveDescription: label for edit save button
|
806
815
|
* - 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.
|
807
816
|
* - content: title or name of current location shown in main part of page header
|
@@ -819,7 +828,8 @@ PageHeader.propTypes = _objectSpread({
|
|
819
828
|
id: _propTypes.default.string,
|
820
829
|
// .isRequired.if(inlineEditRequired),
|
821
830
|
onChange: _propTypes.default.func,
|
822
|
-
|
831
|
+
onSave: _propTypes.default.func,
|
832
|
+
cancelDescription: _propTypes.default.string,
|
823
833
|
//.isRequired.if(inlineEditRequired),
|
824
834
|
saveDescription: _propTypes.default.string //.isRequired.if(inlineEditRequired),
|
825
835
|
// Update docgen if changed
|
@@ -836,8 +846,4 @@ PageHeader.propTypes = _objectSpread({
|
|
836
846
|
*/
|
837
847
|
withoutBackground: _propTypes.default.bool
|
838
848
|
}, deprecatedProps);
|
839
|
-
PageHeader.defaultProps = {
|
840
|
-
fullWidthGrid: false,
|
841
|
-
narrowGrid: false
|
842
|
-
};
|
843
849
|
PageHeader.displayName = componentName;
|
@@ -23,7 +23,7 @@ var _carbonComponentsReact = require("carbon-components-react");
|
|
23
23
|
|
24
24
|
var _ = require("../");
|
25
25
|
|
26
|
-
var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "editDescription", "editableLabel", "revertDescription", "saveDescription"];
|
26
|
+
var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "onSave", "editDescription", "editableLabel", "revertDescription", "saveDescription"];
|
27
27
|
|
28
28
|
/**
|
29
29
|
*
|
@@ -43,13 +43,14 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
|
|
43
43
|
icon = title.icon,
|
44
44
|
asText = title.asText,
|
45
45
|
onChange = title.onChange,
|
46
|
+
onSave = title.onSave,
|
46
47
|
editDescription = title.editDescription,
|
47
48
|
editableLabel = title.editableLabel,
|
48
49
|
revertDescription = title.revertDescription,
|
49
50
|
saveDescription = title.saveDescription,
|
50
51
|
rest = (0, _objectWithoutProperties2.default)(title, _excluded);
|
51
52
|
var titleText;
|
52
|
-
var isEditable = !!
|
53
|
+
var isEditable = !!onSave;
|
53
54
|
|
54
55
|
if (text || !content) {
|
55
56
|
if (text === undefined && typeof title === 'string') {
|
@@ -67,6 +68,7 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
|
|
67
68
|
value: text,
|
68
69
|
editDescription: editDescription,
|
69
70
|
onChange: onChange,
|
71
|
+
onSave: onSave,
|
70
72
|
labelText: editableLabel,
|
71
73
|
revertDescription: revertDescription,
|
72
74
|
saveDescription: saveDescription
|
@@ -87,8 +89,8 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
|
|
87
89
|
exports.PageHeaderTitle = PageHeaderTitle;
|
88
90
|
|
89
91
|
var inlineEditRequired = function inlineEditRequired(_ref2) {
|
90
|
-
var
|
91
|
-
return !!
|
92
|
+
var onSave = _ref2.onSave;
|
93
|
+
return !!onSave;
|
92
94
|
};
|
93
95
|
|
94
96
|
exports.inlineEditRequired = inlineEditRequired;
|
@@ -110,9 +112,10 @@ PageHeaderTitle.propTypes = {
|
|
110
112
|
* - text: title string
|
111
113
|
* - icon: optional icon
|
112
114
|
* - loading: boolean shows loading indicator if true
|
113
|
-
* - onChange: function to process
|
115
|
+
* - onChange: function to process the live value (React change === HTML Input)
|
116
|
+
* - onSave: function to process a confirmed change
|
114
117
|
* - editDescription: description for edit button
|
115
|
-
* - editableLabel: label for edit required if
|
118
|
+
* - editableLabel: label for edit required if onSave supplied
|
116
119
|
* - revertDescription: description for edit revert button
|
117
120
|
* - saveDescription: description for edit save button
|
118
121
|
* - Object containing user defined contents. These must fit within the area defined for the title in both main part of the header and the breadcrumb.
|
@@ -130,6 +133,7 @@ PageHeaderTitle.propTypes = {
|
|
130
133
|
editableLabel: _propTypes.default.string.isRequired.if(inlineEditRequired),
|
131
134
|
id: _propTypes.default.string.isRequired.if(inlineEditRequired),
|
132
135
|
onChange: _propTypes.default.func,
|
136
|
+
onSave: _propTypes.default.func,
|
133
137
|
revertDescription: _propTypes.default.string.isRequired.if(inlineEditRequired),
|
134
138
|
saveDescription: _propTypes.default.string.isRequired.if(inlineEditRequired) // Update docgen if changed
|
135
139
|
|
@@ -11,6 +11,10 @@ exports.ProductiveCard = void 0;
|
|
11
11
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
13
13
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
15
|
+
|
16
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
17
|
+
|
14
18
|
var _react = _interopRequireWildcard(require("react"));
|
15
19
|
|
16
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
@@ -23,21 +27,30 @@ var _propsHelper = require("../../global/js/utils/props-helper");
|
|
23
27
|
|
24
28
|
var _settings = require("../../settings");
|
25
29
|
|
30
|
+
var _excluded = ["actionsPlacement"];
|
31
|
+
|
26
32
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
27
33
|
|
28
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
29
35
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
var
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
36
|
+
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; }
|
37
|
+
|
38
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
39
|
+
|
40
|
+
var componentName = 'ProductiveCard'; // Default values for props
|
41
|
+
|
42
|
+
var defaults = {
|
43
|
+
actionsPlacement: 'top'
|
44
|
+
};
|
45
|
+
var ProductiveCard = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
46
|
+
var _ref$actionsPlacement = _ref.actionsPlacement,
|
47
|
+
actionsPlacement = _ref$actionsPlacement === void 0 ? defaults.actionsPlacement : _ref$actionsPlacement,
|
48
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
49
|
+
var validProps = (0, _propsHelper.prepareProps)(rest, ['media', 'mediaPosition', 'onSecondaryButtonClick', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind', 'secondaryButtonText']);
|
50
|
+
return /*#__PURE__*/_react.default.createElement(_Card.Card, (0, _extends2.default)({}, _objectSpread(_objectSpread({}, validProps), {}, {
|
51
|
+
actionsPlacement: actionsPlacement,
|
52
|
+
ref: ref
|
53
|
+
}), {
|
41
54
|
productive: true
|
42
55
|
}, (0, _devtools.getDevtoolsProps)(componentName)));
|
43
56
|
}); // Return a placeholder if not released and not enabled by feature flag
|
@@ -132,11 +145,4 @@ ProductiveCard.propTypes = {
|
|
132
145
|
*/
|
133
146
|
titleSize: _propTypes.default.oneOf(['default', 'large'])
|
134
147
|
};
|
135
|
-
ProductiveCard.defaultProps = {
|
136
|
-
actionIcons: [],
|
137
|
-
actionsPlacement: 'top',
|
138
|
-
clickZone: 'one',
|
139
|
-
overflowActions: [],
|
140
|
-
titleSize: 'default'
|
141
|
-
};
|
142
148
|
ProductiveCard.displayName = componentName;
|