@carbon/ibm-products 2.22.0 → 2.24.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -1
- package/css/index-full-carbon.css +29490 -28295
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +81 -104
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +24399 -350
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +17204 -123
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/Card/Card.js +1 -2
- package/es/components/Card/CardHeader.js +2 -2
- package/es/components/Carousel/Carousel.js +5 -3
- package/es/components/Coachmark/Coachmark.js +255 -0
- package/es/components/Coachmark/CoachmarkDragbar.js +146 -0
- package/es/components/Coachmark/CoachmarkHeader.js +91 -0
- package/es/components/Coachmark/CoachmarkOverlay.js +235 -0
- package/es/components/Coachmark/CoachmarkTagline.js +97 -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 +93 -0
- package/es/components/CoachmarkBeacon/index.js +8 -0
- package/es/components/CoachmarkButton/CoachmarkButton.js +90 -0
- package/es/components/CoachmarkButton/index.js +8 -0
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +226 -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 +216 -0
- package/es/components/CoachmarkOverlayElements/index.js +8 -0
- package/es/components/CoachmarkStack/CoachmarkStack.js +283 -0
- package/es/components/CoachmarkStack/CoachmarkStackHome.js +192 -0
- package/es/components/CoachmarkStack/index.js +8 -0
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +14 -4
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -1
- package/es/components/Datagrid/Datagrid/DraggableElement.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
- package/es/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.js +26 -0
- package/es/components/Datagrid/Datagrid.docs-page.js +2 -2
- package/es/components/Datagrid/useActionsColumn.js +16 -12
- package/es/components/Datagrid/useDefaultStringRenderer.js +3 -3
- package/es/components/Datagrid/useNestedRowExpander.js +2 -2
- package/es/components/Datagrid/useSortableColumns.js +15 -5
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +7 -2
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +7 -2
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +7 -2
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +7 -2
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +7 -2
- package/es/components/EmptyStates/assets/ErrorIllustration.js +5 -5
- package/es/components/EmptyStates/assets/NoDataIllustration.js +5 -5
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +5 -5
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +5 -5
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +5 -5
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -5
- package/es/components/FilterSummary/FilterSummary.js +100 -19
- package/es/components/InterstitialScreen/InterstitialScreen.js +427 -0
- package/es/components/InterstitialScreen/index.js +8 -0
- package/es/components/InterstitialScreenView/InterstitialScreenView.js +75 -0
- package/es/components/InterstitialScreenView/index.js +8 -0
- package/es/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +83 -0
- package/es/components/InterstitialScreenViewModule/index.js +8 -0
- package/es/components/PageHeader/PageHeaderUtils.js +2 -2
- package/es/components/SearchBar/SearchBar.js +227 -0
- package/es/components/SearchBar/index.js +8 -0
- package/es/components/TagSet/TagSet.js +11 -3
- package/es/components/index.js +12 -1
- package/es/global/js/hooks/useResizeObserver.js +2 -2
- package/es/global/js/package-settings.js +14 -0
- package/lib/components/Card/Card.js +3 -4
- package/lib/components/Card/CardHeader.js +2 -2
- package/lib/components/Carousel/Carousel.js +5 -3
- package/lib/components/Coachmark/Coachmark.js +264 -0
- package/lib/components/Coachmark/CoachmarkDragbar.js +151 -0
- package/lib/components/Coachmark/CoachmarkHeader.js +95 -0
- package/lib/components/Coachmark/CoachmarkOverlay.js +243 -0
- package/lib/components/Coachmark/CoachmarkTagline.js +101 -0
- package/lib/components/Coachmark/index.js +38 -0
- package/lib/components/Coachmark/utils/constants.js +81 -0
- package/lib/components/Coachmark/utils/context.js +11 -0
- package/lib/components/Coachmark/utils/enums.js +46 -0
- package/lib/components/Coachmark/utils/helpers.js +17 -0
- package/lib/components/Coachmark/utils/hooks.js +59 -0
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +97 -0
- package/lib/components/CoachmarkBeacon/index.js +12 -0
- package/lib/components/CoachmarkButton/CoachmarkButton.js +93 -0
- package/lib/components/CoachmarkButton/index.js +12 -0
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +232 -0
- package/lib/components/CoachmarkFixed/index.js +12 -0
- package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +90 -0
- package/lib/components/CoachmarkOverlayElement/index.js +12 -0
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +222 -0
- package/lib/components/CoachmarkOverlayElements/index.js +12 -0
- package/lib/components/CoachmarkStack/CoachmarkStack.js +288 -0
- package/lib/components/CoachmarkStack/CoachmarkStackHome.js +198 -0
- package/lib/components/CoachmarkStack/index.js +12 -0
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +14 -4
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -1
- package/lib/components/Datagrid/Datagrid/DraggableElement.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/ButtonWrapper.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.js +4 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js +1 -1
- package/lib/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.js +36 -0
- package/lib/components/Datagrid/Datagrid.docs-page.js +2 -2
- package/lib/components/Datagrid/useActionsColumn.js +15 -11
- package/lib/components/Datagrid/useDefaultStringRenderer.js +3 -3
- package/lib/components/Datagrid/useNestedRowExpander.js +2 -2
- package/lib/components/Datagrid/useSortableColumns.js +15 -5
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +7 -2
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +8 -3
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +7 -2
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +7 -2
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +7 -2
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +7 -2
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +5 -5
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +5 -5
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +5 -5
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +5 -5
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +5 -5
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -5
- package/lib/components/FilterSummary/FilterSummary.js +103 -23
- package/lib/components/InterstitialScreen/InterstitialScreen.js +434 -0
- package/lib/components/InterstitialScreen/index.js +12 -0
- package/lib/components/InterstitialScreenView/InterstitialScreenView.js +77 -0
- package/lib/components/InterstitialScreenView/index.js +12 -0
- package/lib/components/InterstitialScreenViewModule/InterstitialScreenViewModule.js +85 -0
- package/lib/components/InterstitialScreenViewModule/index.js +12 -0
- package/lib/components/PageHeader/PageHeaderUtils.js +2 -2
- package/lib/components/SearchBar/SearchBar.js +233 -0
- package/lib/components/SearchBar/index.js +12 -0
- package/lib/components/TagSet/TagSet.js +11 -3
- package/lib/components/index.js +78 -1
- package/lib/global/js/hooks/useResizeObserver.js +2 -2
- package/lib/global/js/package-settings.js +14 -0
- package/package.json +5 -5
- package/scss/components/Card/_card.scss +6 -5
- package/scss/components/Coachmark/_carbon-imports.scss +10 -0
- package/scss/components/Coachmark/_coachmark-dragbar.scss +27 -0
- package/scss/components/Coachmark/_coachmark-header.scss +20 -0
- package/scss/components/Coachmark/_coachmark-overlay.scss +431 -0
- package/scss/components/Coachmark/_coachmark-tagline.scss +140 -0
- package/scss/components/Coachmark/_coachmark.scss +30 -0
- package/scss/components/Coachmark/_index-with-carbon.scss +9 -0
- package/scss/components/Coachmark/_index.scss +8 -0
- package/scss/components/CoachmarkBeacon/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkBeacon/_coachmark-beacon.scss +166 -0
- package/scss/components/CoachmarkBeacon/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkBeacon/_index.scss +8 -0
- package/scss/components/CoachmarkButton/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkButton/_coachmark-button.scss +25 -0
- package/scss/components/CoachmarkButton/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkButton/_index.scss +8 -0
- package/scss/components/CoachmarkFixed/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkFixed/_coachmark-fixed.scss +25 -0
- package/scss/components/CoachmarkFixed/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkFixed/_index.scss +8 -0
- package/scss/components/CoachmarkOverlayElement/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkOverlayElement/_coachmark-overlay-element.scss +52 -0
- package/scss/components/CoachmarkOverlayElement/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkOverlayElement/_index.scss +8 -0
- package/scss/components/CoachmarkOverlayElements/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +47 -0
- package/scss/components/CoachmarkOverlayElements/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkOverlayElements/_index.scss +8 -0
- package/scss/components/CoachmarkStack/_carbon-imports.scss +9 -0
- package/scss/components/CoachmarkStack/_coachmark-stack.scss +95 -0
- package/scss/components/CoachmarkStack/_index-with-carbon.scss +9 -0
- package/scss/components/CoachmarkStack/_index.scss +8 -0
- package/scss/components/CreateSidePanel/_create-side-panel.scss +1 -38
- package/scss/components/Datagrid/styles/_datagrid.scss +15 -0
- package/scss/components/EditSidePanel/_edit-side-panel.scss +0 -18
- package/scss/components/FilterSummary/_filter-summary.scss +22 -1
- package/scss/components/InterstitialScreen/_carbon-imports.scss +9 -0
- package/scss/components/InterstitialScreen/_index-with-carbon.scss +9 -0
- package/scss/components/InterstitialScreen/_index.scss +8 -0
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +276 -0
- package/scss/components/InterstitialScreenView/_carbon-imports.scss +9 -0
- package/scss/components/InterstitialScreenView/_index-with-carbon.scss +9 -0
- package/scss/components/InterstitialScreenView/_index.scss +8 -0
- package/scss/components/InterstitialScreenView/_interstitial-screen-view.scss +25 -0
- package/scss/components/InterstitialScreenViewModule/_carbon-imports.scss +9 -0
- package/scss/components/InterstitialScreenViewModule/_index-with-carbon.scss +9 -0
- package/scss/components/InterstitialScreenViewModule/_index.scss +8 -0
- package/scss/components/InterstitialScreenViewModule/_interstitial-screen-view-module.scss +59 -0
- package/scss/components/PageHeader/_page-header.scss +0 -1
- package/scss/components/SearchBar/_carbon-imports.scss +9 -0
- package/scss/components/SearchBar/_index-with-carbon.scss +9 -0
- package/scss/components/SearchBar/_index.scss +8 -0
- package/scss/components/SearchBar/_search-bar.scss +26 -0
- package/scss/components/SidePanel/_side-panel.scss +12 -7
- package/scss/components/_index-with-carbon.scss +11 -0
- package/scss/components/_index.scss +11 -0
@@ -0,0 +1,283 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
+
var _excluded = ["children", "className", "onClose", "description", "media", "navLinkLabels", "portalTarget", "closeButtonLabel", "tagline", "theme", "title"];
|
5
|
+
/**
|
6
|
+
* Copyright IBM Corp. 2023, 2024
|
7
|
+
*
|
8
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
10
|
+
*/
|
11
|
+
|
12
|
+
// Import portions of React that are needed.
|
13
|
+
import React, { Children, useEffect, useRef, useState, useCallback } from 'react';
|
14
|
+
import { createPortal } from 'react-dom';
|
15
|
+
|
16
|
+
// Other standard imports.
|
17
|
+
import PropTypes from 'prop-types';
|
18
|
+
import cx from 'classnames';
|
19
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
20
|
+
import { pkg /*, carbon */ } from '../../settings';
|
21
|
+
|
22
|
+
// Carbon and package components we use.
|
23
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
24
|
+
|
25
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
26
|
+
var blockClass = "".concat(pkg.prefix, "--coachmark-stack");
|
27
|
+
var componentName = 'CoachmarkStack';
|
28
|
+
var elementBlockClass = "".concat(pkg.prefix, "--coachmark-stack-element");
|
29
|
+
import { CoachmarkOverlay } from '../Coachmark/CoachmarkOverlay';
|
30
|
+
import { CoachmarkStackHome } from './CoachmarkStackHome';
|
31
|
+
import { CoachmarkTagline } from '../Coachmark/CoachmarkTagline';
|
32
|
+
import { CoachmarkContext } from '../Coachmark/utils/context';
|
33
|
+
import { COACHMARK_OVERLAY_KIND } from '../Coachmark/utils/enums';
|
34
|
+
var defaults = {
|
35
|
+
onClose: function onClose() {},
|
36
|
+
// Pass through to CoachmarkStackHome
|
37
|
+
theme: 'light'
|
38
|
+
};
|
39
|
+
|
40
|
+
// NOTE
|
41
|
+
// The stack is limited to a depth of two Coachmarks:
|
42
|
+
// - a single parent CoachmarkStackHome
|
43
|
+
// - a single child Coachmark when stacked
|
44
|
+
// The parent will include links to all the children.
|
45
|
+
// No child Coachmark will include links to any other child Coachmarks.
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Stacked coachmarks are used to call out specific functionality or concepts
|
49
|
+
* within the UI that may not be intuitive but are important for the
|
50
|
+
* user to gain understanding of the product's main value and discover new use cases.
|
51
|
+
* This variant allows the stacking of multiple coachmark overlays to be displayed by interacting with the tagline.
|
52
|
+
*/
|
53
|
+
export var CoachmarkStack = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
54
|
+
var _document$querySelect;
|
55
|
+
var children = _ref.children,
|
56
|
+
className = _ref.className,
|
57
|
+
_ref$onClose = _ref.onClose,
|
58
|
+
onClose = _ref$onClose === void 0 ? defaults.onClose : _ref$onClose,
|
59
|
+
description = _ref.description,
|
60
|
+
media = _ref.media,
|
61
|
+
navLinkLabels = _ref.navLinkLabels,
|
62
|
+
_ref$portalTarget = _ref.portalTarget,
|
63
|
+
portalTarget = _ref$portalTarget === void 0 ? defaults.portalTarget : _ref$portalTarget,
|
64
|
+
closeButtonLabel = _ref.closeButtonLabel,
|
65
|
+
tagline = _ref.tagline,
|
66
|
+
_ref$theme = _ref.theme,
|
67
|
+
theme = _ref$theme === void 0 ? defaults.theme : _ref$theme,
|
68
|
+
title = _ref.title,
|
69
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
70
|
+
var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
|
71
|
+
var stackHomeRef = useRef();
|
72
|
+
var stackedCoachmarkRefs = useRef([]);
|
73
|
+
var _useState = useState(false),
|
74
|
+
_useState2 = _slicedToArray(_useState, 2),
|
75
|
+
isOpen = _useState2[0],
|
76
|
+
setIsOpen = _useState2[1];
|
77
|
+
// selectedItemNumber -1 = parent close button was clicked, remove entire stack
|
78
|
+
// selectedItemNumber 0 = (default) the parent is visible, all children are hidden
|
79
|
+
// selectedItemNumber 1+ = a child is visible and stacked atop the parent
|
80
|
+
var _useState3 = useState(0),
|
81
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
82
|
+
selectedItemNumber = _useState4[0],
|
83
|
+
setSelectedItemNumber = _useState4[1];
|
84
|
+
// // The parent height and width values to return to after unstacked
|
85
|
+
var _useState5 = useState(null),
|
86
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
87
|
+
parentHeight = _useState6[0],
|
88
|
+
setParentHeight = _useState6[1];
|
89
|
+
// parent height = child height when stacked behind a child that is shorter
|
90
|
+
var childArray = Children.toArray(children);
|
91
|
+
var mountedRef = useRef();
|
92
|
+
// same value as CSS animation speed
|
93
|
+
var delayMs = 240;
|
94
|
+
|
95
|
+
// Unmount or unstack a child
|
96
|
+
var handleClickNavItem = function handleClickNavItem(itemNumber) {
|
97
|
+
setSelectedItemNumber(itemNumber);
|
98
|
+
};
|
99
|
+
var handleClose = useCallback(function (isParentCloseButton) {
|
100
|
+
if (isParentCloseButton) {
|
101
|
+
// Trigger slide-out animation
|
102
|
+
setSelectedItemNumber(-1);
|
103
|
+
|
104
|
+
// Unmount after animation is complete
|
105
|
+
var timer = setTimeout(function () {
|
106
|
+
setIsOpen(false);
|
107
|
+
onClose();
|
108
|
+
}, delayMs);
|
109
|
+
return function () {
|
110
|
+
return clearTimeout(timer);
|
111
|
+
};
|
112
|
+
} else {
|
113
|
+
// Unstack child
|
114
|
+
setSelectedItemNumber(0);
|
115
|
+
}
|
116
|
+
}, [onClose]);
|
117
|
+
var escFunction = useCallback(function (event) {
|
118
|
+
if (event.key === 'Escape') {
|
119
|
+
selectedItemNumber === 0 ? handleClose(true) : handleClose(false);
|
120
|
+
}
|
121
|
+
}, [handleClose, selectedItemNumber]);
|
122
|
+
useEffect(function () {
|
123
|
+
document.addEventListener('keydown', escFunction, false);
|
124
|
+
return function () {
|
125
|
+
document.removeEventListener('keydown', escFunction, false);
|
126
|
+
};
|
127
|
+
}, [escFunction]);
|
128
|
+
var contextValue = {
|
129
|
+
buttonProps: {
|
130
|
+
tabIndex: 0,
|
131
|
+
'aria-expanded': isOpen,
|
132
|
+
onClick: function onClick() {
|
133
|
+
setIsOpen(true);
|
134
|
+
},
|
135
|
+
// Compensate for accidental open/close on double-click.
|
136
|
+
// Only open on double-click.
|
137
|
+
onDoubleClick: function onDoubleClick() {
|
138
|
+
setIsOpen(true);
|
139
|
+
}
|
140
|
+
},
|
141
|
+
closeButtonProps: {
|
142
|
+
onClick: function onClick() {
|
143
|
+
return handleClose(false);
|
144
|
+
}
|
145
|
+
},
|
146
|
+
isOpen: isOpen
|
147
|
+
};
|
148
|
+
useEffect(function () {
|
149
|
+
mountedRef.current = true;
|
150
|
+
return function () {
|
151
|
+
mountedRef.current = false;
|
152
|
+
};
|
153
|
+
}, []);
|
154
|
+
useEffect(function () {
|
155
|
+
setTimeout(function () {
|
156
|
+
if (stackHomeRef.current) {
|
157
|
+
setParentHeight(stackHomeRef.current.clientHeight + 16);
|
158
|
+
}
|
159
|
+
}, 0);
|
160
|
+
}, [stackHomeRef]);
|
161
|
+
useEffect(function () {
|
162
|
+
var targetSelectedItem = selectedItemNumber - 1;
|
163
|
+
if (!parentHeight) {
|
164
|
+
return;
|
165
|
+
}
|
166
|
+
stackHomeRef.current.style.height = "".concat(parentHeight, "px");
|
167
|
+
if (!isOpen || targetSelectedItem < 0) {
|
168
|
+
stackHomeRef.current.focus();
|
169
|
+
return;
|
170
|
+
}
|
171
|
+
var targetHomeHeight = stackedCoachmarkRefs.current[targetSelectedItem].clientHeight;
|
172
|
+
stackHomeRef.current.style.height = "".concat(targetHomeHeight, "px");
|
173
|
+
stackedCoachmarkRefs.current[targetSelectedItem].focus();
|
174
|
+
}, [selectedItemNumber, isOpen, parentHeight]);
|
175
|
+
var wrappedChildren = Children.map(childArray, function (child, idx) {
|
176
|
+
var mountedClass = mountedRef.current ? "".concat(elementBlockClass, "--is-mounted") : '';
|
177
|
+
return /*#__PURE__*/React.createElement(CoachmarkOverlay, {
|
178
|
+
key: idx,
|
179
|
+
ref: function ref(_ref2) {
|
180
|
+
return stackedCoachmarkRefs.current[idx] = _ref2;
|
181
|
+
},
|
182
|
+
kind: COACHMARK_OVERLAY_KIND.STACKED,
|
183
|
+
onClose: function onClose() {
|
184
|
+
return handleClose(false);
|
185
|
+
},
|
186
|
+
theme: theme,
|
187
|
+
fixedIsVisible: false,
|
188
|
+
className: cx(elementBlockClass, mountedClass, idx === selectedItemNumber - 1 && "".concat(elementBlockClass, "--is-visible"), mountedRef.current && "".concat(elementBlockClass, "--is-mounted"))
|
189
|
+
}, child);
|
190
|
+
});
|
191
|
+
return /*#__PURE__*/React.createElement(CoachmarkContext.Provider, {
|
192
|
+
value: contextValue
|
193
|
+
}, /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
194
|
+
className: cx(blockClass, "".concat(pkg.prefix, "--coachmark-overlay--stack"), className),
|
195
|
+
ref: ref
|
196
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(CoachmarkTagline, {
|
197
|
+
title: tagline,
|
198
|
+
onClose: onClose
|
199
|
+
}), /*#__PURE__*/React.createElement(CoachmarkStackHome, {
|
200
|
+
ref: stackHomeRef,
|
201
|
+
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")),
|
202
|
+
isOpen: isOpen && selectedItemNumber < 1,
|
203
|
+
description: description,
|
204
|
+
media: media,
|
205
|
+
navLinkLabels: navLinkLabels,
|
206
|
+
onClickNavItem: handleClickNavItem,
|
207
|
+
onClose: function onClose() {
|
208
|
+
handleClose(true);
|
209
|
+
},
|
210
|
+
portalTarget: portalTarget,
|
211
|
+
closeButtonLabel: closeButtonLabel,
|
212
|
+
title: title
|
213
|
+
}), /*#__PURE__*/createPortal(wrappedChildren, portalNode)));
|
214
|
+
});
|
215
|
+
|
216
|
+
// Return a placeholder if not released and not enabled by feature flag
|
217
|
+
CoachmarkStack = pkg.checkComponentEnabled(CoachmarkStack, componentName);
|
218
|
+
|
219
|
+
// The display name of the component, used by React. Note that displayName
|
220
|
+
// is used in preference to relying on function.name.
|
221
|
+
CoachmarkStack.displayName = componentName;
|
222
|
+
|
223
|
+
// The types and DocGen commentary for the component props,
|
224
|
+
// in alphabetical order (for consistency).
|
225
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
226
|
+
CoachmarkStack.propTypes = {
|
227
|
+
/**
|
228
|
+
* CoachmarkStack should use a single CoachmarkOverlayElements component as a child.
|
229
|
+
*/
|
230
|
+
children: PropTypes.node.isRequired,
|
231
|
+
/**
|
232
|
+
* Provide an optional class to be applied to the containing node.
|
233
|
+
*/
|
234
|
+
className: PropTypes.string,
|
235
|
+
/**
|
236
|
+
* The label for the button that will close the Stack
|
237
|
+
*/
|
238
|
+
closeButtonLabel: PropTypes.string,
|
239
|
+
// Pass through to CoachmarkStackHome
|
240
|
+
/**
|
241
|
+
* The description of the Coachmark.
|
242
|
+
*/
|
243
|
+
description: PropTypes.node.isRequired,
|
244
|
+
/**
|
245
|
+
* The object describing an image in one of two shapes.
|
246
|
+
*
|
247
|
+
* If a single media element is required, use `{render}`.
|
248
|
+
*
|
249
|
+
* If a stepped animation is required, use `{filePaths}`.
|
250
|
+
*
|
251
|
+
* @see {@link MEDIA_PROP_TYPE}.
|
252
|
+
*/
|
253
|
+
media: PropTypes.oneOfType([PropTypes.shape({
|
254
|
+
render: PropTypes.func
|
255
|
+
}), PropTypes.shape({
|
256
|
+
filePaths: PropTypes.arrayOf(PropTypes.string)
|
257
|
+
})]),
|
258
|
+
/**
|
259
|
+
* The labels used to link to the stackable Coachmarks.
|
260
|
+
*/
|
261
|
+
navLinkLabels: PropTypes.arrayOf(PropTypes.string).isRequired,
|
262
|
+
/**
|
263
|
+
* Function to call when the CoachmarkStack closes.
|
264
|
+
*/
|
265
|
+
onClose: PropTypes.func,
|
266
|
+
/**
|
267
|
+
* Where in the DOM to render the stack.
|
268
|
+
* The default is `document.body`.
|
269
|
+
*/
|
270
|
+
portalTarget: PropTypes.string,
|
271
|
+
/**
|
272
|
+
* The tagline title which will be fixed to the bottom right of the window and will serve as the display trigger.
|
273
|
+
*/
|
274
|
+
tagline: PropTypes.string.isRequired,
|
275
|
+
/**
|
276
|
+
* Determines the theme of the component.
|
277
|
+
*/
|
278
|
+
theme: PropTypes.oneOf(['light', 'dark']),
|
279
|
+
/**
|
280
|
+
* The title of the Coachmark.
|
281
|
+
*/
|
282
|
+
title: PropTypes.string.isRequired
|
283
|
+
};
|
@@ -0,0 +1,192 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
4
|
+
var _excluded = ["className", "description", "isOpen", "media", "navLinkLabels", "onClickNavItem", "onClose", "portalTarget", "closeButtonLabel", "title"];
|
5
|
+
/**
|
6
|
+
* Copyright IBM Corp. 2023, 2024
|
7
|
+
*
|
8
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
9
|
+
* LICENSE file in the root directory of this source tree.
|
10
|
+
*/
|
11
|
+
|
12
|
+
import React, { forwardRef, useRef, useEffect, useState } from 'react';
|
13
|
+
import pconsole from '../../global/js/utils/pconsole';
|
14
|
+
import PropTypes from 'prop-types';
|
15
|
+
import cx from 'classnames';
|
16
|
+
import { Idea } from '@carbon/icons-react';
|
17
|
+
import { Button } from '@carbon/react';
|
18
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
19
|
+
import { pkg /*, carbon */ } from '../../settings';
|
20
|
+
import { createPortal } from 'react-dom';
|
21
|
+
import { CoachmarkHeader } from '../Coachmark/CoachmarkHeader';
|
22
|
+
import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia';
|
23
|
+
|
24
|
+
// Carbon and package components we use.
|
25
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
26
|
+
|
27
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
28
|
+
var blockClass = "".concat(pkg.prefix, "--coachmark-stacked-home");
|
29
|
+
var overlayClass = "".concat(pkg.prefix, "--coachmark-overlay");
|
30
|
+
var componentName = 'CoachmarkStackHome';
|
31
|
+
|
32
|
+
/**
|
33
|
+
* DO NOT USE. This component is for the exclusive use
|
34
|
+
* of other Novice to Pro components.
|
35
|
+
*/
|
36
|
+
export var CoachmarkStackHome = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
37
|
+
var _document$querySelect;
|
38
|
+
var className = _ref.className,
|
39
|
+
description = _ref.description,
|
40
|
+
isOpen = _ref.isOpen,
|
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 = _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]);
|
61
|
+
if (!navLinkLabels) {
|
62
|
+
return pconsole.warn("".concat(componentName, " is a Novice to Pro internal component and is not intended for general use."));
|
63
|
+
}
|
64
|
+
var portalNode = portalTarget ? (_document$querySelect = document.querySelector(portalTarget)) !== null && _document$querySelect !== void 0 ? _document$querySelect : document.querySelector('body') : document.querySelector('body');
|
65
|
+
return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
66
|
+
className: cx(blockClass, className),
|
67
|
+
ref: ref,
|
68
|
+
role: "main"
|
69
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(CoachmarkHeader, {
|
70
|
+
onClose: function onClose() {
|
71
|
+
setLinkFocusIndex(0);
|
72
|
+
_onClose();
|
73
|
+
}
|
74
|
+
}), /*#__PURE__*/React.createElement("div", {
|
75
|
+
className: "".concat(overlayClass, "__body")
|
76
|
+
}, /*#__PURE__*/React.createElement("div", {
|
77
|
+
className: "".concat(overlayClass, "-element")
|
78
|
+
}, !media && /*#__PURE__*/React.createElement(Idea, {
|
79
|
+
size: 20,
|
80
|
+
className: "".concat(blockClass, "__icon-idea")
|
81
|
+
}), media && (media.render ? media.render() : /*#__PURE__*/React.createElement(SteppedAnimatedMedia, {
|
82
|
+
className: "".concat(overlayClass, "__element-stepped-media"),
|
83
|
+
filePaths: media.filePaths,
|
84
|
+
playStep: 0
|
85
|
+
})), /*#__PURE__*/React.createElement("div", {
|
86
|
+
className: "".concat(overlayClass, "-element__content")
|
87
|
+
}, title && /*#__PURE__*/React.createElement("h2", {
|
88
|
+
className: "".concat(overlayClass, "-element__title")
|
89
|
+
}, title), description && /*#__PURE__*/React.createElement("p", {
|
90
|
+
className: "".concat(overlayClass, "-element__body")
|
91
|
+
}, description)), /*#__PURE__*/React.createElement("ul", {
|
92
|
+
className: "".concat(blockClass, "__nav-links")
|
93
|
+
}, navLinkLabels.map(function (label, index) {
|
94
|
+
if (index === linkFocusIndex) {
|
95
|
+
return renderNavLink(index, label, buttonFocusRef);
|
96
|
+
} else {
|
97
|
+
return renderNavLink(index, label);
|
98
|
+
}
|
99
|
+
})), closeButtonLabel && /*#__PURE__*/React.createElement("div", {
|
100
|
+
className: "".concat(overlayClass, "__footer")
|
101
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
102
|
+
size: "sm",
|
103
|
+
onClick: function onClick() {
|
104
|
+
setLinkFocusIndex(0);
|
105
|
+
_onClose();
|
106
|
+
}
|
107
|
+
}, closeButtonLabel))))), portalNode);
|
108
|
+
function renderNavLink(index, label) {
|
109
|
+
var ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
110
|
+
return /*#__PURE__*/React.createElement("li", {
|
111
|
+
key: index
|
112
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
113
|
+
kind: "ghost",
|
114
|
+
size: "sm",
|
115
|
+
onClick: function onClick() {
|
116
|
+
setLinkFocusIndex(index);
|
117
|
+
onClickNavItem(index + 1);
|
118
|
+
},
|
119
|
+
ref: ref
|
120
|
+
}, label));
|
121
|
+
}
|
122
|
+
});
|
123
|
+
|
124
|
+
// Return a placeholder if not released and not enabled by feature flag
|
125
|
+
CoachmarkStackHome = pkg.checkComponentEnabled(CoachmarkStackHome, componentName);
|
126
|
+
|
127
|
+
// The display name of the component, used by React. Note that displayName
|
128
|
+
// is used in preference to relying on function.name.
|
129
|
+
CoachmarkStackHome.displayName = componentName;
|
130
|
+
|
131
|
+
// The types and DocGen commentary for the component props,
|
132
|
+
// in alphabetical order (for consistency).
|
133
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
134
|
+
CoachmarkStackHome.propTypes = {
|
135
|
+
/**
|
136
|
+
* Optional class name for this component.
|
137
|
+
*/
|
138
|
+
className: PropTypes.string,
|
139
|
+
/**
|
140
|
+
* The label for the button that will close the stack
|
141
|
+
*/
|
142
|
+
closeButtonLabel: PropTypes.string,
|
143
|
+
/**
|
144
|
+
* The description of the Coachmark.
|
145
|
+
*/
|
146
|
+
description: PropTypes.node.isRequired,
|
147
|
+
/**
|
148
|
+
* If the stack home is open.
|
149
|
+
*/
|
150
|
+
isOpen: PropTypes.bool.isRequired,
|
151
|
+
/**
|
152
|
+
* The object describing an image in one of two shapes.
|
153
|
+
*
|
154
|
+
* If a single media element is required, use `{render}`.
|
155
|
+
*
|
156
|
+
* If a stepped animation is required, use `{filePaths}`.
|
157
|
+
*
|
158
|
+
* @see {@link MEDIA_PROP_TYPE}.
|
159
|
+
*/
|
160
|
+
media: PropTypes.oneOfType([PropTypes.shape({
|
161
|
+
render: PropTypes.func
|
162
|
+
}), PropTypes.shape({
|
163
|
+
filePaths: PropTypes.arrayOf(PropTypes.string)
|
164
|
+
})]),
|
165
|
+
/**
|
166
|
+
* The labels used to link to the stackable Coachmarks.
|
167
|
+
*/
|
168
|
+
navLinkLabels: PropTypes.arrayOf(PropTypes.string).isRequired,
|
169
|
+
/**
|
170
|
+
* For internal use only by CoachmarkStack and CoachmarkStackHome.
|
171
|
+
*/
|
172
|
+
onClickNavItem: PropTypes.func.isRequired,
|
173
|
+
/**
|
174
|
+
* Function to call when the stack closes.
|
175
|
+
*/
|
176
|
+
onClose: PropTypes.func.isRequired,
|
177
|
+
/**
|
178
|
+
* By default, the CoachmarkStackHome will be appended to the end of `document.body`.
|
179
|
+
* The CoachmarkStackHome will remain persistent as the user navigates the app until
|
180
|
+
* the user closes the CoachmarkStackHome.
|
181
|
+
*
|
182
|
+
* Alternatively, the app developer can tightly couple the CoachmarkStackHome to a DOM
|
183
|
+
* element or other component by specifying a CSS selector. The CoachmarkStackHome will
|
184
|
+
* remain visible as long as that element remains visible or mounted. When the
|
185
|
+
* element is hidden or component is unmounted, the CoachmarkStackHome will disappear.
|
186
|
+
*/
|
187
|
+
portalTarget: PropTypes.string,
|
188
|
+
/**
|
189
|
+
* The title of the Coachmark.
|
190
|
+
*/
|
191
|
+
title: PropTypes.string.isRequired
|
192
|
+
};
|
@@ -9,7 +9,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
9
9
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
10
10
|
/* eslint-disable react/prop-types */
|
11
11
|
/**
|
12
|
-
* Copyright IBM Corp. 2020,
|
12
|
+
* Copyright IBM Corp. 2020, 2024
|
13
13
|
*
|
14
14
|
* This source code is licensed under the Apache-2.0 license found in the
|
15
15
|
* LICENSE file in the root directory of this source tree.
|
@@ -23,6 +23,7 @@ import { selectionColumnId } from '../common-column-ids';
|
|
23
23
|
import { pkg } from '../../../settings';
|
24
24
|
import { handleColumnResizeEndEvent, handleColumnResizingEvent } from './addons/stateReducer';
|
25
25
|
import { getNodeTextContent } from '../../../global/js/utils/getNodeTextContent';
|
26
|
+
import { ColumnHeaderSlug } from './addons/Slug/ColumnHeaderSlug';
|
26
27
|
var blockClass = "".concat(pkg.prefix, "--datagrid");
|
27
28
|
var getAccessibilityProps = function getAccessibilityProps(header) {
|
28
29
|
var props = {};
|
@@ -85,7 +86,8 @@ var ResizeHeader = function ResizeHeader(_ref) {
|
|
85
86
|
}));
|
86
87
|
};
|
87
88
|
var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
88
|
-
var resizerAriaLabel = datagridState.resizerAriaLabel
|
89
|
+
var resizerAriaLabel = datagridState.resizerAriaLabel,
|
90
|
+
isTableSortable = datagridState.isTableSortable;
|
89
91
|
// Used to measure the height of the table and uses that value
|
90
92
|
// to display a vertical line to indicate the column you are resizing
|
91
93
|
useEffect(function () {
|
@@ -127,6 +129,14 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
127
129
|
headerGroupClassName = _headerGroup$getHeade.className,
|
128
130
|
role = _headerGroup$getHeade.role,
|
129
131
|
headerGroupProps = _objectWithoutProperties(_headerGroup$getHeade, _excluded2);
|
132
|
+
var renderSlug = function renderSlug(slug) {
|
133
|
+
if (isTableSortable) {
|
134
|
+
return;
|
135
|
+
}
|
136
|
+
return /*#__PURE__*/React.createElement(ColumnHeaderSlug, {
|
137
|
+
slug: slug
|
138
|
+
});
|
139
|
+
};
|
130
140
|
return /*#__PURE__*/React.createElement(TableRow, _extends({}, headerGroupProps, {
|
131
141
|
className: cx("".concat(blockClass, "__head"), headerGroupClassName),
|
132
142
|
ref: headRef
|
@@ -157,10 +167,10 @@ var HeaderRow = function HeaderRow(datagridState, headRef, headerGroup) {
|
|
157
167
|
headerProps = _objectWithoutProperties(_header$getHeaderProp, _excluded3);
|
158
168
|
var resizerProps = header === null || header === void 0 || (_header$getResizerPro = header.getResizerProps) === null || _header$getResizerPro === void 0 ? void 0 : _header$getResizerPro.call(header);
|
159
169
|
return /*#__PURE__*/React.createElement(TableHeader, _extends({}, headerProps, {
|
160
|
-
className: cx(headerClassName, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header.isSorted), "".concat(blockClass, "__header-actions-column"), header.isAction)),
|
170
|
+
className: cx(headerClassName, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "__resizableColumn"), resizerProps), "".concat(blockClass, "__isResizing"), header.isResizing), "".concat(blockClass, "__sortableColumn"), datagridState.isTableSortable && header.id !== 'spacer'), "".concat(blockClass, "__isSorted"), header.isSorted), "".concat(blockClass, "__header-actions-column"), header.isAction), "".concat(blockClass, "__with-slug"), header.slug && /*#__PURE__*/React.isValidElement(header.slug))),
|
161
171
|
key: header.id,
|
162
172
|
"aria-hidden": header.id === 'spacer' && 'true'
|
163
|
-
}, getAccessibilityProps(header)), header.render('Header'), resizerProps && !header.isAction && /*#__PURE__*/React.createElement(ResizeHeader, {
|
173
|
+
}, getAccessibilityProps(header)), header.render('Header'), renderSlug(header.slug), resizerProps && !header.isAction && /*#__PURE__*/React.createElement(ResizeHeader, {
|
164
174
|
resizerProps: resizerProps,
|
165
175
|
header: header,
|
166
176
|
handleOnMouseDownResize: handleOnMouseDownResize,
|
@@ -44,7 +44,8 @@ var SelectAll = function SelectAll(datagridState) {
|
|
44
44
|
dispatch = datagridState.dispatch,
|
45
45
|
rows = datagridState.rows,
|
46
46
|
getRowId = datagridState.getRowId,
|
47
|
-
toggleAllRowsSelected = datagridState.toggleAllRowsSelected
|
47
|
+
toggleAllRowsSelected = datagridState.toggleAllRowsSelected,
|
48
|
+
onAllRowSelect = datagridState.onAllRowSelect;
|
48
49
|
var isFirstColumnStickyLeft = ((_columns$ = columns[0]) === null || _columns$ === void 0 ? void 0 : _columns$.sticky) === 'left' && withStickyColumn;
|
49
50
|
if (hideSelectAll || radio) {
|
50
51
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -66,6 +67,7 @@ var SelectAll = function SelectAll(datagridState) {
|
|
66
67
|
indeterminate: true
|
67
68
|
});
|
68
69
|
toggleAllRowsSelected(false);
|
70
|
+
onAllRowSelect === null || onAllRowSelect === void 0 || onAllRowSelect(rows, event);
|
69
71
|
return onChange === null || onChange === void 0 ? void 0 : onChange({
|
70
72
|
target: {
|
71
73
|
checked: false
|
@@ -78,6 +80,7 @@ var SelectAll = function SelectAll(datagridState) {
|
|
78
80
|
getRowId: getRowId,
|
79
81
|
isChecked: event.target.checked
|
80
82
|
});
|
83
|
+
onAllRowSelect === null || onAllRowSelect === void 0 || onAllRowSelect(rows, event);
|
81
84
|
return onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
82
85
|
};
|
83
86
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -44,7 +44,7 @@ var DraggableElement = function DraggableElement(_ref) {
|
|
44
44
|
size: 16
|
45
45
|
})), children);
|
46
46
|
var style = {
|
47
|
-
transform: CSS.Transform.toString(transform),
|
47
|
+
transform: !disabled ? CSS.Transform.toString(transform) : {},
|
48
48
|
transition: transition
|
49
49
|
};
|
50
50
|
return /*#__PURE__*/React.createElement("li", _extends({
|
@@ -28,7 +28,7 @@ var ButtonWrapper = function ButtonWrapper(_ref) {
|
|
28
28
|
}, props));
|
29
29
|
},
|
30
30
|
iconDescription: iconTooltipLabel,
|
31
|
-
tooltipPosition: "
|
31
|
+
tooltipPosition: "bottom",
|
32
32
|
kind: "ghost",
|
33
33
|
hasIconOnly: true,
|
34
34
|
"test-id": "".concat(blockClass, "__customize-columns-trigger"),
|
@@ -38,6 +38,9 @@ var Columns = function Columns(_ref) {
|
|
38
38
|
$splice: [[from, 1], [to, 0, fromCol]]
|
39
39
|
}));
|
40
40
|
}, [columns, setColumnsObject]);
|
41
|
+
var filteredStickyColumn = columns === null || columns === void 0 ? void 0 : columns.filter(function (item) {
|
42
|
+
return !item.sticky;
|
43
|
+
});
|
41
44
|
return /*#__PURE__*/React.createElement("div", {
|
42
45
|
className: "".concat(blockClass, "__customize-columns-column-list"),
|
43
46
|
ref: listRef
|
@@ -61,7 +64,7 @@ var Columns = function Columns(_ref) {
|
|
61
64
|
checked: getVisibleColumnsCount() === columns.length,
|
62
65
|
indeterminate: getVisibleColumnsCount() < columns.length && getVisibleColumnsCount() > 0,
|
63
66
|
onChange: function onChange() {
|
64
|
-
onSelectColumn(
|
67
|
+
onSelectColumn(filteredStickyColumn, getVisibleColumnsCount() !== columns.length);
|
65
68
|
},
|
66
69
|
id: "".concat(blockClass, "__customization-column-select-all"),
|
67
70
|
labelText: selectAllLabel
|
package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/CustomizeColumnsTearsheet.js
CHANGED
@@ -90,7 +90,7 @@ var CustomizeColumnsTearsheet = function CustomizeColumnsTearsheet(_ref) {
|
|
90
90
|
};
|
91
91
|
var onCheckboxCheck = function onCheckboxCheck(col, value) {
|
92
92
|
var changedDefinitions = columnObjects.map(function (definition) {
|
93
|
-
if (Array.isArray(col) && col.indexOf(definition) !=
|
93
|
+
if (Array.isArray(col) && col.indexOf(definition) != -1 || definition.id === col.id) {
|
94
94
|
return _objectSpread(_objectSpread({}, definition), {}, {
|
95
95
|
isVisible: value
|
96
96
|
});
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2024, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
import React, { forwardRef, isValidElement } from 'react';
|
9
|
+
import PropTypes from 'prop-types';
|
10
|
+
export var ColumnHeaderSlug = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
11
|
+
var slug = _ref.slug;
|
12
|
+
if (slug && /*#__PURE__*/isValidElement(slug)) {
|
13
|
+
var normalizedSlug = /*#__PURE__*/React.cloneElement(slug, {
|
14
|
+
size: 'mini',
|
15
|
+
ref: ref
|
16
|
+
});
|
17
|
+
return normalizedSlug;
|
18
|
+
}
|
19
|
+
return;
|
20
|
+
});
|
21
|
+
ColumnHeaderSlug.propTypes = {
|
22
|
+
/**
|
23
|
+
* Specify the AI slug to be displayed
|
24
|
+
*/
|
25
|
+
slug: PropTypes.node
|
26
|
+
};
|
@@ -104,9 +104,9 @@ export var DocsPage = function DocsPage() {
|
|
104
104
|
}
|
105
105
|
}, {
|
106
106
|
title: 'Selecting rows',
|
107
|
-
description: "When building a Datagrid that requires selectable rows, use the `useSelectRows` hook.\n- Include `useSelectRows` hook\n- Add `onRowSelect` to the `useDatagrid` hook, this is a callback function called when on a row's selection checkbox onChange, and sends back the row object and the event\n ",
|
107
|
+
description: "When building a Datagrid that requires selectable rows, use the `useSelectRows` hook.\n- Include `useSelectRows` hook\n- Add `onRowSelect` to the `useDatagrid` hook, this is a callback function called when on a row's selection checkbox onChange, and sends back the row object and the event\n- Add `onAllRowSelect` to the `useDatagrid` hook, this is a callback function called when on all rows selection checkbox onChange, and sends back all rows object and the event\n ",
|
108
108
|
source: {
|
109
|
-
code: "\nconst [data] = useState(makeData(10));\nconst columns = React.useMemo(() => getColumns(data), []);\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n onRowSelect: (row, event) => console.log(row, event),\n batchActionMenuButtonLabel: 'More',\n },\n useSelectRows\n);\n\nreturn <Datagrid datagridState={datagridState} />;\n "
|
109
|
+
code: "\nconst [data] = useState(makeData(10));\nconst columns = React.useMemo(() => getColumns(data), []);\nconst datagridState = useDatagrid(\n {\n columns,\n data,\n onRowSelect: (row, event) => console.log(row, event),\n onAllRowSelect: (rows, event) => console.log(rows, event),\n batchActionMenuButtonLabel: 'More',\n },\n useSelectRows\n);\n\nreturn <Datagrid datagridState={datagridState} />;\n "
|
110
110
|
}
|
111
111
|
}, {
|
112
112
|
description: "The select all checkbox can be optionally hidden by settings the `hideSelectAll` property to `true` in the `useDatagrid` hook.",
|