@carbon/ibm-products 1.61.1 → 1.62.1
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +172 -70
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +1768 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +3 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +172 -70
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +172 -70
- package/css/index.css.map +1 -1
- package/css/index.min.css +3 -3
- package/css/index.min.css.map +1 -1
- package/es/components/Carousel/Carousel.js +194 -119
- package/es/components/Carousel/CarouselItem.js +8 -21
- package/es/components/Coachmark/Coachmark.js +17 -5
- package/es/components/Coachmark/CoachmarkDragbar.js +12 -5
- package/es/components/Coachmark/CoachmarkHeader.js +2 -1
- package/es/components/Coachmark/CoachmarkOverlay.js +105 -9
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +5 -2
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +26 -6
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +34 -10
- package/es/components/CoachmarkStack/CoachmarkStack.js +19 -4
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +45 -11
- package/es/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +6 -4
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +42 -25
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +23 -11
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +31 -12
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +43 -23
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +18 -18
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +93 -14
- package/es/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/es/components/Datagrid/useActionsColumn.js +9 -9
- package/es/components/Datagrid/useDatagrid.js +13 -1
- package/es/components/Datagrid/useExpandedRow.js +3 -6
- package/es/components/Datagrid/useFlexResize.js +19 -9
- package/es/components/Datagrid/useFocusRowExpander.js +40 -0
- package/es/components/Datagrid/useInfiniteScroll.js +10 -9
- package/es/components/Datagrid/useNestedRowExpander.js +9 -0
- package/es/components/Datagrid/useNestedRows.js +0 -4
- package/es/components/Datagrid/useOnRowClick.js +6 -7
- package/es/components/Datagrid/useParentDimensions.js +6 -6
- package/es/components/Datagrid/useResizeTable.js +7 -7
- package/es/components/Datagrid/useRowExpander.js +9 -0
- package/es/components/Datagrid/useSelectAllToggle.js +2 -2
- package/es/components/Datagrid/useSelectRows.js +52 -30
- package/es/components/Datagrid/useSkeletonRows.js +6 -6
- package/es/components/Datagrid/useSortableColumns.js +4 -5
- package/es/components/Datagrid/useStickyColumn.js +13 -6
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -0
- package/es/components/EmptyStates/assets/ErrorIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NoDataIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +6 -4
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +6 -4
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -4
- package/es/components/Guidebanner/Guidebanner.js +9 -12
- package/es/global/js/hooks/index.js +3 -2
- package/es/global/js/hooks/usePrefix.js +11 -0
- package/es/global/js/package-settings.js +1 -4
- package/lib/components/Carousel/Carousel.js +190 -114
- package/lib/components/Carousel/CarouselItem.js +9 -25
- package/lib/components/Coachmark/Coachmark.js +16 -4
- package/lib/components/Coachmark/CoachmarkDragbar.js +12 -5
- package/lib/components/Coachmark/CoachmarkHeader.js +2 -1
- package/lib/components/Coachmark/CoachmarkOverlay.js +105 -8
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +5 -2
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +25 -5
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +34 -10
- package/lib/components/CoachmarkStack/CoachmarkStack.js +18 -3
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +44 -10
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +6 -4
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +42 -32
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +17 -4
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +25 -5
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +43 -23
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +12 -12
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +96 -15
- package/lib/components/Datagrid/Datagrid.stories/StickyActionsColumnStory.js +1 -1
- package/lib/components/Datagrid/useActionsColumn.js +9 -12
- package/lib/components/Datagrid/useDatagrid.js +13 -1
- package/lib/components/Datagrid/useExpandedRow.js +2 -5
- package/lib/components/Datagrid/useFlexResize.js +19 -9
- package/lib/components/Datagrid/useFocusRowExpander.js +46 -0
- package/lib/components/Datagrid/useInfiniteScroll.js +9 -9
- package/lib/components/Datagrid/useNestedRowExpander.js +9 -0
- package/lib/components/Datagrid/useNestedRows.js +0 -4
- package/lib/components/Datagrid/useOnRowClick.js +6 -7
- package/lib/components/Datagrid/useParentDimensions.js +5 -6
- package/lib/components/Datagrid/useResizeTable.js +6 -7
- package/lib/components/Datagrid/useRowExpander.js +9 -0
- package/lib/components/Datagrid/useSelectAllToggle.js +2 -2
- package/lib/components/Datagrid/useSelectRows.js +46 -23
- package/lib/components/Datagrid/useSkeletonRows.js +6 -6
- package/lib/components/Datagrid/useSortableColumns.js +4 -5
- package/lib/components/Datagrid/useStickyColumn.js +8 -0
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -0
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -0
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -0
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -0
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -0
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -0
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +6 -4
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +6 -4
- package/lib/components/Guidebanner/Guidebanner.js +9 -12
- package/lib/global/js/hooks/index.js +8 -1
- package/lib/global/js/hooks/usePrefix.js +19 -0
- package/lib/global/js/package-settings.js +1 -4
- package/package.json +2 -2
- package/scss/components/Carousel/_carousel.scss +1 -2
- package/scss/components/Checklist/_checklist.scss +13 -25
- package/scss/components/Coachmark/styles/_coachmark-dragbar.scss +1 -45
- package/scss/components/Coachmark/styles/_coachmark-header.scss +0 -33
- package/scss/components/Coachmark/styles/_coachmark-overlay.scss +113 -5
- package/scss/components/Coachmark/styles/_coachmark-tagline.scss +18 -0
- package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +19 -1
- package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +2 -0
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -0
- package/scss/components/CoachmarkStack/_coachmark-stack.scss +3 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +31 -5
- package/scss/components/Datagrid/styles/_useExpandedRow.scss +21 -0
- package/scss/components/Datagrid/styles/_useNestedRows.scss +1 -1
- package/scss/components/Datagrid/styles/addons/_RowSizeDropdown.scss +9 -0
- package/scss/components/_index-released-only.scss +1 -0
- package/es/components/Carousel/utils.js +0 -98
- package/lib/components/Carousel/utils.js +0 -108
@@ -1,4 +1,5 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
4
|
var _excluded = ["children", "onClose", "fixedIsVisible", "className", "kind", "theme"];
|
4
5
|
/**
|
@@ -9,8 +10,8 @@ var _excluded = ["children", "onClose", "fixedIsVisible", "className", "kind", "
|
|
9
10
|
*/
|
10
11
|
|
11
12
|
// Import portions of React that are needed.
|
12
|
-
import React, { forwardRef, useRef } from 'react';
|
13
|
-
|
13
|
+
import React, { forwardRef, useRef, useState, useEffect } from 'react';
|
14
|
+
import uuidv4 from '../../global/js/utils/uuidv4';
|
14
15
|
// Other standard imports.
|
15
16
|
import PropTypes from 'prop-types';
|
16
17
|
import cx from 'classnames';
|
@@ -47,12 +48,46 @@ export var CoachmarkOverlay = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
47
48
|
_ref$theme = _ref.theme,
|
48
49
|
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
49
50
|
rest = _objectWithoutProperties(_ref, _excluded);
|
51
|
+
var _useWindowDimensions = useWindowDimensions(),
|
52
|
+
winHeight = _useWindowDimensions.winHeight,
|
53
|
+
winWidth = _useWindowDimensions.winWidth;
|
54
|
+
var _useState = useState(false),
|
55
|
+
_useState2 = _slicedToArray(_useState, 2),
|
56
|
+
a11yDragMode = _useState2[0],
|
57
|
+
setA11yDragMode = _useState2[1];
|
50
58
|
var overlayRef = useRef();
|
51
59
|
var coachmark = useCoachmark();
|
52
60
|
var isBeacon = kind === COACHMARK_OVERLAY_KIND.TOOLTIP;
|
53
61
|
var isDraggable = kind === COACHMARK_OVERLAY_KIND.FLOATING;
|
62
|
+
var isVisible = className && className.includes('is-visible');
|
63
|
+
var handleKeyPress = function handleKeyPress(event) {
|
64
|
+
var shiftKey = event.shiftKey,
|
65
|
+
key = event.key;
|
66
|
+
if (key === 'Enter' || key === ' ') {
|
67
|
+
setA11yDragMode(function (prevVal) {
|
68
|
+
return !prevVal;
|
69
|
+
});
|
70
|
+
} else if (a11yDragMode) {
|
71
|
+
var distanceToMove = shiftKey ? 128 : 32;
|
72
|
+
switch (key) {
|
73
|
+
case 'ArrowLeft':
|
74
|
+
handleDrag(distanceToMove * -1, 0);
|
75
|
+
break;
|
76
|
+
case 'ArrowRight':
|
77
|
+
handleDrag(distanceToMove, 0);
|
78
|
+
break;
|
79
|
+
case 'ArrowUp':
|
80
|
+
handleDrag(0, distanceToMove * -1);
|
81
|
+
break;
|
82
|
+
case 'ArrowDown':
|
83
|
+
handleDrag(0, distanceToMove);
|
84
|
+
break;
|
85
|
+
default:
|
86
|
+
break;
|
87
|
+
}
|
88
|
+
}
|
89
|
+
};
|
54
90
|
var styledTune = {};
|
55
|
-
// TODO: check this... this feels like it should be in a hook with no dep array.
|
56
91
|
if (isBeacon || isDraggable) {
|
57
92
|
if (coachmark.targetRect) {
|
58
93
|
styledTune = {
|
@@ -71,33 +106,94 @@ export var CoachmarkOverlay = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
71
106
|
styledTune.top += offsetTune.top;
|
72
107
|
}
|
73
108
|
}
|
109
|
+
function handleDragBounds(x, y) {
|
110
|
+
var xRes = x;
|
111
|
+
var yRes = y;
|
112
|
+
var xMax = winWidth - 288;
|
113
|
+
var yMax = winHeight - 150;
|
114
|
+
if (xRes < 0) {
|
115
|
+
xRes = 0;
|
116
|
+
} else if (xRes > xMax) {
|
117
|
+
xRes = xMax;
|
118
|
+
}
|
119
|
+
if (yRes < 0) {
|
120
|
+
yRes = 0;
|
121
|
+
} else if (yRes > yMax) {
|
122
|
+
yRes = yMax;
|
123
|
+
}
|
124
|
+
return {
|
125
|
+
targetX: xRes,
|
126
|
+
targetY: yRes
|
127
|
+
};
|
128
|
+
}
|
74
129
|
function handleDrag(movementX, movementY) {
|
75
130
|
var overlay = overlayRef.current;
|
76
131
|
var _overlay$getBoundingC = overlay.getBoundingClientRect(),
|
77
132
|
x = _overlay$getBoundingC.x,
|
78
133
|
y = _overlay$getBoundingC.y;
|
134
|
+
var _handleDragBounds = handleDragBounds(x + movementX, y + movementY),
|
135
|
+
targetX = _handleDragBounds.targetX,
|
136
|
+
targetY = _handleDragBounds.targetY;
|
79
137
|
overlay.style.transform = 'none';
|
80
138
|
overlay.style.position = 'fixed';
|
81
|
-
overlay.style.left = "".concat(
|
82
|
-
overlay.style.top = "".concat(
|
139
|
+
overlay.style.left = "".concat(targetX, "px");
|
140
|
+
overlay.style.top = "".concat(targetY, "px");
|
83
141
|
overlay.style.bottom = 'auto';
|
84
142
|
}
|
143
|
+
var contentId = uuidv4();
|
85
144
|
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
86
|
-
className: cx(blockClass, "".concat(blockClass, "--").concat(kind), "".concat(blockClass, "__").concat(theme), (isBeacon || isDraggable) && "".concat(blockClass, "--").concat(coachmark.align), fixedIsVisible && "".concat(blockClass, "--is-visible"), className),
|
145
|
+
className: cx(blockClass, "".concat(blockClass, "--").concat(kind), "".concat(blockClass, "__").concat(theme), (isBeacon || isDraggable) && "".concat(blockClass, "--").concat(coachmark.align), fixedIsVisible && "".concat(blockClass, "--is-visible"), a11yDragMode && "".concat(blockClass, "--is-dragmode"), className),
|
87
146
|
ref: overlayRef,
|
88
|
-
style: styledTune
|
147
|
+
style: styledTune,
|
148
|
+
"aria-labelledby": contentId,
|
149
|
+
tabIndex: -1
|
89
150
|
}, getDevtoolsProps(componentName)), isDraggable ? /*#__PURE__*/React.createElement(CoachmarkDragbar, {
|
151
|
+
a11yKeyboardHandler: handleKeyPress,
|
152
|
+
onBlur: function onBlur() {
|
153
|
+
return setA11yDragMode(false);
|
154
|
+
},
|
90
155
|
onDrag: handleDrag,
|
156
|
+
theme: theme,
|
91
157
|
onClose: onClose
|
92
158
|
}) : /*#__PURE__*/React.createElement(CoachmarkHeader, {
|
93
159
|
onClose: onClose
|
94
160
|
}), /*#__PURE__*/React.createElement("div", {
|
95
161
|
className: "".concat(blockClass, "__body"),
|
96
|
-
ref: ref
|
97
|
-
|
162
|
+
ref: ref,
|
163
|
+
id: contentId
|
164
|
+
}, React.Children.map(children, function (child) {
|
165
|
+
return /*#__PURE__*/React.cloneElement(child, {
|
166
|
+
isVisible: isVisible
|
167
|
+
});
|
168
|
+
})), isBeacon && /*#__PURE__*/React.createElement("span", {
|
98
169
|
className: "".concat(blockClass, "__caret")
|
99
170
|
}));
|
100
171
|
});
|
172
|
+
function getWindowDimensions() {
|
173
|
+
var _window = window,
|
174
|
+
winWidth = _window.innerWidth,
|
175
|
+
winHeight = _window.innerHeight;
|
176
|
+
return {
|
177
|
+
winWidth: winWidth,
|
178
|
+
winHeight: winHeight
|
179
|
+
};
|
180
|
+
}
|
181
|
+
var useWindowDimensions = function useWindowDimensions() {
|
182
|
+
var _useState3 = useState(getWindowDimensions()),
|
183
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
184
|
+
windowDimensions = _useState4[0],
|
185
|
+
setWindowDimensions = _useState4[1];
|
186
|
+
useEffect(function () {
|
187
|
+
function handleResize() {
|
188
|
+
setWindowDimensions(getWindowDimensions());
|
189
|
+
}
|
190
|
+
window.addEventListener('resize', handleResize);
|
191
|
+
return function () {
|
192
|
+
return window.removeEventListener('resize', handleResize);
|
193
|
+
};
|
194
|
+
}, []);
|
195
|
+
return windowDimensions;
|
196
|
+
};
|
101
197
|
|
102
198
|
// Return a placeholder if not released and not enabled by feature flag
|
103
199
|
CoachmarkOverlay = pkg.checkComponentEnabled(CoachmarkOverlay, componentName);
|
@@ -47,14 +47,17 @@ export var CoachmarkBeacon = /*#__PURE__*/React.forwardRef(function (_ref, ref)
|
|
47
47
|
className: cx(blockClass, "".concat(blockClass, "-").concat(kind), className),
|
48
48
|
ref: ref,
|
49
49
|
style: overlayPositionStyle
|
50
|
-
}, getDevtoolsProps(componentName)
|
50
|
+
}, getDevtoolsProps(componentName), {
|
51
|
+
role: "tooltip"
|
52
|
+
}), /*#__PURE__*/React.createElement("button", _extends({
|
51
53
|
tabIndex: 0,
|
52
54
|
type: "button"
|
53
55
|
}, coachmark.buttonProps, {
|
54
56
|
"aria-label": label,
|
55
57
|
className: "".concat(blockClass, "__target")
|
56
58
|
}), /*#__PURE__*/React.createElement("svg", {
|
57
|
-
className: "".concat(blockClass, "__center")
|
59
|
+
className: "".concat(blockClass, "__center"),
|
60
|
+
alt: ""
|
58
61
|
}, /*#__PURE__*/React.createElement("circle", {
|
59
62
|
r: 1,
|
60
63
|
cx: 38,
|
@@ -10,7 +10,7 @@ var _excluded = ["children", "className", "onClose", "portalTarget", "tagline",
|
|
10
10
|
*/
|
11
11
|
|
12
12
|
// Import portions of React that are needed.
|
13
|
-
import React, { useEffect, useRef, useState } from 'react';
|
13
|
+
import React, { useEffect, useRef, useState, useCallback } from 'react';
|
14
14
|
|
15
15
|
// Other standard imports.
|
16
16
|
import PropTypes from 'prop-types';
|
@@ -24,7 +24,9 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
|
24
24
|
import { pkg /*, carbon */ } from '../../settings';
|
25
25
|
|
26
26
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
|
-
var
|
27
|
+
var coachmarkClass = "".concat(pkg.prefix, "--coachmark");
|
28
|
+
var blockClass = "".concat(coachmarkClass, "-fixed");
|
29
|
+
var overlayBlockClass = "".concat(coachmarkClass, "-overlay");
|
28
30
|
var componentName = 'CoachmarkFixed';
|
29
31
|
var defaults = {
|
30
32
|
onClose: function onClose() {},
|
@@ -75,9 +77,14 @@ export var CoachmarkFixed = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
75
77
|
_useState10 = _slicedToArray(_useState9, 2),
|
76
78
|
fixedIsVisible = _useState10[0],
|
77
79
|
setFixedIsVisible = _useState10[1];
|
78
|
-
var
|
79
|
-
|
80
|
-
|
80
|
+
var prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
81
|
+
var handleClose = useCallback(function () {
|
82
|
+
if (prefersReducedMotion.matches) {
|
83
|
+
setIsOpen(false);
|
84
|
+
} else {
|
85
|
+
setFixedIsVisible(false);
|
86
|
+
}
|
87
|
+
}, [prefersReducedMotion.matches]);
|
81
88
|
var handleTransitionEnd = function handleTransitionEnd(e) {
|
82
89
|
if (e.propertyName === 'transform' && !fixedIsVisible) {
|
83
90
|
setIsOpen(false);
|
@@ -94,9 +101,21 @@ export var CoachmarkFixed = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
94
101
|
setIsOpen(false);
|
95
102
|
setShouldResetPosition(true);
|
96
103
|
};
|
104
|
+
var escFunction = useCallback(function (event) {
|
105
|
+
if (event.key === 'Escape') {
|
106
|
+
handleClose();
|
107
|
+
}
|
108
|
+
}, [handleClose]);
|
109
|
+
useEffect(function () {
|
110
|
+
document.addEventListener('keydown', escFunction, false);
|
111
|
+
return function () {
|
112
|
+
document.removeEventListener('keydown', escFunction, false);
|
113
|
+
};
|
114
|
+
}, [escFunction]);
|
97
115
|
var contextValue = {
|
98
116
|
buttonProps: {
|
99
117
|
'aria-expanded': isOpen,
|
118
|
+
tabIndex: 0,
|
100
119
|
onClick: handleTargetClick,
|
101
120
|
// Compensate for accidental open/close on double-click.
|
102
121
|
// Only open on double-click.
|
@@ -151,7 +170,8 @@ export var CoachmarkFixed = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
151
170
|
kind: COACHMARK_OVERLAY_KIND.FIXED,
|
152
171
|
onClose: handleClose,
|
153
172
|
onTransitionEnd: handleTransitionEnd,
|
154
|
-
theme: theme
|
173
|
+
theme: theme,
|
174
|
+
className: cx(fixedIsVisible && "".concat(overlayBlockClass, "--is-visible"), overlayBlockClass)
|
155
175
|
}, children), portalNode)));
|
156
176
|
});
|
157
177
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
-
var _excluded = ["className", "children", "media", "nextButtonText", "previousButtonLabel", "closeButtonLabel"];
|
4
|
+
var _excluded = ["className", "children", "isVisible", "media", "nextButtonText", "previousButtonLabel", "closeButtonLabel"];
|
5
5
|
/**
|
6
6
|
* Copyright IBM Corp. 2023, 2023
|
7
7
|
*
|
@@ -27,6 +27,7 @@ import { pkg /*, carbon */ } from '../../settings';
|
|
27
27
|
var blockClass = "".concat(pkg.prefix, "--coachmark-overlay-elements");
|
28
28
|
var componentName = 'CoachmarkOverlayElements';
|
29
29
|
var defaults = {
|
30
|
+
isVisible: false,
|
30
31
|
nextButtonText: 'Next',
|
31
32
|
previousButtonLabel: 'Back',
|
32
33
|
closeButtonLabel: 'Got it'
|
@@ -39,6 +40,8 @@ var defaults = {
|
|
39
40
|
export var CoachmarkOverlayElements = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
40
41
|
var className = _ref.className,
|
41
42
|
children = _ref.children,
|
43
|
+
_ref$isVisible = _ref.isVisible,
|
44
|
+
isVisible = _ref$isVisible === void 0 ? defaults.isVisible : _ref$isVisible,
|
42
45
|
media = _ref.media,
|
43
46
|
_ref$nextButtonText = _ref.nextButtonText,
|
44
47
|
nextButtonText = _ref$nextButtonText === void 0 ? defaults.nextButtonText : _ref$nextButtonText,
|
@@ -56,8 +59,16 @@ export var CoachmarkOverlayElements = /*#__PURE__*/React.forwardRef(function (_r
|
|
56
59
|
var _useState3 = useState(0),
|
57
60
|
_useState4 = _slicedToArray(_useState3, 2),
|
58
61
|
currentProgStep = _useState4[0],
|
59
|
-
|
62
|
+
_setCurrentProgStep = _useState4[1];
|
60
63
|
var coachmark = useCoachmark();
|
64
|
+
var setCurrentProgStep = function setCurrentProgStep(value) {
|
65
|
+
if (currentProgStep > 0 && value === 0 && buttonFocusRef.current) {
|
66
|
+
setTimeout(function () {
|
67
|
+
buttonFocusRef.current.focus();
|
68
|
+
}, 1000);
|
69
|
+
}
|
70
|
+
_setCurrentProgStep(value);
|
71
|
+
};
|
61
72
|
var numProgSteps = Children.count(children);
|
62
73
|
var progStepFloor = 0;
|
63
74
|
var progStepCeil = numProgSteps - 1;
|
@@ -68,6 +79,13 @@ export var CoachmarkOverlayElements = /*#__PURE__*/React.forwardRef(function (_r
|
|
68
79
|
buttonFocusRef.current.focus();
|
69
80
|
}
|
70
81
|
}, []);
|
82
|
+
useEffect(function () {
|
83
|
+
setTimeout(function () {
|
84
|
+
if (buttonFocusRef.current && isVisible) {
|
85
|
+
buttonFocusRef.current.focus();
|
86
|
+
}
|
87
|
+
}, 100);
|
88
|
+
}, [isVisible]);
|
71
89
|
if (!coachmark) {
|
72
90
|
return pconsole.warn("The ".concat(componentName, " is a composable container element which should be used only within the scope of a Coachmark or a CoachmarkFixed component."));
|
73
91
|
}
|
@@ -91,9 +109,14 @@ export var CoachmarkOverlayElements = /*#__PURE__*/React.forwardRef(function (_r
|
|
91
109
|
className: cx("".concat(blockClass, "__footer"), 'coachmark-carousel-controls')
|
92
110
|
}, /*#__PURE__*/React.createElement(Button, _extends({
|
93
111
|
size: "sm"
|
94
|
-
}, coachmark.closeButtonProps
|
112
|
+
}, coachmark.closeButtonProps, {
|
113
|
+
ref: buttonFocusRef
|
114
|
+
}), closeButtonLabel))) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Carousel, {
|
95
115
|
disableArrowScroll: true,
|
96
|
-
ref: scrollRef
|
116
|
+
ref: scrollRef,
|
117
|
+
onScroll: function onScroll(scrollPercent) {
|
118
|
+
setScrollPosition(scrollPercent);
|
119
|
+
}
|
97
120
|
}, children), /*#__PURE__*/React.createElement("div", {
|
98
121
|
className: cx("".concat(blockClass, "__footer"))
|
99
122
|
}, /*#__PURE__*/React.createElement("div", {
|
@@ -105,9 +128,7 @@ export var CoachmarkOverlayElements = /*#__PURE__*/React.forwardRef(function (_r
|
|
105
128
|
disabled: scrollPosition === 0,
|
106
129
|
onClick: function onClick() {
|
107
130
|
var targetStep = clamp(currentProgStep - 1, progStepFloor, progStepCeil);
|
108
|
-
scrollRef.current.scrollToView(targetStep)
|
109
|
-
setScrollPosition(scrollPercentage);
|
110
|
-
});
|
131
|
+
scrollRef.current.scrollToView(targetStep);
|
111
132
|
setCurrentProgStep(targetStep);
|
112
133
|
}
|
113
134
|
}, previousButtonLabel), currentProgStep < progStepCeil ? /*#__PURE__*/React.createElement(Button, {
|
@@ -117,9 +138,7 @@ export var CoachmarkOverlayElements = /*#__PURE__*/React.forwardRef(function (_r
|
|
117
138
|
disabled: scrollPosition === 1,
|
118
139
|
onClick: function onClick() {
|
119
140
|
var targetStep = clamp(currentProgStep + 1, progStepFloor, progStepCeil);
|
120
|
-
scrollRef.current.scrollToView(targetStep)
|
121
|
-
setScrollPosition(scrollPercentage);
|
122
|
-
});
|
141
|
+
scrollRef.current.scrollToView(targetStep);
|
123
142
|
setCurrentProgStep(targetStep);
|
124
143
|
}
|
125
144
|
}, nextButtonText) : closeButtonLabel && /*#__PURE__*/React.createElement(Button, _extends({
|
@@ -154,6 +173,11 @@ CoachmarkOverlayElements.propTypes = {
|
|
154
173
|
* The label for the Close button.
|
155
174
|
*/
|
156
175
|
closeButtonLabel: PropTypes.string,
|
176
|
+
/**
|
177
|
+
* The visibility of CoachmarkOverlayElements is
|
178
|
+
* managed in the parent component.
|
179
|
+
*/
|
180
|
+
isVisible: PropTypes.bool,
|
157
181
|
/**
|
158
182
|
* The object describing an image in one of two shapes.
|
159
183
|
* If a single media element is required, use `{render}`.
|
@@ -9,7 +9,7 @@ var _excluded = ["children", "className", "onClose", "description", "media", "na
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
10
10
|
*/
|
11
11
|
|
12
|
-
import React, { Children, useEffect, useRef, useState } from 'react';
|
12
|
+
import React, { Children, useEffect, useRef, useState, useCallback } from 'react';
|
13
13
|
import { createPortal } from 'react-dom';
|
14
14
|
import PropTypes from 'prop-types';
|
15
15
|
import cx from 'classnames';
|
@@ -88,7 +88,18 @@ export var CoachmarkStack = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
88
88
|
var handleClickNavItem = function handleClickNavItem(itemNumber) {
|
89
89
|
setSelectedItemNumber(itemNumber);
|
90
90
|
};
|
91
|
-
var
|
91
|
+
var escFunction = useCallback(function (event) {
|
92
|
+
if (event.key === 'Escape') {
|
93
|
+
selectedItemNumber === 0 ? handleClose(true) : handleClose(false);
|
94
|
+
}
|
95
|
+
}, [handleClose, selectedItemNumber]);
|
96
|
+
useEffect(function () {
|
97
|
+
document.addEventListener('keydown', escFunction, false);
|
98
|
+
return function () {
|
99
|
+
document.removeEventListener('keydown', escFunction, false);
|
100
|
+
};
|
101
|
+
}, [escFunction]);
|
102
|
+
var handleClose = useCallback(function (isParentCloseButton) {
|
92
103
|
if (isParentCloseButton) {
|
93
104
|
// Trigger slide-out animation
|
94
105
|
setSelectedItemNumber(-1);
|
@@ -105,9 +116,10 @@ export var CoachmarkStack = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
105
116
|
// Unstack child
|
106
117
|
setSelectedItemNumber(0);
|
107
118
|
}
|
108
|
-
};
|
119
|
+
}, [onClose]);
|
109
120
|
var contextValue = {
|
110
121
|
buttonProps: {
|
122
|
+
tabIndex: 0,
|
111
123
|
'aria-expanded': isOpen,
|
112
124
|
onClick: function onClick() {
|
113
125
|
setIsOpen(true);
|
@@ -134,7 +146,7 @@ export var CoachmarkStack = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
134
146
|
useEffect(function () {
|
135
147
|
setTimeout(function () {
|
136
148
|
if (stackHomeRef.current) {
|
137
|
-
setParentHeight(stackHomeRef.current.clientHeight);
|
149
|
+
setParentHeight(stackHomeRef.current.clientHeight + 16);
|
138
150
|
}
|
139
151
|
}, 0);
|
140
152
|
}, [stackHomeRef]);
|
@@ -145,10 +157,12 @@ export var CoachmarkStack = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
145
157
|
}
|
146
158
|
stackHomeRef.current.style.height = "".concat(parentHeight, "px");
|
147
159
|
if (!isOpen || targetSelectedItem < 0) {
|
160
|
+
stackHomeRef.current.focus();
|
148
161
|
return;
|
149
162
|
}
|
150
163
|
var targetHomeHeight = stackedCoachmarkRefs.current[targetSelectedItem].clientHeight;
|
151
164
|
stackHomeRef.current.style.height = "".concat(targetHomeHeight, "px");
|
165
|
+
stackedCoachmarkRefs.current[targetSelectedItem].focus();
|
152
166
|
}, [selectedItemNumber, isOpen, parentHeight]);
|
153
167
|
var wrappedChildren = Children.map(childArray, function (child, idx) {
|
154
168
|
var mountedClass = mountedRef.current ? "".concat(elementBlockClass, "--is-mounted") : '';
|
@@ -177,6 +191,7 @@ export var CoachmarkStack = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
177
191
|
}), /*#__PURE__*/React.createElement(CoachmarkStackHome, {
|
178
192
|
ref: stackHomeRef,
|
179
193
|
className: cx("".concat(pkg.prefix, "--coachmark-overlay"), "".concat(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")),
|
194
|
+
isOpen: isOpen && selectedItemNumber < 1,
|
180
195
|
description: description,
|
181
196
|
media: media,
|
182
197
|
navLinkLabels: navLinkLabels,
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
-
var _excluded = ["className", "description", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
|
4
|
+
var _excluded = ["className", "description", "isOpen", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
|
4
5
|
/**
|
5
6
|
* Copyright IBM Corp. 2023, 2023
|
6
7
|
*
|
@@ -8,7 +9,7 @@ var _excluded = ["className", "description", "media", "navLinkLabels", "onClickN
|
|
8
9
|
* LICENSE file in the root directory of this source tree.
|
9
10
|
*/
|
10
11
|
|
11
|
-
import React, { forwardRef } from 'react';
|
12
|
+
import React, { forwardRef, useRef, useEffect, useState } from 'react';
|
12
13
|
import pconsole from '../../global/js/utils/pconsole';
|
13
14
|
import PropTypes from 'prop-types';
|
14
15
|
import cx from 'classnames';
|
@@ -36,14 +37,27 @@ export var CoachmarkStackHome = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
36
37
|
var _document$querySelect;
|
37
38
|
var className = _ref.className,
|
38
39
|
description = _ref.description,
|
40
|
+
isOpen = _ref.isOpen,
|
39
41
|
media = _ref.media,
|
40
42
|
navLinkLabels = _ref.navLinkLabels,
|
41
43
|
onClickNavItem = _ref.onClickNavItem,
|
42
|
-
|
44
|
+
_onClose = _ref.onClose,
|
43
45
|
portalTarget = _ref.portalTarget,
|
44
46
|
closeButtonLabel = _ref.closeButtonLabel,
|
45
47
|
title = _ref.title,
|
46
48
|
rest = _objectWithoutProperties(_ref, _excluded);
|
49
|
+
var buttonFocusRef = useRef();
|
50
|
+
var _useState = useState(0),
|
51
|
+
_useState2 = _slicedToArray(_useState, 2),
|
52
|
+
linkFocusIndex = _useState2[0],
|
53
|
+
setLinkFocusIndex = _useState2[1];
|
54
|
+
useEffect(function () {
|
55
|
+
setTimeout(function () {
|
56
|
+
if (isOpen && buttonFocusRef.current) {
|
57
|
+
buttonFocusRef.current.focus();
|
58
|
+
}
|
59
|
+
}, 100);
|
60
|
+
}, [isOpen]);
|
47
61
|
if (!navLinkLabels) {
|
48
62
|
return pconsole.warn("".concat(componentName, " is a Novice to Pro internal component and is not intended for general use."));
|
49
63
|
}
|
@@ -53,7 +67,10 @@ export var CoachmarkStackHome = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
53
67
|
ref: ref,
|
54
68
|
role: "main"
|
55
69
|
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(CoachmarkHeader, {
|
56
|
-
onClose: onClose
|
70
|
+
onClose: function onClose() {
|
71
|
+
setLinkFocusIndex(0);
|
72
|
+
_onClose();
|
73
|
+
}
|
57
74
|
}), /*#__PURE__*/React.createElement("div", {
|
58
75
|
className: "".concat(overlayClass, "__body")
|
59
76
|
}, /*#__PURE__*/React.createElement("div", {
|
@@ -73,21 +90,34 @@ export var CoachmarkStackHome = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
73
90
|
}, description)), /*#__PURE__*/React.createElement("ul", {
|
74
91
|
className: "".concat(blockClass, "__nav-links")
|
75
92
|
}, navLinkLabels.map(function (label, index) {
|
93
|
+
if (index === linkFocusIndex) {
|
94
|
+
return renderNavLink(index, label, buttonFocusRef);
|
95
|
+
} else {
|
96
|
+
return renderNavLink(index, label);
|
97
|
+
}
|
98
|
+
})), closeButtonLabel && /*#__PURE__*/React.createElement("div", {
|
99
|
+
className: "".concat(overlayClass, "__footer")
|
100
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
101
|
+
size: "sm",
|
102
|
+
onClick: function onClick() {
|
103
|
+
setLinkFocusIndex(0);
|
104
|
+
_onClose();
|
105
|
+
}
|
106
|
+
}, closeButtonLabel))))), portalNode);
|
107
|
+
function renderNavLink(index, label) {
|
108
|
+
var ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
76
109
|
return /*#__PURE__*/React.createElement("li", {
|
77
110
|
key: index
|
78
111
|
}, /*#__PURE__*/React.createElement(Button, {
|
79
112
|
kind: "ghost",
|
80
113
|
size: "sm",
|
81
114
|
onClick: function onClick() {
|
115
|
+
setLinkFocusIndex(index);
|
82
116
|
onClickNavItem(index + 1);
|
83
|
-
}
|
117
|
+
},
|
118
|
+
ref: ref
|
84
119
|
}, label));
|
85
|
-
}
|
86
|
-
className: "".concat(overlayClass, "__footer")
|
87
|
-
}, /*#__PURE__*/React.createElement(Button, {
|
88
|
-
size: "sm",
|
89
|
-
onClick: onClose
|
90
|
-
}, closeButtonLabel))))), portalNode);
|
120
|
+
}
|
91
121
|
});
|
92
122
|
|
93
123
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -113,6 +143,10 @@ CoachmarkStackHome.propTypes = {
|
|
113
143
|
* The description of the Coachmark.
|
114
144
|
*/
|
115
145
|
description: PropTypes.node.isRequired,
|
146
|
+
/**
|
147
|
+
* If the stack home is open.
|
148
|
+
*/
|
149
|
+
isOpen: PropTypes.bool.isRequired,
|
116
150
|
/**
|
117
151
|
* The object describing an image in one of two shapes.
|
118
152
|
*
|
@@ -31,7 +31,7 @@ var TableContainer = DataTable.TableContainer,
|
|
31
31
|
Table = DataTable.Table;
|
32
32
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
33
33
|
export var DatagridContent = function DatagridContent(_ref) {
|
34
|
-
var
|
34
|
+
var _cx5;
|
35
35
|
var datagridState = _ref.datagridState,
|
36
36
|
title = _ref.title;
|
37
37
|
var _useContext = useContext(InlineEditContext),
|
@@ -44,8 +44,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
44
44
|
var activeCellId = inlineEditState.activeCellId,
|
45
45
|
gridActive = inlineEditState.gridActive,
|
46
46
|
editId = inlineEditState.editId;
|
47
|
-
var
|
48
|
-
getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
|
47
|
+
var getTableProps = datagridState.getTableProps,
|
49
48
|
getFilterFlyoutProps = datagridState.getFilterFlyoutProps,
|
50
49
|
withVirtualScroll = datagridState.withVirtualScroll,
|
51
50
|
DatagridPagination = datagridState.DatagridPagination,
|
@@ -68,6 +67,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
68
67
|
state = datagridState.state,
|
69
68
|
page = datagridState.page,
|
70
69
|
rows = datagridState.rows;
|
70
|
+
var columnResizing = state.columnResizing;
|
71
71
|
var contentRows = DatagridPagination && page || rows;
|
72
72
|
var gridAreaRef = useRef();
|
73
73
|
var multiKeyTrackingRef = useRef();
|
@@ -89,10 +89,11 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
89
89
|
var renderTable = function renderTable() {
|
90
90
|
var _getTableProps;
|
91
91
|
return /*#__PURE__*/React.createElement(Table, _extends({}, getTableProps(), {
|
92
|
-
className: cx(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
|
92
|
+
className: cx(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), _defineProperty({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), _defineProperty({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), _defineProperty({}, "".concat(blockClass, "__table-grid-active"), gridActive), _defineProperty({}, "".concat(blockClass, "__table-is-resizing"), typeof columnResizing.isResizingColumn === 'string'), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
|
93
93
|
role: withInlineEdit && 'grid',
|
94
94
|
tabIndex: withInlineEdit && 0,
|
95
|
-
onKeyDown:
|
95
|
+
onKeyDown: /* istanbul ignore next */
|
96
|
+
withInlineEdit && function (event) {
|
96
97
|
return handleGridKeyPress({
|
97
98
|
event: event,
|
98
99
|
dispatch: dispatch,
|
@@ -101,10 +102,10 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
101
102
|
state: inlineEditState,
|
102
103
|
usingMac: usingMac
|
103
104
|
});
|
104
|
-
}
|
105
|
-
onFocus: withInlineEdit
|
105
|
+
},
|
106
|
+
onFocus: withInlineEdit && function () {
|
106
107
|
return handleGridFocus(inlineEditState, dispatch);
|
107
|
-
}
|
108
|
+
},
|
108
109
|
title: title
|
109
110
|
}), !withVirtualScroll && /*#__PURE__*/React.createElement(DatagridHead, datagridState), /*#__PURE__*/React.createElement(DatagridBody, _extends({}, datagridState, {
|
110
111
|
rows: contentRows
|
@@ -133,6 +134,8 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
133
134
|
useSubscribeToEventEmitter(CLEAR_SINGLE_FILTER, function (id) {
|
134
135
|
return clearSingleFilter(id, setAllFilters, state);
|
135
136
|
});
|
137
|
+
|
138
|
+
/* istanbul ignore next */
|
136
139
|
var renderFilterSummary = function renderFilterSummary() {
|
137
140
|
return state.filters.length > 0 && /*#__PURE__*/React.createElement(FilterSummary, {
|
138
141
|
className: "".concat(blockClass, "__filter-summary"),
|
@@ -145,7 +148,7 @@ export var DatagridContent = function DatagridContent(_ref) {
|
|
145
148
|
});
|
146
149
|
};
|
147
150
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TableContainer, {
|
148
|
-
className: cx("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : '', (
|
151
|
+
className: cx("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : '', (_cx5 = {}, _defineProperty(_cx5, "".concat(blockClass, "__grid-container-grid-active"), gridActive), _defineProperty(_cx5, "".concat(blockClass, "__grid-container-inline-edit"), withInlineEdit), _defineProperty(_cx5, "".concat(blockClass, "__grid-container-grid-active--without-toolbar"), withInlineEdit && !DatagridActions), _cx5)),
|
149
152
|
title: gridTitle,
|
150
153
|
description: gridDescription
|
151
154
|
}, /*#__PURE__*/React.createElement(DatagridToolbar, datagridState), /*#__PURE__*/React.createElement("div", {
|
@@ -13,10 +13,10 @@ var blockClass = "".concat(pkg.prefix, "--datagrid");
|
|
13
13
|
var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentComponent) {
|
14
14
|
return function (datagridState) {
|
15
15
|
var row = datagridState.row;
|
16
|
-
var
|
17
|
-
expandedContentHeight = _ref.expandedContentHeight;
|
16
|
+
var expandedContentHeight = row.expandedContentHeight;
|
18
17
|
var toggleParentHoverClass = function toggleParentHoverClass(event, eventType) {
|
19
18
|
var _event$target, _event$target$parentN;
|
19
|
+
/* istanbul ignore else */
|
20
20
|
if (event !== null && event !== void 0 && (_event$target = event.target) !== null && _event$target !== void 0 && (_event$target$parentN = _event$target.parentNode) !== null && _event$target$parentN !== void 0 && _event$target$parentN.previousElementSibling) {
|
21
21
|
var parentNode = event.target.parentNode.previousElementSibling;
|
22
22
|
if (eventType === 'enter') {
|
@@ -34,12 +34,14 @@ var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentCompone
|
|
34
34
|
onMouseLeave: function onMouseLeave(event) {
|
35
35
|
return toggleParentHoverClass(event);
|
36
36
|
}
|
37
|
+
}, /*#__PURE__*/React.createElement("td", {
|
38
|
+
className: "".concat(blockClass, "__expanded-row-cell-wrapper")
|
37
39
|
}, /*#__PURE__*/React.createElement("div", {
|
38
40
|
className: "".concat(blockClass, "__expanded-row-content"),
|
39
41
|
style: {
|
40
|
-
height: expandedContentHeight
|
42
|
+
height: expandedContentHeight && expandedContentHeight
|
41
43
|
}
|
42
|
-
}, ExpandedRowContentComponent
|
44
|
+
}, /*#__PURE__*/React.createElement(ExpandedRowContentComponent, datagridState))));
|
43
45
|
};
|
44
46
|
};
|
45
47
|
export default DatagridExpandedRow;
|