@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,264 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.CoachmarkStack = void 0;
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
13
|
+
var _reactDom = require("react-dom");
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
15
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
16
|
+
var _devtools = require("../../global/js/utils/devtools");
|
17
|
+
var _settings = require("../../settings");
|
18
|
+
var _CoachmarkOverlay = require("../Coachmark/CoachmarkOverlay");
|
19
|
+
var _CoachmarkStackHome = require("./CoachmarkStackHome");
|
20
|
+
var _CoachmarkTagline = require("../Coachmark/CoachmarkTagline");
|
21
|
+
var _context = require("../Coachmark/utils/context");
|
22
|
+
var _enums = require("../Coachmark/utils/enums");
|
23
|
+
var _excluded = ["children", "className", "onClose", "description", "media", "navLinkLabels", "portalTarget", "closeButtonLabel", "tagline", "theme", "title"];
|
24
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
25
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
26
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-stack");
|
27
|
+
var elementBlockClass = "".concat(_settings.pkg.prefix, "--coachmark-stack-element");
|
28
|
+
var componentName = 'CoachmarkStack';
|
29
|
+
var defaults = {
|
30
|
+
onClose: function onClose() {},
|
31
|
+
// Pass through to CoachmarkStackHome
|
32
|
+
theme: 'light'
|
33
|
+
};
|
34
|
+
|
35
|
+
// NOTE
|
36
|
+
// The stack is limited to a depth of two Coachmarks:
|
37
|
+
// - a single parent CoachmarkStackHome
|
38
|
+
// - a single child Coachmark when stacked
|
39
|
+
// The parent will include links to all the children.
|
40
|
+
// No child Coachmark will include links to any other child Coachmarks.
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Stacked coachmarks are used to call out specific functionality or concepts
|
44
|
+
* within the UI that may not be intuitive but are important for the
|
45
|
+
* user to gain understanding of the product's main value and discover new use cases.
|
46
|
+
* This variant allows the stacking of multiple coachmark overlays to be displayed by interacting with the tagline.
|
47
|
+
*/
|
48
|
+
var CoachmarkStack = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
49
|
+
var _document$querySelect;
|
50
|
+
var children = _ref.children,
|
51
|
+
className = _ref.className,
|
52
|
+
_ref$onClose = _ref.onClose,
|
53
|
+
onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
|
54
|
+
description = _ref.description,
|
55
|
+
media = _ref.media,
|
56
|
+
navLinkLabels = _ref.navLinkLabels,
|
57
|
+
_ref$portalTarget = _ref.portalTarget,
|
58
|
+
portalTarget = _ref$portalTarget === void 0 ? defaults.portalTarget : _ref$portalTarget,
|
59
|
+
closeButtonLabel = _ref.closeButtonLabel,
|
60
|
+
tagline = _ref.tagline,
|
61
|
+
_ref$theme = _ref.theme,
|
62
|
+
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
63
|
+
title = _ref.title,
|
64
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
65
|
+
var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
|
66
|
+
var stackHomeRef = (0, _react.useRef)();
|
67
|
+
var stackedCoachmarkRefs = (0, _react.useRef)([]);
|
68
|
+
var _useState = (0, _react.useState)(false),
|
69
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
70
|
+
isOpen = _useState2[0],
|
71
|
+
setIsOpen = _useState2[1];
|
72
|
+
// selectedItemNumber -1 = parent close button was clicked, remove entire stack
|
73
|
+
// selectedItemNumber 0 = (default) the parent is visible, all children are hidden
|
74
|
+
// selectedItemNumber 1+ = a child is visible and stacked atop the parent
|
75
|
+
var _useState3 = (0, _react.useState)(0),
|
76
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
77
|
+
selectedItemNumber = _useState4[0],
|
78
|
+
setSelectedItemNumber = _useState4[1];
|
79
|
+
// // The parent height and width values to return to after unstacked
|
80
|
+
var _useState5 = (0, _react.useState)(null),
|
81
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
82
|
+
parentHeight = _useState6[0],
|
83
|
+
setParentHeight = _useState6[1];
|
84
|
+
// parent height = child height when stacked behind a child that is shorter
|
85
|
+
var childArray = _react.Children.toArray(children);
|
86
|
+
var mountedRef = (0, _react.useRef)();
|
87
|
+
// same value as CSS animation speed
|
88
|
+
var delayMs = 240;
|
89
|
+
|
90
|
+
// Unmount or unstack a child
|
91
|
+
var handleClickNavItem = function handleClickNavItem(itemNumber) {
|
92
|
+
setSelectedItemNumber(itemNumber);
|
93
|
+
};
|
94
|
+
var handleClose = function handleClose(isParentCloseButton) {
|
95
|
+
if (isParentCloseButton) {
|
96
|
+
// Trigger slide-out animation
|
97
|
+
setSelectedItemNumber(-1);
|
98
|
+
|
99
|
+
// Unmount after animation is complete
|
100
|
+
var timer = setTimeout(function () {
|
101
|
+
setIsOpen(false);
|
102
|
+
onClose();
|
103
|
+
}, delayMs);
|
104
|
+
return function () {
|
105
|
+
return clearTimeout(timer);
|
106
|
+
};
|
107
|
+
} else {
|
108
|
+
// Unstack child
|
109
|
+
setSelectedItemNumber(0);
|
110
|
+
}
|
111
|
+
};
|
112
|
+
var contextValue = {
|
113
|
+
buttonProps: {
|
114
|
+
'aria-expanded': isOpen,
|
115
|
+
onClick: function onClick() {
|
116
|
+
setIsOpen(true);
|
117
|
+
},
|
118
|
+
// Compensate for accidental open/close on double-click.
|
119
|
+
// Only open on double-click.
|
120
|
+
onDoubleClick: function onDoubleClick() {
|
121
|
+
setIsOpen(true);
|
122
|
+
}
|
123
|
+
},
|
124
|
+
closeButtonProps: {
|
125
|
+
onClick: function onClick() {
|
126
|
+
return handleClose(false);
|
127
|
+
}
|
128
|
+
},
|
129
|
+
isOpen: isOpen
|
130
|
+
};
|
131
|
+
(0, _react.useEffect)(function () {
|
132
|
+
mountedRef.current = true;
|
133
|
+
return function () {
|
134
|
+
mountedRef.current = false;
|
135
|
+
};
|
136
|
+
}, []);
|
137
|
+
(0, _react.useEffect)(function () {
|
138
|
+
setTimeout(function () {
|
139
|
+
if (stackHomeRef.current) {
|
140
|
+
setParentHeight(stackHomeRef.current.clientHeight);
|
141
|
+
}
|
142
|
+
}, 0);
|
143
|
+
}, [stackHomeRef]);
|
144
|
+
(0, _react.useEffect)(function () {
|
145
|
+
var targetSelectedItem = selectedItemNumber - 1;
|
146
|
+
if (!parentHeight) {
|
147
|
+
return;
|
148
|
+
}
|
149
|
+
stackHomeRef.current.style.height = "".concat(parentHeight, "px");
|
150
|
+
if (!isOpen || targetSelectedItem < 0) {
|
151
|
+
return;
|
152
|
+
}
|
153
|
+
var targetHomeHeight = stackedCoachmarkRefs.current[targetSelectedItem].clientHeight;
|
154
|
+
stackHomeRef.current.style.height = "".concat(targetHomeHeight, "px");
|
155
|
+
}, [selectedItemNumber, isOpen, parentHeight]);
|
156
|
+
var wrappedChildren = _react.Children.map(childArray, function (child, idx) {
|
157
|
+
var mountedClass = mountedRef.current ? "".concat(elementBlockClass, "--is-mounted") : '';
|
158
|
+
return /*#__PURE__*/_react.default.createElement(_CoachmarkOverlay.CoachmarkOverlay, {
|
159
|
+
key: idx,
|
160
|
+
ref: function ref(_ref2) {
|
161
|
+
return stackedCoachmarkRefs.current[idx] = _ref2;
|
162
|
+
},
|
163
|
+
kind: _enums.COACHMARK_OVERLAY_KIND.STACKED,
|
164
|
+
onClose: function onClose() {
|
165
|
+
return handleClose(false);
|
166
|
+
},
|
167
|
+
theme: theme,
|
168
|
+
fixedIsVisible: false,
|
169
|
+
className: (0, _classnames.default)(elementBlockClass, mountedClass, idx === selectedItemNumber - 1 && "".concat(elementBlockClass, "--is-visible"), mountedRef.current && "".concat(elementBlockClass, "--is-mounted"))
|
170
|
+
}, child);
|
171
|
+
});
|
172
|
+
return /*#__PURE__*/_react.default.createElement(_context.CoachmarkContext.Provider, {
|
173
|
+
value: contextValue
|
174
|
+
}, /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
175
|
+
className: (0, _classnames.default)(blockClass, "".concat(_settings.pkg.prefix, "--coachmark-overlay--stack"), className),
|
176
|
+
ref: ref
|
177
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_CoachmarkTagline.CoachmarkTagline, {
|
178
|
+
title: tagline,
|
179
|
+
onClose: onClose
|
180
|
+
}), /*#__PURE__*/_react.default.createElement(_CoachmarkStackHome.CoachmarkStackHome, {
|
181
|
+
ref: stackHomeRef,
|
182
|
+
className: (0, _classnames.default)("".concat(_settings.pkg.prefix, "--coachmark-overlay"), "".concat(_settings.pkg.prefix, "--coachmark-overlay__").concat(theme), elementBlockClass, selectedItemNumber > 0 && "".concat(elementBlockClass, "--is-stacked"), selectedItemNumber > 0 && "".concat(elementBlockClass, "--is-stacked__").concat(theme), isOpen && "".concat(elementBlockClass, "--is-visible"), mountedRef.current && "".concat(elementBlockClass, "--is-mounted")),
|
183
|
+
description: description,
|
184
|
+
media: media,
|
185
|
+
navLinkLabels: navLinkLabels,
|
186
|
+
onClickNavItem: handleClickNavItem,
|
187
|
+
onClose: function onClose() {
|
188
|
+
handleClose(true);
|
189
|
+
},
|
190
|
+
portalTarget: portalTarget,
|
191
|
+
closeButtonLabel: closeButtonLabel,
|
192
|
+
title: title
|
193
|
+
}), /*#__PURE__*/(0, _reactDom.createPortal)(wrappedChildren, portalNode)));
|
194
|
+
});
|
195
|
+
|
196
|
+
// Return a placeholder if not released and not enabled by feature flag
|
197
|
+
exports.CoachmarkStack = CoachmarkStack;
|
198
|
+
exports.CoachmarkStack = CoachmarkStack = _settings.pkg.checkComponentEnabled(CoachmarkStack, componentName);
|
199
|
+
|
200
|
+
// The display name of the component, used by React. Note that displayName
|
201
|
+
// is used in preference to relying on function.name.
|
202
|
+
CoachmarkStack.displayName = componentName;
|
203
|
+
|
204
|
+
// The types and DocGen commentary for the component props,
|
205
|
+
// in alphabetical order (for consistency).
|
206
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
207
|
+
CoachmarkStack.propTypes = {
|
208
|
+
/**
|
209
|
+
* CoachmarkStack should use a single CoachmarkOverlayElements component as a child.
|
210
|
+
*/
|
211
|
+
children: _propTypes.default.node.isRequired,
|
212
|
+
/**
|
213
|
+
* Provide an optional class to be applied to the containing node.
|
214
|
+
*/
|
215
|
+
className: _propTypes.default.string,
|
216
|
+
/**
|
217
|
+
* The label for the button that will close the Stack
|
218
|
+
*/
|
219
|
+
closeButtonLabel: _propTypes.default.string,
|
220
|
+
// Pass through to CoachmarkStackHome
|
221
|
+
/**
|
222
|
+
* The description of the Coachmark.
|
223
|
+
*/
|
224
|
+
description: _propTypes.default.node.isRequired,
|
225
|
+
/**
|
226
|
+
* The object describing an image in one of two shapes.
|
227
|
+
*
|
228
|
+
* If a single media element is required, use `{render}`.
|
229
|
+
*
|
230
|
+
* If a stepped animation is required, use `{filePaths}`.
|
231
|
+
*
|
232
|
+
* @see {@link MEDIA_PROP_TYPE}.
|
233
|
+
*/
|
234
|
+
media: _propTypes.default.oneOfType([_propTypes.default.shape({
|
235
|
+
render: _propTypes.default.func
|
236
|
+
}), _propTypes.default.shape({
|
237
|
+
filePaths: _propTypes.default.arrayOf(_propTypes.default.string)
|
238
|
+
})]),
|
239
|
+
/**
|
240
|
+
* The labels used to link to the stackable Coachmarks.
|
241
|
+
*/
|
242
|
+
navLinkLabels: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
243
|
+
/**
|
244
|
+
* Function to call when the CoachmarkStack closes.
|
245
|
+
*/
|
246
|
+
onClose: _propTypes.default.func,
|
247
|
+
/**
|
248
|
+
* Where in the DOM to render the stack.
|
249
|
+
* The default is `document.body`.
|
250
|
+
*/
|
251
|
+
portalTarget: _propTypes.default.string,
|
252
|
+
/**
|
253
|
+
* The tagline title which will be fixed to the bottom right of the window and will serve as the display trigger.
|
254
|
+
*/
|
255
|
+
tagline: _propTypes.default.string.isRequired,
|
256
|
+
/**
|
257
|
+
* Determines the theme of the component.
|
258
|
+
*/
|
259
|
+
theme: _propTypes.default.oneOf(['light', 'dark']),
|
260
|
+
/**
|
261
|
+
* The title of the Coachmark.
|
262
|
+
*/
|
263
|
+
title: _propTypes.default.string.isRequired
|
264
|
+
};
|
@@ -0,0 +1,160 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.CoachmarkStackHome = void 0;
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
12
|
+
var _pconsole = _interopRequireDefault(require("../../global/js/utils/pconsole"));
|
13
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
15
|
+
var _iconsReact = require("@carbon/icons-react");
|
16
|
+
var _carbonComponentsReact = require("carbon-components-react");
|
17
|
+
var _devtools = require("../../global/js/utils/devtools");
|
18
|
+
var _settings = require("../../settings");
|
19
|
+
var _reactDom = require("react-dom");
|
20
|
+
var _CoachmarkHeader = require("../Coachmark/CoachmarkHeader");
|
21
|
+
var _SteppedAnimatedMedia = require("../SteppedAnimatedMedia");
|
22
|
+
var _excluded = ["className", "description", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
|
23
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
+
// Carbon and package components we use.
|
26
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
27
|
+
|
28
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
29
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--coachmark-stacked-home");
|
30
|
+
var overlayClass = "".concat(_settings.pkg.prefix, "--coachmark-overlay");
|
31
|
+
var componentName = 'CoachmarkStackHome';
|
32
|
+
|
33
|
+
/**
|
34
|
+
* DO NOT USE. This component is for the exclusive use
|
35
|
+
* of other Novice to Pro components.
|
36
|
+
*/
|
37
|
+
var CoachmarkStackHome = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
38
|
+
var _document$querySelect;
|
39
|
+
var className = _ref.className,
|
40
|
+
description = _ref.description,
|
41
|
+
media = _ref.media,
|
42
|
+
navLinkLabels = _ref.navLinkLabels,
|
43
|
+
onClickNavItem = _ref.onClickNavItem,
|
44
|
+
onClose = _ref.onClose,
|
45
|
+
portalTarget = _ref.portalTarget,
|
46
|
+
closeButtonLabel = _ref.closeButtonLabel,
|
47
|
+
title = _ref.title,
|
48
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
49
|
+
if (!navLinkLabels) {
|
50
|
+
return _pconsole.default.warn("".concat(componentName, " is a Novice to Pro internal component and is not intended for general use."));
|
51
|
+
}
|
52
|
+
var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
|
53
|
+
return /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
54
|
+
className: (0, _classnames.default)(blockClass, className),
|
55
|
+
ref: ref,
|
56
|
+
role: "main"
|
57
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_CoachmarkHeader.CoachmarkHeader, {
|
58
|
+
onClose: onClose
|
59
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
60
|
+
className: "".concat(overlayClass, "__body")
|
61
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
62
|
+
className: "".concat(overlayClass, "-element")
|
63
|
+
}, !media && /*#__PURE__*/_react.default.createElement(_iconsReact.Idea20, {
|
64
|
+
className: "".concat(blockClass, "__icon-idea")
|
65
|
+
}), media && (media.render ? media.render() : /*#__PURE__*/_react.default.createElement(_SteppedAnimatedMedia.SteppedAnimatedMedia, {
|
66
|
+
className: "".concat(overlayClass, "__element-stepped-media"),
|
67
|
+
filePaths: media.filePaths,
|
68
|
+
playStep: 0
|
69
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
70
|
+
className: "".concat(overlayClass, "-element__content")
|
71
|
+
}, title && /*#__PURE__*/_react.default.createElement("h2", {
|
72
|
+
className: "".concat(overlayClass, "-element__title")
|
73
|
+
}, title), description && /*#__PURE__*/_react.default.createElement("p", {
|
74
|
+
className: "".concat(overlayClass, "-element__body")
|
75
|
+
}, description)), /*#__PURE__*/_react.default.createElement("ul", {
|
76
|
+
className: "".concat(blockClass, "__nav-links")
|
77
|
+
}, navLinkLabels.map(function (label, index) {
|
78
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
79
|
+
key: index
|
80
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
81
|
+
kind: "ghost",
|
82
|
+
size: "sm",
|
83
|
+
onClick: function onClick() {
|
84
|
+
onClickNavItem(index + 1);
|
85
|
+
}
|
86
|
+
}, label));
|
87
|
+
})), closeButtonLabel && /*#__PURE__*/_react.default.createElement("div", {
|
88
|
+
className: "".concat(overlayClass, "__footer")
|
89
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
90
|
+
size: "sm",
|
91
|
+
onClick: onClose
|
92
|
+
}, closeButtonLabel))))), portalNode);
|
93
|
+
});
|
94
|
+
|
95
|
+
// Return a placeholder if not released and not enabled by feature flag
|
96
|
+
exports.CoachmarkStackHome = CoachmarkStackHome;
|
97
|
+
exports.CoachmarkStackHome = CoachmarkStackHome = _settings.pkg.checkComponentEnabled(CoachmarkStackHome, componentName);
|
98
|
+
|
99
|
+
// The display name of the component, used by React. Note that displayName
|
100
|
+
// is used in preference to relying on function.name.
|
101
|
+
CoachmarkStackHome.displayName = componentName;
|
102
|
+
|
103
|
+
// The types and DocGen commentary for the component props,
|
104
|
+
// in alphabetical order (for consistency).
|
105
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
106
|
+
CoachmarkStackHome.propTypes = {
|
107
|
+
/**
|
108
|
+
* Optional class name for this component.
|
109
|
+
*/
|
110
|
+
className: _propTypes.default.string,
|
111
|
+
/**
|
112
|
+
* The label for the button that will close the stack
|
113
|
+
*/
|
114
|
+
closeButtonLabel: _propTypes.default.string,
|
115
|
+
/**
|
116
|
+
* The description of the Coachmark.
|
117
|
+
*/
|
118
|
+
description: _propTypes.default.node.isRequired,
|
119
|
+
/**
|
120
|
+
* The object describing an image in one of two shapes.
|
121
|
+
*
|
122
|
+
* If a single media element is required, use `{render}`.
|
123
|
+
*
|
124
|
+
* If a stepped animation is required, use `{filePaths}`.
|
125
|
+
*
|
126
|
+
* @see {@link MEDIA_PROP_TYPE}.
|
127
|
+
*/
|
128
|
+
media: _propTypes.default.oneOfType([_propTypes.default.shape({
|
129
|
+
render: _propTypes.default.func
|
130
|
+
}), _propTypes.default.shape({
|
131
|
+
filePaths: _propTypes.default.arrayOf(_propTypes.default.string)
|
132
|
+
})]),
|
133
|
+
/**
|
134
|
+
* The labels used to link to the stackable Coachmarks.
|
135
|
+
*/
|
136
|
+
navLinkLabels: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
137
|
+
/**
|
138
|
+
* For internal use only by CoachmarkStack and CoachmarkStackHome.
|
139
|
+
*/
|
140
|
+
onClickNavItem: _propTypes.default.func.isRequired,
|
141
|
+
/**
|
142
|
+
* Function to call when the stack closes.
|
143
|
+
*/
|
144
|
+
onClose: _propTypes.default.func.isRequired,
|
145
|
+
/**
|
146
|
+
* By default, the CoachmarkStackHome will be appended to the end of `document.body`.
|
147
|
+
* The CoachmarkStackHome will remain persistent as the user navigates the app until
|
148
|
+
* the user closes the CoachmarkStackHome.
|
149
|
+
*
|
150
|
+
* Alternatively, the app developer can tightly couple the CoachmarkStackHome to a DOM
|
151
|
+
* element or other component by specifying a CSS selector. The CoachmarkStackHome will
|
152
|
+
* remain visible as long as that element remains visible or mounted. When the
|
153
|
+
* element is hidden or component is unmounted, the CoachmarkStackHome will disappear.
|
154
|
+
*/
|
155
|
+
portalTarget: _propTypes.default.string,
|
156
|
+
/**
|
157
|
+
* The title of the Coachmark.
|
158
|
+
*/
|
159
|
+
title: _propTypes.default.string.isRequired
|
160
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "CoachmarkStack", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _CoachmarkStack.CoachmarkStack;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
var _CoachmarkStack = require("./CoachmarkStack");
|
@@ -42,8 +42,7 @@ var Columns = function Columns(_ref) {
|
|
42
42
|
onSelectColumn = _ref.onSelectColumn,
|
43
43
|
assistiveTextInstructionsLabel = _ref.assistiveTextInstructionsLabel,
|
44
44
|
assistiveTextDisabledInstructionsLabel = _ref.assistiveTextDisabledInstructionsLabel,
|
45
|
-
selectAllLabel = _ref.selectAllLabel
|
46
|
-
isTableSortable = _ref.isTableSortable;
|
45
|
+
selectAllLabel = _ref.selectAllLabel;
|
47
46
|
var _React$useState = _react.default.useState(''),
|
48
47
|
_React$useState2 = (0, _slicedToArray2.default)(_React$useState, 2),
|
49
48
|
ariaRegionText = _React$useState2[0],
|
@@ -99,7 +98,6 @@ var Columns = function Columns(_ref) {
|
|
99
98
|
filterString: filterString,
|
100
99
|
focusIndex: focusIndex,
|
101
100
|
getNextIndex: getNextIndex,
|
102
|
-
isTableSortable: isTableSortable,
|
103
101
|
moveElement: moveElement,
|
104
102
|
onSelectColumn: onSelectColumn,
|
105
103
|
setAriaRegionText: setAriaRegionText,
|
@@ -115,7 +113,6 @@ Columns.propTypes = {
|
|
115
113
|
filterString: _propTypes.default.string.isRequired,
|
116
114
|
getVisibleColumnsCount: _propTypes.default.func.isRequired,
|
117
115
|
instructionsLabel: _propTypes.default.string,
|
118
|
-
isTableSortable: _propTypes.default.bool.isRequired,
|
119
116
|
onSelectColumn: _propTypes.default.func.isRequired,
|
120
117
|
selectAllLabel: _propTypes.default.string,
|
121
118
|
setColumnStatus: _propTypes.default.func,
|
package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js
CHANGED
@@ -43,8 +43,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
43
43
|
_ref$assistiveTextDis = _ref.assistiveTextDisabledInstructionsLabel,
|
44
44
|
assistiveTextDisabledInstructionsLabel = _ref$assistiveTextDis === void 0 ? 'Reordering columns are disabled because they are filtered currently.' : _ref$assistiveTextDis,
|
45
45
|
_ref$selectAllLabel = _ref.selectAllLabel,
|
46
|
-
selectAllLabel = _ref$selectAllLabel === void 0 ? 'Column name' : _ref$selectAllLabel
|
47
|
-
isTableSortable = _ref.isTableSortable;
|
46
|
+
selectAllLabel = _ref$selectAllLabel === void 0 ? 'Column name' : _ref$selectAllLabel;
|
48
47
|
var _useState = (0, _react.useState)(''),
|
49
48
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
50
49
|
visibleColumnsCount = _useState2[0],
|
@@ -154,8 +153,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
154
153
|
setColumnObjects(cols);
|
155
154
|
setDirty();
|
156
155
|
},
|
157
|
-
selectAllLabel: selectAllLabel
|
158
|
-
isTableSortable: isTableSortable
|
156
|
+
selectAllLabel: selectAllLabel
|
159
157
|
}));
|
160
158
|
};
|
161
159
|
CustomizeColumnsTearsheet.propTypes = {
|
@@ -166,7 +164,6 @@ CustomizeColumnsTearsheet.propTypes = {
|
|
166
164
|
findColumnPlaceholderLabel: _propTypes.default.string,
|
167
165
|
instructionsLabel: _propTypes.default.string,
|
168
166
|
isOpen: _propTypes.default.bool.isRequired,
|
169
|
-
isTableSortable: _propTypes.default.bool.isRequired,
|
170
167
|
onSaveColumnPrefs: _propTypes.default.func.isRequired,
|
171
168
|
originalColumnDefinitions: _propTypes.default.array.isRequired,
|
172
169
|
primaryButtonTextLabel: _propTypes.default.string,
|
@@ -24,32 +24,49 @@ var DraggableItemsList = function DraggableItemsList(_ref) {
|
|
24
24
|
filterString = _ref.filterString,
|
25
25
|
focusIndex = _ref.focusIndex,
|
26
26
|
getNextIndex = _ref.getNextIndex,
|
27
|
-
isTableSortable = _ref.isTableSortable,
|
28
27
|
moveElement = _ref.moveElement,
|
29
28
|
onSelectColumn = _ref.onSelectColumn,
|
30
29
|
setAriaRegionText = _ref.setAriaRegionText,
|
31
30
|
setColumnsObject = _ref.setColumnsObject,
|
32
31
|
setFocusIndex = _ref.setFocusIndex;
|
32
|
+
// This function recursively looks for the nested header element until we can find the key which contains the title.
|
33
|
+
// This can happen if multiple hooks are used together that manipulate the rendering of the column
|
34
|
+
// header, such as `useColumnCenterAlign` and `useSortableColumns`.
|
35
|
+
var getNestedTitle = function getNestedTitle(component) {
|
36
|
+
if (component && !component.key) {
|
37
|
+
return getNestedTitle(component.children);
|
38
|
+
}
|
39
|
+
if (component && component.key && typeof component.key === 'string') {
|
40
|
+
return component.key;
|
41
|
+
}
|
42
|
+
};
|
43
|
+
var getColTitle = function getColTitle(col) {
|
44
|
+
if (!col) {
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
var checkTitle = function checkTitle() {
|
48
|
+
if (col.Header().props.children.props && col.Header().props.children.props.title) {
|
49
|
+
return col.Header().props.children.props.title;
|
50
|
+
}
|
51
|
+
return getNestedTitle(col.Header().props.children.props);
|
52
|
+
};
|
53
|
+
return typeof (col === null || col === void 0 ? void 0 : col.Header) === 'function' ? checkTitle() : col.Header.props.title;
|
54
|
+
};
|
33
55
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, columns
|
34
56
|
// hide the columns without Header, e.g the sticky actions, spacer
|
35
57
|
.filter(function (colDef) {
|
36
|
-
|
37
|
-
|
38
|
-
return !!colDef.Header.props && !!((_colDef$Header$props = colDef.Header.props) !== null && _colDef$Header$props !== void 0 && _colDef$Header$props.title) || isTableSortable && !!sortableTitle;
|
39
|
-
}).filter(function (colDef) {
|
58
|
+
return !!getColTitle(colDef);
|
59
|
+
}).filter(Boolean).filter(function (colDef) {
|
40
60
|
return !colDef.isAction;
|
41
61
|
}).filter(function (colDef) {
|
42
|
-
var
|
43
|
-
|
44
|
-
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';
|
62
|
+
var _getColTitle;
|
63
|
+
return filterString.length === 0 || ((_getColTitle = getColTitle(colDef)) === null || _getColTitle === void 0 ? void 0 : _getColTitle.toLowerCase().includes(filterString)) && colDef.id !== 'spacer';
|
45
64
|
}).map(function (colDef, i) {
|
46
|
-
var
|
47
|
-
var isSortableColumn = !!colDef.canSort && !!isTableSortable;
|
48
|
-
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);
|
65
|
+
var colHeaderTitle = getColTitle(colDef);
|
49
66
|
var searchString = new RegExp('(' + filterString + ')');
|
50
|
-
var res = filterString.length ?
|
67
|
+
var res = filterString.length ? colHeaderTitle.toLowerCase().split(searchString) : null;
|
51
68
|
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;
|
52
|
-
var highlightedText = res !== null ? res[0] === '' ? "<strong>".concat(firstWord, "</strong>") + res[2] : firstWord + "<strong>".concat(res[1], "</strong>") + res[2] :
|
69
|
+
var highlightedText = res !== null ? res[0] === '' ? "<strong>".concat(firstWord, "</strong>") + res[2] : firstWord + "<strong>".concat(res[1], "</strong>") + res[2] : colHeaderTitle;
|
53
70
|
var isFrozenColumn = !!colDef.sticky;
|
54
71
|
var listContents = /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Checkbox, {
|
55
72
|
wrapperClassName: "".concat(blockClass, "__customize-columns-checkbox-wrapper"),
|
@@ -57,8 +74,8 @@ var DraggableItemsList = function DraggableItemsList(_ref) {
|
|
57
74
|
disabled: isFrozenColumn,
|
58
75
|
onChange: onSelectColumn.bind(null, colDef),
|
59
76
|
id: "".concat(blockClass, "__customization-column-").concat(colDef.id),
|
60
|
-
labelText:
|
61
|
-
title:
|
77
|
+
labelText: colHeaderTitle,
|
78
|
+
title: colHeaderTitle,
|
62
79
|
className: "".concat(blockClass, "__customize-columns-checkbox"),
|
63
80
|
hideLabel: true
|
64
81
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
@@ -74,7 +91,7 @@ var DraggableItemsList = function DraggableItemsList(_ref) {
|
|
74
91
|
id: "dnd-datagrid-columns-".concat(colDef.id),
|
75
92
|
type: "column-customization",
|
76
93
|
disabled: filterString.length > 0 || isFrozenColumn,
|
77
|
-
ariaLabel:
|
94
|
+
ariaLabel: colHeaderTitle,
|
78
95
|
onGrab: setAriaRegionText,
|
79
96
|
isFocused: focusIndex === i,
|
80
97
|
moveElement: moveElement,
|
@@ -104,7 +121,6 @@ DraggableItemsList.propTypes = {
|
|
104
121
|
filterString: _propTypes.PropTypes.string.isRequired,
|
105
122
|
focusIndex: _propTypes.PropTypes.number.isRequired,
|
106
123
|
getNextIndex: _propTypes.PropTypes.func.isRequired,
|
107
|
-
isTableSortable: _propTypes.PropTypes.bool,
|
108
124
|
moveElement: _propTypes.PropTypes.func.isRequired,
|
109
125
|
onSelectColumn: _propTypes.PropTypes.func.isRequired,
|
110
126
|
setAriaRegionText: _propTypes.PropTypes.func.isRequired,
|
@@ -24,7 +24,6 @@ var TearsheetWrapper = function TearsheetWrapper(_ref) {
|
|
24
24
|
rest = (0, _objectWithoutProperties2.default)(_instance$customizeCo, _excluded);
|
25
25
|
return /*#__PURE__*/React.createElement(_CustomizeColumnsTearsheet.default, (0, _extends2.default)({}, rest, labels, {
|
26
26
|
isOpen: isTearsheetOpen,
|
27
|
-
isTableSortable: instance === null || instance === void 0 ? void 0 : instance.isTableSortable,
|
28
27
|
setIsTearsheetOpen: setIsTearsheetOpen,
|
29
28
|
columnDefinitions: instance.allColumns,
|
30
29
|
originalColumnDefinitions: instance.columns,
|
@@ -24,7 +24,8 @@ var useDefaultStringRenderer = function useDefaultStringRenderer(hooks) {
|
|
24
24
|
var HeaderRenderer = function HeaderRenderer(header) {
|
25
25
|
return /*#__PURE__*/_react.default.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,
|
@@ -17,6 +17,7 @@ var _devtools = require("../../global/js/utils/devtools");
|
|
17
17
|
var _hooks = require("../../global/js/hooks");
|
18
18
|
var _settings = require("../../settings");
|
19
19
|
var _utils = require("./utils");
|
20
|
+
var _propsHelper = require("../../global/js/utils/props-helper");
|
20
21
|
var _NotificationsEmptyState = require("../EmptyStates/NotificationsEmptyState");
|
21
22
|
var _carbonComponentsReact = require("carbon-components-react");
|
22
23
|
var _iconsReact = require("@carbon/icons-react");
|
@@ -285,10 +286,10 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
|
|
285
286
|
nowText: nowText
|
286
287
|
})), /*#__PURE__*/_react.default.createElement("h6", {
|
287
288
|
className: notificationHeaderClassName
|
288
|
-
}, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Link, {
|
289
|
+
}, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Link, (0, _extends2.default)({
|
289
290
|
href: notification.link.url,
|
290
291
|
className: "".concat(blockClass, "__notifications-link")
|
291
|
-
}, notification.link.text)), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
292
|
+
}, (0, _propsHelper.prepareProps)({}, notification.link, ['text', 'url'])), notification.link.text)), /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
292
293
|
kind: "ghost",
|
293
294
|
size: "small",
|
294
295
|
renderIcon: _iconsReact.Close16,
|