@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
@@ -1,4 +1,12 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
+
var _excluded = ["actionsPlacement"];
|
5
|
+
|
6
|
+
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; }
|
7
|
+
|
8
|
+
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) { _defineProperty(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; }
|
9
|
+
|
2
10
|
//
|
3
11
|
// Copyright IBM Corp. 2020, 2021
|
4
12
|
//
|
@@ -11,11 +19,21 @@ import { Card } from '../Card';
|
|
11
19
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
12
20
|
import { prepareProps } from '../../global/js/utils/props-helper';
|
13
21
|
import { pkg } from '../../settings';
|
14
|
-
var componentName = 'ProductiveCard';
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
22
|
+
var componentName = 'ProductiveCard'; // Default values for props
|
23
|
+
|
24
|
+
var defaults = {
|
25
|
+
actionsPlacement: 'top'
|
26
|
+
};
|
27
|
+
export var ProductiveCard = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
28
|
+
var _ref$actionsPlacement = _ref.actionsPlacement,
|
29
|
+
actionsPlacement = _ref$actionsPlacement === void 0 ? defaults.actionsPlacement : _ref$actionsPlacement,
|
30
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
31
|
+
|
32
|
+
var validProps = prepareProps(rest, ['media', 'mediaPosition', 'onSecondaryButtonClick', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind', 'secondaryButtonText']);
|
33
|
+
return /*#__PURE__*/React.createElement(Card, _extends({}, _objectSpread(_objectSpread({}, validProps), {}, {
|
34
|
+
actionsPlacement: actionsPlacement,
|
35
|
+
ref: ref
|
36
|
+
}), {
|
19
37
|
productive: true
|
20
38
|
}, getDevtoolsProps(componentName)));
|
21
39
|
}); // Return a placeholder if not released and not enabled by feature flag
|
@@ -109,11 +127,4 @@ ProductiveCard.propTypes = {
|
|
109
127
|
*/
|
110
128
|
titleSize: PropTypes.oneOf(['default', 'large'])
|
111
129
|
};
|
112
|
-
ProductiveCard.defaultProps = {
|
113
|
-
actionIcons: [],
|
114
|
-
actionsPlacement: 'top',
|
115
|
-
clickZone: 'one',
|
116
|
-
overflowActions: [],
|
117
|
-
titleSize: 'default'
|
118
|
-
};
|
119
130
|
ProductiveCard.displayName = componentName;
|
@@ -34,7 +34,16 @@ import { Close20, ArrowLeft20 } from '@carbon/icons-react';
|
|
34
34
|
import { ActionSet } from '../ActionSet';
|
35
35
|
var blockClass = "".concat(pkg.prefix, "--side-panel");
|
36
36
|
var componentName = 'SidePanel'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
37
|
+
// Default values for props
|
37
38
|
|
39
|
+
var defaults = {
|
40
|
+
animateTitle: true,
|
41
|
+
closeIconDescription: 'Close',
|
42
|
+
currentStep: 0,
|
43
|
+
navigationBackIconDescription: 'Back',
|
44
|
+
placement: 'right',
|
45
|
+
size: 'md'
|
46
|
+
};
|
38
47
|
/**
|
39
48
|
* Side panels keep users in-context of a page while performing tasks like navigating, editing, viewing details, or configuring something new.
|
40
49
|
*/
|
@@ -44,24 +53,30 @@ export var SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
44
53
|
|
45
54
|
var actionToolbarButtons = _ref.actionToolbarButtons,
|
46
55
|
actions = _ref.actions,
|
47
|
-
animateTitle = _ref.animateTitle,
|
56
|
+
_ref$animateTitle = _ref.animateTitle,
|
57
|
+
animateTitle = _ref$animateTitle === void 0 ? defaults.animateTitle : _ref$animateTitle,
|
48
58
|
children = _ref.children,
|
49
59
|
className = _ref.className,
|
50
|
-
|
60
|
+
_ref$closeIconDescrip = _ref.closeIconDescription,
|
61
|
+
closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
|
51
62
|
condensedActions = _ref.condensedActions,
|
52
|
-
currentStep = _ref.currentStep,
|
63
|
+
_ref$currentStep = _ref.currentStep,
|
64
|
+
currentStep = _ref$currentStep === void 0 ? defaults.currentStep : _ref$currentStep,
|
53
65
|
includeOverlay = _ref.includeOverlay,
|
54
66
|
labelText = _ref.labelText,
|
55
|
-
|
67
|
+
_ref$navigationBackIc = _ref.navigationBackIconDescription,
|
68
|
+
navigationBackIconDescription = _ref$navigationBackIc === void 0 ? defaults.navigationBackIconDescription : _ref$navigationBackIc,
|
56
69
|
onNavigationBack = _ref.onNavigationBack,
|
57
70
|
onRequestClose = _ref.onRequestClose,
|
58
71
|
onUnmount = _ref.onUnmount,
|
59
72
|
open = _ref.open,
|
60
|
-
placement = _ref.placement,
|
73
|
+
_ref$placement = _ref.placement,
|
74
|
+
placement = _ref$placement === void 0 ? defaults.placement : _ref$placement,
|
61
75
|
preventCloseOnClickOutside = _ref.preventCloseOnClickOutside,
|
62
76
|
selectorPageContent = _ref.selectorPageContent,
|
63
77
|
selectorPrimaryFocus = _ref.selectorPrimaryFocus,
|
64
|
-
size = _ref.size,
|
78
|
+
_ref$size = _ref.size,
|
79
|
+
size = _ref$size === void 0 ? defaults.size : _ref$size,
|
65
80
|
slideIn = _ref.slideIn,
|
66
81
|
subtitle = _ref.subtitle,
|
67
82
|
title = _ref.title,
|
@@ -550,7 +565,7 @@ SidePanel.propTypes = {
|
|
550
565
|
/**
|
551
566
|
* Sets the close button icon description
|
552
567
|
*/
|
553
|
-
closeIconDescription: PropTypes.string
|
568
|
+
closeIconDescription: PropTypes.string,
|
554
569
|
|
555
570
|
/**
|
556
571
|
* Determines whether the side panel should render the condensed version (affects action buttons primarily)
|
@@ -647,14 +662,4 @@ SidePanel.propTypes = {
|
|
647
662
|
return labelText;
|
648
663
|
})
|
649
664
|
};
|
650
|
-
SidePanel.defaultProps = {
|
651
|
-
animateTitle: true,
|
652
|
-
placement: 'right',
|
653
|
-
size: 'md',
|
654
|
-
slideIn: false,
|
655
|
-
currentStep: 0,
|
656
|
-
navigationBackIconDescription: 'Back',
|
657
|
-
closeIconDescription: 'Close',
|
658
|
-
preventCloseOnClickOutside: false
|
659
|
-
};
|
660
665
|
SidePanel.displayName = componentName;
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
-
var _excluded = ["align", "className", "maxVisible", "overflowAlign", "overflowClassName", "overflowDirection", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags"],
|
5
|
+
var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "overflowAlign", "overflowClassName", "overflowDirection", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags"],
|
6
6
|
_excluded2 = ["label", "id"],
|
7
7
|
_excluded3 = ["label"];
|
8
8
|
|
@@ -17,6 +17,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
17
17
|
// LICENSE file in the root directory of this source tree.
|
18
18
|
//
|
19
19
|
import React, { useState, useEffect, useRef, useCallback } from 'react';
|
20
|
+
import { createPortal } from 'react-dom';
|
20
21
|
import PropTypes from 'prop-types';
|
21
22
|
import cx from 'classnames';
|
22
23
|
import { TagSetOverflow } from './TagSetOverflow';
|
@@ -28,14 +29,26 @@ import { prepareProps, isRequiredIf } from '../../global/js/utils/props-helper';
|
|
28
29
|
import { pkg } from '../../settings';
|
29
30
|
var componentName = 'TagSet';
|
30
31
|
var blockClass = "".concat(pkg.prefix, "--tag-set");
|
31
|
-
var allTagsModalSearchThreshold = 10;
|
32
|
+
var allTagsModalSearchThreshold = 10; // Default values for props
|
33
|
+
|
34
|
+
var defaults = {
|
35
|
+
align: 'start',
|
36
|
+
allTagsModalTarget: document.body,
|
37
|
+
overflowAlign: 'center',
|
38
|
+
overflowDirection: 'bottom'
|
39
|
+
};
|
32
40
|
export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
33
|
-
var align = _ref.align,
|
41
|
+
var _ref$align = _ref.align,
|
42
|
+
align = _ref$align === void 0 ? defaults.align : _ref$align,
|
43
|
+
_ref$allTagsModalTarg = _ref.allTagsModalTarget,
|
44
|
+
allTagsModalTarget = _ref$allTagsModalTarg === void 0 ? defaults.allTagsModalTarget : _ref$allTagsModalTarg,
|
34
45
|
className = _ref.className,
|
35
46
|
maxVisible = _ref.maxVisible,
|
36
|
-
overflowAlign = _ref.overflowAlign,
|
47
|
+
_ref$overflowAlign = _ref.overflowAlign,
|
48
|
+
overflowAlign = _ref$overflowAlign === void 0 ? defaults.overflowAlign : _ref$overflowAlign,
|
37
49
|
overflowClassName = _ref.overflowClassName,
|
38
|
-
|
50
|
+
_ref$overflowDirectio = _ref.overflowDirection,
|
51
|
+
overflowDirection = _ref$overflowDirectio === void 0 ? defaults.overflowDirection : _ref$overflowDirectio,
|
39
52
|
allTagsModalTitle = _ref.allTagsModalTitle,
|
40
53
|
allTagsModalSearchLabel = _ref.allTagsModalSearchLabel,
|
41
54
|
allTagsModalSearchPlaceholderText = _ref.allTagsModalSearchPlaceholderText,
|
@@ -215,14 +228,14 @@ export var TagSet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
215
228
|
}, hiddenSizingTags), /*#__PURE__*/React.createElement("div", {
|
216
229
|
className: "".concat(blockClass, "__tag-container"),
|
217
230
|
ref: displayedArea
|
218
|
-
}, displayedTags)), tags && displayCount < tags.length ? /*#__PURE__*/React.createElement(TagSetModal, {
|
231
|
+
}, displayedTags)), allTagsModalTarget && tags && displayCount < tags.length ? /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(TagSetModal, {
|
219
232
|
allTags: tags,
|
220
233
|
open: showAllModalOpen,
|
221
234
|
title: allTagsModalTitle,
|
222
235
|
onClose: handleModalClose,
|
223
236
|
searchLabel: allTagsModalSearchLabel,
|
224
237
|
searchPlaceholder: allTagsModalSearchPlaceholderText
|
225
|
-
}) : null);
|
238
|
+
}), allTagsModalTarget) : null);
|
226
239
|
}); // Return a placeholder if not released and not enabled by feature flag
|
227
240
|
|
228
241
|
TagSet = pkg.checkComponentEnabled(TagSet, componentName);
|
@@ -267,6 +280,11 @@ TagSet.propTypes = {
|
|
267
280
|
*/
|
268
281
|
allTagsModalSearchPlaceholderText: string_required_if_more_than_10_tags,
|
269
282
|
|
283
|
+
/**
|
284
|
+
* portal target for the all tags modal
|
285
|
+
*/
|
286
|
+
allTagsModalTarget: PropTypes.node,
|
287
|
+
|
270
288
|
/**
|
271
289
|
* title for the show all modal. **Note: Required if more than 10 tags**
|
272
290
|
*/
|
@@ -320,10 +338,5 @@ TagSet.propTypes = {
|
|
320
338
|
type: PropTypes.oneOf(tagTypes)
|
321
339
|
})))
|
322
340
|
};
|
323
|
-
TagSet.defaultProps = {
|
324
|
-
align: 'start',
|
325
|
-
overflowAlign: 'center',
|
326
|
-
overflowDirection: 'bottom'
|
327
|
-
};
|
328
341
|
TagSet.displayName = componentName;
|
329
342
|
export default TagSet;
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
2
|
import _extends from "@babel/runtime/helpers/extends";
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
5
|
-
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
+
var _excluded = ["allTags", "className", "title", "onClose", "open", "searchLabel", "searchPlaceholder"],
|
6
|
+
_excluded2 = ["label"];
|
6
7
|
|
7
8
|
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
9
|
|
@@ -21,15 +22,22 @@ import { ComposedModal, ModalHeader, ModalBody, Search, Tag } from 'carbon-compo
|
|
21
22
|
import { pkg } from '../../settings';
|
22
23
|
import { prepareProps } from '../../global/js/utils/props-helper';
|
23
24
|
var componentName = 'TagSetModal';
|
24
|
-
var blockClass = "".concat(pkg.prefix, "--tag-set-modal");
|
25
|
+
var blockClass = "".concat(pkg.prefix, "--tag-set-modal"); // Default values for props
|
26
|
+
|
27
|
+
var defaults = {
|
28
|
+
// marked as required by TagSet if needed, default used to satisfy <Search /> component
|
29
|
+
searchLabel: ''
|
30
|
+
};
|
25
31
|
export var TagSetModal = function TagSetModal(_ref) {
|
26
32
|
var allTags = _ref.allTags,
|
27
33
|
className = _ref.className,
|
28
34
|
title = _ref.title,
|
29
35
|
onClose = _ref.onClose,
|
30
36
|
open = _ref.open,
|
31
|
-
searchLabel = _ref.searchLabel,
|
32
|
-
|
37
|
+
_ref$searchLabel = _ref.searchLabel,
|
38
|
+
searchLabel = _ref$searchLabel === void 0 ? defaults.searchLabel : _ref$searchLabel,
|
39
|
+
searchPlaceholder = _ref.searchPlaceholder,
|
40
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
33
41
|
|
34
42
|
var _useState = useState([]),
|
35
43
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -69,13 +77,13 @@ export var TagSetModal = function TagSetModal(_ref) {
|
|
69
77
|
setSearch(ev.target.value || '');
|
70
78
|
};
|
71
79
|
|
72
|
-
return /*#__PURE__*/React.createElement(ComposedModal, {
|
80
|
+
return /*#__PURE__*/React.createElement(ComposedModal, _extends({}, rest, {
|
73
81
|
containerClassName: "".concat(blockClass, "__container"),
|
74
82
|
className: cx(className, "".concat(blockClass)),
|
75
83
|
size: "sm",
|
76
84
|
open: open,
|
77
85
|
onClose: onClose
|
78
|
-
}, /*#__PURE__*/React.createElement(ModalHeader, {
|
86
|
+
}), /*#__PURE__*/React.createElement(ModalHeader, {
|
79
87
|
title: title,
|
80
88
|
className: "".concat(blockClass, "__header")
|
81
89
|
}, /*#__PURE__*/React.createElement(Search, {
|
@@ -90,7 +98,7 @@ export var TagSetModal = function TagSetModal(_ref) {
|
|
90
98
|
hasForm: true
|
91
99
|
}, filteredModalTags.map(function (_ref2, index) {
|
92
100
|
var label = _ref2.label,
|
93
|
-
other = _objectWithoutProperties(_ref2,
|
101
|
+
other = _objectWithoutProperties(_ref2, _excluded2);
|
94
102
|
|
95
103
|
return /*#__PURE__*/React.createElement(Tag, _extends({}, other, {
|
96
104
|
filter: false,
|
@@ -111,8 +119,4 @@ TagSetModal.propTypes = {
|
|
111
119
|
searchPlaceholder: PropTypes.string,
|
112
120
|
title: PropTypes.string
|
113
121
|
};
|
114
|
-
TagSetModal.defaultProps = {
|
115
|
-
// marked as required by TagSet if needed, default used to satisfy <Search /> component
|
116
|
-
searchLabel: ''
|
117
|
-
};
|
118
122
|
TagSetModal.displayName = componentName;
|
@@ -1,5 +1,8 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
1
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
+
var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowDirection", "overflowTags", "showAllTagsLabel"];
|
3
6
|
//
|
4
7
|
// Copyright IBM Corp. 2021, 2021
|
5
8
|
//
|
@@ -13,15 +16,25 @@ import { Link, Tag, Tooltip } from 'carbon-components-react';
|
|
13
16
|
import { pkg } from '../../settings';
|
14
17
|
import { noop } from '../../global/js/utils/pconsole';
|
15
18
|
var componentName = 'TagSetOverflow';
|
16
|
-
var blockClass = "".concat(pkg.prefix, "--tag-set-overflow");
|
19
|
+
var blockClass = "".concat(pkg.prefix, "--tag-set-overflow"); // Default values for props
|
20
|
+
|
21
|
+
var defaults = {
|
22
|
+
allTagsModalSearchThreshold: 10,
|
23
|
+
overflowAlign: 'center',
|
24
|
+
overflowDirection: 'bottom'
|
25
|
+
};
|
17
26
|
export var TagSetOverflow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
18
|
-
var
|
19
|
-
|
27
|
+
var _ref$allTagsModalSear = _ref.allTagsModalSearchThreshold,
|
28
|
+
allTagsModalSearchThreshold = _ref$allTagsModalSear === void 0 ? defaults.allTagsModalSearchThreshold : _ref$allTagsModalSear,
|
29
|
+
className = _ref.className,
|
20
30
|
onShowAllClick = _ref.onShowAllClick,
|
21
|
-
overflowAlign = _ref.overflowAlign,
|
22
|
-
|
31
|
+
_ref$overflowAlign = _ref.overflowAlign,
|
32
|
+
overflowAlign = _ref$overflowAlign === void 0 ? defaults.overflowAlign : _ref$overflowAlign,
|
33
|
+
_ref$overflowDirectio = _ref.overflowDirection,
|
34
|
+
overflowDirection = _ref$overflowDirectio === void 0 ? defaults.overflowDirection : _ref$overflowDirectio,
|
35
|
+
overflowTags = _ref.overflowTags,
|
23
36
|
showAllTagsLabel = _ref.showAllTagsLabel,
|
24
|
-
|
37
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
25
38
|
|
26
39
|
var _useState = useState(false),
|
27
40
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -42,11 +55,11 @@ export var TagSetOverflow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
42
55
|
onShowAllClick();
|
43
56
|
};
|
44
57
|
|
45
|
-
return /*#__PURE__*/React.createElement("span", {
|
58
|
+
return /*#__PURE__*/React.createElement("span", _extends({}, rest, {
|
46
59
|
"aria-hidden": overflowTags.length === 0,
|
47
60
|
className: cx("".concat(blockClass), _defineProperty({}, "".concat(blockClass, "--hidden"), overflowTags.length === 0)),
|
48
61
|
ref: ref
|
49
|
-
}, /*#__PURE__*/React.createElement(Tooltip, {
|
62
|
+
}), /*#__PURE__*/React.createElement(Tooltip, {
|
50
63
|
align: overflowAlign,
|
51
64
|
className: cx(className, "".concat(blockClass, "__tooltip")),
|
52
65
|
direction: overflowDirection,
|
@@ -113,9 +126,4 @@ TagSetOverflow.propTypes = {
|
|
113
126
|
* label for the overflow show all tags link
|
114
127
|
*/
|
115
128
|
showAllTagsLabel: PropTypes.string
|
116
|
-
};
|
117
|
-
TagSetOverflow.defaultProps = {
|
118
|
-
allTagsModalSearchThreshold: 10,
|
119
|
-
overflowAlign: 'center',
|
120
|
-
overflowDirection: 'bottom'
|
121
129
|
};
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
-
import
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["influencerPosition", "influencerWidth", "verticalPosition"];
|
3
4
|
|
4
5
|
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; }
|
5
6
|
|
@@ -16,14 +17,20 @@ import React from 'react'; // Other standard imports.
|
|
16
17
|
|
17
18
|
import PropTypes from 'prop-types';
|
18
19
|
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
19
|
-
import { allPropTypes
|
20
|
+
import { allPropTypes } from '../../global/js/utils/props-helper';
|
20
21
|
import { pkg } from '../../settings'; // Carbon and package components we use.
|
21
22
|
|
22
23
|
import { Button } from 'carbon-components-react';
|
23
24
|
import { ActionSet } from '../ActionSet';
|
24
25
|
import { tearsheetHasCloseIcon, TearsheetShell } from './TearsheetShell';
|
25
26
|
var componentName = 'Tearsheet'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
27
|
+
// Default values for props
|
26
28
|
|
29
|
+
var defaults = {
|
30
|
+
influencerPosition: 'left',
|
31
|
+
influencerWidth: 'narrow',
|
32
|
+
verticalPosition: 'lower'
|
33
|
+
};
|
27
34
|
/**
|
28
35
|
* A tearsheet is a mostly full-screen type of dialog that keeps users
|
29
36
|
* in-context and focused by bringing actionable content front and center while
|
@@ -37,11 +44,22 @@ var componentName = 'Tearsheet'; // NOTE: the component SCSS is not imported her
|
|
37
44
|
* action buttons.
|
38
45
|
*/
|
39
46
|
|
40
|
-
export var Tearsheet = /*#__PURE__*/React.forwardRef(function (
|
41
|
-
|
47
|
+
export var Tearsheet = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
48
|
+
var _ref$influencerPositi = _ref.influencerPosition,
|
49
|
+
influencerPosition = _ref$influencerPositi === void 0 ? defaults.influencerPosition : _ref$influencerPositi,
|
50
|
+
_ref$influencerWidth = _ref.influencerWidth,
|
51
|
+
influencerWidth = _ref$influencerWidth === void 0 ? defaults.influencerWidth : _ref$influencerWidth,
|
52
|
+
_ref$verticalPosition = _ref.verticalPosition,
|
53
|
+
verticalPosition = _ref$verticalPosition === void 0 ? defaults.verticalPosition : _ref$verticalPosition,
|
54
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
55
|
+
|
56
|
+
return /*#__PURE__*/React.createElement(TearsheetShell, _objectSpread(_objectSpread(_objectSpread({}, getDevtoolsProps(componentName)), rest), {}, {
|
57
|
+
influencerPosition: influencerPosition,
|
58
|
+
influencerWidth: influencerWidth,
|
59
|
+
verticalPosition: verticalPosition,
|
42
60
|
ref: ref,
|
43
61
|
size: 'wide'
|
44
|
-
}))
|
62
|
+
}));
|
45
63
|
}); // Return a placeholder if not released and not enabled by feature flag
|
46
64
|
|
47
65
|
Tearsheet = pkg.checkComponentEnabled(Tearsheet, componentName); // The display name of the component, used by React. Note that displayName
|
@@ -100,9 +118,9 @@ Tearsheet.propTypes = _objectSpread({
|
|
100
118
|
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
101
119
|
* there are a no navigation actions and/or hasCloseIcon is true.
|
102
120
|
*/
|
103
|
-
closeIconDescription: PropTypes.string.isRequired.if(function (
|
104
|
-
var actions =
|
105
|
-
hasCloseIcon =
|
121
|
+
closeIconDescription: PropTypes.string.isRequired.if(function (_ref2) {
|
122
|
+
var actions = _ref2.actions,
|
123
|
+
hasCloseIcon = _ref2.hasCloseIcon;
|
106
124
|
return tearsheetHasCloseIcon(actions, hasCloseIcon);
|
107
125
|
}),
|
108
126
|
|
@@ -168,13 +186,4 @@ Tearsheet.propTypes = _objectSpread({
|
|
168
186
|
* The main title of the tearsheet, displayed in the header area.
|
169
187
|
*/
|
170
188
|
title: PropTypes.node
|
171
|
-
}, deprecatedProps);
|
172
|
-
// props that are required, nor for props where the component can apply
|
173
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
174
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
175
|
-
|
176
|
-
Tearsheet.defaultProps = {
|
177
|
-
influencerPosition: 'left',
|
178
|
-
influencerWidth: 'narrow',
|
179
|
-
verticalPosition: 'lower'
|
180
|
-
};
|
189
|
+
}, deprecatedProps);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
-
import
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["verticalPosition"];
|
3
4
|
|
4
5
|
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; }
|
5
6
|
|
@@ -23,7 +24,11 @@ import { Button } from 'carbon-components-react';
|
|
23
24
|
import { ActionSet } from '../ActionSet';
|
24
25
|
import { tearsheetHasCloseIcon, TearsheetShell, tearsheetShellWideProps as blocked } from './TearsheetShell';
|
25
26
|
var componentName = 'TearsheetNarrow'; // NOTE: the component SCSS is not imported here: it is rolled up separately.
|
27
|
+
// Default values for props
|
26
28
|
|
29
|
+
var defaults = {
|
30
|
+
verticalPosition: 'lower'
|
31
|
+
};
|
27
32
|
/**
|
28
33
|
* A narrow tearsheet is a slimmer variant of the tearsheet, providing a dialog
|
29
34
|
* that keeps users in-context and focused by bringing actionable content front
|
@@ -33,11 +38,16 @@ var componentName = 'TearsheetNarrow'; // NOTE: the component SCSS is not import
|
|
33
38
|
* main content area, and a set of action buttons.
|
34
39
|
*/
|
35
40
|
|
36
|
-
export var TearsheetNarrow = /*#__PURE__*/React.forwardRef(function (
|
37
|
-
|
41
|
+
export var TearsheetNarrow = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
42
|
+
var _ref$verticalPosition = _ref.verticalPosition,
|
43
|
+
verticalPosition = _ref$verticalPosition === void 0 ? defaults.verticalPosition : _ref$verticalPosition,
|
44
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
45
|
+
|
46
|
+
return /*#__PURE__*/React.createElement(TearsheetShell, _objectSpread(_objectSpread(_objectSpread({}, getDevtoolsProps(componentName)), prepareProps(rest, blocked)), {}, {
|
47
|
+
verticalPosition: verticalPosition,
|
38
48
|
ref: ref,
|
39
49
|
size: 'narrow'
|
40
|
-
}))
|
50
|
+
}));
|
41
51
|
}); // Return a placeholder if not released and not enabled by feature flag
|
42
52
|
|
43
53
|
TearsheetNarrow = pkg.checkComponentEnabled(TearsheetNarrow, componentName); // The display name of the component, used by React. Note that displayName
|
@@ -96,9 +106,9 @@ TearsheetNarrow.propTypes = _objectSpread({
|
|
96
106
|
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
97
107
|
* there are a no navigation actions and/or hasCloseIcon is true.
|
98
108
|
*/
|
99
|
-
closeIconDescription: PropTypes.string.isRequired.if(function (
|
100
|
-
var actions =
|
101
|
-
hasCloseIcon =
|
109
|
+
closeIconDescription: PropTypes.string.isRequired.if(function (_ref2) {
|
110
|
+
var actions = _ref2.actions,
|
111
|
+
hasCloseIcon = _ref2.hasCloseIcon;
|
102
112
|
return tearsheetHasCloseIcon(actions, hasCloseIcon);
|
103
113
|
}),
|
104
114
|
|
@@ -138,11 +148,4 @@ TearsheetNarrow.propTypes = _objectSpread({
|
|
138
148
|
* The main title of the tearsheet, displayed in the header area.
|
139
149
|
*/
|
140
150
|
title: PropTypes.node
|
141
|
-
}, deprecatedProps);
|
142
|
-
// props that are required, nor for props where the component can apply
|
143
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
144
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
145
|
-
|
146
|
-
TearsheetNarrow.defaultProps = {
|
147
|
-
verticalPosition: 'lower'
|
148
|
-
};
|
151
|
+
}, deprecatedProps);
|
@@ -50,8 +50,5 @@ ToolbarButton.propTypes = {
|
|
50
50
|
/** Provide an optional class to be applied to the containing node */
|
51
51
|
className: string
|
52
52
|
};
|
53
|
-
ToolbarButton.defaultProps = {
|
54
|
-
caret: false
|
55
|
-
};
|
56
53
|
ToolbarButton = pkg.checkComponentEnabled(ToolbarButton, componentName);
|
57
54
|
export { blockClass, ToolbarButton };
|
@@ -78,7 +78,8 @@ export var UserProfileImage = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
78
78
|
};
|
79
79
|
|
80
80
|
return FillItem && (tooltipText ? /*#__PURE__*/React.createElement(TooltipIcon, {
|
81
|
-
tooltipText: tooltipText
|
81
|
+
tooltipText: tooltipText,
|
82
|
+
className: "".concat(blockClass, "__tooltip")
|
82
83
|
}, renderUserProfileImage()) : renderUserProfileImage());
|
83
84
|
}); // Return a placeholder if not released and not enabled by feature flag
|
84
85
|
|
@@ -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 = ["
|
5
|
+
var _excluded = ["actions", "children", "className", "closeIconDescription", "closeTerminal", "documentationLinks", "documentationLinksIconDescription", "open"];
|
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
|
|
@@ -25,18 +25,27 @@ import { Close16 as Close, Help16 as Help } from '@carbon/icons-react';
|
|
25
25
|
import { Button, OverflowMenu, OverflowMenuItem } from 'carbon-components-react'; // The block part of our conventional BEM class names (blockClass__E--M).
|
26
26
|
|
27
27
|
var componentName = 'WebTerminal';
|
28
|
-
var blockClass = "".concat(pkg.prefix, "--web-terminal");
|
28
|
+
var blockClass = "".concat(pkg.prefix, "--web-terminal"); // Default values for props
|
29
|
+
|
30
|
+
var defaults = {
|
31
|
+
actions: Object.freeze([]),
|
32
|
+
documentationLinks: Object.freeze([]),
|
33
|
+
documentationLinksIconDescription: 'Show documentation links'
|
34
|
+
};
|
29
35
|
export var WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
30
36
|
var _ref2;
|
31
37
|
|
32
|
-
var
|
38
|
+
var _ref$actions = _ref.actions,
|
39
|
+
actions = _ref$actions === void 0 ? defaults.actions : _ref$actions,
|
40
|
+
children = _ref.children,
|
33
41
|
className = _ref.className,
|
42
|
+
closeIconDescription = _ref.closeIconDescription,
|
34
43
|
closeTerminal = _ref.closeTerminal,
|
35
|
-
|
36
|
-
|
44
|
+
_ref$documentationLin = _ref.documentationLinks,
|
45
|
+
documentationLinks = _ref$documentationLin === void 0 ? defaults.documentationLinks : _ref$documentationLin,
|
46
|
+
_ref$documentationLin2 = _ref.documentationLinksIconDescription,
|
47
|
+
documentationLinksIconDescription = _ref$documentationLin2 === void 0 ? defaults.documentationLinksIconDescription : _ref$documentationLin2,
|
37
48
|
open = _ref.open,
|
38
|
-
actions = _ref.actions,
|
39
|
-
closeIconDescription = _ref.closeIconDescription,
|
40
49
|
rest = _objectWithoutProperties(_ref, _excluded);
|
41
50
|
|
42
51
|
var _useState = useState(open),
|
@@ -61,7 +70,7 @@ export var WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
61
70
|
|
62
71
|
return shouldRender ? /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
63
72
|
ref: ref,
|
64
|
-
className: cx([blockClass, (_ref2 = {}, _defineProperty(_ref2, "".concat(blockClass, "--open"), open), _defineProperty(_ref2, "".concat(blockClass, "--closed"), !open),
|
73
|
+
className: cx([className, blockClass, (_ref2 = {}, _defineProperty(_ref2, "".concat(blockClass, "--open"), open), _defineProperty(_ref2, "".concat(blockClass, "--closed"), !open), _ref2)]),
|
65
74
|
style: {
|
66
75
|
animation: "".concat(open ? 'web-terminal-entrance 250ms' : 'web-terminal-exit 250ms')
|
67
76
|
},
|
@@ -155,14 +164,4 @@ WebTerminal.propTypes = {
|
|
155
164
|
* Boolean that determines if the web terminal is opened or closed
|
156
165
|
*/
|
157
166
|
open: PropTypes.bool.isRequired
|
158
|
-
}; // Default values for component props. Default values are not required for
|
159
|
-
// props that are required, nor for props where the component can apply
|
160
|
-
// 'undefined' values reasonably. Default values should be provided when the
|
161
|
-
// component needs to make a choice or assumption when a prop is not supplied.
|
162
|
-
|
163
|
-
WebTerminal.defaultProps = {
|
164
|
-
actions: [],
|
165
|
-
documentationLinks: [],
|
166
|
-
documentationLinksIconDescription: 'Show documentation links',
|
167
|
-
className: ''
|
168
167
|
};
|
package/es/components/index.js
CHANGED
@@ -36,6 +36,5 @@ export { UserProfileImage } from './UserProfileImage';
|
|
36
36
|
export { WebTerminal } from './WebTerminal';
|
37
37
|
export { EditSidePanel } from './EditSidePanel';
|
38
38
|
export { OptionsTile } from './OptionsTile';
|
39
|
-
export { CancelableTextEdit } from './CancelableTextEdit';
|
40
39
|
export { InlineEdit } from './InlineEdit';
|
41
40
|
export { DataSpreadsheet } from './DataSpreadsheet';
|
@@ -4,6 +4,7 @@
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
|
+
export { useActiveElement } from './useActiveElement';
|
7
8
|
export { useNearestScroll, useWindowScroll } from './useWindowScroll';
|
8
9
|
export { useWindowResize } from './useWindowResize';
|
9
10
|
export { useClickOutside } from './useClickOutside';
|
@@ -0,0 +1,27 @@
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Copyright IBM Corp. 2022, 2022
|
5
|
+
*
|
6
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
8
|
+
*/
|
9
|
+
import { useState, useEffect } from 'react';
|
10
|
+
export var useActiveElement = function useActiveElement() {
|
11
|
+
var _useState = useState(document.activeElement),
|
12
|
+
_useState2 = _slicedToArray(_useState, 2),
|
13
|
+
active = _useState2[0],
|
14
|
+
setActive = _useState2[1];
|
15
|
+
|
16
|
+
var handleFocusIn = function handleFocusIn() {
|
17
|
+
setActive(document.activeElement);
|
18
|
+
};
|
19
|
+
|
20
|
+
useEffect(function () {
|
21
|
+
document.addEventListener('focusin', handleFocusIn);
|
22
|
+
return function () {
|
23
|
+
document.removeEventListener('focusin', handleFocusIn);
|
24
|
+
};
|
25
|
+
}, []);
|
26
|
+
return active;
|
27
|
+
};
|