@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,224 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.InlineTip = void 0;
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
12
|
+
var _react = _interopRequireWildcard(require("react"));
|
13
|
+
var _icons = require("@carbon/react/icons");
|
14
|
+
var _react2 = require("@carbon/react");
|
15
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
16
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
17
|
+
var _utils = require("./utils");
|
18
|
+
var _SteppedAnimatedMedia = require("../SteppedAnimatedMedia");
|
19
|
+
var _devtools = require("../../global/js/utils/devtools");
|
20
|
+
var _uuidv = _interopRequireDefault(require("../../global/js/utils/uuidv4"));
|
21
|
+
var _settings = require("../../settings");
|
22
|
+
var _excluded = ["children", "className", "closeIconDescription", "collapsible", "collapseButtonLabel", "expandButtonLabel", "narrow", "onClick", "onClose", "tertiaryButtonLabel", "action", "title", "media"];
|
23
|
+
/**
|
24
|
+
* Copyright IBM Corp. 2023, 2023
|
25
|
+
*
|
26
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
27
|
+
* LICENSE file in the root directory of this source tree.
|
28
|
+
*/
|
29
|
+
// Import portions of React that are needed.
|
30
|
+
// Other standard imports.
|
31
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
32
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
33
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
34
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--inline-tip");
|
35
|
+
var componentName = 'InlineTip';
|
36
|
+
|
37
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
38
|
+
|
39
|
+
// Default values for props
|
40
|
+
var defaults = {
|
41
|
+
closeIconDescription: 'Close',
|
42
|
+
collapsible: false,
|
43
|
+
collapseButtonLabel: 'Read less',
|
44
|
+
expandButtonLabel: 'Read more',
|
45
|
+
narrow: false,
|
46
|
+
onClick: function onClick() {},
|
47
|
+
onClose: function onClose() {}
|
48
|
+
};
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Inline tips are messages embedded within other components that
|
52
|
+
* provide an ambient way to deliver learning content without
|
53
|
+
* distracting the user from their flow.
|
54
|
+
*/
|
55
|
+
var InlineTip = exports.InlineTip = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
56
|
+
var children = _ref.children,
|
57
|
+
className = _ref.className,
|
58
|
+
_ref$closeIconDescrip = _ref.closeIconDescription,
|
59
|
+
closeIconDescription = _ref$closeIconDescrip === void 0 ? defaults.closeIconDescription : _ref$closeIconDescrip,
|
60
|
+
_ref$collapsible = _ref.collapsible,
|
61
|
+
collapsible = _ref$collapsible === void 0 ? defaults.collapsible : _ref$collapsible,
|
62
|
+
_ref$collapseButtonLa = _ref.collapseButtonLabel,
|
63
|
+
collapseButtonLabel = _ref$collapseButtonLa === void 0 ? defaults.collapseButtonLabel : _ref$collapseButtonLa,
|
64
|
+
_ref$expandButtonLabe = _ref.expandButtonLabel,
|
65
|
+
expandButtonLabel = _ref$expandButtonLabe === void 0 ? defaults.expandButtonLabel : _ref$expandButtonLabe,
|
66
|
+
_ref$narrow = _ref.narrow,
|
67
|
+
narrow = _ref$narrow === void 0 ? defaults.narrow : _ref$narrow,
|
68
|
+
onClick = _ref.onClick,
|
69
|
+
onClose = _ref.onClose,
|
70
|
+
tertiaryButtonLabel = _ref.tertiaryButtonLabel,
|
71
|
+
action = _ref.action,
|
72
|
+
_ref$title = _ref.title,
|
73
|
+
title = _ref$title === void 0 ? defaults.title : _ref$title,
|
74
|
+
media = _ref.media,
|
75
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
76
|
+
var _useState = (0, _react.useState)(collapsible),
|
77
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
78
|
+
isCollapsed = _useState2[0],
|
79
|
+
setIsCollapsed = _useState2[1];
|
80
|
+
var labelId = (0, _react.useRef)((0, _uuidv.default)()).current;
|
81
|
+
var previewText = (0, _react.useMemo)(function () {
|
82
|
+
return (0, _utils.getComponentText)(_react.default.Children.toArray(children));
|
83
|
+
}, [children]);
|
84
|
+
var childrenToRender = children;
|
85
|
+
if (!media && collapsible && isCollapsed) {
|
86
|
+
childrenToRender = /*#__PURE__*/_react.default.createElement("p", {
|
87
|
+
className: "".concat(blockClass, "__preview-text")
|
88
|
+
}, previewText);
|
89
|
+
}
|
90
|
+
|
91
|
+
// If `collapsible` is changed after initial render...
|
92
|
+
(0, _react.useEffect)(function () {
|
93
|
+
setIsCollapsed(collapsible);
|
94
|
+
}, [collapsible]);
|
95
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
96
|
+
"aria-labelledby": labelId,
|
97
|
+
className: (0, _classnames.default)(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]),
|
98
|
+
ref: ref,
|
99
|
+
role: "complementary"
|
100
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement("div", {
|
101
|
+
className: "".concat(blockClass, "__close-icon-wrapper")
|
102
|
+
}, /*#__PURE__*/_react.default.createElement(_react2.IconButton, {
|
103
|
+
className: "".concat(blockClass, "__close-icon"),
|
104
|
+
kind: "ghost",
|
105
|
+
label: closeIconDescription,
|
106
|
+
onClick: onClose,
|
107
|
+
size: "lg"
|
108
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.Close, {
|
109
|
+
size: 16
|
110
|
+
}))), (!media && narrow || !narrow) && /*#__PURE__*/_react.default.createElement("div", {
|
111
|
+
className: "".concat(blockClass, "__icon-idea"),
|
112
|
+
tabIndex: -1
|
113
|
+
}, /*#__PURE__*/_react.default.createElement(_icons.Idea, {
|
114
|
+
size: 16
|
115
|
+
})), /*#__PURE__*/_react.default.createElement("div", {
|
116
|
+
className: "".concat(blockClass, "__content")
|
117
|
+
}, /*#__PURE__*/_react.default.createElement("h6", {
|
118
|
+
id: labelId,
|
119
|
+
className: "".concat(blockClass, "__title")
|
120
|
+
}, title), /*#__PURE__*/_react.default.createElement("section", {
|
121
|
+
className: "".concat(blockClass, "__body")
|
122
|
+
}, childrenToRender, action && (!collapsible || collapsible && !isCollapsed) && /*#__PURE__*/_react.default.createElement("div", {
|
123
|
+
className: "".concat(blockClass, "__secondary-btn")
|
124
|
+
}, action)), (collapsible || tertiaryButtonLabel) && /*#__PURE__*/_react.default.createElement("footer", {
|
125
|
+
className: "".concat(blockClass, "__footer")
|
126
|
+
}, collapsible && !media && /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
127
|
+
className: "".concat(blockClass, "__toggle-btn"),
|
128
|
+
kind: "ghost",
|
129
|
+
size: "md",
|
130
|
+
onClick: function onClick() {
|
131
|
+
setIsCollapsed(function (prevState) {
|
132
|
+
return !prevState;
|
133
|
+
});
|
134
|
+
}
|
135
|
+
}, isCollapsed ? expandButtonLabel : collapseButtonLabel), tertiaryButtonLabel && /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
136
|
+
className: "".concat(blockClass, "__close-btn"),
|
137
|
+
size: "md",
|
138
|
+
onClick: onClick,
|
139
|
+
kind: "tertiary",
|
140
|
+
renderIcon: function renderIcon() {
|
141
|
+
return /*#__PURE__*/_react.default.createElement(_icons.Crossroads, {
|
142
|
+
size: 16
|
143
|
+
});
|
144
|
+
}
|
145
|
+
}, tertiaryButtonLabel))), media && (media.render ? /*#__PURE__*/_react.default.createElement("div", {
|
146
|
+
className: "".concat(blockClass, "__media")
|
147
|
+
}, media.render()) : /*#__PURE__*/_react.default.createElement(_SteppedAnimatedMedia.SteppedAnimatedMedia, {
|
148
|
+
className: "".concat(blockClass, "__media"),
|
149
|
+
filePaths: media.filePaths
|
150
|
+
})));
|
151
|
+
});
|
152
|
+
exports.InlineTip = InlineTip = _settings.pkg.checkComponentEnabled(InlineTip, componentName);
|
153
|
+
InlineTip.displayName = componentName;
|
154
|
+
InlineTip.propTypes = {
|
155
|
+
/**
|
156
|
+
* Optional "call to action" ghost button or link that can appear
|
157
|
+
* directly below the content. This component comes with pre-styled
|
158
|
+
* elements available to use: `InlineTipLink` and `InlineTipButton`.
|
159
|
+
*/
|
160
|
+
action: _propTypes.default.node,
|
161
|
+
/**
|
162
|
+
* Provide the contents of the InlineTip.
|
163
|
+
*/
|
164
|
+
children: _propTypes.default.node.isRequired,
|
165
|
+
/**
|
166
|
+
* Provide an optional class to be applied to the containing node.
|
167
|
+
*/
|
168
|
+
className: _propTypes.default.string,
|
169
|
+
/**
|
170
|
+
* Tooltip text and aria label for the Close button icon.
|
171
|
+
*/
|
172
|
+
closeIconDescription: _propTypes.default.string,
|
173
|
+
/**
|
174
|
+
* The label for the collapse button.
|
175
|
+
* This button is not visible if `media` is specified.
|
176
|
+
*/
|
177
|
+
collapseButtonLabel: _propTypes.default.string,
|
178
|
+
/**
|
179
|
+
* If set to `true`, it will truncate the body text to
|
180
|
+
* one line and expose an expand/collapse button toggle.
|
181
|
+
*
|
182
|
+
* This feature is disabled if `media` is specified.
|
183
|
+
*/
|
184
|
+
collapsible: _propTypes.default.bool,
|
185
|
+
/**
|
186
|
+
* The label for the expand button.
|
187
|
+
* This button is not visible if `media` is specified.
|
188
|
+
*/
|
189
|
+
expandButtonLabel: _propTypes.default.string,
|
190
|
+
/**
|
191
|
+
* The object describing an image in one of two shapes.
|
192
|
+
* - If a single media element is required, use `{render}`.
|
193
|
+
* - If a stepped animation is required, use `{filePaths}`.
|
194
|
+
*
|
195
|
+
* Enabling `media` disables the `collapsible` feature.
|
196
|
+
*/
|
197
|
+
media: _propTypes.default.oneOfType([_propTypes.default.shape({
|
198
|
+
render: _propTypes.default.func
|
199
|
+
}), _propTypes.default.shape({
|
200
|
+
filePaths: _propTypes.default.string
|
201
|
+
})]),
|
202
|
+
/**
|
203
|
+
* Set to `true` to arrange the information in a format
|
204
|
+
* that is easier to read in a limited space.
|
205
|
+
*/
|
206
|
+
narrow: _propTypes.default.bool,
|
207
|
+
/**
|
208
|
+
* Function to call when the tertiary button is clicked.
|
209
|
+
*/
|
210
|
+
onClick: _propTypes.default.func,
|
211
|
+
/**
|
212
|
+
* Function to call when the InlineTip is closed via the "X" button.
|
213
|
+
*/
|
214
|
+
onClose: _propTypes.default.func,
|
215
|
+
/**
|
216
|
+
* Defining the label will show a the tertiary button with the crossroads icon.
|
217
|
+
* You will still need to define the `onClose` method to trigger a callback.
|
218
|
+
*/
|
219
|
+
tertiaryButtonLabel: _propTypes.default.string,
|
220
|
+
/**
|
221
|
+
* The title of the InlineTip.
|
222
|
+
*/
|
223
|
+
title: _propTypes.default.string.isRequired
|
224
|
+
};
|
@@ -0,0 +1,57 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.InlineTipButton = void 0;
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
13
|
+
var _react2 = require("@carbon/react");
|
14
|
+
var _devtools = require("../../global/js/utils/devtools");
|
15
|
+
var _settings = require("../../settings");
|
16
|
+
var _excluded = ["children", "className"];
|
17
|
+
/**
|
18
|
+
* Copyright IBM Corp. 2023, 2023
|
19
|
+
*
|
20
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
21
|
+
* LICENSE file in the root directory of this source tree.
|
22
|
+
*/
|
23
|
+
// Import portions of React that are needed.
|
24
|
+
// Other standard imports.
|
25
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
26
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--inline-tip__button");
|
27
|
+
var componentName = 'InlineTipButton';
|
28
|
+
|
29
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
30
|
+
|
31
|
+
/**
|
32
|
+
* This is a standard Carbon button, styled specifically for use inside InlineTip.
|
33
|
+
*/
|
34
|
+
var InlineTipButton = exports.InlineTipButton = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
35
|
+
var children = _ref.children,
|
36
|
+
className = _ref.className,
|
37
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
38
|
+
return /*#__PURE__*/_react.default.createElement(_react2.Button, (0, _extends2.default)({}, rest, {
|
39
|
+
className: (0, _classnames.default)(blockClass, className),
|
40
|
+
ref: ref
|
41
|
+
}, (0, _devtools.getDevtoolsProps)(componentName), {
|
42
|
+
size: "md",
|
43
|
+
kind: "ghost"
|
44
|
+
}), children);
|
45
|
+
});
|
46
|
+
InlineTipButton.propTypes = {
|
47
|
+
/**
|
48
|
+
* Provide the contents of the InlineTipButton.
|
49
|
+
*/
|
50
|
+
children: _propTypes.default.node.isRequired,
|
51
|
+
/**
|
52
|
+
* Provide an optional class to be applied to the containing node.
|
53
|
+
*/
|
54
|
+
className: _propTypes.default.string
|
55
|
+
|
56
|
+
/* TODO: add types and DocGen for all props. */
|
57
|
+
};
|
@@ -0,0 +1,61 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.InlineTipLink = void 0;
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
13
|
+
var _icons = require("@carbon/react/icons");
|
14
|
+
var _react2 = require("@carbon/react");
|
15
|
+
var _devtools = require("../../global/js/utils/devtools");
|
16
|
+
var _settings = require("../../settings");
|
17
|
+
var _excluded = ["children", "className"];
|
18
|
+
/**
|
19
|
+
* Copyright IBM Corp. 2023, 2023
|
20
|
+
*
|
21
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
22
|
+
* LICENSE file in the root directory of this source tree.
|
23
|
+
*/
|
24
|
+
// Import portions of React that are needed.
|
25
|
+
// Other standard imports.
|
26
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
27
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--inline-tip__link");
|
28
|
+
var componentName = 'InlineTipLink';
|
29
|
+
|
30
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
31
|
+
|
32
|
+
/**
|
33
|
+
* This is a standard Carbon link, styled specifically for use inside InlineTip.
|
34
|
+
*/
|
35
|
+
var InlineTipLink = exports.InlineTipLink = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
36
|
+
var children = _ref.children,
|
37
|
+
className = _ref.className,
|
38
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_react2.Link, (0, _extends2.default)({}, rest, {
|
40
|
+
className: (0, _classnames.default)(blockClass, className),
|
41
|
+
ref: ref
|
42
|
+
}, (0, _devtools.getDevtoolsProps)(componentName), {
|
43
|
+
renderIcon: function renderIcon() {
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_icons.Launch, {
|
45
|
+
size: 16
|
46
|
+
});
|
47
|
+
}
|
48
|
+
}), children);
|
49
|
+
});
|
50
|
+
InlineTipLink.propTypes = {
|
51
|
+
/**
|
52
|
+
* Provide the contents of the InlineTipLink.
|
53
|
+
*/
|
54
|
+
children: _propTypes.default.node.isRequired,
|
55
|
+
/**
|
56
|
+
* Provide an optional class to be applied to the containing node.
|
57
|
+
*/
|
58
|
+
className: _propTypes.default.string
|
59
|
+
|
60
|
+
/* TODO: add types and DocGen for all props. */
|
61
|
+
};
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "InlineTip", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _InlineTip.InlineTip;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
Object.defineProperty(exports, "InlineTipButton", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function get() {
|
15
|
+
return _InlineTipButton.InlineTipButton;
|
16
|
+
}
|
17
|
+
});
|
18
|
+
Object.defineProperty(exports, "InlineTipLink", {
|
19
|
+
enumerable: true,
|
20
|
+
get: function get() {
|
21
|
+
return _InlineTipLink.InlineTipLink;
|
22
|
+
}
|
23
|
+
});
|
24
|
+
var _InlineTip = require("./InlineTip");
|
25
|
+
var _InlineTipButton = require("./InlineTipButton");
|
26
|
+
var _InlineTipLink = require("./InlineTipLink");
|
@@ -0,0 +1,43 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.getComponentText = void 0;
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
9
|
+
/**
|
10
|
+
* Copyright IBM Corp. 2023, 2023
|
11
|
+
*
|
12
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
14
|
+
*/
|
15
|
+
|
16
|
+
var getComponentText = exports.getComponentText = function getComponentText(reactNode) {
|
17
|
+
var _reactNode$props;
|
18
|
+
var tmpChildren = (reactNode === null || reactNode === void 0 || (_reactNode$props = reactNode.props) === null || _reactNode$props === void 0 ? void 0 : _reactNode$props.children) || undefined;
|
19
|
+
if (Array.isArray(reactNode)) {
|
20
|
+
var joinedNodes = [];
|
21
|
+
reactNode.forEach(function (node) {
|
22
|
+
if ((0, _typeof2.default)(node) === 'object') {
|
23
|
+
joinedNodes.push(getComponentText(node));
|
24
|
+
} else if (typeof node === 'string') {
|
25
|
+
joinedNodes.push(node);
|
26
|
+
}
|
27
|
+
});
|
28
|
+
return joinedNodes.join(' ');
|
29
|
+
}
|
30
|
+
if (tmpChildren === undefined) {
|
31
|
+
if (typeof reactNode === 'string') {
|
32
|
+
return reactNode;
|
33
|
+
} else {
|
34
|
+
return ' ';
|
35
|
+
}
|
36
|
+
}
|
37
|
+
if ((0, _typeof2.default)(tmpChildren) === 'object') {
|
38
|
+
return getComponentText(reactNode.props.children);
|
39
|
+
}
|
40
|
+
if (typeof tmpChildren === 'string') {
|
41
|
+
return reactNode.props.children;
|
42
|
+
}
|
43
|
+
};
|
@@ -0,0 +1,21 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.default = void 0;
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
10
|
+
var _StoryDocsPage = require("../../global/js/utils/StoryDocsPage");
|
11
|
+
var stories = _interopRequireWildcard(require("./SteppedAnimatedMedia.stories"));
|
12
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
13
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
14
|
+
var DocsPage = function DocsPage() {
|
15
|
+
return /*#__PURE__*/_react.default.createElement(_StoryDocsPage.StoryDocsPage, {
|
16
|
+
blocks: [{
|
17
|
+
story: stories.steppedAnimatedMedia
|
18
|
+
}]
|
19
|
+
});
|
20
|
+
};
|
21
|
+
var _default = exports.default = DocsPage;
|
@@ -0,0 +1,148 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
exports.SteppedAnimatedMedia = void 0;
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
11
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
13
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
15
|
+
var _lottieWeb = _interopRequireDefault(require("lottie-web"));
|
16
|
+
var _clamp = _interopRequireDefault(require("lodash/clamp"));
|
17
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
18
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
19
|
+
var _devtools = require("../../global/js/utils/devtools");
|
20
|
+
var _settings = require("../../settings");
|
21
|
+
var _excluded = ["className", "playStep", "filePaths"];
|
22
|
+
/**
|
23
|
+
* Copyright IBM Corp. 2023, 2023
|
24
|
+
*
|
25
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
26
|
+
* LICENSE file in the root directory of this source tree.
|
27
|
+
*/
|
28
|
+
// Import portions of React that are needed.
|
29
|
+
// Other standard imports.
|
30
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
31
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
32
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
33
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--stepped-animated-media");
|
34
|
+
var componentName = 'SteppedAnimatedMedia';
|
35
|
+
|
36
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
37
|
+
|
38
|
+
// Default values for props
|
39
|
+
var defaults = {
|
40
|
+
playStep: 0
|
41
|
+
};
|
42
|
+
|
43
|
+
/**
|
44
|
+
* The SteppedAnimatedMedia is a Novice to Pro internal component and is not intended for general use.
|
45
|
+
*/
|
46
|
+
var SteppedAnimatedMedia = exports.SteppedAnimatedMedia = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
47
|
+
var className = _ref.className,
|
48
|
+
_ref$playStep = _ref.playStep,
|
49
|
+
playStep = _ref$playStep === void 0 ? defaults.playStep : _ref$playStep,
|
50
|
+
filePaths = _ref.filePaths,
|
51
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
52
|
+
var _useState = (0, _react.useState)([]),
|
53
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
54
|
+
jsonData = _useState2[0],
|
55
|
+
setJsonData = _useState2[1];
|
56
|
+
var animRef = (0, _react.useRef)();
|
57
|
+
var backupRef = (0, _react.useRef)();
|
58
|
+
var localRef = ref !== null && ref !== void 0 ? ref : backupRef;
|
59
|
+
// load animation source
|
60
|
+
(0, _react.useEffect)(function () {
|
61
|
+
var isJsonFile = function isJsonFile(filePath) {
|
62
|
+
return filePath.includes('.json');
|
63
|
+
};
|
64
|
+
function loadArtifact() {
|
65
|
+
return _loadArtifact.apply(this, arguments);
|
66
|
+
}
|
67
|
+
function _loadArtifact() {
|
68
|
+
_loadArtifact = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
69
|
+
var allJsonArtifacts, rawResponse, jsonResponse, fileData;
|
70
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
71
|
+
while (1) switch (_context.prev = _context.next) {
|
72
|
+
case 0:
|
73
|
+
if (!(filePaths && filePaths.every(isJsonFile))) {
|
74
|
+
_context.next = 10;
|
75
|
+
break;
|
76
|
+
}
|
77
|
+
allJsonArtifacts = filePaths.map(function (el) {
|
78
|
+
return fetch(el);
|
79
|
+
});
|
80
|
+
_context.next = 4;
|
81
|
+
return Promise.all(allJsonArtifacts);
|
82
|
+
case 4:
|
83
|
+
rawResponse = _context.sent;
|
84
|
+
jsonResponse = rawResponse.map(function (el) {
|
85
|
+
return el.json();
|
86
|
+
});
|
87
|
+
_context.next = 8;
|
88
|
+
return Promise.all(jsonResponse);
|
89
|
+
case 8:
|
90
|
+
fileData = _context.sent;
|
91
|
+
setJsonData(fileData);
|
92
|
+
case 10:
|
93
|
+
case "end":
|
94
|
+
return _context.stop();
|
95
|
+
}
|
96
|
+
}, _callee);
|
97
|
+
}));
|
98
|
+
return _loadArtifact.apply(this, arguments);
|
99
|
+
}
|
100
|
+
loadArtifact();
|
101
|
+
}, [filePaths]);
|
102
|
+
(0, _react.useEffect)(function () {
|
103
|
+
var _window;
|
104
|
+
var prefersReducedMotion = (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : true;
|
105
|
+
if (localRef.current) {
|
106
|
+
var _animRef$current, _animRef$current2, _animRef$current3;
|
107
|
+
(_animRef$current = animRef.current) === null || _animRef$current === void 0 || _animRef$current.destroy();
|
108
|
+
animRef.current = _lottieWeb.default.loadAnimation({
|
109
|
+
container: localRef.current,
|
110
|
+
renderer: 'svg',
|
111
|
+
animationData: jsonData[(0, _clamp.default)(playStep, 0, jsonData.length - 1)],
|
112
|
+
loop: false,
|
113
|
+
autoplay: false,
|
114
|
+
rendererSettings: {
|
115
|
+
preserveAspectRatio: 'xMidYMid slice'
|
116
|
+
}
|
117
|
+
});
|
118
|
+
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);
|
119
|
+
}
|
120
|
+
return function () {
|
121
|
+
var _animRef$current4;
|
122
|
+
return (_animRef$current4 = animRef.current) === null || _animRef$current4 === void 0 ? void 0 : _animRef$current4.destroy();
|
123
|
+
};
|
124
|
+
}, [jsonData, localRef, playStep]);
|
125
|
+
if (!jsonData) {
|
126
|
+
return null;
|
127
|
+
}
|
128
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, rest, {
|
129
|
+
className: (0, _classnames.default)(blockClass, className),
|
130
|
+
role: "img",
|
131
|
+
ref: localRef
|
132
|
+
}, (0, _devtools.getDevtoolsProps)(componentName)));
|
133
|
+
});
|
134
|
+
SteppedAnimatedMedia.displayName = componentName;
|
135
|
+
SteppedAnimatedMedia.propTypes = {
|
136
|
+
/**
|
137
|
+
* Optional class name for this component.
|
138
|
+
*/
|
139
|
+
className: _propTypes.default.string,
|
140
|
+
/**
|
141
|
+
* The file path(s) to json formatted Lottie animation files.
|
142
|
+
*/
|
143
|
+
filePaths: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
144
|
+
/**
|
145
|
+
* Which animation step from the filePaths array to play.
|
146
|
+
*/
|
147
|
+
playStep: _propTypes.default.number
|
148
|
+
};
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.HowACaseIsCreated3 = exports.HowACaseIsCreated2 = exports.HowACaseIsCreated1 = void 0;
|
7
|
+
var HowACaseIsCreated1 = exports.HowACaseIsCreated1 = new URL('./illustrations/how-a-case-is-created-1', import.meta.url).pathname;
|
8
|
+
var HowACaseIsCreated2 = exports.HowACaseIsCreated2 = new URL('./illustrations/how-a-case-is-created-2', import.meta.url).pathname;
|
9
|
+
var HowACaseIsCreated3 = exports.HowACaseIsCreated3 = new URL('./illustrations/how-a-case-is-created-3', import.meta.url).pathname;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "SteppedAnimatedMedia", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _SteppedAnimatedMedia.SteppedAnimatedMedia;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
var _SteppedAnimatedMedia = require("./SteppedAnimatedMedia");
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "2.
|
4
|
+
"version": "2.16.0",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -96,5 +96,5 @@
|
|
96
96
|
"react": "^16.8.6 || ^17.0.1 || ^18.2.0",
|
97
97
|
"react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
|
98
98
|
},
|
99
|
-
"gitHead": "
|
99
|
+
"gitHead": "ed97e8fd254f759b49c99165ded03c0105389b99"
|
100
100
|
}
|