@carbon/ibm-products 1.55.1 → 1.56.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +639 -16
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +4 -4
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon.css +582 -9
- 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 +620 -12
- package/css/index.css.map +1 -1
- package/css/index.min.css +4 -4
- package/css/index.min.css.map +1 -1
- package/es/components/Carousel/Carousel.js +15 -5
- package/es/components/Coachmark/Coachmark.js +243 -0
- package/es/components/Coachmark/CoachmarkDragbar.js +137 -0
- package/es/components/Coachmark/CoachmarkHeader.js +88 -0
- package/es/components/Coachmark/CoachmarkOverlay.js +139 -0
- package/es/components/Coachmark/CoachmarkTagline.js +93 -0
- package/es/components/Coachmark/index.js +10 -0
- package/es/components/Coachmark/utils/constants.js +76 -0
- package/es/components/Coachmark/utils/context.js +5 -0
- package/es/components/Coachmark/utils/enums.js +40 -0
- package/es/components/Coachmark/utils/helpers.js +11 -0
- package/es/components/Coachmark/utils/hooks.js +54 -0
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +90 -0
- package/es/components/CoachmarkBeacon/index.js +8 -0
- package/es/components/CoachmarkButton/CoachmarkButton.js +72 -0
- package/es/components/CoachmarkButton/index.js +8 -0
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +201 -0
- package/es/components/CoachmarkFixed/index.js +8 -0
- package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +86 -0
- package/es/components/CoachmarkOverlayElement/index.js +8 -0
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +175 -0
- package/es/components/CoachmarkOverlayElements/index.js +8 -0
- package/es/components/CoachmarkStack/CoachmarkStack.js +260 -0
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +157 -0
- package/es/components/CoachmarkStack/index.js +8 -0
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +1 -4
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +2 -5
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +33 -17
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +0 -1
- package/es/components/Datagrid/useDefaultStringRenderer.js +2 -1
- package/es/components/Datagrid/useSortableColumns.js +8 -4
- package/es/components/NotificationsPanel/NotificationsPanel.js +3 -2
- package/es/components/index.js +7 -0
- package/es/global/js/package-settings.js +8 -1
- package/es/global/js/utils/test-helper.js +3 -3
- package/lib/components/Carousel/Carousel.js +15 -5
- package/lib/components/Coachmark/Coachmark.js +247 -0
- package/lib/components/Coachmark/CoachmarkDragbar.js +137 -0
- package/lib/components/Coachmark/CoachmarkHeader.js +85 -0
- package/lib/components/Coachmark/CoachmarkOverlay.js +139 -0
- package/lib/components/Coachmark/CoachmarkTagline.js +90 -0
- package/lib/components/Coachmark/index.js +38 -0
- package/lib/components/Coachmark/utils/constants.js +82 -0
- package/lib/components/Coachmark/utils/context.js +13 -0
- package/lib/components/Coachmark/utils/enums.js +49 -0
- package/lib/components/Coachmark/utils/helpers.js +17 -0
- package/lib/components/Coachmark/utils/hooks.js +60 -0
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +87 -0
- package/lib/components/CoachmarkBeacon/index.js +12 -0
- package/lib/components/CoachmarkButton/CoachmarkButton.js +69 -0
- package/lib/components/CoachmarkButton/index.js +12 -0
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +201 -0
- package/lib/components/CoachmarkFixed/index.js +12 -0
- package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +83 -0
- package/lib/components/CoachmarkOverlayElement/index.js +12 -0
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +176 -0
- package/lib/components/CoachmarkOverlayElements/index.js +12 -0
- package/lib/components/CoachmarkStack/CoachmarkStack.js +264 -0
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +160 -0
- package/lib/components/CoachmarkStack/index.js +12 -0
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +1 -4
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +2 -5
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +33 -17
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/TearsheetWrapper.js +0 -1
- package/lib/components/Datagrid/useDefaultStringRenderer.js +2 -1
- package/lib/components/Datagrid/useSortableColumns.js +8 -4
- package/lib/components/NotificationsPanel/NotificationsPanel.js +3 -2
- package/lib/components/index.js +49 -0
- package/lib/global/js/package-settings.js +8 -1
- package/lib/global/js/utils/test-helper.js +3 -3
- package/package.json +8 -8
- package/scss/components/Carousel/_carousel.scss +3 -0
- package/scss/components/Coachmark/_index.scss +11 -0
- package/scss/components/Coachmark/_storybook-styles.scss +20 -0
- package/scss/components/Coachmark/styles/_coachmark-dragbar.scss +74 -0
- package/scss/components/Coachmark/styles/_coachmark-header.scss +58 -0
- package/scss/components/Coachmark/styles/_coachmark-overlay.scss +327 -0
- package/scss/components/Coachmark/styles/_coachmark-tagline.scss +118 -0
- package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +166 -0
- package/scss/components/CoachmarkBeacon/_index.scss +8 -0
- package/scss/components/CoachmarkBeacon/_storybook-styles.scss +19 -0
- package/scss/components/CoachmarkButton/_coachmark-button.scss +34 -0
- package/scss/components/CoachmarkButton/_index.scss +8 -0
- package/scss/components/CoachmarkButton/_storybook-styles.scss +19 -0
- package/scss/components/CoachmarkFixed/_coachmark-fixed.scss +34 -0
- package/scss/components/CoachmarkFixed/_index.scss +8 -0
- package/scss/components/CoachmarkFixed/_storybook-styles.scss +10 -0
- package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +50 -0
- package/scss/components/CoachmarkOverlayElement/_index.scss +8 -0
- package/scss/components/CoachmarkOverlayElement/_storybook-styles.scss +19 -0
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +40 -0
- package/scss/components/CoachmarkOverlayElements/_index.scss +8 -0
- package/scss/components/CoachmarkOverlayElements/_storybook-styles.scss +19 -0
- package/scss/components/CoachmarkStack/_coachmark-stack.scss +85 -0
- package/scss/components/CoachmarkStack/_index.scss +8 -0
- package/scss/components/CoachmarkStack/_storybook-styles.scss +10 -0
- package/scss/components/Datagrid/styles/_useColumnCenterAlign.scss +9 -9
- package/scss/components/_index.scss +7 -1
@@ -0,0 +1,157 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["className", "description", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
|
4
|
+
/**
|
5
|
+
* Copyright IBM Corp. 2023, 2023
|
6
|
+
*
|
7
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
|
11
|
+
import React, { forwardRef } from 'react';
|
12
|
+
import pconsole from '../../global/js/utils/pconsole';
|
13
|
+
import PropTypes from 'prop-types';
|
14
|
+
import cx from 'classnames';
|
15
|
+
import { Idea20 } from '@carbon/icons-react';
|
16
|
+
import { Button } from 'carbon-components-react';
|
17
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
18
|
+
import { pkg /*, carbon */ } from '../../settings';
|
19
|
+
import { createPortal } from 'react-dom';
|
20
|
+
import { CoachmarkHeader } from '../Coachmark/CoachmarkHeader';
|
21
|
+
import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia';
|
22
|
+
|
23
|
+
// Carbon and package components we use.
|
24
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
25
|
+
|
26
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
|
+
var blockClass = "".concat(pkg.prefix, "--coachmark-stacked-home");
|
28
|
+
var overlayClass = "".concat(pkg.prefix, "--coachmark-overlay");
|
29
|
+
var componentName = 'CoachmarkStackHome';
|
30
|
+
|
31
|
+
/**
|
32
|
+
* DO NOT USE. This component is for the exclusive use
|
33
|
+
* of other Novice to Pro components.
|
34
|
+
*/
|
35
|
+
export var CoachmarkStackHome = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
36
|
+
var _document$querySelect;
|
37
|
+
var className = _ref.className,
|
38
|
+
description = _ref.description,
|
39
|
+
media = _ref.media,
|
40
|
+
navLinkLabels = _ref.navLinkLabels,
|
41
|
+
onClickNavItem = _ref.onClickNavItem,
|
42
|
+
onClose = _ref.onClose,
|
43
|
+
portalTarget = _ref.portalTarget,
|
44
|
+
closeButtonLabel = _ref.closeButtonLabel,
|
45
|
+
title = _ref.title,
|
46
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
47
|
+
if (!navLinkLabels) {
|
48
|
+
return pconsole.warn("".concat(componentName, " is a Novice to Pro internal component and is not intended for general use."));
|
49
|
+
}
|
50
|
+
var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
|
51
|
+
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
52
|
+
className: cx(blockClass, className),
|
53
|
+
ref: ref,
|
54
|
+
role: "main"
|
55
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(CoachmarkHeader, {
|
56
|
+
onClose: onClose
|
57
|
+
}), /*#__PURE__*/React.createElement("div", {
|
58
|
+
className: "".concat(overlayClass, "__body")
|
59
|
+
}, /*#__PURE__*/React.createElement("div", {
|
60
|
+
className: "".concat(overlayClass, "-element")
|
61
|
+
}, !media && /*#__PURE__*/React.createElement(Idea20, {
|
62
|
+
className: "".concat(blockClass, "__icon-idea")
|
63
|
+
}), media && (media.render ? media.render() : /*#__PURE__*/React.createElement(SteppedAnimatedMedia, {
|
64
|
+
className: "".concat(overlayClass, "__element-stepped-media"),
|
65
|
+
filePaths: media.filePaths,
|
66
|
+
playStep: 0
|
67
|
+
})), /*#__PURE__*/React.createElement("div", {
|
68
|
+
className: "".concat(overlayClass, "-element__content")
|
69
|
+
}, title && /*#__PURE__*/React.createElement("h2", {
|
70
|
+
className: "".concat(overlayClass, "-element__title")
|
71
|
+
}, title), description && /*#__PURE__*/React.createElement("p", {
|
72
|
+
className: "".concat(overlayClass, "-element__body")
|
73
|
+
}, description)), /*#__PURE__*/React.createElement("ul", {
|
74
|
+
className: "".concat(blockClass, "__nav-links")
|
75
|
+
}, navLinkLabels.map(function (label, index) {
|
76
|
+
return /*#__PURE__*/React.createElement("li", {
|
77
|
+
key: index
|
78
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
79
|
+
kind: "ghost",
|
80
|
+
size: "sm",
|
81
|
+
onClick: function onClick() {
|
82
|
+
onClickNavItem(index + 1);
|
83
|
+
}
|
84
|
+
}, label));
|
85
|
+
})), closeButtonLabel && /*#__PURE__*/React.createElement("div", {
|
86
|
+
className: "".concat(overlayClass, "__footer")
|
87
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
88
|
+
size: "sm",
|
89
|
+
onClick: onClose
|
90
|
+
}, closeButtonLabel))))), portalNode);
|
91
|
+
});
|
92
|
+
|
93
|
+
// Return a placeholder if not released and not enabled by feature flag
|
94
|
+
CoachmarkStackHome = pkg.checkComponentEnabled(CoachmarkStackHome, componentName);
|
95
|
+
|
96
|
+
// The display name of the component, used by React. Note that displayName
|
97
|
+
// is used in preference to relying on function.name.
|
98
|
+
CoachmarkStackHome.displayName = componentName;
|
99
|
+
|
100
|
+
// The types and DocGen commentary for the component props,
|
101
|
+
// in alphabetical order (for consistency).
|
102
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
103
|
+
CoachmarkStackHome.propTypes = {
|
104
|
+
/**
|
105
|
+
* Optional class name for this component.
|
106
|
+
*/
|
107
|
+
className: PropTypes.string,
|
108
|
+
/**
|
109
|
+
* The label for the button that will close the stack
|
110
|
+
*/
|
111
|
+
closeButtonLabel: PropTypes.string,
|
112
|
+
/**
|
113
|
+
* The description of the Coachmark.
|
114
|
+
*/
|
115
|
+
description: PropTypes.node.isRequired,
|
116
|
+
/**
|
117
|
+
* The object describing an image in one of two shapes.
|
118
|
+
*
|
119
|
+
* If a single media element is required, use `{render}`.
|
120
|
+
*
|
121
|
+
* If a stepped animation is required, use `{filePaths}`.
|
122
|
+
*
|
123
|
+
* @see {@link MEDIA_PROP_TYPE}.
|
124
|
+
*/
|
125
|
+
media: PropTypes.oneOfType([PropTypes.shape({
|
126
|
+
render: PropTypes.func
|
127
|
+
}), PropTypes.shape({
|
128
|
+
filePaths: PropTypes.arrayOf(PropTypes.string)
|
129
|
+
})]),
|
130
|
+
/**
|
131
|
+
* The labels used to link to the stackable Coachmarks.
|
132
|
+
*/
|
133
|
+
navLinkLabels: PropTypes.arrayOf(PropTypes.string).isRequired,
|
134
|
+
/**
|
135
|
+
* For internal use only by CoachmarkStack and CoachmarkStackHome.
|
136
|
+
*/
|
137
|
+
onClickNavItem: PropTypes.func.isRequired,
|
138
|
+
/**
|
139
|
+
* Function to call when the stack closes.
|
140
|
+
*/
|
141
|
+
onClose: PropTypes.func.isRequired,
|
142
|
+
/**
|
143
|
+
* By default, the CoachmarkStackHome will be appended to the end of `document.body`.
|
144
|
+
* The CoachmarkStackHome will remain persistent as the user navigates the app until
|
145
|
+
* the user closes the CoachmarkStackHome.
|
146
|
+
*
|
147
|
+
* Alternatively, the app developer can tightly couple the CoachmarkStackHome to a DOM
|
148
|
+
* element or other component by specifying a CSS selector. The CoachmarkStackHome will
|
149
|
+
* remain visible as long as that element remains visible or mounted. When the
|
150
|
+
* element is hidden or component is unmounted, the CoachmarkStackHome will disappear.
|
151
|
+
*/
|
152
|
+
portalTarget: PropTypes.string,
|
153
|
+
/**
|
154
|
+
* The title of the Coachmark.
|
155
|
+
*/
|
156
|
+
title: PropTypes.string.isRequired
|
157
|
+
};
|
@@ -35,8 +35,7 @@ var Columns = function Columns(_ref) {
|
|
35
35
|
onSelectColumn = _ref.onSelectColumn,
|
36
36
|
assistiveTextInstructionsLabel = _ref.assistiveTextInstructionsLabel,
|
37
37
|
assistiveTextDisabledInstructionsLabel = _ref.assistiveTextDisabledInstructionsLabel,
|
38
|
-
selectAllLabel = _ref.selectAllLabel
|
39
|
-
isTableSortable = _ref.isTableSortable;
|
38
|
+
selectAllLabel = _ref.selectAllLabel;
|
40
39
|
var _React$useState = React.useState(''),
|
41
40
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
42
41
|
ariaRegionText = _React$useState2[0],
|
@@ -92,7 +91,6 @@ var Columns = function Columns(_ref) {
|
|
92
91
|
filterString: filterString,
|
93
92
|
focusIndex: focusIndex,
|
94
93
|
getNextIndex: getNextIndex,
|
95
|
-
isTableSortable: isTableSortable,
|
96
94
|
moveElement: moveElement,
|
97
95
|
onSelectColumn: onSelectColumn,
|
98
96
|
setAriaRegionText: setAriaRegionText,
|
@@ -108,7 +106,6 @@ Columns.propTypes = {
|
|
108
106
|
filterString: PropTypes.string.isRequired,
|
109
107
|
getVisibleColumnsCount: PropTypes.func.isRequired,
|
110
108
|
instructionsLabel: PropTypes.string,
|
111
|
-
isTableSortable: PropTypes.bool.isRequired,
|
112
109
|
onSelectColumn: PropTypes.func.isRequired,
|
113
110
|
selectAllLabel: PropTypes.string,
|
114
111
|
setColumnStatus: PropTypes.func,
|
package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js
CHANGED
@@ -41,8 +41,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
41
41
|
_ref$assistiveTextDis = _ref.assistiveTextDisabledInstructionsLabel,
|
42
42
|
assistiveTextDisabledInstructionsLabel = _ref$assistiveTextDis === void 0 ? 'Reordering columns are disabled because they are filtered currently.' : _ref$assistiveTextDis,
|
43
43
|
_ref$selectAllLabel = _ref.selectAllLabel,
|
44
|
-
selectAllLabel = _ref$selectAllLabel === void 0 ? 'Column name' : _ref$selectAllLabel
|
45
|
-
isTableSortable = _ref.isTableSortable;
|
44
|
+
selectAllLabel = _ref$selectAllLabel === void 0 ? 'Column name' : _ref$selectAllLabel;
|
46
45
|
var _useState = useState(''),
|
47
46
|
_useState2 = _slicedToArray(_useState, 2),
|
48
47
|
visibleColumnsCount = _useState2[0],
|
@@ -152,8 +151,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
152
151
|
setColumnObjects(cols);
|
153
152
|
setDirty();
|
154
153
|
},
|
155
|
-
selectAllLabel: selectAllLabel
|
156
|
-
isTableSortable: isTableSortable
|
154
|
+
selectAllLabel: selectAllLabel
|
157
155
|
}));
|
158
156
|
};
|
159
157
|
CustomizeColumnsTearsheet.propTypes = {
|
@@ -164,7 +162,6 @@ CustomizeColumnsTearsheet.propTypes = {
|
|
164
162
|
findColumnPlaceholderLabel: PropTypes.string,
|
165
163
|
instructionsLabel: PropTypes.string,
|
166
164
|
isOpen: PropTypes.bool.isRequired,
|
167
|
-
isTableSortable: PropTypes.bool.isRequired,
|
168
165
|
onSaveColumnPrefs: PropTypes.func.isRequired,
|
169
166
|
originalColumnDefinitions: PropTypes.array.isRequired,
|
170
167
|
primaryButtonTextLabel: PropTypes.string,
|
@@ -17,32 +17,49 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
|
|
17
17
|
filterString = _ref.filterString,
|
18
18
|
focusIndex = _ref.focusIndex,
|
19
19
|
getNextIndex = _ref.getNextIndex,
|
20
|
-
isTableSortable = _ref.isTableSortable,
|
21
20
|
moveElement = _ref.moveElement,
|
22
21
|
onSelectColumn = _ref.onSelectColumn,
|
23
22
|
setAriaRegionText = _ref.setAriaRegionText,
|
24
23
|
setColumnsObject = _ref.setColumnsObject,
|
25
24
|
setFocusIndex = _ref.setFocusIndex;
|
25
|
+
// This function recursively looks for the nested header element until we can find the key which contains the title.
|
26
|
+
// This can happen if multiple hooks are used together that manipulate the rendering of the column
|
27
|
+
// header, such as `useColumnCenterAlign` and `useSortableColumns`.
|
28
|
+
var getNestedTitle = function getNestedTitle(component) {
|
29
|
+
if (component && !component.key) {
|
30
|
+
return getNestedTitle(component.children);
|
31
|
+
}
|
32
|
+
if (component && component.key && typeof component.key === 'string') {
|
33
|
+
return component.key;
|
34
|
+
}
|
35
|
+
};
|
36
|
+
var getColTitle = function getColTitle(col) {
|
37
|
+
if (!col) {
|
38
|
+
return;
|
39
|
+
}
|
40
|
+
var checkTitle = function checkTitle() {
|
41
|
+
if (col.Header().props.children.props && col.Header().props.children.props.title) {
|
42
|
+
return col.Header().props.children.props.title;
|
43
|
+
}
|
44
|
+
return getNestedTitle(col.Header().props.children.props);
|
45
|
+
};
|
46
|
+
return typeof (col === null || col === void 0 ? void 0 : col.Header) === 'function' ? checkTitle() : col.Header.props.title;
|
47
|
+
};
|
26
48
|
return /*#__PURE__*/React.createElement(React.Fragment, null, columns
|
27
49
|
// hide the columns without Header, e.g the sticky actions, spacer
|
28
50
|
.filter(function (colDef) {
|
29
|
-
|
30
|
-
|
31
|
-
return !!colDef.Header.props && !!((_colDef$Header$props = colDef.Header.props) !== null && _colDef$Header$props !== void 0 && _colDef$Header$props.title) || isTableSortable && !!sortableTitle;
|
32
|
-
}).filter(function (colDef) {
|
51
|
+
return !!getColTitle(colDef);
|
52
|
+
}).filter(Boolean).filter(function (colDef) {
|
33
53
|
return !colDef.isAction;
|
34
54
|
}).filter(function (colDef) {
|
35
|
-
var
|
36
|
-
|
37
|
-
return filterString.length === 0 || (isTableSortable ? sortableTitle === null || sortableTitle === void 0 ? void 0 : sortableTitle.toLowerCase().includes(filterString) : (_colDef$Header$props2 = colDef.Header.props) === null || _colDef$Header$props2 === void 0 ? void 0 : (_colDef$Header$props3 = _colDef$Header$props2.title) === null || _colDef$Header$props3 === void 0 ? void 0 : _colDef$Header$props3.toLowerCase().includes(filterString)) && colDef.id !== 'spacer';
|
55
|
+
var _getColTitle;
|
56
|
+
return filterString.length === 0 || ((_getColTitle = getColTitle(colDef)) === null || _getColTitle === void 0 ? void 0 : _getColTitle.toLowerCase().includes(filterString)) && colDef.id !== 'spacer';
|
38
57
|
}).map(function (colDef, i) {
|
39
|
-
var
|
40
|
-
var isSortableColumn = !!colDef.canSort && !!isTableSortable;
|
41
|
-
var sortableTitle = isTableSortable && ((_colDef$Header$props$3 = colDef.Header().props.children.props) === null || _colDef$Header$props$3 === void 0 ? void 0 : _colDef$Header$props$3.title);
|
58
|
+
var colHeaderTitle = getColTitle(colDef);
|
42
59
|
var searchString = new RegExp('(' + filterString + ')');
|
43
|
-
var res = filterString.length ?
|
60
|
+
var res = filterString.length ? colHeaderTitle.toLowerCase().split(searchString) : null;
|
44
61
|
var firstWord = res !== null ? res[0] === '' ? res[1].charAt(0).toUpperCase() + res[1].substring(1) : res[0].charAt(0).toUpperCase() + res[0].substring(1) : null;
|
45
|
-
var highlightedText = res !== null ? res[0] === '' ? "<strong>".concat(firstWord, "</strong>") + res[2] : firstWord + "<strong>".concat(res[1], "</strong>") + res[2] :
|
62
|
+
var highlightedText = res !== null ? res[0] === '' ? "<strong>".concat(firstWord, "</strong>") + res[2] : firstWord + "<strong>".concat(res[1], "</strong>") + res[2] : colHeaderTitle;
|
46
63
|
var isFrozenColumn = !!colDef.sticky;
|
47
64
|
var listContents = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Checkbox, {
|
48
65
|
wrapperClassName: "".concat(blockClass, "__customize-columns-checkbox-wrapper"),
|
@@ -50,8 +67,8 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
|
|
50
67
|
disabled: isFrozenColumn,
|
51
68
|
onChange: onSelectColumn.bind(null, colDef),
|
52
69
|
id: "".concat(blockClass, "__customization-column-").concat(colDef.id),
|
53
|
-
labelText:
|
54
|
-
title:
|
70
|
+
labelText: colHeaderTitle,
|
71
|
+
title: colHeaderTitle,
|
55
72
|
className: "".concat(blockClass, "__customize-columns-checkbox"),
|
56
73
|
hideLabel: true
|
57
74
|
}), /*#__PURE__*/React.createElement("div", {
|
@@ -67,7 +84,7 @@ export var DraggableItemsList = function DraggableItemsList(_ref) {
|
|
67
84
|
id: "dnd-datagrid-columns-".concat(colDef.id),
|
68
85
|
type: "column-customization",
|
69
86
|
disabled: filterString.length > 0 || isFrozenColumn,
|
70
|
-
ariaLabel:
|
87
|
+
ariaLabel: colHeaderTitle,
|
71
88
|
onGrab: setAriaRegionText,
|
72
89
|
isFocused: focusIndex === i,
|
73
90
|
moveElement: moveElement,
|
@@ -96,7 +113,6 @@ DraggableItemsList.propTypes = {
|
|
96
113
|
filterString: PropTypes.string.isRequired,
|
97
114
|
focusIndex: PropTypes.number.isRequired,
|
98
115
|
getNextIndex: PropTypes.func.isRequired,
|
99
|
-
isTableSortable: PropTypes.bool,
|
100
116
|
moveElement: PropTypes.func.isRequired,
|
101
117
|
onSelectColumn: PropTypes.func.isRequired,
|
102
118
|
setAriaRegionText: PropTypes.func.isRequired,
|
@@ -21,7 +21,6 @@ var TearsheetWrapper = function TearsheetWrapper(_ref) {
|
|
21
21
|
rest = _objectWithoutProperties(_instance$customizeCo, _excluded);
|
22
22
|
return /*#__PURE__*/React.createElement(CustomizeColumnsTearsheet, _extends({}, rest, labels, {
|
23
23
|
isOpen: isTearsheetOpen,
|
24
|
-
isTableSortable: instance === null || instance === void 0 ? void 0 : instance.isTableSortable,
|
25
24
|
setIsTearsheetOpen: setIsTearsheetOpen,
|
26
25
|
columnDefinitions: instance.allColumns,
|
27
26
|
originalColumnDefinitions: instance.columns,
|
@@ -24,7 +24,8 @@ var useDefaultStringRenderer = function useDefaultStringRenderer(hooks) {
|
|
24
24
|
var HeaderRenderer = function HeaderRenderer(header) {
|
25
25
|
return /*#__PURE__*/React.createElement("div", {
|
26
26
|
className: "".concat(blockClass, "__defaultStringRenderer"),
|
27
|
-
title: typeof header === 'string' ? header : ''
|
27
|
+
title: typeof header === 'string' ? header : '',
|
28
|
+
key: typeof header === 'string' ? header : ''
|
28
29
|
}, header);
|
29
30
|
};
|
30
31
|
var visibleColumns = function visibleColumns(columns) {
|
@@ -24,8 +24,12 @@ var getAriaSortValue = function getAriaSortValue(col, _ref) {
|
|
24
24
|
var ascendingSortableLabelText = _ref.ascendingSortableLabelText,
|
25
25
|
descendingSortableLabelText = _ref.descendingSortableLabelText,
|
26
26
|
defaultSortableLabelText = _ref.defaultSortableLabelText;
|
27
|
-
|
28
|
-
|
27
|
+
if (!col) {
|
28
|
+
return;
|
29
|
+
}
|
30
|
+
var _ref2 = col || {},
|
31
|
+
isSorted = _ref2.isSorted,
|
32
|
+
isSortedDesc = _ref2.isSortedDesc;
|
29
33
|
if (!isSorted) {
|
30
34
|
return defaultSortableLabelText || 'none';
|
31
35
|
}
|
@@ -37,9 +41,9 @@ var getAriaSortValue = function getAriaSortValue(col, _ref) {
|
|
37
41
|
}
|
38
42
|
};
|
39
43
|
var useSortableColumns = function useSortableColumns(hooks) {
|
40
|
-
var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns,
|
44
|
+
var sortableVisibleColumns = function sortableVisibleColumns(visibleColumns, _ref3) {
|
41
45
|
var _instance$customizeCo;
|
42
|
-
var instance =
|
46
|
+
var instance = _ref3.instance;
|
43
47
|
var onSort = instance.onSort,
|
44
48
|
ascendingSortableLabelText = instance.ascendingSortableLabelText,
|
45
49
|
descendingSortableLabelText = instance.descendingSortableLabelText,
|
@@ -20,6 +20,7 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
|
20
20
|
import { useClickOutside } from '../../global/js/hooks';
|
21
21
|
import { pkg } from '../../settings';
|
22
22
|
import { timeAgo } from './utils';
|
23
|
+
import { prepareProps } from '../../global/js/utils/props-helper';
|
23
24
|
import { NotificationsEmptyState } from '../EmptyStates/NotificationsEmptyState';
|
24
25
|
|
25
26
|
// Carbon and package components we use.
|
@@ -289,10 +290,10 @@ export var NotificationsPanel = /*#__PURE__*/React.forwardRef(function (_ref, re
|
|
289
290
|
nowText: nowText
|
290
291
|
})), /*#__PURE__*/React.createElement("h6", {
|
291
292
|
className: notificationHeaderClassName
|
292
|
-
}, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/React.createElement(Link, {
|
293
|
+
}, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/React.createElement(Link, _extends({
|
293
294
|
href: notification.link.url,
|
294
295
|
className: "".concat(blockClass, "__notifications-link")
|
295
|
-
}, notification.link.text)), /*#__PURE__*/React.createElement(Button, {
|
296
|
+
}, prepareProps({}, notification.link, ['text', 'url'])), notification.link.text)), /*#__PURE__*/React.createElement(Button, {
|
296
297
|
kind: "ghost",
|
297
298
|
size: "small",
|
298
299
|
renderIcon: Close16,
|
package/es/components/index.js
CHANGED
@@ -46,4 +46,11 @@ export { InlineEdit } from './InlineEdit';
|
|
46
46
|
export { EditInPlace } from './EditInPlace';
|
47
47
|
export { Guidebanner } from './Guidebanner';
|
48
48
|
export { NonLinearReading } from './NonLinearReading';
|
49
|
+
export { Coachmark } from './Coachmark';
|
50
|
+
export { CoachmarkFixed } from './CoachmarkFixed';
|
51
|
+
export { CoachmarkBeacon } from './CoachmarkBeacon';
|
52
|
+
export { CoachmarkButton } from './CoachmarkButton';
|
53
|
+
export { CoachmarkOverlayElements } from './CoachmarkOverlayElements';
|
54
|
+
export { CoachmarkOverlayElement } from './CoachmarkOverlayElement';
|
55
|
+
export { CoachmarkStack } from './CoachmarkStack';
|
49
56
|
export { InlineTip } from './InlineTip';
|
@@ -74,7 +74,14 @@ var defaults = {
|
|
74
74
|
// Novice to pro components not yet reviewed and released:
|
75
75
|
InlineTip: false,
|
76
76
|
Guidebanner: false,
|
77
|
-
NonLinearReading: false
|
77
|
+
NonLinearReading: false,
|
78
|
+
Coachmark: false,
|
79
|
+
CoachmarkBeacon: false,
|
80
|
+
CoachmarkButton: false,
|
81
|
+
CoachmarkFixed: false,
|
82
|
+
CoachmarkOverlayElement: false,
|
83
|
+
CoachmarkOverlayElements: false,
|
84
|
+
CoachmarkStack: false
|
78
85
|
/* new component flags here - comment used by generate CLI */
|
79
86
|
},
|
80
87
|
|
@@ -109,7 +109,7 @@ var makeMatcherArray = function makeMatcherArray(args) {
|
|
109
109
|
* A helper function to enable a test to expect a single call to
|
110
110
|
* console.warn, for example when intentionally using a deprecated prop
|
111
111
|
* or supplying invalid parameters for the purposes of the test.
|
112
|
-
* @param {string|regex|
|
112
|
+
* @param {string|regex|Function|[]} message the expected parameters for the call to
|
113
113
|
* console.warn, which must be called exactly once. A single string or regex or an
|
114
114
|
* expect matcher can be used to match a single-argument call to console.warn (most common),
|
115
115
|
* while an array of strings and/or regex and/or expect matchers can be used to match a
|
@@ -194,7 +194,7 @@ var checkLogging = function checkLogging(mock, message) {
|
|
194
194
|
* A helper function to enable a test to expect a single call to
|
195
195
|
* console.error, for example when intentionally omitting a required prop
|
196
196
|
* or supplying an invalid prop type or value for the purposes of the test.
|
197
|
-
* @param {errors: {string|regex|
|
197
|
+
* @param {errors: {string|regex|Function|[]}, warnings: {string|regex|Function|[]}} messages the expected parameters for the call to
|
198
198
|
* console.error or console.warn, which must be called exactly once. A single string or regex or an
|
199
199
|
* expect matcher can be used to match a single-argument call to console.error (most common),
|
200
200
|
* while an array of strings and/or regex and/or expect matchers can be used to match a
|
@@ -220,7 +220,7 @@ export var expectLogging = function expectLogging(_ref2, test) {
|
|
220
220
|
* A helper function to enable a test to expect a single call to
|
221
221
|
* console.error, for example when intentionally omitting a required prop
|
222
222
|
* or supplying an invalid prop type or value for the purposes of the test.
|
223
|
-
* @param {string|regex|
|
223
|
+
* @param {string|regex|Function|[]} message the expected parameters for the call to
|
224
224
|
* console.error, which must be called exactly once. A single string or regex or an
|
225
225
|
* expect matcher can be used to match a single-argument call to console.error (most common),
|
226
226
|
* while an array of strings and/or regex and/or expect matchers can be used to match a
|
@@ -59,6 +59,7 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
59
59
|
var currentViewIDRef = (0, _react.useRef)(currentViewID);
|
60
60
|
var scrollRef = (0, _react.useRef)();
|
61
61
|
var carouselRef = (0, _react.useRef)();
|
62
|
+
var mountedRef = (0, _react.useRef)(true);
|
62
63
|
var isScrollable = (0, _utils.useIsOverflow)(scrollRef);
|
63
64
|
// Scrolling has no complete callback, nor does it return a promise.
|
64
65
|
// Since there is no way to tell when a scroll is finished we can set a timeout.
|
@@ -73,7 +74,7 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
73
74
|
return scrollToView(currentViewID - 1);
|
74
75
|
}, [currentViewID, scrollToView]);
|
75
76
|
var scrollToView = (0, _react.useCallback)(function (viewID) {
|
76
|
-
if (!isScrolling) {
|
77
|
+
if (!isScrolling && scrollRef.current && mountedRef.current) {
|
77
78
|
var _scrollRef$current;
|
78
79
|
var targetViewID = (0, _lodash.clamp)(viewID, 0, totalViews - 1);
|
79
80
|
setCurrentViewID(targetViewID);
|
@@ -93,9 +94,11 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
93
94
|
});
|
94
95
|
}, [resolveScroll]);
|
95
96
|
var resolveScroll = (0, _react.useCallback)(function (resolve) {
|
96
|
-
|
97
|
-
|
98
|
-
|
97
|
+
if (mountedRef.current) {
|
98
|
+
setIsScrolling(false);
|
99
|
+
var percentage = scrollPosition() / maxScroll();
|
100
|
+
return resolve(parseFloat(percentage.toFixed(2)));
|
101
|
+
}
|
99
102
|
}, []);
|
100
103
|
var scrollPosition = function scrollPosition() {
|
101
104
|
var _scrollRef$current2;
|
@@ -119,8 +122,10 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
119
122
|
|
120
123
|
// EFFECTS
|
121
124
|
(0, _utils.useWindowEvent)('resize', handleResize);
|
125
|
+
// SAVE POINT
|
126
|
+
|
122
127
|
(0, _react.useEffect)(function () {
|
123
|
-
if (scrollableChange) {
|
128
|
+
if (scrollableChange && mountedRef.current) {
|
124
129
|
scrollableChange(isScrollable);
|
125
130
|
}
|
126
131
|
}, [isScrollable, scrollableChange]);
|
@@ -160,6 +165,11 @@ var Carousel = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
160
165
|
};
|
161
166
|
}
|
162
167
|
}, [disableArrowScroll]);
|
168
|
+
(0, _react.useEffect)(function () {
|
169
|
+
return function () {
|
170
|
+
mountedRef.current = false;
|
171
|
+
};
|
172
|
+
}, []);
|
163
173
|
(0, _react.useImperativeHandle)(ref, function () {
|
164
174
|
return {
|
165
175
|
scrollNext: scrollNext,
|