@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
@@ -7,8 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.CoachmarkOverlay = void 0;
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
13
|
+
var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
|
12
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
13
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
14
16
|
var _devtools = require("../../global/js/utils/devtools");
|
@@ -46,12 +48,46 @@ var CoachmarkOverlay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
46
48
|
_ref$theme = _ref.theme,
|
47
49
|
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
48
50
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
51
|
+
var _useWindowDimensions = useWindowDimensions(),
|
52
|
+
winHeight = _useWindowDimensions.winHeight,
|
53
|
+
winWidth = _useWindowDimensions.winWidth;
|
54
|
+
var _useState = (0, _react.useState)(false),
|
55
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
56
|
+
a11yDragMode = _useState2[0],
|
57
|
+
setA11yDragMode = _useState2[1];
|
49
58
|
var overlayRef = (0, _react.useRef)();
|
50
59
|
var coachmark = (0, _context.useCoachmark)();
|
51
60
|
var isBeacon = kind === _enums.COACHMARK_OVERLAY_KIND.TOOLTIP;
|
52
61
|
var isDraggable = kind === _enums.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
|
+
};
|
53
90
|
var styledTune = {};
|
54
|
-
// TODO: check this... this feels like it should be in a hook with no dep array.
|
55
91
|
if (isBeacon || isDraggable) {
|
56
92
|
if (coachmark.targetRect) {
|
57
93
|
styledTune = {
|
@@ -70,36 +106,97 @@ var CoachmarkOverlay = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref)
|
|
70
106
|
styledTune.top += offsetTune.top;
|
71
107
|
}
|
72
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
|
+
}
|
73
129
|
function handleDrag(movementX, movementY) {
|
74
130
|
var overlay = overlayRef.current;
|
75
131
|
var _overlay$getBoundingC = overlay.getBoundingClientRect(),
|
76
132
|
x = _overlay$getBoundingC.x,
|
77
133
|
y = _overlay$getBoundingC.y;
|
134
|
+
var _handleDragBounds = handleDragBounds(x + movementX, y + movementY),
|
135
|
+
targetX = _handleDragBounds.targetX,
|
136
|
+
targetY = _handleDragBounds.targetY;
|
78
137
|
overlay.style.transform = 'none';
|
79
138
|
overlay.style.position = 'fixed';
|
80
|
-
overlay.style.left = "".concat(
|
81
|
-
overlay.style.top = "".concat(
|
139
|
+
overlay.style.left = "".concat(targetX, "px");
|
140
|
+
overlay.style.top = "".concat(targetY, "px");
|
82
141
|
overlay.style.bottom = 'auto';
|
83
142
|
}
|
143
|
+
var contentId = (0, _uuidv.default)();
|
84
144
|
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
85
|
-
className: (0, _classnames.default)(blockClass, "".concat(blockClass, "--").concat(kind), "".concat(blockClass, "__").concat(theme), (isBeacon || isDraggable) && "".concat(blockClass, "--").concat(coachmark.align), fixedIsVisible && "".concat(blockClass, "--is-visible"), className),
|
145
|
+
className: (0, _classnames.default)(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),
|
86
146
|
ref: overlayRef,
|
87
|
-
style: styledTune
|
147
|
+
style: styledTune,
|
148
|
+
"aria-labelledby": contentId,
|
149
|
+
tabIndex: -1
|
88
150
|
}, (0, _devtools.getDevtoolsProps)(componentName)), isDraggable ? /*#__PURE__*/_react.default.createElement(_CoachmarkDragbar.CoachmarkDragbar, {
|
151
|
+
a11yKeyboardHandler: handleKeyPress,
|
152
|
+
onBlur: function onBlur() {
|
153
|
+
return setA11yDragMode(false);
|
154
|
+
},
|
89
155
|
onDrag: handleDrag,
|
156
|
+
theme: theme,
|
90
157
|
onClose: onClose
|
91
158
|
}) : /*#__PURE__*/_react.default.createElement(_CoachmarkHeader.CoachmarkHeader, {
|
92
159
|
onClose: onClose
|
93
160
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
94
161
|
className: "".concat(blockClass, "__body"),
|
95
|
-
ref: ref
|
96
|
-
|
162
|
+
ref: ref,
|
163
|
+
id: contentId
|
164
|
+
}, _react.default.Children.map(children, function (child) {
|
165
|
+
return /*#__PURE__*/_react.default.cloneElement(child, {
|
166
|
+
isVisible: isVisible
|
167
|
+
});
|
168
|
+
})), isBeacon && /*#__PURE__*/_react.default.createElement("span", {
|
97
169
|
className: "".concat(blockClass, "__caret")
|
98
170
|
}));
|
99
171
|
});
|
172
|
+
exports.CoachmarkOverlay = CoachmarkOverlay;
|
173
|
+
function getWindowDimensions() {
|
174
|
+
var _window = window,
|
175
|
+
winWidth = _window.innerWidth,
|
176
|
+
winHeight = _window.innerHeight;
|
177
|
+
return {
|
178
|
+
winWidth: winWidth,
|
179
|
+
winHeight: winHeight
|
180
|
+
};
|
181
|
+
}
|
182
|
+
var useWindowDimensions = function useWindowDimensions() {
|
183
|
+
var _useState3 = (0, _react.useState)(getWindowDimensions()),
|
184
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
185
|
+
windowDimensions = _useState4[0],
|
186
|
+
setWindowDimensions = _useState4[1];
|
187
|
+
(0, _react.useEffect)(function () {
|
188
|
+
function handleResize() {
|
189
|
+
setWindowDimensions(getWindowDimensions());
|
190
|
+
}
|
191
|
+
window.addEventListener('resize', handleResize);
|
192
|
+
return function () {
|
193
|
+
return window.removeEventListener('resize', handleResize);
|
194
|
+
};
|
195
|
+
}, []);
|
196
|
+
return windowDimensions;
|
197
|
+
};
|
100
198
|
|
101
199
|
// Return a placeholder if not released and not enabled by feature flag
|
102
|
-
exports.CoachmarkOverlay = CoachmarkOverlay;
|
103
200
|
exports.CoachmarkOverlay = CoachmarkOverlay = _settings.pkg.checkComponentEnabled(CoachmarkOverlay, componentName);
|
104
201
|
|
105
202
|
// The display name of the component, used by React. Note that displayName
|
@@ -43,14 +43,17 @@ var CoachmarkBeacon = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref
|
|
43
43
|
className: (0, _classnames.default)(blockClass, "".concat(blockClass, "-").concat(kind), className),
|
44
44
|
ref: ref,
|
45
45
|
style: overlayPositionStyle
|
46
|
-
}, (0, _devtools.getDevtoolsProps)(componentName)
|
46
|
+
}, (0, _devtools.getDevtoolsProps)(componentName), {
|
47
|
+
role: "tooltip"
|
48
|
+
}), /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({
|
47
49
|
tabIndex: 0,
|
48
50
|
type: "button"
|
49
51
|
}, coachmark.buttonProps, {
|
50
52
|
"aria-label": label,
|
51
53
|
className: "".concat(blockClass, "__target")
|
52
54
|
}), /*#__PURE__*/_react.default.createElement("svg", {
|
53
|
-
className: "".concat(blockClass, "__center")
|
55
|
+
className: "".concat(blockClass, "__center"),
|
56
|
+
alt: ""
|
54
57
|
}, /*#__PURE__*/_react.default.createElement("circle", {
|
55
58
|
r: 1,
|
56
59
|
cx: 38,
|
@@ -23,7 +23,9 @@ var _excluded = ["children", "className", "onClose", "portalTarget", "tagline",
|
|
23
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
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
25
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
26
|
-
var
|
26
|
+
var coachmarkClass = "".concat(_settings.pkg.prefix, "--coachmark");
|
27
|
+
var blockClass = "".concat(coachmarkClass, "-fixed");
|
28
|
+
var overlayBlockClass = "".concat(coachmarkClass, "-overlay");
|
27
29
|
var componentName = 'CoachmarkFixed';
|
28
30
|
var defaults = {
|
29
31
|
onClose: function onClose() {},
|
@@ -74,9 +76,14 @@ var CoachmarkFixed = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
74
76
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
75
77
|
fixedIsVisible = _useState10[0],
|
76
78
|
setFixedIsVisible = _useState10[1];
|
77
|
-
var
|
78
|
-
|
79
|
-
|
79
|
+
var prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)');
|
80
|
+
var handleClose = (0, _react.useCallback)(function () {
|
81
|
+
if (prefersReducedMotion.matches) {
|
82
|
+
setIsOpen(false);
|
83
|
+
} else {
|
84
|
+
setFixedIsVisible(false);
|
85
|
+
}
|
86
|
+
}, [prefersReducedMotion.matches]);
|
80
87
|
var handleTransitionEnd = function handleTransitionEnd(e) {
|
81
88
|
if (e.propertyName === 'transform' && !fixedIsVisible) {
|
82
89
|
setIsOpen(false);
|
@@ -93,9 +100,21 @@ var CoachmarkFixed = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
93
100
|
setIsOpen(false);
|
94
101
|
setShouldResetPosition(true);
|
95
102
|
};
|
103
|
+
var escFunction = (0, _react.useCallback)(function (event) {
|
104
|
+
if (event.key === 'Escape') {
|
105
|
+
handleClose();
|
106
|
+
}
|
107
|
+
}, [handleClose]);
|
108
|
+
(0, _react.useEffect)(function () {
|
109
|
+
document.addEventListener('keydown', escFunction, false);
|
110
|
+
return function () {
|
111
|
+
document.removeEventListener('keydown', escFunction, false);
|
112
|
+
};
|
113
|
+
}, [escFunction]);
|
96
114
|
var contextValue = {
|
97
115
|
buttonProps: {
|
98
116
|
'aria-expanded': isOpen,
|
117
|
+
tabIndex: 0,
|
99
118
|
onClick: handleTargetClick,
|
100
119
|
// Compensate for accidental open/close on double-click.
|
101
120
|
// Only open on double-click.
|
@@ -150,7 +169,8 @@ var CoachmarkFixed = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
150
169
|
kind: _enums.COACHMARK_OVERLAY_KIND.FIXED,
|
151
170
|
onClose: handleClose,
|
152
171
|
onTransitionEnd: handleTransitionEnd,
|
153
|
-
theme: theme
|
172
|
+
theme: theme,
|
173
|
+
className: (0, _classnames.default)(fixedIsVisible && "".concat(overlayBlockClass, "--is-visible"), overlayBlockClass)
|
154
174
|
}, children), portalNode)));
|
155
175
|
});
|
156
176
|
|
@@ -20,13 +20,14 @@ var _Carousel = require("../Carousel");
|
|
20
20
|
var _SteppedAnimatedMedia = require("../SteppedAnimatedMedia");
|
21
21
|
var _devtools = require("../../global/js/utils/devtools");
|
22
22
|
var _settings = require("../../settings");
|
23
|
-
var _excluded = ["className", "children", "media", "nextButtonText", "previousButtonLabel", "closeButtonLabel"];
|
23
|
+
var _excluded = ["className", "children", "isVisible", "media", "nextButtonText", "previousButtonLabel", "closeButtonLabel"];
|
24
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
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
26
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
27
|
var blockClass = "".concat(_settings.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
|
var CoachmarkOverlayElements = /*#__PURE__*/_react.default.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 @@ var CoachmarkOverlayElements = /*#__PURE__*/_react.default.forwardRef(function (
|
|
56
59
|
var _useState3 = (0, _react.useState)(0),
|
57
60
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
58
61
|
currentProgStep = _useState4[0],
|
59
|
-
|
62
|
+
_setCurrentProgStep = _useState4[1];
|
60
63
|
var coachmark = (0, _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 = _react.Children.count(children);
|
62
73
|
var progStepFloor = 0;
|
63
74
|
var progStepCeil = numProgSteps - 1;
|
@@ -68,6 +79,13 @@ var CoachmarkOverlayElements = /*#__PURE__*/_react.default.forwardRef(function (
|
|
68
79
|
buttonFocusRef.current.focus();
|
69
80
|
}
|
70
81
|
}, []);
|
82
|
+
(0, _react.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.default.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 @@ var CoachmarkOverlayElements = /*#__PURE__*/_react.default.forwardRef(function (
|
|
91
109
|
className: (0, _classnames.default)("".concat(blockClass, "__footer"), 'coachmark-carousel-controls')
|
92
110
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({
|
93
111
|
size: "sm"
|
94
|
-
}, coachmark.closeButtonProps
|
112
|
+
}, coachmark.closeButtonProps, {
|
113
|
+
ref: buttonFocusRef
|
114
|
+
}), closeButtonLabel))) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Carousel.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.default.createElement("div", {
|
98
121
|
className: (0, _classnames.default)("".concat(blockClass, "__footer"))
|
99
122
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
@@ -105,9 +128,7 @@ var CoachmarkOverlayElements = /*#__PURE__*/_react.default.forwardRef(function (
|
|
105
128
|
disabled: scrollPosition === 0,
|
106
129
|
onClick: function onClick() {
|
107
130
|
var targetStep = (0, _lodash.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.default.createElement(_carbonComponentsReact.Button, {
|
@@ -117,9 +138,7 @@ var CoachmarkOverlayElements = /*#__PURE__*/_react.default.forwardRef(function (
|
|
117
138
|
disabled: scrollPosition === 1,
|
118
139
|
onClick: function onClick() {
|
119
140
|
var targetStep = (0, _lodash.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.default.createElement(_carbonComponentsReact.Button, (0, _extends2.default)({
|
@@ -155,6 +174,11 @@ CoachmarkOverlayElements.propTypes = {
|
|
155
174
|
* The label for the Close button.
|
156
175
|
*/
|
157
176
|
closeButtonLabel: _propTypes.default.string,
|
177
|
+
/**
|
178
|
+
* The visibility of CoachmarkOverlayElements is
|
179
|
+
* managed in the parent component.
|
180
|
+
*/
|
181
|
+
isVisible: _propTypes.default.bool,
|
158
182
|
/**
|
159
183
|
* The object describing an image in one of two shapes.
|
160
184
|
* If a single media element is required, use `{render}`.
|
@@ -91,7 +91,18 @@ var CoachmarkStack = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
91
91
|
var handleClickNavItem = function handleClickNavItem(itemNumber) {
|
92
92
|
setSelectedItemNumber(itemNumber);
|
93
93
|
};
|
94
|
-
var
|
94
|
+
var escFunction = (0, _react.useCallback)(function (event) {
|
95
|
+
if (event.key === 'Escape') {
|
96
|
+
selectedItemNumber === 0 ? handleClose(true) : handleClose(false);
|
97
|
+
}
|
98
|
+
}, [handleClose, selectedItemNumber]);
|
99
|
+
(0, _react.useEffect)(function () {
|
100
|
+
document.addEventListener('keydown', escFunction, false);
|
101
|
+
return function () {
|
102
|
+
document.removeEventListener('keydown', escFunction, false);
|
103
|
+
};
|
104
|
+
}, [escFunction]);
|
105
|
+
var handleClose = (0, _react.useCallback)(function (isParentCloseButton) {
|
95
106
|
if (isParentCloseButton) {
|
96
107
|
// Trigger slide-out animation
|
97
108
|
setSelectedItemNumber(-1);
|
@@ -108,9 +119,10 @@ var CoachmarkStack = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
108
119
|
// Unstack child
|
109
120
|
setSelectedItemNumber(0);
|
110
121
|
}
|
111
|
-
};
|
122
|
+
}, [onClose]);
|
112
123
|
var contextValue = {
|
113
124
|
buttonProps: {
|
125
|
+
tabIndex: 0,
|
114
126
|
'aria-expanded': isOpen,
|
115
127
|
onClick: function onClick() {
|
116
128
|
setIsOpen(true);
|
@@ -137,7 +149,7 @@ var CoachmarkStack = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
137
149
|
(0, _react.useEffect)(function () {
|
138
150
|
setTimeout(function () {
|
139
151
|
if (stackHomeRef.current) {
|
140
|
-
setParentHeight(stackHomeRef.current.clientHeight);
|
152
|
+
setParentHeight(stackHomeRef.current.clientHeight + 16);
|
141
153
|
}
|
142
154
|
}, 0);
|
143
155
|
}, [stackHomeRef]);
|
@@ -148,10 +160,12 @@ var CoachmarkStack = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
148
160
|
}
|
149
161
|
stackHomeRef.current.style.height = "".concat(parentHeight, "px");
|
150
162
|
if (!isOpen || targetSelectedItem < 0) {
|
163
|
+
stackHomeRef.current.focus();
|
151
164
|
return;
|
152
165
|
}
|
153
166
|
var targetHomeHeight = stackedCoachmarkRefs.current[targetSelectedItem].clientHeight;
|
154
167
|
stackHomeRef.current.style.height = "".concat(targetHomeHeight, "px");
|
168
|
+
stackedCoachmarkRefs.current[targetSelectedItem].focus();
|
155
169
|
}, [selectedItemNumber, isOpen, parentHeight]);
|
156
170
|
var wrappedChildren = _react.Children.map(childArray, function (child, idx) {
|
157
171
|
var mountedClass = mountedRef.current ? "".concat(elementBlockClass, "--is-mounted") : '';
|
@@ -180,6 +194,7 @@ var CoachmarkStack = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref)
|
|
180
194
|
}), /*#__PURE__*/_react.default.createElement(_CoachmarkStackHome.CoachmarkStackHome, {
|
181
195
|
ref: stackHomeRef,
|
182
196
|
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")),
|
197
|
+
isOpen: isOpen && selectedItemNumber < 1,
|
183
198
|
description: description,
|
184
199
|
media: media,
|
185
200
|
navLinkLabels: navLinkLabels,
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
});
|
8
8
|
exports.CoachmarkStackHome = void 0;
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
12
13
|
var _pconsole = _interopRequireDefault(require("../../global/js/utils/pconsole"));
|
@@ -19,7 +20,7 @@ var _settings = require("../../settings");
|
|
19
20
|
var _reactDom = require("react-dom");
|
20
21
|
var _CoachmarkHeader = require("../Coachmark/CoachmarkHeader");
|
21
22
|
var _SteppedAnimatedMedia = require("../SteppedAnimatedMedia");
|
22
|
-
var _excluded = ["className", "description", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
|
23
|
+
var _excluded = ["className", "description", "isOpen", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
|
23
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); }
|
24
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; }
|
25
26
|
// Carbon and package components we use.
|
@@ -38,14 +39,27 @@ var CoachmarkStackHome = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
38
39
|
var _document$querySelect;
|
39
40
|
var className = _ref.className,
|
40
41
|
description = _ref.description,
|
42
|
+
isOpen = _ref.isOpen,
|
41
43
|
media = _ref.media,
|
42
44
|
navLinkLabels = _ref.navLinkLabels,
|
43
45
|
onClickNavItem = _ref.onClickNavItem,
|
44
|
-
|
46
|
+
_onClose = _ref.onClose,
|
45
47
|
portalTarget = _ref.portalTarget,
|
46
48
|
closeButtonLabel = _ref.closeButtonLabel,
|
47
49
|
title = _ref.title,
|
48
50
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
51
|
+
var buttonFocusRef = (0, _react.useRef)();
|
52
|
+
var _useState = (0, _react.useState)(0),
|
53
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
54
|
+
linkFocusIndex = _useState2[0],
|
55
|
+
setLinkFocusIndex = _useState2[1];
|
56
|
+
(0, _react.useEffect)(function () {
|
57
|
+
setTimeout(function () {
|
58
|
+
if (isOpen && buttonFocusRef.current) {
|
59
|
+
buttonFocusRef.current.focus();
|
60
|
+
}
|
61
|
+
}, 100);
|
62
|
+
}, [isOpen]);
|
49
63
|
if (!navLinkLabels) {
|
50
64
|
return _pconsole.default.warn("".concat(componentName, " is a Novice to Pro internal component and is not intended for general use."));
|
51
65
|
}
|
@@ -55,7 +69,10 @@ var CoachmarkStackHome = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
55
69
|
ref: ref,
|
56
70
|
role: "main"
|
57
71
|
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(_CoachmarkHeader.CoachmarkHeader, {
|
58
|
-
onClose: onClose
|
72
|
+
onClose: function onClose() {
|
73
|
+
setLinkFocusIndex(0);
|
74
|
+
_onClose();
|
75
|
+
}
|
59
76
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
60
77
|
className: "".concat(overlayClass, "__body")
|
61
78
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
@@ -75,21 +92,34 @@ var CoachmarkStackHome = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref
|
|
75
92
|
}, description)), /*#__PURE__*/_react.default.createElement("ul", {
|
76
93
|
className: "".concat(blockClass, "__nav-links")
|
77
94
|
}, navLinkLabels.map(function (label, index) {
|
95
|
+
if (index === linkFocusIndex) {
|
96
|
+
return renderNavLink(index, label, buttonFocusRef);
|
97
|
+
} else {
|
98
|
+
return renderNavLink(index, label);
|
99
|
+
}
|
100
|
+
})), closeButtonLabel && /*#__PURE__*/_react.default.createElement("div", {
|
101
|
+
className: "".concat(overlayClass, "__footer")
|
102
|
+
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
103
|
+
size: "sm",
|
104
|
+
onClick: function onClick() {
|
105
|
+
setLinkFocusIndex(0);
|
106
|
+
_onClose();
|
107
|
+
}
|
108
|
+
}, closeButtonLabel))))), portalNode);
|
109
|
+
function renderNavLink(index, label) {
|
110
|
+
var ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
78
111
|
return /*#__PURE__*/_react.default.createElement("li", {
|
79
112
|
key: index
|
80
113
|
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
81
114
|
kind: "ghost",
|
82
115
|
size: "sm",
|
83
116
|
onClick: function onClick() {
|
117
|
+
setLinkFocusIndex(index);
|
84
118
|
onClickNavItem(index + 1);
|
85
|
-
}
|
119
|
+
},
|
120
|
+
ref: ref
|
86
121
|
}, label));
|
87
|
-
}
|
88
|
-
className: "".concat(overlayClass, "__footer")
|
89
|
-
}, /*#__PURE__*/_react.default.createElement(_carbonComponentsReact.Button, {
|
90
|
-
size: "sm",
|
91
|
-
onClick: onClose
|
92
|
-
}, closeButtonLabel))))), portalNode);
|
122
|
+
}
|
93
123
|
});
|
94
124
|
|
95
125
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -116,6 +146,10 @@ CoachmarkStackHome.propTypes = {
|
|
116
146
|
* The description of the Coachmark.
|
117
147
|
*/
|
118
148
|
description: _propTypes.default.node.isRequired,
|
149
|
+
/**
|
150
|
+
* If the stack home is open.
|
151
|
+
*/
|
152
|
+
isOpen: _propTypes.default.bool.isRequired,
|
119
153
|
/**
|
120
154
|
* The object describing an image in one of two shapes.
|
121
155
|
*
|
@@ -41,7 +41,7 @@ var TableContainer = _carbonComponentsReact.DataTable.TableContainer,
|
|
41
41
|
Table = _carbonComponentsReact.DataTable.Table;
|
42
42
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
43
43
|
var DatagridContent = function DatagridContent(_ref) {
|
44
|
-
var
|
44
|
+
var _cx5;
|
45
45
|
var datagridState = _ref.datagridState,
|
46
46
|
title = _ref.title;
|
47
47
|
var _useContext = (0, _react.useContext)(_InlineEditContext.InlineEditContext),
|
@@ -54,8 +54,7 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
54
54
|
var activeCellId = inlineEditState.activeCellId,
|
55
55
|
gridActive = inlineEditState.gridActive,
|
56
56
|
editId = inlineEditState.editId;
|
57
|
-
var
|
58
|
-
getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
|
57
|
+
var getTableProps = datagridState.getTableProps,
|
59
58
|
getFilterFlyoutProps = datagridState.getFilterFlyoutProps,
|
60
59
|
withVirtualScroll = datagridState.withVirtualScroll,
|
61
60
|
DatagridPagination = datagridState.DatagridPagination,
|
@@ -78,6 +77,7 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
78
77
|
state = datagridState.state,
|
79
78
|
page = datagridState.page,
|
80
79
|
rows = datagridState.rows;
|
80
|
+
var columnResizing = state.columnResizing;
|
81
81
|
var contentRows = DatagridPagination && page || rows;
|
82
82
|
var gridAreaRef = (0, _react.useRef)();
|
83
83
|
var multiKeyTrackingRef = (0, _react.useRef)();
|
@@ -99,10 +99,11 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
99
99
|
var renderTable = function renderTable() {
|
100
100
|
var _getTableProps;
|
101
101
|
return /*#__PURE__*/_react.default.createElement(Table, (0, _extends2.default)({}, getTableProps(), {
|
102
|
-
className: (0, _classnames.default)(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-grid-active"), gridActive), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
|
102
|
+
className: (0, _classnames.default)(withVirtualScroll ? '' : "".concat(blockClass, "__table-simple"), "".concat(blockClass, "__vertical-align-").concat(verticalAlign), (0, _defineProperty2.default)({}, "".concat(blockClass, "__variable-row-height"), variableRowHeight), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-with-inline-edit"), withInlineEdit), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-grid-active"), gridActive), (0, _defineProperty2.default)({}, "".concat(blockClass, "__table-is-resizing"), typeof columnResizing.isResizingColumn === 'string'), (_getTableProps = getTableProps()) === null || _getTableProps === void 0 ? void 0 : _getTableProps.className),
|
103
103
|
role: withInlineEdit && 'grid',
|
104
104
|
tabIndex: withInlineEdit && 0,
|
105
|
-
onKeyDown:
|
105
|
+
onKeyDown: /* istanbul ignore next */
|
106
|
+
withInlineEdit && function (event) {
|
106
107
|
return (0, _handleGridKeyPress.handleGridKeyPress)({
|
107
108
|
event: event,
|
108
109
|
dispatch: dispatch,
|
@@ -111,10 +112,10 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
111
112
|
state: inlineEditState,
|
112
113
|
usingMac: usingMac
|
113
114
|
});
|
114
|
-
}
|
115
|
-
onFocus: withInlineEdit
|
115
|
+
},
|
116
|
+
onFocus: withInlineEdit && function () {
|
116
117
|
return (0, _handleGridFocus.handleGridFocus)(inlineEditState, dispatch);
|
117
|
-
}
|
118
|
+
},
|
118
119
|
title: title
|
119
120
|
}), !withVirtualScroll && /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
|
120
121
|
rows: contentRows
|
@@ -143,6 +144,8 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
143
144
|
(0, _hooks3.useSubscribeToEventEmitter)(_constants.CLEAR_SINGLE_FILTER, function (id) {
|
144
145
|
return (0, _FilterProvider.clearSingleFilter)(id, setAllFilters, state);
|
145
146
|
});
|
147
|
+
|
148
|
+
/* istanbul ignore next */
|
146
149
|
var renderFilterSummary = function renderFilterSummary() {
|
147
150
|
return state.filters.length > 0 && /*#__PURE__*/_react.default.createElement(_FilterSummary.FilterSummary, {
|
148
151
|
className: "".concat(blockClass, "__filter-summary"),
|
@@ -155,7 +158,7 @@ var DatagridContent = function DatagridContent(_ref) {
|
|
155
158
|
});
|
156
159
|
};
|
157
160
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(TableContainer, {
|
158
|
-
className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : '', (
|
161
|
+
className: (0, _classnames.default)("".concat(blockClass, "__grid-container"), withVirtualScroll || fullHeightDatagrid ? "".concat(blockClass, "__full-height") : '', DatagridPagination ? "".concat(blockClass, "__with-pagination") : '', useDenseHeader ? "".concat(blockClass, "__dense-header") : '', (_cx5 = {}, (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__grid-container-grid-active"), gridActive), (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__grid-container-inline-edit"), withInlineEdit), (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__grid-container-grid-active--without-toolbar"), withInlineEdit && !DatagridActions), _cx5)),
|
159
162
|
title: gridTitle,
|
160
163
|
description: gridDescription
|
161
164
|
}, /*#__PURE__*/_react.default.createElement(_DatagridToolbar.default, datagridState), /*#__PURE__*/_react.default.createElement("div", {
|
@@ -20,10 +20,10 @@ var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
|
20
20
|
var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentComponent) {
|
21
21
|
return function (datagridState) {
|
22
22
|
var row = datagridState.row;
|
23
|
-
var
|
24
|
-
expandedContentHeight = _ref.expandedContentHeight;
|
23
|
+
var expandedContentHeight = row.expandedContentHeight;
|
25
24
|
var toggleParentHoverClass = function toggleParentHoverClass(event, eventType) {
|
26
25
|
var _event$target, _event$target$parentN;
|
26
|
+
/* istanbul ignore else */
|
27
27
|
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) {
|
28
28
|
var parentNode = event.target.parentNode.previousElementSibling;
|
29
29
|
if (eventType === 'enter') {
|
@@ -41,12 +41,14 @@ var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentCompone
|
|
41
41
|
onMouseLeave: function onMouseLeave(event) {
|
42
42
|
return toggleParentHoverClass(event);
|
43
43
|
}
|
44
|
+
}, /*#__PURE__*/_react.default.createElement("td", {
|
45
|
+
className: "".concat(blockClass, "__expanded-row-cell-wrapper")
|
44
46
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
45
47
|
className: "".concat(blockClass, "__expanded-row-content"),
|
46
48
|
style: {
|
47
|
-
height: expandedContentHeight
|
49
|
+
height: expandedContentHeight && expandedContentHeight
|
48
50
|
}
|
49
|
-
}, ExpandedRowContentComponent
|
51
|
+
}, /*#__PURE__*/_react.default.createElement(ExpandedRowContentComponent, datagridState))));
|
50
52
|
};
|
51
53
|
};
|
52
54
|
var _default = DatagridExpandedRow;
|