@carbon/ibm-products 2.15.1 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +217 -9
- 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 +1 -1
- 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 +217 -9
- 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 +27 -9
- 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/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/es/components/Datagrid/Datagrid/DatagridExpandedRow.js +4 -4
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +40 -25
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridRow.js +5 -2
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +12 -11
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +35 -28
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +2 -2
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +50 -14
- package/es/components/Datagrid/Datagrid.docs-page.js +8 -2
- package/es/components/Datagrid/useActionsColumn.js +7 -5
- package/es/components/Datagrid/useDatagrid.js +13 -1
- package/es/components/Datagrid/useInfiniteScroll.js +10 -9
- 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/useSelectRows.js +8 -5
- package/es/components/Datagrid/useSkeletonRows.js +6 -6
- package/es/components/Datagrid/useSortableColumns.js +5 -7
- package/es/components/Datagrid/useStickyColumn.js +13 -6
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +2 -1
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +2 -1
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +2 -1
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +2 -1
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +2 -1
- package/es/components/EmptyStates/assets/ErrorIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NoDataIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NoTagsIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NotFoundIllustration.js +5 -3
- package/es/components/EmptyStates/assets/NotificationsIllustration.js +5 -3
- package/es/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -3
- package/es/components/InlineTip/InlineTip.docs-page.js +13 -0
- package/es/components/InlineTip/InlineTip.js +217 -0
- package/es/components/InlineTip/InlineTipButton.js +53 -0
- package/es/components/InlineTip/InlineTipLink.js +57 -0
- package/es/components/InlineTip/index.js +10 -0
- package/es/components/InlineTip/utils.js +36 -0
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.docs-page.js +11 -0
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +140 -0
- package/es/components/SteppedAnimatedMedia/assets/index.js +4 -0
- package/es/components/SteppedAnimatedMedia/index.js +8 -0
- package/es/global/js/package-settings.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +12 -9
- package/lib/components/Datagrid/Datagrid/DatagridExpandedRow.js +4 -4
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +45 -32
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +5 -2
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +11 -11
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +33 -27
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +2 -2
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +51 -15
- package/lib/components/Datagrid/Datagrid.docs-page.js +8 -2
- package/lib/components/Datagrid/useActionsColumn.js +7 -5
- package/lib/components/Datagrid/useDatagrid.js +13 -1
- package/lib/components/Datagrid/useInfiniteScroll.js +9 -9
- 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/useSelectRows.js +8 -5
- package/lib/components/Datagrid/useSkeletonRows.js +6 -6
- package/lib/components/Datagrid/useSortableColumns.js +5 -7
- package/lib/components/Datagrid/useStickyColumn.js +13 -6
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +2 -1
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +2 -1
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +2 -1
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +2 -1
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +2 -1
- package/lib/components/EmptyStates/assets/ErrorIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NoDataIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NoTagsIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NotFoundIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/NotificationsIllustration.js +5 -3
- package/lib/components/EmptyStates/assets/UnauthorizedIllustration.js +5 -3
- package/lib/components/InlineTip/InlineTip.docs-page.js +23 -0
- package/lib/components/InlineTip/InlineTip.js +224 -0
- package/lib/components/InlineTip/InlineTipButton.js +57 -0
- package/lib/components/InlineTip/InlineTipLink.js +61 -0
- package/lib/components/InlineTip/index.js +26 -0
- package/lib/components/InlineTip/utils.js +43 -0
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.docs-page.js +21 -0
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +148 -0
- package/lib/components/SteppedAnimatedMedia/assets/index.js +9 -0
- package/lib/components/SteppedAnimatedMedia/index.js +12 -0
- package/lib/global/js/package-settings.js +2 -1
- package/package.json +2 -2
- package/scss/components/Datagrid/styles/_datagrid.scss +31 -5
- package/scss/components/InlineTip/_index.scss +8 -0
- package/scss/components/InlineTip/_inline-tip.scss +229 -0
- package/scss/components/InlineTip/_storybook-styles.scss +20 -0
- package/scss/components/SidePanel/_side-panel.scss +1 -4
- package/scss/components/SteppedAnimatedMedia/_index.scss +8 -0
- package/scss/components/SteppedAnimatedMedia/_stepped-animated-media.scss +6 -0
- package/scss/components/SteppedAnimatedMedia/_storybook-styles.scss +13 -0
- package/scss/components/_index.scss +1 -0
@@ -0,0 +1,217 @@
|
|
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", "closeIconDescription", "collapsible", "collapseButtonLabel", "expandButtonLabel", "narrow", "onClick", "onClose", "tertiaryButtonLabel", "action", "title", "media"];
|
5
|
+
/**
|
6
|
+
* Copyright IBM Corp. 2023, 2023
|
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, { useEffect, useMemo, useRef, useState } from 'react';
|
14
|
+
|
15
|
+
// Other standard imports.
|
16
|
+
import { Close, Crossroads, Idea } from '@carbon/react/icons';
|
17
|
+
import { Button, IconButton } from '@carbon/react';
|
18
|
+
import PropTypes from 'prop-types';
|
19
|
+
import cx from 'classnames';
|
20
|
+
import { getComponentText } from './utils';
|
21
|
+
import { SteppedAnimatedMedia } from '../SteppedAnimatedMedia';
|
22
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
23
|
+
import uuidv4 from '../../global/js/utils/uuidv4';
|
24
|
+
import { pkg } from '../../settings';
|
25
|
+
|
26
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
|
+
var blockClass = "".concat(pkg.prefix, "--inline-tip");
|
28
|
+
var componentName = 'InlineTip';
|
29
|
+
|
30
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
31
|
+
|
32
|
+
// Default values for props
|
33
|
+
var defaults = {
|
34
|
+
closeIconDescription: 'Close',
|
35
|
+
collapsible: false,
|
36
|
+
collapseButtonLabel: 'Read less',
|
37
|
+
expandButtonLabel: 'Read more',
|
38
|
+
narrow: false,
|
39
|
+
onClick: function onClick() {},
|
40
|
+
onClose: function onClose() {}
|
41
|
+
};
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Inline tips are messages embedded within other components that
|
45
|
+
* provide an ambient way to deliver learning content without
|
46
|
+
* distracting the user from their flow.
|
47
|
+
*/
|
48
|
+
export var InlineTip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
49
|
+
var children = _ref.children,
|
50
|
+
className = _ref.className,
|
51
|
+
_ref$closeIconDescrip = _ref.closeIconDescription,
|
52
|
+
closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
|
53
|
+
_ref$collapsible = _ref.collapsible,
|
54
|
+
collapsible = _ref$collapsible === void 0 ? defaults.collapsible : _ref$collapsible,
|
55
|
+
_ref$collapseButtonLa = _ref.collapseButtonLabel,
|
56
|
+
collapseButtonLabel = _ref$collapseButtonLa === void 0 ? defaults.collapseButtonLabel : _ref$collapseButtonLa,
|
57
|
+
_ref$expandButtonLabe = _ref.expandButtonLabel,
|
58
|
+
expandButtonLabel = _ref$expandButtonLabe === void 0 ? defaults.expandButtonLabel : _ref$expandButtonLabe,
|
59
|
+
_ref$narrow = _ref.narrow,
|
60
|
+
narrow = _ref$narrow === void 0 ? defaults.narrow : _ref$narrow,
|
61
|
+
onClick = _ref.onClick,
|
62
|
+
onClose = _ref.onClose,
|
63
|
+
tertiaryButtonLabel = _ref.tertiaryButtonLabel,
|
64
|
+
action = _ref.action,
|
65
|
+
_ref$title = _ref.title,
|
66
|
+
title = _ref$title === void 0 ? defaults.title : _ref$title,
|
67
|
+
media = _ref.media,
|
68
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
69
|
+
var _useState = useState(collapsible),
|
70
|
+
_useState2 = _slicedToArray(_useState, 2),
|
71
|
+
isCollapsed = _useState2[0],
|
72
|
+
setIsCollapsed = _useState2[1];
|
73
|
+
var labelId = useRef(uuidv4()).current;
|
74
|
+
var previewText = useMemo(function () {
|
75
|
+
return getComponentText(React.Children.toArray(children));
|
76
|
+
}, [children]);
|
77
|
+
var childrenToRender = children;
|
78
|
+
if (!media && collapsible && isCollapsed) {
|
79
|
+
childrenToRender = /*#__PURE__*/React.createElement("p", {
|
80
|
+
className: "".concat(blockClass, "__preview-text")
|
81
|
+
}, previewText);
|
82
|
+
}
|
83
|
+
|
84
|
+
// If `collapsible` is changed after initial render...
|
85
|
+
useEffect(function () {
|
86
|
+
setIsCollapsed(collapsible);
|
87
|
+
}, [collapsible]);
|
88
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
89
|
+
"aria-labelledby": labelId,
|
90
|
+
className: cx(blockClass, className, [collapsible ? "".concat(blockClass, "__collapsible") : null], [isCollapsed ? "".concat(blockClass, "__collapsible-collapsed") : null], [narrow ? "".concat(blockClass, "__narrow") : "".concat(blockClass, "__wide")], [media ? "".concat(blockClass, "__has-media") : null]),
|
91
|
+
ref: ref,
|
92
|
+
role: "complementary"
|
93
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement("div", {
|
94
|
+
className: "".concat(blockClass, "__close-icon-wrapper")
|
95
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
96
|
+
className: "".concat(blockClass, "__close-icon"),
|
97
|
+
kind: "ghost",
|
98
|
+
label: closeIconDescription,
|
99
|
+
onClick: onClose,
|
100
|
+
size: "lg"
|
101
|
+
}, /*#__PURE__*/React.createElement(Close, {
|
102
|
+
size: 16
|
103
|
+
}))), (!media && narrow || !narrow) && /*#__PURE__*/React.createElement("div", {
|
104
|
+
className: "".concat(blockClass, "__icon-idea"),
|
105
|
+
tabIndex: -1
|
106
|
+
}, /*#__PURE__*/React.createElement(Idea, {
|
107
|
+
size: 16
|
108
|
+
})), /*#__PURE__*/React.createElement("div", {
|
109
|
+
className: "".concat(blockClass, "__content")
|
110
|
+
}, /*#__PURE__*/React.createElement("h6", {
|
111
|
+
id: labelId,
|
112
|
+
className: "".concat(blockClass, "__title")
|
113
|
+
}, title), /*#__PURE__*/React.createElement("section", {
|
114
|
+
className: "".concat(blockClass, "__body")
|
115
|
+
}, childrenToRender, action && (!collapsible || collapsible && !isCollapsed) && /*#__PURE__*/React.createElement("div", {
|
116
|
+
className: "".concat(blockClass, "__secondary-btn")
|
117
|
+
}, action)), (collapsible || tertiaryButtonLabel) && /*#__PURE__*/React.createElement("footer", {
|
118
|
+
className: "".concat(blockClass, "__footer")
|
119
|
+
}, collapsible && !media && /*#__PURE__*/React.createElement(Button, {
|
120
|
+
className: "".concat(blockClass, "__toggle-btn"),
|
121
|
+
kind: "ghost",
|
122
|
+
size: "md",
|
123
|
+
onClick: function onClick() {
|
124
|
+
setIsCollapsed(function (prevState) {
|
125
|
+
return !prevState;
|
126
|
+
});
|
127
|
+
}
|
128
|
+
}, isCollapsed ? expandButtonLabel : collapseButtonLabel), tertiaryButtonLabel && /*#__PURE__*/React.createElement(Button, {
|
129
|
+
className: "".concat(blockClass, "__close-btn"),
|
130
|
+
size: "md",
|
131
|
+
onClick: onClick,
|
132
|
+
kind: "tertiary",
|
133
|
+
renderIcon: function renderIcon() {
|
134
|
+
return /*#__PURE__*/React.createElement(Crossroads, {
|
135
|
+
size: 16
|
136
|
+
});
|
137
|
+
}
|
138
|
+
}, tertiaryButtonLabel))), media && (media.render ? /*#__PURE__*/React.createElement("div", {
|
139
|
+
className: "".concat(blockClass, "__media")
|
140
|
+
}, media.render()) : /*#__PURE__*/React.createElement(SteppedAnimatedMedia, {
|
141
|
+
className: "".concat(blockClass, "__media"),
|
142
|
+
filePaths: media.filePaths
|
143
|
+
})));
|
144
|
+
});
|
145
|
+
InlineTip = pkg.checkComponentEnabled(InlineTip, componentName);
|
146
|
+
InlineTip.displayName = componentName;
|
147
|
+
InlineTip.propTypes = {
|
148
|
+
/**
|
149
|
+
* Optional "call to action" ghost button or link that can appear
|
150
|
+
* directly below the content. This component comes with pre-styled
|
151
|
+
* elements available to use: `InlineTipLink` and `InlineTipButton`.
|
152
|
+
*/
|
153
|
+
action: PropTypes.node,
|
154
|
+
/**
|
155
|
+
* Provide the contents of the InlineTip.
|
156
|
+
*/
|
157
|
+
children: PropTypes.node.isRequired,
|
158
|
+
/**
|
159
|
+
* Provide an optional class to be applied to the containing node.
|
160
|
+
*/
|
161
|
+
className: PropTypes.string,
|
162
|
+
/**
|
163
|
+
* Tooltip text and aria label for the Close button icon.
|
164
|
+
*/
|
165
|
+
closeIconDescription: PropTypes.string,
|
166
|
+
/**
|
167
|
+
* The label for the collapse button.
|
168
|
+
* This button is not visible if `media` is specified.
|
169
|
+
*/
|
170
|
+
collapseButtonLabel: PropTypes.string,
|
171
|
+
/**
|
172
|
+
* If set to `true`, it will truncate the body text to
|
173
|
+
* one line and expose an expand/collapse button toggle.
|
174
|
+
*
|
175
|
+
* This feature is disabled if `media` is specified.
|
176
|
+
*/
|
177
|
+
collapsible: PropTypes.bool,
|
178
|
+
/**
|
179
|
+
* The label for the expand button.
|
180
|
+
* This button is not visible if `media` is specified.
|
181
|
+
*/
|
182
|
+
expandButtonLabel: PropTypes.string,
|
183
|
+
/**
|
184
|
+
* The object describing an image in one of two shapes.
|
185
|
+
* - If a single media element is required, use `{render}`.
|
186
|
+
* - If a stepped animation is required, use `{filePaths}`.
|
187
|
+
*
|
188
|
+
* Enabling `media` disables the `collapsible` feature.
|
189
|
+
*/
|
190
|
+
media: PropTypes.oneOfType([PropTypes.shape({
|
191
|
+
render: PropTypes.func
|
192
|
+
}), PropTypes.shape({
|
193
|
+
filePaths: PropTypes.string
|
194
|
+
})]),
|
195
|
+
/**
|
196
|
+
* Set to `true` to arrange the information in a format
|
197
|
+
* that is easier to read in a limited space.
|
198
|
+
*/
|
199
|
+
narrow: PropTypes.bool,
|
200
|
+
/**
|
201
|
+
* Function to call when the tertiary button is clicked.
|
202
|
+
*/
|
203
|
+
onClick: PropTypes.func,
|
204
|
+
/**
|
205
|
+
* Function to call when the InlineTip is closed via the "X" button.
|
206
|
+
*/
|
207
|
+
onClose: PropTypes.func,
|
208
|
+
/**
|
209
|
+
* Defining the label will show a the tertiary button with the crossroads icon.
|
210
|
+
* You will still need to define the `onClose` method to trigger a callback.
|
211
|
+
*/
|
212
|
+
tertiaryButtonLabel: PropTypes.string,
|
213
|
+
/**
|
214
|
+
* The title of the InlineTip.
|
215
|
+
*/
|
216
|
+
title: PropTypes.string.isRequired
|
217
|
+
};
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["children", "className"];
|
4
|
+
/**
|
5
|
+
* Copyright IBM Corp. 2023, 2023
|
6
|
+
*
|
7
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
|
11
|
+
// Import portions of React that are needed.
|
12
|
+
import React from 'react';
|
13
|
+
|
14
|
+
// Other standard imports.
|
15
|
+
import PropTypes from 'prop-types';
|
16
|
+
import cx from 'classnames';
|
17
|
+
import { Button } from '@carbon/react';
|
18
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
19
|
+
import { pkg } from '../../settings';
|
20
|
+
|
21
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
22
|
+
var blockClass = "".concat(pkg.prefix, "--inline-tip__button");
|
23
|
+
var componentName = 'InlineTipButton';
|
24
|
+
|
25
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
26
|
+
|
27
|
+
/**
|
28
|
+
* This is a standard Carbon button, styled specifically for use inside InlineTip.
|
29
|
+
*/
|
30
|
+
export var InlineTipButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
31
|
+
var children = _ref.children,
|
32
|
+
className = _ref.className,
|
33
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
34
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
|
35
|
+
className: cx(blockClass, className),
|
36
|
+
ref: ref
|
37
|
+
}, getDevtoolsProps(componentName), {
|
38
|
+
size: "md",
|
39
|
+
kind: "ghost"
|
40
|
+
}), children);
|
41
|
+
});
|
42
|
+
InlineTipButton.propTypes = {
|
43
|
+
/**
|
44
|
+
* Provide the contents of the InlineTipButton.
|
45
|
+
*/
|
46
|
+
children: PropTypes.node.isRequired,
|
47
|
+
/**
|
48
|
+
* Provide an optional class to be applied to the containing node.
|
49
|
+
*/
|
50
|
+
className: PropTypes.string
|
51
|
+
|
52
|
+
/* TODO: add types and DocGen for all props. */
|
53
|
+
};
|
@@ -0,0 +1,57 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
3
|
+
var _excluded = ["children", "className"];
|
4
|
+
/**
|
5
|
+
* Copyright IBM Corp. 2023, 2023
|
6
|
+
*
|
7
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
9
|
+
*/
|
10
|
+
|
11
|
+
// Import portions of React that are needed.
|
12
|
+
import React from 'react';
|
13
|
+
|
14
|
+
// Other standard imports.
|
15
|
+
import PropTypes from 'prop-types';
|
16
|
+
import cx from 'classnames';
|
17
|
+
import { Launch } from '@carbon/react/icons';
|
18
|
+
import { Link } from '@carbon/react';
|
19
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
20
|
+
import { pkg } from '../../settings';
|
21
|
+
|
22
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
23
|
+
var blockClass = "".concat(pkg.prefix, "--inline-tip__link");
|
24
|
+
var componentName = 'InlineTipLink';
|
25
|
+
|
26
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
27
|
+
|
28
|
+
/**
|
29
|
+
* This is a standard Carbon link, styled specifically for use inside InlineTip.
|
30
|
+
*/
|
31
|
+
export var InlineTipLink = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
32
|
+
var children = _ref.children,
|
33
|
+
className = _ref.className,
|
34
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
35
|
+
return /*#__PURE__*/React.createElement(Link, _extends({}, rest, {
|
36
|
+
className: cx(blockClass, className),
|
37
|
+
ref: ref
|
38
|
+
}, getDevtoolsProps(componentName), {
|
39
|
+
renderIcon: function renderIcon() {
|
40
|
+
return /*#__PURE__*/React.createElement(Launch, {
|
41
|
+
size: 16
|
42
|
+
});
|
43
|
+
}
|
44
|
+
}), children);
|
45
|
+
});
|
46
|
+
InlineTipLink.propTypes = {
|
47
|
+
/**
|
48
|
+
* Provide the contents of the InlineTipLink.
|
49
|
+
*/
|
50
|
+
children: PropTypes.node.isRequired,
|
51
|
+
/**
|
52
|
+
* Provide an optional class to be applied to the containing node.
|
53
|
+
*/
|
54
|
+
className: PropTypes.string
|
55
|
+
|
56
|
+
/* TODO: add types and DocGen for all props. */
|
57
|
+
};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2023, 2023
|
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
|
+
export { InlineTip } from './InlineTip';
|
9
|
+
export { InlineTipButton } from './InlineTipButton';
|
10
|
+
export { InlineTipLink } from './InlineTipLink';
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
2
|
+
/**
|
3
|
+
* Copyright IBM Corp. 2023, 2023
|
4
|
+
*
|
5
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
7
|
+
*/
|
8
|
+
|
9
|
+
export var getComponentText = function getComponentText(reactNode) {
|
10
|
+
var _reactNode$props;
|
11
|
+
var tmpChildren = (reactNode === null || reactNode === void 0 || (_reactNode$props = reactNode.props) === null || _reactNode$props === void 0 ? void 0 : _reactNode$props.children) || undefined;
|
12
|
+
if (Array.isArray(reactNode)) {
|
13
|
+
var joinedNodes = [];
|
14
|
+
reactNode.forEach(function (node) {
|
15
|
+
if (_typeof(node) === 'object') {
|
16
|
+
joinedNodes.push(getComponentText(node));
|
17
|
+
} else if (typeof node === 'string') {
|
18
|
+
joinedNodes.push(node);
|
19
|
+
}
|
20
|
+
});
|
21
|
+
return joinedNodes.join(' ');
|
22
|
+
}
|
23
|
+
if (tmpChildren === undefined) {
|
24
|
+
if (typeof reactNode === 'string') {
|
25
|
+
return reactNode;
|
26
|
+
} else {
|
27
|
+
return ' ';
|
28
|
+
}
|
29
|
+
}
|
30
|
+
if (_typeof(tmpChildren) === 'object') {
|
31
|
+
return getComponentText(reactNode.props.children);
|
32
|
+
}
|
33
|
+
if (typeof tmpChildren === 'string') {
|
34
|
+
return reactNode.props.children;
|
35
|
+
}
|
36
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
import { StoryDocsPage } from '../../global/js/utils/StoryDocsPage';
|
3
|
+
import * as stories from './SteppedAnimatedMedia.stories';
|
4
|
+
var DocsPage = function DocsPage() {
|
5
|
+
return /*#__PURE__*/React.createElement(StoryDocsPage, {
|
6
|
+
blocks: [{
|
7
|
+
story: stories.steppedAnimatedMedia
|
8
|
+
}]
|
9
|
+
});
|
10
|
+
};
|
11
|
+
export default DocsPage;
|
@@ -0,0 +1,140 @@
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
2
|
+
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
5
|
+
var _excluded = ["className", "playStep", "filePaths"];
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
7
|
+
/**
|
8
|
+
* Copyright IBM Corp. 2023, 2023
|
9
|
+
*
|
10
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
12
|
+
*/
|
13
|
+
|
14
|
+
// Import portions of React that are needed.
|
15
|
+
import React, { useEffect, useRef, useState } from 'react';
|
16
|
+
import lottie from 'lottie-web';
|
17
|
+
import clamp from 'lodash/clamp';
|
18
|
+
// Other standard imports.
|
19
|
+
import PropTypes from 'prop-types';
|
20
|
+
import cx from 'classnames';
|
21
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
22
|
+
import { pkg } from '../../settings';
|
23
|
+
|
24
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
25
|
+
var blockClass = "".concat(pkg.prefix, "--stepped-animated-media");
|
26
|
+
var componentName = 'SteppedAnimatedMedia';
|
27
|
+
|
28
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
29
|
+
|
30
|
+
// Default values for props
|
31
|
+
var defaults = {
|
32
|
+
playStep: 0
|
33
|
+
};
|
34
|
+
|
35
|
+
/**
|
36
|
+
* The SteppedAnimatedMedia is a Novice to Pro internal component and is not intended for general use.
|
37
|
+
*/
|
38
|
+
export var SteppedAnimatedMedia = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
39
|
+
var className = _ref.className,
|
40
|
+
_ref$playStep = _ref.playStep,
|
41
|
+
playStep = _ref$playStep === void 0 ? defaults.playStep : _ref$playStep,
|
42
|
+
filePaths = _ref.filePaths,
|
43
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
44
|
+
var _useState = useState([]),
|
45
|
+
_useState2 = _slicedToArray(_useState, 2),
|
46
|
+
jsonData = _useState2[0],
|
47
|
+
setJsonData = _useState2[1];
|
48
|
+
var animRef = useRef();
|
49
|
+
var backupRef = useRef();
|
50
|
+
var localRef = ref !== null && ref !== void 0 ? ref : backupRef;
|
51
|
+
// load animation source
|
52
|
+
useEffect(function () {
|
53
|
+
var isJsonFile = function isJsonFile(filePath) {
|
54
|
+
return filePath.includes('.json');
|
55
|
+
};
|
56
|
+
function loadArtifact() {
|
57
|
+
return _loadArtifact.apply(this, arguments);
|
58
|
+
}
|
59
|
+
function _loadArtifact() {
|
60
|
+
_loadArtifact = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
61
|
+
var allJsonArtifacts, rawResponse, jsonResponse, fileData;
|
62
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
63
|
+
while (1) switch (_context.prev = _context.next) {
|
64
|
+
case 0:
|
65
|
+
if (!(filePaths && filePaths.every(isJsonFile))) {
|
66
|
+
_context.next = 10;
|
67
|
+
break;
|
68
|
+
}
|
69
|
+
allJsonArtifacts = filePaths.map(function (el) {
|
70
|
+
return fetch(el);
|
71
|
+
});
|
72
|
+
_context.next = 4;
|
73
|
+
return Promise.all(allJsonArtifacts);
|
74
|
+
case 4:
|
75
|
+
rawResponse = _context.sent;
|
76
|
+
jsonResponse = rawResponse.map(function (el) {
|
77
|
+
return el.json();
|
78
|
+
});
|
79
|
+
_context.next = 8;
|
80
|
+
return Promise.all(jsonResponse);
|
81
|
+
case 8:
|
82
|
+
fileData = _context.sent;
|
83
|
+
setJsonData(fileData);
|
84
|
+
case 10:
|
85
|
+
case "end":
|
86
|
+
return _context.stop();
|
87
|
+
}
|
88
|
+
}, _callee);
|
89
|
+
}));
|
90
|
+
return _loadArtifact.apply(this, arguments);
|
91
|
+
}
|
92
|
+
loadArtifact();
|
93
|
+
}, [filePaths]);
|
94
|
+
useEffect(function () {
|
95
|
+
var _window;
|
96
|
+
var prefersReducedMotion = (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : true;
|
97
|
+
if (localRef.current) {
|
98
|
+
var _animRef$current, _animRef$current2, _animRef$current3;
|
99
|
+
(_animRef$current = animRef.current) === null || _animRef$current === void 0 || _animRef$current.destroy();
|
100
|
+
animRef.current = lottie.loadAnimation({
|
101
|
+
container: localRef.current,
|
102
|
+
renderer: 'svg',
|
103
|
+
animationData: jsonData[clamp(playStep, 0, jsonData.length - 1)],
|
104
|
+
loop: false,
|
105
|
+
autoplay: false,
|
106
|
+
rendererSettings: {
|
107
|
+
preserveAspectRatio: 'xMidYMid slice'
|
108
|
+
}
|
109
|
+
});
|
110
|
+
prefersReducedMotion ? (_animRef$current2 = animRef.current) === null || _animRef$current2 === void 0 ? void 0 : _animRef$current2.goToAndStop(0) : (_animRef$current3 = animRef.current) === null || _animRef$current3 === void 0 ? void 0 : _animRef$current3.goToAndPlay(0);
|
111
|
+
}
|
112
|
+
return function () {
|
113
|
+
var _animRef$current4;
|
114
|
+
return (_animRef$current4 = animRef.current) === null || _animRef$current4 === void 0 ? void 0 : _animRef$current4.destroy();
|
115
|
+
};
|
116
|
+
}, [jsonData, localRef, playStep]);
|
117
|
+
if (!jsonData) {
|
118
|
+
return null;
|
119
|
+
}
|
120
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
121
|
+
className: cx(blockClass, className),
|
122
|
+
role: "img",
|
123
|
+
ref: localRef
|
124
|
+
}, getDevtoolsProps(componentName)));
|
125
|
+
});
|
126
|
+
SteppedAnimatedMedia.displayName = componentName;
|
127
|
+
SteppedAnimatedMedia.propTypes = {
|
128
|
+
/**
|
129
|
+
* Optional class name for this component.
|
130
|
+
*/
|
131
|
+
className: PropTypes.string,
|
132
|
+
/**
|
133
|
+
* The file path(s) to json formatted Lottie animation files.
|
134
|
+
*/
|
135
|
+
filePaths: PropTypes.arrayOf(PropTypes.string).isRequired,
|
136
|
+
/**
|
137
|
+
* Which animation step from the filePaths array to play.
|
138
|
+
*/
|
139
|
+
playStep: PropTypes.number
|
140
|
+
};
|
@@ -0,0 +1,4 @@
|
|
1
|
+
var HowACaseIsCreated1 = new URL('./illustrations/how-a-case-is-created-1', import.meta.url).pathname;
|
2
|
+
var HowACaseIsCreated2 = new URL('./illustrations/how-a-case-is-created-2', import.meta.url).pathname;
|
3
|
+
var HowACaseIsCreated3 = new URL('./illustrations/how-a-case-is-created-3', import.meta.url).pathname;
|
4
|
+
export { HowACaseIsCreated1, HowACaseIsCreated2, HowACaseIsCreated3 };
|
@@ -39,7 +39,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
39
39
|
var blockClass = "".concat(_settings.pkg.prefix, "--datagrid");
|
40
40
|
var gcClass = "".concat(blockClass, "__grid-container");
|
41
41
|
var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
42
|
-
var
|
42
|
+
var _cx5;
|
43
43
|
var datagridState = _ref.datagridState,
|
44
44
|
title = _ref.title;
|
45
45
|
var _useContext = (0, _react.useContext)(_InlineEditContext.InlineEditContext),
|
@@ -52,8 +52,7 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
52
52
|
var activeCellId = inlineEditState.activeCellId,
|
53
53
|
gridActive = inlineEditState.gridActive,
|
54
54
|
editId = inlineEditState.editId;
|
55
|
-
var
|
56
|
-
getTableProps = _datagridState$getTab === void 0 ? function () {} : _datagridState$getTab,
|
55
|
+
var getTableProps = datagridState.getTableProps,
|
57
56
|
getFilterFlyoutProps = datagridState.getFilterFlyoutProps,
|
58
57
|
withVirtualScroll = datagridState.withVirtualScroll,
|
59
58
|
DatagridPagination = datagridState.DatagridPagination,
|
@@ -76,6 +75,7 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
76
75
|
state = datagridState.state,
|
77
76
|
page = datagridState.page,
|
78
77
|
rows = datagridState.rows;
|
78
|
+
var columnResizing = state.columnResizing;
|
79
79
|
var contentRows = DatagridPagination && page || rows;
|
80
80
|
var gridAreaRef = (0, _react.useRef)();
|
81
81
|
var multiKeyTrackingRef = (0, _react.useRef)();
|
@@ -97,10 +97,11 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
97
97
|
var renderTable = function renderTable() {
|
98
98
|
var _getTableProps;
|
99
99
|
return /*#__PURE__*/_react.default.createElement(_react2.Table, (0, _extends2.default)({}, getTableProps(), {
|
100
|
-
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),
|
100
|
+
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),
|
101
101
|
role: withInlineEdit ? 'grid' : undefined,
|
102
102
|
tabIndex: withInlineEdit ? 0 : -1,
|
103
|
-
onKeyDown:
|
103
|
+
onKeyDown: /* istanbul ignore next */
|
104
|
+
withInlineEdit && function (event) {
|
104
105
|
return (0, _handleGridKeyPress.handleGridKeyPress)({
|
105
106
|
event: event,
|
106
107
|
dispatch: dispatch,
|
@@ -109,10 +110,10 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
109
110
|
state: inlineEditState,
|
110
111
|
usingMac: usingMac
|
111
112
|
});
|
112
|
-
}
|
113
|
-
onFocus: withInlineEdit
|
113
|
+
},
|
114
|
+
onFocus: withInlineEdit && function () {
|
114
115
|
return (0, _handleGridFocus.handleGridFocus)(inlineEditState, dispatch);
|
115
|
-
}
|
116
|
+
},
|
116
117
|
title: title
|
117
118
|
}), !withVirtualScroll && /*#__PURE__*/_react.default.createElement(_DatagridHead.default, datagridState), /*#__PURE__*/_react.default.createElement(_DatagridBody.default, (0, _extends2.default)({}, datagridState, {
|
118
119
|
rows: contentRows
|
@@ -141,6 +142,8 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
141
142
|
(0, _hooks3.useSubscribeToEventEmitter)(_constants.CLEAR_SINGLE_FILTER, function (id) {
|
142
143
|
return (0, _FilterProvider.clearSingleFilter)(id, setAllFilters, state);
|
143
144
|
});
|
145
|
+
|
146
|
+
/* istanbul ignore next */
|
144
147
|
var renderFilterSummary = function renderFilterSummary() {
|
145
148
|
return state.filters.length > 0 && /*#__PURE__*/_react.default.createElement(_FilterSummary.FilterSummary, {
|
146
149
|
className: "".concat(blockClass, "__filter-summary"),
|
@@ -153,7 +156,7 @@ var DatagridContent = exports.DatagridContent = function DatagridContent(_ref) {
|
|
153
156
|
});
|
154
157
|
};
|
155
158
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_react2.TableContainer, {
|
156
|
-
className: (0, _classnames.default)("".concat(gcClass), (
|
159
|
+
className: (0, _classnames.default)("".concat(gcClass), (_cx5 = {}, (0, _defineProperty2.default)(_cx5, "".concat(gcClass, "-active"), gridActive), (0, _defineProperty2.default)(_cx5, "".concat(gcClass, "-active--without-toolbar"), withInlineEdit && !DatagridActions), (0, _defineProperty2.default)(_cx5, "".concat(gcClass, "-inline-edit"), withInlineEdit), (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__full-height"), withVirtualScroll || fullHeightDatagrid), (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__with-pagination"), DatagridPagination), (0, _defineProperty2.default)(_cx5, "".concat(blockClass, "__dense-header"), useDenseHeader), _cx5)),
|
157
160
|
title: gridTitle,
|
158
161
|
description: gridDescription
|
159
162
|
}, /*#__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;
|
26
|
+
/* istanbul ignore else */
|
27
27
|
if (event !== null && event !== void 0 && (_event$target = event.target) !== null && _event$target !== void 0 && (_event$target = _event$target.parentNode) !== null && _event$target !== void 0 && _event$target.previousElementSibling) {
|
28
28
|
var parentNode = event.target.parentNode.previousElementSibling;
|
29
29
|
if (eventType === 'enter') {
|
@@ -44,9 +44,9 @@ var DatagridExpandedRow = function DatagridExpandedRow(ExpandedRowContentCompone
|
|
44
44
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
45
45
|
className: "".concat(blockClass, "__expanded-row-content"),
|
46
46
|
style: {
|
47
|
-
height: expandedContentHeight
|
47
|
+
height: expandedContentHeight && expandedContentHeight
|
48
48
|
}
|
49
|
-
}, ExpandedRowContentComponent
|
49
|
+
}, /*#__PURE__*/_react.default.createElement(ExpandedRowContentComponent, datagridState)));
|
50
50
|
};
|
51
51
|
};
|
52
52
|
var _default = exports.default = DatagridExpandedRow;
|