@carbon/ibm-products 1.7.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 +27 -130
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +2 -2
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +27 -130
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +27 -130
- package/css/index.css.map +1 -1
- package/css/index.min.css +2 -2
- 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 +7 -5
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
- package/es/components/ButtonMenu/ButtonMenu.js +6 -4
- 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 +340 -80
- 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/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 +11 -13
- 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 +6 -9
- package/es/components/PageHeader/PageHeader.js +10 -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 +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/Toolbar/ToolbarButton.js +0 -3
- 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/Wrap.js +7 -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 +10 -12
- package/lib/components/AddSelect/AddSelect.js +7 -5
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +0 -3
- package/lib/components/ButtonMenu/ButtonMenu.js +6 -4
- 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 +342 -75
- 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/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 +11 -13
- 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 +6 -9
- package/lib/components/PageHeader/PageHeader.js +9 -6
- 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 +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/Toolbar/ToolbarButton.js +0 -3
- 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/Wrap.js +7 -5
- package/package.json +8 -8
- package/scss/components/DataSpreadsheet/_data-spreadsheet.scss +26 -3
- package/scss/components/InlineEdit/_inline-edit.scss +5 -0
- package/scss/components/_index.scss +0 -1
- 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
- package/scss/components/CancelableTextEdit/_index.scss +0 -8
- package/scss/components/CancelableTextEdit/_storybook-styles.scss +0 -8
@@ -0,0 +1,45 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2022, 2022
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { px } from '@carbon/layout';
|
8
|
+
import { pkg } from '../../settings';
|
9
|
+
export var createActiveCellFn = function createActiveCellFn(_ref) {
|
10
|
+
var placementElement = _ref.placementElement,
|
11
|
+
coords = _ref.coords,
|
12
|
+
_ref$addToHeader = _ref.addToHeader,
|
13
|
+
addToHeader = _ref$addToHeader === void 0 ? false : _ref$addToHeader,
|
14
|
+
contextRef = _ref.contextRef,
|
15
|
+
_ref$blockClass = _ref.blockClass,
|
16
|
+
blockClass = _ref$blockClass === void 0 ? "".concat(pkg.prefix, "--data-spreadsheet") : _ref$blockClass,
|
17
|
+
onActiveCellChange = _ref.onActiveCellChange,
|
18
|
+
activeCellValue = _ref.activeCellValue;
|
19
|
+
|
20
|
+
if (!coords) {
|
21
|
+
return;
|
22
|
+
} // If the active cell is in the column header row (very first), we need to append this element
|
23
|
+
// to `.${blockClass}__header--container`, otherwise it should be appended to `.${blockClass}__listContainer` firstElementChild
|
24
|
+
|
25
|
+
|
26
|
+
var activeElementContainer = addToHeader ? contextRef === null || contextRef === void 0 ? void 0 : contextRef.current.querySelector(".".concat(blockClass, "__header--container")) : contextRef === null || contextRef === void 0 ? void 0 : contextRef.current.querySelector(".".concat(blockClass, "__list--container")).firstElementChild;
|
27
|
+
var relativePosition = {
|
28
|
+
top: placementElement.getBoundingClientRect().top - activeElementContainer.getBoundingClientRect().top,
|
29
|
+
left: placementElement.getBoundingClientRect().left - activeElementContainer.getBoundingClientRect().left
|
30
|
+
};
|
31
|
+
var activeCellButton = (contextRef === null || contextRef === void 0 ? void 0 : contextRef.current.querySelector(".".concat(blockClass, "__active-cell--highlight"))) || document.createElement('button');
|
32
|
+
activeCellButton.classList.add("".concat(blockClass, "__active-cell--highlight"), "".concat(blockClass, "--interactive-cell-element"));
|
33
|
+
activeCellButton.style.width = px(placementElement === null || placementElement === void 0 ? void 0 : placementElement.offsetWidth);
|
34
|
+
activeCellButton.style.height = px(placementElement === null || placementElement === void 0 ? void 0 : placementElement.offsetHeight);
|
35
|
+
activeCellButton.style.left = px(relativePosition.left);
|
36
|
+
activeCellButton.style.top = px(relativePosition.top);
|
37
|
+
activeCellButton.setAttribute('data-active-row-index', typeof (coords === null || coords === void 0 ? void 0 : coords.row) === 'number' ? coords.row : 'header');
|
38
|
+
activeCellButton.setAttribute('data-active-column-index', typeof (coords === null || coords === void 0 ? void 0 : coords.column) === 'number' ? coords.column : 'header');
|
39
|
+
activeElementContainer.appendChild(activeCellButton);
|
40
|
+
activeCellButton.focus();
|
41
|
+
|
42
|
+
if (typeof (coords === null || coords === void 0 ? void 0 : coords.column) === 'number' && typeof (coords === null || coords === void 0 ? void 0 : coords.row) === 'number') {
|
43
|
+
onActiveCellChange(activeCellValue);
|
44
|
+
}
|
45
|
+
};
|
@@ -0,0 +1,30 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2022, 2022
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import { baseFontSize, sizeXSmall as compact, sizeSmall as standard, sizeMedium as medium, sizeLarge as large } from '@carbon/layout';
|
8
|
+
|
9
|
+
var getSizeInPixels = function getSizeInPixels(carbonSize) {
|
10
|
+
return Number(carbonSize.replace('rem', '') * baseFontSize);
|
11
|
+
};
|
12
|
+
|
13
|
+
export var getCellSize = function getCellSize(cellSize) {
|
14
|
+
switch (cellSize) {
|
15
|
+
case 'compact':
|
16
|
+
return getSizeInPixels(compact);
|
17
|
+
|
18
|
+
case 'standard':
|
19
|
+
return getSizeInPixels(standard);
|
20
|
+
|
21
|
+
case 'medium':
|
22
|
+
return getSizeInPixels(medium);
|
23
|
+
|
24
|
+
case 'large':
|
25
|
+
return getSizeInPixels(large);
|
26
|
+
|
27
|
+
default:
|
28
|
+
return getSizeInPixels(standard);
|
29
|
+
}
|
30
|
+
};
|
@@ -31,7 +31,12 @@ import '../../global/js/utils/props-helper'; // The block part of our convention
|
|
31
31
|
var blockClass = "".concat(pkg.prefix, "--edit-side-panel");
|
32
32
|
var sidePanelBlockClass = "".concat(pkg.prefix, "--side-panel");
|
33
33
|
var componentName = 'EditSidePanel'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
34
|
+
// Default values for props
|
34
35
|
|
36
|
+
var defaults = {
|
37
|
+
placement: 'right',
|
38
|
+
size: 'md'
|
39
|
+
};
|
35
40
|
/**
|
36
41
|
* TODO: A description of the component.
|
37
42
|
*/
|
@@ -45,12 +50,14 @@ export var EditSidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
45
50
|
onRequestClose = _ref.onRequestClose,
|
46
51
|
onRequestSubmit = _ref.onRequestSubmit,
|
47
52
|
open = _ref.open,
|
48
|
-
placement = _ref.placement,
|
53
|
+
_ref$placement = _ref.placement,
|
54
|
+
placement = _ref$placement === void 0 ? defaults.placement : _ref$placement,
|
49
55
|
primaryButtonText = _ref.primaryButtonText,
|
50
56
|
secondaryButtonText = _ref.secondaryButtonText,
|
51
57
|
selectorPrimaryFocus = _ref.selectorPrimaryFocus,
|
52
58
|
selectorPageContent = _ref.selectorPageContent,
|
53
|
-
size = _ref.size,
|
59
|
+
_ref$size = _ref.size,
|
60
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
54
61
|
slideIn = _ref.slideIn,
|
55
62
|
subtitle = _ref.subtitle,
|
56
63
|
title = _ref.title,
|
@@ -198,12 +205,4 @@ EditSidePanel.propTypes = {
|
|
198
205
|
* The title of the CreateSidePanel is usually the product or service name.
|
199
206
|
*/
|
200
207
|
title: PropTypes.node.isRequired
|
201
|
-
}; // Default values for component props. Default values are not required for
|
202
|
-
// props that are required, nor for props where the component can apply
|
203
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
204
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
205
|
-
|
206
|
-
EditSidePanel.defaultProps = {
|
207
|
-
placement: 'right',
|
208
|
-
size: 'md'
|
209
208
|
};
|
@@ -25,14 +25,19 @@ import { pkg } from '../../settings';
|
|
25
25
|
import { EmptyStateContent } from './EmptyStateContent'; // The block part of our conventional BEM class names (blockClass__E--M).
|
26
26
|
|
27
27
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
28
|
-
var componentName = 'EmptyState';
|
28
|
+
var componentName = 'EmptyState'; // Default values for props
|
29
|
+
|
30
|
+
export var defaults = {
|
31
|
+
size: 'lg'
|
32
|
+
};
|
29
33
|
export var EmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
30
34
|
var action = _ref.action,
|
31
35
|
className = _ref.className,
|
32
36
|
illustration = _ref.illustration,
|
33
37
|
illustrationDescription = _ref.illustrationDescription,
|
34
38
|
link = _ref.link,
|
35
|
-
size = _ref.size,
|
39
|
+
_ref$size = _ref.size,
|
40
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
36
41
|
subtitle = _ref.subtitle,
|
37
42
|
title = _ref.title,
|
38
43
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -58,9 +63,6 @@ export var EmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
58
63
|
}); // Return a placeholder if not released and not enabled by feature flag
|
59
64
|
|
60
65
|
EmptyState = pkg.checkComponentEnabled(EmptyState, componentName);
|
61
|
-
export var EmptyStateDefaultProps = {
|
62
|
-
size: 'lg'
|
63
|
-
};
|
64
66
|
EmptyState.propTypes = {
|
65
67
|
/**
|
66
68
|
* Empty state action button
|
@@ -114,5 +116,4 @@ EmptyState.propTypes = {
|
|
114
116
|
*/
|
115
117
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired
|
116
118
|
};
|
117
|
-
EmptyState.defaultProps = EmptyStateDefaultProps;
|
118
119
|
EmptyState.displayName = componentName;
|
@@ -23,7 +23,7 @@ import { getDevtoolsProps } from '../../../global/js/utils/devtools';
|
|
23
23
|
import { pkg } from '../../../settings';
|
24
24
|
import { EmptyStateContent } from '../EmptyStateContent';
|
25
25
|
import { ErrorIllustration } from '../assets/ErrorIllustration';
|
26
|
-
import {
|
26
|
+
import { defaults } from '../EmptyState'; // The block part of our conventional BEM class names (blockClass__E--M).
|
27
27
|
|
28
28
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
29
29
|
var componentName = 'ErrorEmptyState';
|
@@ -32,7 +32,8 @@ export var ErrorEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
32
32
|
className = _ref.className,
|
33
33
|
illustrationTheme = _ref.illustrationTheme,
|
34
34
|
link = _ref.link,
|
35
|
-
size = _ref.size,
|
35
|
+
_ref$size = _ref.size,
|
36
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
36
37
|
subtitle = _ref.subtitle,
|
37
38
|
title = _ref.title,
|
38
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -105,9 +106,4 @@ ErrorEmptyState.propTypes = {
|
|
105
106
|
* Empty state title
|
106
107
|
*/
|
107
108
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired
|
108
|
-
};
|
109
|
-
// props that are required, nor for props where the component can apply
|
110
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
111
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
112
|
-
|
113
|
-
ErrorEmptyState.defaultProps = EmptyStateDefaultProps;
|
109
|
+
};
|
@@ -23,7 +23,7 @@ import { getDevtoolsProps } from '../../../global/js/utils/devtools';
|
|
23
23
|
import { pkg } from '../../../settings';
|
24
24
|
import { EmptyStateContent } from '../EmptyStateContent';
|
25
25
|
import { NoDataIllustration } from '../assets/NoDataIllustration';
|
26
|
-
import {
|
26
|
+
import { defaults } from '../EmptyState'; // The block part of our conventional BEM class names (blockClass__E--M).
|
27
27
|
|
28
28
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
29
29
|
var componentName = 'NoDataEmptyState';
|
@@ -32,7 +32,8 @@ export var NoDataEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
32
32
|
className = _ref.className,
|
33
33
|
illustrationTheme = _ref.illustrationTheme,
|
34
34
|
link = _ref.link,
|
35
|
-
size = _ref.size,
|
35
|
+
_ref$size = _ref.size,
|
36
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
36
37
|
subtitle = _ref.subtitle,
|
37
38
|
title = _ref.title,
|
38
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -105,9 +106,4 @@ NoDataEmptyState.propTypes = {
|
|
105
106
|
* Empty state title
|
106
107
|
*/
|
107
108
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired
|
108
|
-
};
|
109
|
-
// props that are required, nor for props where the component can apply
|
110
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
111
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
112
|
-
|
113
|
-
NoDataEmptyState.defaultProps = EmptyStateDefaultProps;
|
109
|
+
};
|
@@ -23,7 +23,7 @@ import { getDevtoolsProps } from '../../../global/js/utils/devtools';
|
|
23
23
|
import { pkg } from '../../../settings';
|
24
24
|
import { EmptyStateContent } from '../EmptyStateContent';
|
25
25
|
import { NoTagsIllustration } from '../assets/NoTagsIllustration';
|
26
|
-
import {
|
26
|
+
import { defaults } from '../EmptyState'; // The block part of our conventional BEM class names (blockClass__E--M).
|
27
27
|
|
28
28
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
29
29
|
var componentName = 'NoTagsEmptyState';
|
@@ -32,7 +32,8 @@ export var NoTagsEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
32
32
|
className = _ref.className,
|
33
33
|
illustrationTheme = _ref.illustrationTheme,
|
34
34
|
link = _ref.link,
|
35
|
-
size = _ref.size,
|
35
|
+
_ref$size = _ref.size,
|
36
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
36
37
|
subtitle = _ref.subtitle,
|
37
38
|
title = _ref.title,
|
38
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -105,9 +106,4 @@ NoTagsEmptyState.propTypes = {
|
|
105
106
|
* Empty state title
|
106
107
|
*/
|
107
108
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired
|
108
|
-
};
|
109
|
-
// props that are required, nor for props where the component can apply
|
110
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
111
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
112
|
-
|
113
|
-
NoTagsEmptyState.defaultProps = EmptyStateDefaultProps;
|
109
|
+
};
|
@@ -23,7 +23,7 @@ import { getDevtoolsProps } from '../../../global/js/utils/devtools';
|
|
23
23
|
import { pkg } from '../../../settings';
|
24
24
|
import { EmptyStateContent } from '../EmptyStateContent';
|
25
25
|
import { NotFoundIllustration } from '../assets/NotFoundIllustration';
|
26
|
-
import {
|
26
|
+
import { defaults } from '../EmptyState'; // The block part of our conventional BEM class names (blockClass__E--M).
|
27
27
|
|
28
28
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
29
29
|
var componentName = 'NotFoundEmptyState';
|
@@ -32,7 +32,8 @@ export var NotFoundEmptyState = /*#__PURE__*/React.forwardRef(function (_ref, re
|
|
32
32
|
className = _ref.className,
|
33
33
|
illustrationTheme = _ref.illustrationTheme,
|
34
34
|
link = _ref.link,
|
35
|
-
size = _ref.size,
|
35
|
+
_ref$size = _ref.size,
|
36
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
36
37
|
subtitle = _ref.subtitle,
|
37
38
|
title = _ref.title,
|
38
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -105,9 +106,4 @@ NotFoundEmptyState.propTypes = {
|
|
105
106
|
* Empty state title
|
106
107
|
*/
|
107
108
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired
|
108
|
-
};
|
109
|
-
// props that are required, nor for props where the component can apply
|
110
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
111
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
112
|
-
|
113
|
-
NotFoundEmptyState.defaultProps = EmptyStateDefaultProps;
|
109
|
+
};
|
@@ -23,7 +23,7 @@ import { getDevtoolsProps } from '../../../global/js/utils/devtools';
|
|
23
23
|
import { pkg } from '../../../settings';
|
24
24
|
import { EmptyStateContent } from '../EmptyStateContent';
|
25
25
|
import { NotificationsIllustration } from '../assets/NotificationsIllustration';
|
26
|
-
import {
|
26
|
+
import { defaults } from '../EmptyState'; // The block part of our conventional BEM class names (blockClass__E--M).
|
27
27
|
|
28
28
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
29
29
|
var componentName = 'NotificationsEmptyState';
|
@@ -32,7 +32,8 @@ export var NotificationsEmptyState = /*#__PURE__*/React.forwardRef(function (_re
|
|
32
32
|
className = _ref.className,
|
33
33
|
illustrationTheme = _ref.illustrationTheme,
|
34
34
|
link = _ref.link,
|
35
|
-
size = _ref.size,
|
35
|
+
_ref$size = _ref.size,
|
36
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
36
37
|
subtitle = _ref.subtitle,
|
37
38
|
title = _ref.title,
|
38
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -105,9 +106,4 @@ NotificationsEmptyState.propTypes = {
|
|
105
106
|
* Empty state title
|
106
107
|
*/
|
107
108
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired
|
108
|
-
};
|
109
|
-
// props that are required, nor for props where the component can apply
|
110
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
111
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
112
|
-
|
113
|
-
NotificationsEmptyState.defaultProps = EmptyStateDefaultProps;
|
109
|
+
};
|
@@ -23,7 +23,7 @@ import { getDevtoolsProps } from '../../../global/js/utils/devtools';
|
|
23
23
|
import { pkg } from '../../../settings';
|
24
24
|
import { EmptyStateContent } from '../EmptyStateContent';
|
25
25
|
import { UnauthorizedIllustration } from '../assets/UnauthorizedIllustration';
|
26
|
-
import {
|
26
|
+
import { defaults } from '../EmptyState'; // The block part of our conventional BEM class names (blockClass__E--M).
|
27
27
|
|
28
28
|
var blockClass = "".concat(pkg.prefix, "--empty-state");
|
29
29
|
var componentName = 'UnauthorizedEmptyState';
|
@@ -32,7 +32,8 @@ export var UnauthorizedEmptyState = /*#__PURE__*/React.forwardRef(function (_ref
|
|
32
32
|
className = _ref.className,
|
33
33
|
illustrationTheme = _ref.illustrationTheme,
|
34
34
|
link = _ref.link,
|
35
|
-
size = _ref.size,
|
35
|
+
_ref$size = _ref.size,
|
36
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
36
37
|
subtitle = _ref.subtitle,
|
37
38
|
title = _ref.title,
|
38
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -105,9 +106,4 @@ UnauthorizedEmptyState.propTypes = {
|
|
105
106
|
* Empty state title
|
106
107
|
*/
|
107
108
|
title: PropTypes.oneOfType([PropTypes.string, PropTypes.node]).isRequired
|
108
|
-
};
|
109
|
-
// props that are required, nor for props where the component can apply
|
110
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
111
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
112
|
-
|
113
|
-
UnauthorizedEmptyState.defaultProps = EmptyStateDefaultProps;
|
109
|
+
};
|
@@ -24,7 +24,13 @@ import { Button, ButtonSet } from 'carbon-components-react'; // The block part o
|
|
24
24
|
|
25
25
|
var blockClass = "".concat(pkg.prefix, "--example-component");
|
26
26
|
var componentName = 'ExampleComponent'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
27
|
+
// Default values for props
|
27
28
|
|
29
|
+
var defaults = {
|
30
|
+
primaryKind: 'primary',
|
31
|
+
secondaryKind: 'secondary',
|
32
|
+
size: 'default'
|
33
|
+
};
|
28
34
|
/**
|
29
35
|
* This is an example component to show relevant conventions and usage.
|
30
36
|
*/
|
@@ -37,10 +43,13 @@ export var ExampleComponent = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
37
43
|
onPrimaryClick = _ref.onPrimaryClick,
|
38
44
|
onSecondaryClick = _ref.onSecondaryClick,
|
39
45
|
primaryButtonLabel = _ref.primaryButtonLabel,
|
40
|
-
primaryKind = _ref.primaryKind,
|
46
|
+
_ref$primaryKind = _ref.primaryKind,
|
47
|
+
primaryKind = _ref$primaryKind === void 0 ? defaults.primaryKind : _ref$primaryKind,
|
41
48
|
secondaryButtonLabel = _ref.secondaryButtonLabel,
|
42
|
-
secondaryKind = _ref.secondaryKind,
|
43
|
-
|
49
|
+
_ref$secondaryKind = _ref.secondaryKind,
|
50
|
+
secondaryKind = _ref$secondaryKind === void 0 ? defaults.secondaryKind : _ref$secondaryKind,
|
51
|
+
_ref$size = _ref.size,
|
52
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
44
53
|
style = _ref.style,
|
45
54
|
rest = _objectWithoutProperties(_ref, _excluded);
|
46
55
|
|
@@ -147,14 +156,4 @@ ExampleComponent.propTypes = {
|
|
147
156
|
* Optional style settings for the containing node.
|
148
157
|
*/
|
149
158
|
style: PropTypes.object
|
150
|
-
}; // Default values for component props. Default values are not required for
|
151
|
-
// props that are required, nor for props where the component can apply
|
152
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
153
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
154
|
-
|
155
|
-
ExampleComponent.defaultProps = {
|
156
|
-
boxedBorder: false,
|
157
|
-
primaryKind: 'primary',
|
158
|
-
secondaryKind: 'secondary',
|
159
|
-
size: 'default'
|
160
159
|
};
|
@@ -22,7 +22,13 @@ import PropTypes from 'prop-types';
|
|
22
22
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
23
23
|
import uuidv4 from '../../global/js/utils/uuidv4';
|
24
24
|
import { pkg } from '../../settings';
|
25
|
-
var componentName = 'ExportModal';
|
25
|
+
var componentName = 'ExportModal'; // Default values for props
|
26
|
+
|
27
|
+
var defaults = {
|
28
|
+
inputType: 'text',
|
29
|
+
preformattedExtensions: Object.freeze([]),
|
30
|
+
validExtensions: Object.freeze([])
|
31
|
+
};
|
26
32
|
export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
27
33
|
var _preformattedExtensio;
|
28
34
|
|
@@ -33,14 +39,16 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
33
39
|
filename = _ref.filename,
|
34
40
|
hidePasswordLabel = _ref.hidePasswordLabel,
|
35
41
|
inputLabel = _ref.inputLabel,
|
36
|
-
inputType = _ref.inputType,
|
42
|
+
_ref$inputType = _ref.inputType,
|
43
|
+
inputType = _ref$inputType === void 0 ? defaults.inputType : _ref$inputType,
|
37
44
|
invalidInputText = _ref.invalidInputText,
|
38
45
|
loading = _ref.loading,
|
39
46
|
loadingMessage = _ref.loadingMessage,
|
40
47
|
onClose = _ref.onClose,
|
41
48
|
onRequestSubmit = _ref.onRequestSubmit,
|
42
49
|
open = _ref.open,
|
43
|
-
|
50
|
+
_ref$preformattedExte = _ref.preformattedExtensions,
|
51
|
+
preformattedExtensions = _ref$preformattedExte === void 0 ? defaults.preformattedExtensions : _ref$preformattedExte,
|
44
52
|
preformattedExtensionsLabel = _ref.preformattedExtensionsLabel,
|
45
53
|
primaryButtonText = _ref.primaryButtonText,
|
46
54
|
secondaryButtonText = _ref.secondaryButtonText,
|
@@ -48,7 +56,8 @@ export var ExportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
48
56
|
successMessage = _ref.successMessage,
|
49
57
|
successful = _ref.successful,
|
50
58
|
title = _ref.title,
|
51
|
-
validExtensions = _ref.validExtensions,
|
59
|
+
_ref$validExtensions = _ref.validExtensions,
|
60
|
+
validExtensions = _ref$validExtensions === void 0 ? defaults.validExtensions : _ref$validExtensions,
|
52
61
|
rest = _objectWithoutProperties(_ref, _excluded);
|
53
62
|
|
54
63
|
var _useState = useState(filename),
|
@@ -297,9 +306,4 @@ ExportModal.propTypes = {
|
|
297
306
|
*/
|
298
307
|
validExtensions: PropTypes.array
|
299
308
|
};
|
300
|
-
ExportModal.defaultProps = {
|
301
|
-
inputType: 'text',
|
302
|
-
preformattedExtensions: [],
|
303
|
-
validExtensions: []
|
304
|
-
};
|
305
309
|
ExportModal.displayName = componentName;
|
@@ -128,12 +128,4 @@ ExpressiveCard.propTypes = {
|
|
128
128
|
*/
|
129
129
|
title: PropTypes.string
|
130
130
|
};
|
131
|
-
ExpressiveCard.defaultProps = {
|
132
|
-
actionIcons: [],
|
133
|
-
actionIconsPosition: 'bottom',
|
134
|
-
mediaPosition: 'top',
|
135
|
-
overflowActions: [],
|
136
|
-
primaryButtonKind: 'primary',
|
137
|
-
secondaryButtonKind: 'secondary'
|
138
|
-
};
|
139
131
|
ExpressiveCard.displayName = componentName;
|
@@ -24,9 +24,14 @@ import PropTypes from 'prop-types';
|
|
24
24
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
25
25
|
import uuidv4 from '../../global/js/utils/uuidv4';
|
26
26
|
import { pkg } from '../../settings';
|
27
|
-
var componentName = 'ImportModal';
|
27
|
+
var componentName = 'ImportModal'; // Default values for props
|
28
|
+
|
29
|
+
var defaults = {
|
30
|
+
accept: Object.freeze([])
|
31
|
+
};
|
28
32
|
export var ImportModal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
29
|
-
var accept = _ref.accept,
|
33
|
+
var _ref$accept = _ref.accept,
|
34
|
+
accept = _ref$accept === void 0 ? defaults.accept : _ref$accept,
|
30
35
|
className = _ref.className,
|
31
36
|
defaultErrorBody = _ref.defaultErrorBody,
|
32
37
|
defaultErrorHeader = _ref.defaultErrorHeader,
|
@@ -416,7 +421,4 @@ ImportModal.propTypes = {
|
|
416
421
|
*/
|
417
422
|
title: PropTypes.string.isRequired
|
418
423
|
};
|
419
|
-
ImportModal.defaultProps = {
|
420
|
-
accept: []
|
421
|
-
};
|
422
424
|
ImportModal.displayName = componentName;
|
@@ -26,12 +26,17 @@ import { Close16, Edit16, EditOff16, Checkmark16, WarningFilled16, WarningAltFil
|
|
26
26
|
var blockClass = "".concat(pkg.prefix, "--inline-edit");
|
27
27
|
var componentName = 'InlineEdit'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
28
28
|
|
29
|
+
var defaults = {
|
30
|
+
light: true,
|
31
|
+
// defaults to true to reflect design
|
32
|
+
size: 'md'
|
33
|
+
};
|
29
34
|
/**
|
30
35
|
* TODO: A description of the component.
|
31
36
|
*/
|
32
37
|
|
33
38
|
export var InlineEdit = /*#__PURE__*/React.forwardRef(function (_ref, refIn) {
|
34
|
-
var _cx, _cx3;
|
39
|
+
var _cx, _refInput$current, _refInput$current$inn, _cx3;
|
35
40
|
|
36
41
|
var cancelDescription = _ref.cancelDescription,
|
37
42
|
className = _ref.className,
|
@@ -42,13 +47,15 @@ export var InlineEdit = /*#__PURE__*/React.forwardRef(function (_ref, refIn) {
|
|
42
47
|
invalid = _ref.invalid,
|
43
48
|
invalidText = _ref.invalidText,
|
44
49
|
labelText = _ref.labelText,
|
45
|
-
light = _ref.light,
|
50
|
+
_ref$light = _ref.light,
|
51
|
+
light = _ref$light === void 0 ? defaults.light : _ref$light,
|
46
52
|
onCancel = _ref.onCancel,
|
47
53
|
onSave = _ref.onSave,
|
48
54
|
onChange = _ref.onChange,
|
49
55
|
placeholder = _ref.placeholder,
|
50
56
|
saveDescription = _ref.saveDescription,
|
51
|
-
size = _ref.size,
|
57
|
+
_ref$size = _ref.size,
|
58
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
52
59
|
value = _ref.value,
|
53
60
|
warn = _ref.warn,
|
54
61
|
warnText = _ref.warnText,
|
@@ -219,7 +226,7 @@ export var InlineEdit = /*#__PURE__*/React.forwardRef(function (_ref, refIn) {
|
|
219
226
|
}, /*#__PURE__*/React.createElement("div", _extends({}, rest, getDevtoolsProps(componentName), {
|
220
227
|
id: id,
|
221
228
|
size: size,
|
222
|
-
className: cx("".concat(blockClass, "__input"), _defineProperty({}, "".concat(blockClass, "__input--empty"),
|
229
|
+
className: cx("".concat(blockClass, "__input"), _defineProperty({}, "".concat(blockClass, "__input--empty"), ((_refInput$current = refInput.current) === null || _refInput$current === void 0 ? void 0 : (_refInput$current$inn = _refInput$current.innerText) === null || _refInput$current$inn === void 0 ? void 0 : _refInput$current$inn.length) === 0)),
|
223
230
|
contentEditable: true,
|
224
231
|
"aria-label": labelText,
|
225
232
|
role: "textbox",
|
@@ -382,13 +389,4 @@ InlineEdit.propTypes = {
|
|
382
389
|
* text shown when warn true
|
383
390
|
*/
|
384
391
|
warnText: PropTypes.string
|
385
|
-
}; // Default values for component props. Default values are not required for
|
386
|
-
// props that are required, nor for props where the component can apply
|
387
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
388
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
389
|
-
|
390
|
-
InlineEdit.defaultProps = {
|
391
|
-
light: true,
|
392
|
-
// defaults to true to reflect design
|
393
|
-
size: 'md'
|
394
392
|
};
|
@@ -23,7 +23,13 @@ import { pkg
|
|
23
23
|
|
24
24
|
var blockClass = "".concat(pkg.prefix, "--loading-bar");
|
25
25
|
var componentName = 'LoadingBar'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
26
|
+
// Default values for props
|
26
27
|
|
28
|
+
var defaults = {
|
29
|
+
active: true,
|
30
|
+
percentage: undefined,
|
31
|
+
ariaLabel: 'Active loading indicator'
|
32
|
+
};
|
27
33
|
/**
|
28
34
|
* The LoadingBar component provides a way to communicate the loading state to users.
|
29
35
|
* It is intended to fill the space of where it's used, and should persist until the
|
@@ -40,11 +46,14 @@ var componentName = 'LoadingBar'; // NOTE: the component SCSS is not imported he
|
|
40
46
|
export var LoadingBar = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
41
47
|
var _cx2, _cx3;
|
42
48
|
|
43
|
-
var active = _ref.active,
|
44
|
-
|
49
|
+
var _ref$active = _ref.active,
|
50
|
+
active = _ref$active === void 0 ? defaults.active : _ref$active,
|
51
|
+
_ref$ariaLabel = _ref.ariaLabel,
|
52
|
+
ariaLabel = _ref$ariaLabel === void 0 ? defaults.ariaLabel : _ref$ariaLabel,
|
45
53
|
className = _ref.className,
|
46
54
|
id = _ref.id,
|
47
|
-
percentage = _ref.percentage,
|
55
|
+
_ref$percentage = _ref.percentage,
|
56
|
+
percentage = _ref$percentage === void 0 ? defaults.percentage : _ref$percentage,
|
48
57
|
percentageIndicatorText = _ref.percentageIndicatorText,
|
49
58
|
showPercentageIndicator = _ref.showPercentageIndicator,
|
50
59
|
small = _ref.small,
|
@@ -108,7 +117,7 @@ LoadingBar.propTypes = {
|
|
108
117
|
/**
|
109
118
|
* Specify whether you want the loading bar indicator to be active or not
|
110
119
|
*/
|
111
|
-
active: PropTypes.bool
|
120
|
+
active: PropTypes.bool,
|
112
121
|
|
113
122
|
/**
|
114
123
|
* Specify a ariaLabel that would be used to best describe the active loading state
|
@@ -144,17 +153,4 @@ LoadingBar.propTypes = {
|
|
144
153
|
* Specify whether you would like the small variant of this component
|
145
154
|
*/
|
146
155
|
small: PropTypes.bool
|
147
|
-
}; // Default values for component props. Default values are not required for
|
148
|
-
// props that are required, nor for props where the component can apply
|
149
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
150
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
151
|
-
|
152
|
-
LoadingBar.defaultProps = {
|
153
|
-
/* add defaults for relevant props. */
|
154
|
-
active: true,
|
155
|
-
small: false,
|
156
|
-
percentage: undefined,
|
157
|
-
showPercentageIndicator: false,
|
158
|
-
percentageIndicatorText: undefined,
|
159
|
-
ariaLabel: 'Active loading indicator'
|
160
156
|
};
|
@@ -46,9 +46,4 @@ ModifiedTabLabelWithClose.propTypes = {
|
|
46
46
|
* unsavedContent indicates tab contents have not been saved
|
47
47
|
*/
|
48
48
|
unsavedContent: PropTypes.bool
|
49
|
-
};
|
50
|
-
ModifiedTabLabelWithClose.defaultProps = {
|
51
|
-
unsavedContent: false,
|
52
|
-
label: '',
|
53
|
-
onClose: undefined
|
54
49
|
};
|