@carbon/ibm-products 1.54.2 → 1.55.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +1312 -108
- 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.css +1200 -1
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +2 -2
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +1310 -106
- 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/APIKeyModal/APIKeyModal.js +25 -21
- package/es/components/ActionBar/ActionBar.js +5 -5
- package/es/components/Carousel/Carousel.js +237 -0
- package/es/components/Carousel/CarouselItem.js +66 -0
- package/es/components/Carousel/index.js +9 -0
- package/es/components/Carousel/utils.js +98 -0
- package/es/components/CreateFullPage/CreateFullPage.js +4 -2
- package/es/components/CreateModal/CreateModal.js +2 -1
- package/es/components/CreateSidePanel/CreateSidePanel.js +6 -2
- package/es/components/CreateTearsheet/CreateTearsheet.js +3 -1
- package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +6 -2
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +3 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/index.js +2 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js +13 -0
- package/es/components/Datagrid/index.js +2 -1
- package/es/components/Datagrid/useActionsColumn.js +13 -7
- package/es/components/Datagrid/useOnRowClick.js +20 -4
- package/es/components/Datagrid/useSortableColumns.js +27 -3
- package/es/components/Datagrid/utils/DatagridActions.js +6 -6
- package/es/components/Datagrid/utils/getArgTypes.js +4 -0
- package/es/components/EditSidePanel/EditSidePanel.js +7 -3
- package/es/components/FilterSummary/FilterSummary.js +7 -3
- package/es/components/Guidebanner/Guidebanner.js +229 -0
- package/es/components/Guidebanner/GuidebannerElement.js +71 -0
- package/es/components/Guidebanner/GuidebannerElementButton.js +76 -0
- package/es/components/Guidebanner/GuidebannerElementLink.js +56 -0
- package/es/components/Guidebanner/index.js +11 -0
- package/es/components/InlineTip/InlineTip.js +228 -0
- package/es/components/InlineTip/InlineTipButton.js +89 -0
- package/es/components/InlineTip/InlineTipLink.js +89 -0
- package/es/components/InlineTip/index.js +10 -0
- package/es/components/InlineTip/utils.js +36 -0
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +164 -0
- package/es/components/SteppedAnimatedMedia/assets/index.js +4 -0
- package/es/components/SteppedAnimatedMedia/index.js +8 -0
- package/es/components/Tearsheet/TearsheetShell.js +2 -1
- package/es/components/index.js +4 -2
- package/es/global/js/hooks/useResizeObserver.js +1 -1
- package/es/global/js/package-settings.js +2 -0
- package/lib/components/APIKeyModal/APIKeyModal.js +25 -21
- package/lib/components/ActionBar/ActionBar.js +5 -5
- package/lib/components/Carousel/Carousel.js +238 -0
- package/lib/components/Carousel/CarouselItem.js +66 -0
- package/lib/components/Carousel/index.js +19 -0
- package/lib/components/Carousel/utils.js +108 -0
- package/lib/components/CreateFullPage/CreateFullPage.js +4 -2
- package/lib/components/CreateModal/CreateModal.js +2 -1
- package/lib/components/CreateSidePanel/CreateSidePanel.js +6 -2
- package/lib/components/CreateTearsheet/CreateTearsheet.js +3 -1
- package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.js +6 -2
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +1 -1
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +3 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/index.js +8 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilterContext.js +20 -0
- package/lib/components/Datagrid/index.js +8 -1
- package/lib/components/Datagrid/useActionsColumn.js +13 -7
- package/lib/components/Datagrid/useOnRowClick.js +20 -4
- package/lib/components/Datagrid/useSortableColumns.js +27 -3
- package/lib/components/Datagrid/utils/DatagridActions.js +6 -6
- package/lib/components/Datagrid/utils/getArgTypes.js +4 -0
- package/lib/components/EditSidePanel/EditSidePanel.js +7 -3
- package/lib/components/FilterSummary/FilterSummary.js +7 -3
- package/lib/components/Guidebanner/Guidebanner.js +229 -0
- package/lib/components/Guidebanner/GuidebannerElement.js +67 -0
- package/lib/components/Guidebanner/GuidebannerElementButton.js +71 -0
- package/lib/components/Guidebanner/GuidebannerElementLink.js +52 -0
- package/lib/components/Guidebanner/index.js +33 -0
- package/lib/components/InlineTip/InlineTip.js +228 -0
- package/lib/components/InlineTip/InlineTipButton.js +86 -0
- package/lib/components/InlineTip/InlineTipLink.js +86 -0
- package/lib/components/InlineTip/index.js +26 -0
- package/lib/components/InlineTip/utils.js +44 -0
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +165 -0
- package/lib/components/SteppedAnimatedMedia/assets/index.js +12 -0
- package/lib/components/SteppedAnimatedMedia/index.js +12 -0
- package/lib/components/Tearsheet/TearsheetShell.js +2 -1
- package/lib/components/index.js +21 -1
- package/lib/global/js/hooks/useResizeObserver.js +1 -1
- package/lib/global/js/package-settings.js +2 -0
- package/package.json +5 -5
- package/scss/components/Carousel/_carousel.scss +80 -0
- package/scss/components/Carousel/_index.scss +8 -0
- package/scss/components/Carousel/_storybook-styles.scss +10 -0
- package/scss/components/Datagrid/_storybook-styles.scss +5 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +1 -1
- package/scss/components/Guidebanner/_guidebanner.scss +257 -0
- package/scss/components/Guidebanner/_index.scss +8 -0
- package/scss/components/Guidebanner/_storybook-styles.scss +20 -0
- package/scss/components/InlineTip/_index.scss +8 -0
- package/scss/components/InlineTip/_inline-tip.scss +231 -0
- package/scss/components/InlineTip/_storybook-styles.scss +21 -0
- package/scss/components/SteppedAnimatedMedia/_index.scss +8 -0
- package/scss/components/SteppedAnimatedMedia/_stepped-animated-media.scss +34 -0
- package/scss/components/SteppedAnimatedMedia/_storybook-styles.scss +12 -0
- package/scss/components/_index.scss +4 -0
@@ -0,0 +1,228 @@
|
|
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, useState } from 'react';
|
14
|
+
|
15
|
+
// Other standard imports.
|
16
|
+
import { Close16, Crossroads16, Idea20 } from '@carbon/icons-react';
|
17
|
+
import { Button } from 'carbon-components-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 { pkg /*, carbon */ } from '../../settings';
|
24
|
+
|
25
|
+
// Carbon and package components we use.
|
26
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
27
|
+
|
28
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
29
|
+
var blockClass = "".concat(pkg.prefix, "--inline-tip");
|
30
|
+
var componentName = 'InlineTip';
|
31
|
+
|
32
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
33
|
+
|
34
|
+
// Default values can be included here and then assigned to the prop params,
|
35
|
+
// e.g. prop = defaults.prop,
|
36
|
+
// This gathers default values together neatly and ensures non-primitive
|
37
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
38
|
+
// Note that default values are not required for props that are 'required',
|
39
|
+
// nor for props where the component can apply undefined values reasonably.
|
40
|
+
// Default values should be provided when the component needs to make a choice
|
41
|
+
// or assumption when a prop is not supplied.
|
42
|
+
|
43
|
+
// Default values for props
|
44
|
+
var defaults = {
|
45
|
+
closeIconDescription: 'Close',
|
46
|
+
collapsible: false,
|
47
|
+
collapseButtonLabel: 'Read less',
|
48
|
+
expandButtonLabel: 'Read more',
|
49
|
+
narrow: false,
|
50
|
+
onClick: function onClick() {},
|
51
|
+
onClose: function onClose() {}
|
52
|
+
};
|
53
|
+
|
54
|
+
/**
|
55
|
+
* TODO: A description of the component.
|
56
|
+
*/
|
57
|
+
export var InlineTip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
58
|
+
var children = _ref.children,
|
59
|
+
className = _ref.className,
|
60
|
+
_ref$closeIconDescrip = _ref.closeIconDescription,
|
61
|
+
closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
|
62
|
+
_ref$collapsible = _ref.collapsible,
|
63
|
+
collapsible = _ref$collapsible === void 0 ? defaults.collapsible : _ref$collapsible,
|
64
|
+
_ref$collapseButtonLa = _ref.collapseButtonLabel,
|
65
|
+
collapseButtonLabel = _ref$collapseButtonLa === void 0 ? defaults.collapseButtonLabel : _ref$collapseButtonLa,
|
66
|
+
_ref$expandButtonLabe = _ref.expandButtonLabel,
|
67
|
+
expandButtonLabel = _ref$expandButtonLabe === void 0 ? defaults.expandButtonLabel : _ref$expandButtonLabe,
|
68
|
+
_ref$narrow = _ref.narrow,
|
69
|
+
narrow = _ref$narrow === void 0 ? defaults.narrow : _ref$narrow,
|
70
|
+
onClick = _ref.onClick,
|
71
|
+
onClose = _ref.onClose,
|
72
|
+
tertiaryButtonLabel = _ref.tertiaryButtonLabel,
|
73
|
+
action = _ref.action,
|
74
|
+
_ref$title = _ref.title,
|
75
|
+
title = _ref$title === void 0 ? defaults.title : _ref$title,
|
76
|
+
media = _ref.media,
|
77
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
78
|
+
var _useState = useState(collapsible),
|
79
|
+
_useState2 = _slicedToArray(_useState, 2),
|
80
|
+
isCollapsed = _useState2[0],
|
81
|
+
setIsCollapsed = _useState2[1];
|
82
|
+
var previewText = useMemo(function () {
|
83
|
+
return getComponentText(React.Children.toArray(children));
|
84
|
+
}, [children]);
|
85
|
+
var childrenToRender = children;
|
86
|
+
if (!media && collapsible && isCollapsed) {
|
87
|
+
childrenToRender = /*#__PURE__*/React.createElement("p", {
|
88
|
+
className: "".concat(blockClass, "__preview-text")
|
89
|
+
}, previewText);
|
90
|
+
}
|
91
|
+
|
92
|
+
// If `collapsible` is changed after initial render...
|
93
|
+
useEffect(function () {
|
94
|
+
setIsCollapsed(collapsible);
|
95
|
+
}, [collapsible]);
|
96
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
97
|
+
className: cx(blockClass,
|
98
|
+
// Apply the block class to the main HTML element
|
99
|
+
className,
|
100
|
+
// Apply any supplied class names to the main HTML element.
|
101
|
+
[collapsible ? "".concat(blockClass, "__collapsible") : null], [isCollapsed ? "".concat(blockClass, "__collapsible-collapsed") : null], [narrow ? "".concat(blockClass, "__narrow") : "".concat(blockClass, "__wide")], [media ? "".concat(blockClass, "__has-media") : null]),
|
102
|
+
ref: ref,
|
103
|
+
role: "complementary"
|
104
|
+
}, getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(Button, {
|
105
|
+
kind: "ghost",
|
106
|
+
size: "lg",
|
107
|
+
renderIcon: Close16,
|
108
|
+
iconDescription: closeIconDescription,
|
109
|
+
hasIconOnly: true,
|
110
|
+
className: "".concat(blockClass, "__close-icon"),
|
111
|
+
onClick: onClose
|
112
|
+
}), (!media && narrow || !narrow) && /*#__PURE__*/React.createElement("div", {
|
113
|
+
className: "".concat(blockClass, "__icon-idea"),
|
114
|
+
tabIndex: -1
|
115
|
+
}, /*#__PURE__*/React.createElement(Idea20, null)), /*#__PURE__*/React.createElement("div", {
|
116
|
+
className: "".concat(blockClass, "__content")
|
117
|
+
}, /*#__PURE__*/React.createElement("h6", {
|
118
|
+
className: "".concat(blockClass, "__title")
|
119
|
+
}, title), /*#__PURE__*/React.createElement("section", {
|
120
|
+
className: "".concat(blockClass, "__body")
|
121
|
+
}, childrenToRender, action && (!collapsible || collapsible && !isCollapsed) && /*#__PURE__*/React.createElement("div", {
|
122
|
+
className: "".concat(blockClass, "__secondary-btn")
|
123
|
+
}, action)), (collapsible || tertiaryButtonLabel) && /*#__PURE__*/React.createElement("footer", {
|
124
|
+
className: "".concat(blockClass, "__footer")
|
125
|
+
}, collapsible && !media && /*#__PURE__*/React.createElement(Button, {
|
126
|
+
className: "".concat(blockClass, "__toggle-btn"),
|
127
|
+
kind: "ghost",
|
128
|
+
size: "md",
|
129
|
+
onClick: function onClick() {
|
130
|
+
setIsCollapsed(function (prevState) {
|
131
|
+
return !prevState;
|
132
|
+
});
|
133
|
+
}
|
134
|
+
}, isCollapsed ? expandButtonLabel : collapseButtonLabel), tertiaryButtonLabel && /*#__PURE__*/React.createElement(Button, {
|
135
|
+
className: "".concat(blockClass, "__close-btn"),
|
136
|
+
size: "md",
|
137
|
+
onClick: onClick,
|
138
|
+
kind: "tertiary",
|
139
|
+
renderIcon: Crossroads16
|
140
|
+
}, tertiaryButtonLabel))), media && (media.render ? /*#__PURE__*/React.createElement("div", {
|
141
|
+
className: "".concat(blockClass, "__media")
|
142
|
+
}, media.render()) : /*#__PURE__*/React.createElement(SteppedAnimatedMedia, {
|
143
|
+
className: "".concat(blockClass, "__media"),
|
144
|
+
filePaths: media.filePaths
|
145
|
+
})));
|
146
|
+
});
|
147
|
+
|
148
|
+
// Return a placeholder if not released and not enabled by feature flag
|
149
|
+
InlineTip = pkg.checkComponentEnabled(InlineTip, componentName);
|
150
|
+
|
151
|
+
// The display name of the component, used by React. Note that displayName
|
152
|
+
// is used in preference to relying on function.name.
|
153
|
+
InlineTip.displayName = componentName;
|
154
|
+
|
155
|
+
// The types and DocGen commentary for the component props,
|
156
|
+
// in alphabetical order (for consistency).
|
157
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
158
|
+
InlineTip.propTypes = {
|
159
|
+
/**
|
160
|
+
* Optional "call to action" ghost button or link that can appear
|
161
|
+
* directly below the content. This component comes with pre-styled
|
162
|
+
* elements available to use: `InlineTipLink` and `InlineTipButton`.
|
163
|
+
*/
|
164
|
+
action: PropTypes.node,
|
165
|
+
/**
|
166
|
+
* Provide the contents of the InlineTip.
|
167
|
+
*/
|
168
|
+
children: PropTypes.node.isRequired,
|
169
|
+
/**
|
170
|
+
* Provide an optional class to be applied to the containing node.
|
171
|
+
*/
|
172
|
+
className: PropTypes.string,
|
173
|
+
/**
|
174
|
+
* Tooltip text and aria label for the Close button icon.
|
175
|
+
*/
|
176
|
+
closeIconDescription: PropTypes.string,
|
177
|
+
/**
|
178
|
+
* The label for the collapse button.
|
179
|
+
* This button is not visible if `media` is specified.
|
180
|
+
*/
|
181
|
+
collapseButtonLabel: PropTypes.string,
|
182
|
+
/**
|
183
|
+
* If set to `true`, it will truncate the body text to
|
184
|
+
* one line and expose an expand/collapse button toggle.
|
185
|
+
*
|
186
|
+
* This feature is disabled if `media` is specified.
|
187
|
+
*/
|
188
|
+
collapsible: PropTypes.bool,
|
189
|
+
/**
|
190
|
+
* The label for the expand button.
|
191
|
+
* This button is not visible if `media` is specified.
|
192
|
+
*/
|
193
|
+
expandButtonLabel: PropTypes.string,
|
194
|
+
/**
|
195
|
+
* The object describing an image in one of two shapes.
|
196
|
+
* - If a single media element is required, use `{render}`.
|
197
|
+
* - If a stepped animation is required, use `{filePaths}`.
|
198
|
+
*
|
199
|
+
* Enabling `media` disables the `collapsible` feature.
|
200
|
+
*/
|
201
|
+
media: PropTypes.oneOfType([PropTypes.shape({
|
202
|
+
render: PropTypes.func
|
203
|
+
}), PropTypes.shape({
|
204
|
+
filePaths: PropTypes.string
|
205
|
+
})]),
|
206
|
+
/**
|
207
|
+
* Set to `true` to arrange the information in a format
|
208
|
+
* that is easier to read in a limited space.
|
209
|
+
*/
|
210
|
+
narrow: PropTypes.bool,
|
211
|
+
/**
|
212
|
+
* Function to call when the tertiary button is clicked.
|
213
|
+
*/
|
214
|
+
onClick: PropTypes.func,
|
215
|
+
/**
|
216
|
+
* Function to call when the InlineTip is closed via the "X" button.
|
217
|
+
*/
|
218
|
+
onClose: PropTypes.func,
|
219
|
+
/**
|
220
|
+
* Defining the label will show a the tertiary button with the crossroads icon.
|
221
|
+
* You will still need to define the `onClose` method to trigger a callback.
|
222
|
+
*/
|
223
|
+
tertiaryButtonLabel: PropTypes.string,
|
224
|
+
/**
|
225
|
+
* The title of the InlineTip.
|
226
|
+
*/
|
227
|
+
title: PropTypes.string.isRequired
|
228
|
+
};
|
@@ -0,0 +1,89 @@
|
|
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-components-react';
|
18
|
+
import { getDevtoolsProps } from '../../global/js/utils/devtools';
|
19
|
+
import { pkg /*, carbon */ } from '../../settings';
|
20
|
+
|
21
|
+
// Carbon and package components we use.
|
22
|
+
/* TODO: @import(s) of carbon components and other package components. */
|
23
|
+
|
24
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
25
|
+
var blockClass = "".concat(pkg.prefix, "--inline-tip__button");
|
26
|
+
var componentName = 'InlineTipButton';
|
27
|
+
|
28
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
29
|
+
|
30
|
+
// Default values can be included here and then assigned to the prop params,
|
31
|
+
// e.g. prop = defaults.prop,
|
32
|
+
// This gathers default values together neatly and ensures non-primitive
|
33
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
34
|
+
// Note that default values are not required for props that are 'required',
|
35
|
+
// nor for props where the component can apply undefined values reasonably.
|
36
|
+
// Default values should be provided when the component needs to make a choice
|
37
|
+
// or assumption when a prop is not supplied.
|
38
|
+
|
39
|
+
// Default values for props
|
40
|
+
// const defaults = {
|
41
|
+
// /* TODO: add defaults for relevant props if needed */
|
42
|
+
// };
|
43
|
+
|
44
|
+
/**
|
45
|
+
* TODO: A description of the component.
|
46
|
+
*/
|
47
|
+
export var InlineTipButton = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
48
|
+
var children = _ref.children,
|
49
|
+
className = _ref.className,
|
50
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
51
|
+
return /*#__PURE__*/React.createElement(Button, _extends({}, rest, {
|
52
|
+
className: cx(blockClass,
|
53
|
+
// Apply the block class to the main HTML element
|
54
|
+
className,
|
55
|
+
// Apply any supplied class names to the main HTML element.
|
56
|
+
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
57
|
+
{
|
58
|
+
// switched classes dependant on props or state
|
59
|
+
// example: [`${blockClass}__here-if-small`]: size === 'sm',
|
60
|
+
}),
|
61
|
+
ref: ref
|
62
|
+
}, getDevtoolsProps(componentName), {
|
63
|
+
size: "md",
|
64
|
+
kind: "ghost"
|
65
|
+
}), children);
|
66
|
+
});
|
67
|
+
|
68
|
+
// Return a placeholder if not released and not enabled by feature flag
|
69
|
+
InlineTipButton = pkg.checkComponentEnabled(InlineTipButton, componentName);
|
70
|
+
|
71
|
+
// The display name of the component, used by React. Note that displayName
|
72
|
+
// is used in preference to relying on function.name.
|
73
|
+
InlineTipButton.displayName = componentName;
|
74
|
+
|
75
|
+
// The types and DocGen commentary for the component props,
|
76
|
+
// in alphabetical order (for consistency).
|
77
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
78
|
+
InlineTipButton.propTypes = {
|
79
|
+
/**
|
80
|
+
* Provide the contents of the InlineTipButton.
|
81
|
+
*/
|
82
|
+
children: PropTypes.node.isRequired,
|
83
|
+
/**
|
84
|
+
* Provide an optional class to be applied to the containing node.
|
85
|
+
*/
|
86
|
+
className: PropTypes.string
|
87
|
+
|
88
|
+
/* TODO: add types and DocGen for all props. */
|
89
|
+
};
|
@@ -0,0 +1,89 @@
|
|
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 { Launch16 } from '@carbon/icons-react';
|
18
|
+
import { Link } from 'carbon-components-react';
|
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, "--inline-tip__link");
|
27
|
+
var componentName = 'InlineTipLink';
|
28
|
+
|
29
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
30
|
+
|
31
|
+
// Default values can be included here and then assigned to the prop params,
|
32
|
+
// e.g. prop = defaults.prop,
|
33
|
+
// This gathers default values together neatly and ensures non-primitive
|
34
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
35
|
+
// Note that default values are not required for props that are 'required',
|
36
|
+
// nor for props where the component can apply undefined values reasonably.
|
37
|
+
// Default values should be provided when the component needs to make a choice
|
38
|
+
// or assumption when a prop is not supplied.
|
39
|
+
|
40
|
+
// Default values for props
|
41
|
+
// const defaults = {
|
42
|
+
// /* TODO: add defaults for relevant props if needed */
|
43
|
+
// };
|
44
|
+
|
45
|
+
/**
|
46
|
+
* TODO: A description of the component.
|
47
|
+
*/
|
48
|
+
export var InlineTipLink = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
49
|
+
var children = _ref.children,
|
50
|
+
className = _ref.className,
|
51
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
52
|
+
return /*#__PURE__*/React.createElement(Link, _extends({}, rest, {
|
53
|
+
className: cx(blockClass,
|
54
|
+
// Apply the block class to the main HTML element
|
55
|
+
className,
|
56
|
+
// Apply any supplied class names to the main HTML element.
|
57
|
+
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
58
|
+
{
|
59
|
+
// switched classes dependant on props or state
|
60
|
+
// example: [`${blockClass}__here-if-small`]: size === 'sm',
|
61
|
+
}),
|
62
|
+
ref: ref
|
63
|
+
}, getDevtoolsProps(componentName), {
|
64
|
+
renderIcon: Launch16
|
65
|
+
}), children);
|
66
|
+
});
|
67
|
+
|
68
|
+
// Return a placeholder if not released and not enabled by feature flag
|
69
|
+
InlineTipLink = pkg.checkComponentEnabled(InlineTipLink, componentName);
|
70
|
+
|
71
|
+
// The display name of the component, used by React. Note that displayName
|
72
|
+
// is used in preference to relying on function.name.
|
73
|
+
InlineTipLink.displayName = componentName;
|
74
|
+
|
75
|
+
// The types and DocGen commentary for the component props,
|
76
|
+
// in alphabetical order (for consistency).
|
77
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
78
|
+
InlineTipLink.propTypes = {
|
79
|
+
/**
|
80
|
+
* Provide the contents of the InlineTipLink.
|
81
|
+
*/
|
82
|
+
children: PropTypes.node.isRequired,
|
83
|
+
/**
|
84
|
+
* Provide an optional class to be applied to the containing node.
|
85
|
+
*/
|
86
|
+
className: PropTypes.string
|
87
|
+
|
88
|
+
/* TODO: add types and DocGen for all props. */
|
89
|
+
};
|
@@ -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 ? 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,164 @@
|
|
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 /*, carbon */ } 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 can be included here and then assigned to the prop params,
|
31
|
+
// e.g. prop = defaults.prop,
|
32
|
+
// This gathers default values together neatly and ensures non-primitive
|
33
|
+
// values are initialized early to avoid react making unnecessary re-renders.
|
34
|
+
// Note that default values are not required for props that are 'required',
|
35
|
+
// nor for props where the component can apply undefined values reasonably.
|
36
|
+
// Default values should be provided when the component needs to make a choice
|
37
|
+
// or assumption when a prop is not supplied.
|
38
|
+
|
39
|
+
// Default values for props
|
40
|
+
var defaults = {
|
41
|
+
playStep: 0
|
42
|
+
};
|
43
|
+
|
44
|
+
/**
|
45
|
+
* The SteppedAnimatedMedia is a Novice to Pro internal component and is not intended for general use.
|
46
|
+
*/
|
47
|
+
export var SteppedAnimatedMedia = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
48
|
+
var className = _ref.className,
|
49
|
+
_ref$playStep = _ref.playStep,
|
50
|
+
playStep = _ref$playStep === void 0 ? defaults.playStep : _ref$playStep,
|
51
|
+
filePaths = _ref.filePaths,
|
52
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
53
|
+
var _useState = useState([]),
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
55
|
+
jsonData = _useState2[0],
|
56
|
+
setJsonData = _useState2[1];
|
57
|
+
var animRef = useRef();
|
58
|
+
var backupRef = useRef();
|
59
|
+
var localRef = ref !== null && ref !== void 0 ? ref : backupRef;
|
60
|
+
// load animation source
|
61
|
+
useEffect(function () {
|
62
|
+
var isJsonFile = function isJsonFile(filePath) {
|
63
|
+
return filePath.includes('.json');
|
64
|
+
};
|
65
|
+
function loadArtifact() {
|
66
|
+
return _loadArtifact.apply(this, arguments);
|
67
|
+
}
|
68
|
+
function _loadArtifact() {
|
69
|
+
_loadArtifact = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
70
|
+
var allJsonArtifacts, rawResponse, jsonResponse, fileData;
|
71
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
72
|
+
while (1) switch (_context.prev = _context.next) {
|
73
|
+
case 0:
|
74
|
+
if (!(filePaths && filePaths.every(isJsonFile))) {
|
75
|
+
_context.next = 10;
|
76
|
+
break;
|
77
|
+
}
|
78
|
+
allJsonArtifacts = filePaths.map(function (el) {
|
79
|
+
return fetch(el);
|
80
|
+
});
|
81
|
+
_context.next = 4;
|
82
|
+
return Promise.all(allJsonArtifacts);
|
83
|
+
case 4:
|
84
|
+
rawResponse = _context.sent;
|
85
|
+
jsonResponse = rawResponse.map(function (el) {
|
86
|
+
return el.json();
|
87
|
+
});
|
88
|
+
_context.next = 8;
|
89
|
+
return Promise.all(jsonResponse);
|
90
|
+
case 8:
|
91
|
+
fileData = _context.sent;
|
92
|
+
setJsonData(fileData);
|
93
|
+
case 10:
|
94
|
+
case "end":
|
95
|
+
return _context.stop();
|
96
|
+
}
|
97
|
+
}, _callee);
|
98
|
+
}));
|
99
|
+
return _loadArtifact.apply(this, arguments);
|
100
|
+
}
|
101
|
+
loadArtifact();
|
102
|
+
}, [filePaths]);
|
103
|
+
useEffect(function () {
|
104
|
+
var _window;
|
105
|
+
var prefersReducedMotion = (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : true;
|
106
|
+
if (localRef.current) {
|
107
|
+
var _animRef$current, _animRef$current2, _animRef$current3;
|
108
|
+
(_animRef$current = animRef.current) === null || _animRef$current === void 0 ? void 0 : _animRef$current.destroy();
|
109
|
+
animRef.current = lottie.loadAnimation({
|
110
|
+
container: localRef.current,
|
111
|
+
renderer: 'svg',
|
112
|
+
animationData: jsonData[clamp(playStep, 0, jsonData.length - 1)],
|
113
|
+
loop: false,
|
114
|
+
autoplay: false,
|
115
|
+
rendererSettings: {
|
116
|
+
preserveAspectRatio: 'xMidYMid slice'
|
117
|
+
}
|
118
|
+
});
|
119
|
+
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);
|
120
|
+
}
|
121
|
+
return function () {
|
122
|
+
var _animRef$current4;
|
123
|
+
return (_animRef$current4 = animRef.current) === null || _animRef$current4 === void 0 ? void 0 : _animRef$current4.destroy();
|
124
|
+
};
|
125
|
+
}, [jsonData, localRef, playStep]);
|
126
|
+
if (!jsonData) {
|
127
|
+
return null;
|
128
|
+
}
|
129
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, rest, {
|
130
|
+
className: cx(blockClass,
|
131
|
+
// Apply the block class to the main HTML element
|
132
|
+
className,
|
133
|
+
// Apply any supplied class names to the main HTML element.
|
134
|
+
// example: `${blockClass}__template-string-class-${kind}-n-${size}`,
|
135
|
+
{
|
136
|
+
// switched classes dependant on props or state
|
137
|
+
// example: [`${blockClass}__here-if-small`]: size === 'sm',
|
138
|
+
}),
|
139
|
+
role: "img",
|
140
|
+
ref: localRef
|
141
|
+
}, getDevtoolsProps(componentName)));
|
142
|
+
});
|
143
|
+
|
144
|
+
// The display name of the component, used by React. Note that displayName
|
145
|
+
// is used in preference to relying on function.name.
|
146
|
+
SteppedAnimatedMedia.displayName = componentName;
|
147
|
+
|
148
|
+
// The types and DocGen commentary for the component props,
|
149
|
+
// in alphabetical order (for consistency).
|
150
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
151
|
+
SteppedAnimatedMedia.propTypes = {
|
152
|
+
/**
|
153
|
+
* Optional class name for this component.
|
154
|
+
*/
|
155
|
+
className: PropTypes.string,
|
156
|
+
/**
|
157
|
+
* The file path(s) to json formatted Lottie animation files.
|
158
|
+
*/
|
159
|
+
filePaths: PropTypes.arrayOf(PropTypes.string).isRequired,
|
160
|
+
/**
|
161
|
+
* Which animation step from the filePaths array to play.
|
162
|
+
*/
|
163
|
+
playStep: PropTypes.number
|
164
|
+
};
|
@@ -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 };
|
@@ -251,7 +251,8 @@ export var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
251
251
|
actions: actions,
|
252
252
|
buttonSize: size === 'wide' ? 'xl' : null,
|
253
253
|
className: "".concat(bc, "__buttons"),
|
254
|
-
size: size === 'wide' ? 'max' : 'lg'
|
254
|
+
size: size === 'wide' ? 'max' : 'lg',
|
255
|
+
"aria-hidden": !open
|
255
256
|
})))), /*#__PURE__*/React.createElement("div", {
|
256
257
|
className: "".concat(bc, "__resize-detector"),
|
257
258
|
ref: resizer
|
package/es/components/index.js
CHANGED
@@ -37,11 +37,13 @@ export { WebTerminal, WebTerminalContentWrapper, useWebTerminal, WebTerminalProv
|
|
37
37
|
export { EditSidePanel } from './EditSidePanel';
|
38
38
|
export { OptionsTile } from './OptionsTile';
|
39
39
|
export { DataSpreadsheet } from './DataSpreadsheet';
|
40
|
-
export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnCenterAlign, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle, useColumnOrder, useInlineEdit, useEditableCell, useFiltering, getAutoSizedColumnWidth } from './Datagrid';
|
40
|
+
export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows, useExpandedRow, useOnRowClick, useSortableColumns, useRowIsMouseOver, useColumnCenterAlign, useColumnRightAlign, useDisableSelectRows, useStickyColumn, useActionsColumn, useCustomizeColumns, useSelectAllWithToggle, useColumnOrder, useInlineEdit, useEditableCell, useFiltering, getAutoSizedColumnWidth, useFilterContext } from './Datagrid';
|
41
41
|
export { EditTearsheet } from './EditTearsheet';
|
42
42
|
export { EditTearsheetNarrow } from './EditTearsheetNarrow';
|
43
43
|
export { EditFullPage } from './EditFullPage';
|
44
44
|
export { EditUpdateCards } from './EditUpdateCards';
|
45
45
|
export { InlineEdit } from './InlineEdit';
|
46
46
|
export { EditInPlace } from './EditInPlace';
|
47
|
-
export {
|
47
|
+
export { Guidebanner } from './Guidebanner';
|
48
|
+
export { NonLinearReading } from './NonLinearReading';
|
49
|
+
export { InlineTip } from './InlineTip';
|