@carbon/ibm-products 2.6.1 → 2.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +6368 -5849
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +3 -3
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +24 -23
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +2 -2
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +1428 -278
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +3 -3
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +1902 -1767
- 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/AddSelect/AddSelectRow.js +2 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +6 -7
- package/es/components/ButtonMenu/ButtonMenu.js +4 -0
- package/es/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +21 -28
- package/es/components/ComboButton/ComboButton.js +5 -0
- package/es/components/CreateTearsheet/CreateTearsheet.js +30 -14
- package/es/components/CreateTearsheet/CreateTearsheetStep.js +10 -4
- package/es/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +3 -0
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +1 -1
- package/es/components/Datagrid/Datagrid/Datagrid.js +12 -7
- package/es/components/Datagrid/Datagrid/DatagridContent.js +18 -14
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +128 -10
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +8 -14
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +1 -23
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +111 -0
- package/es/components/Datagrid/Datagrid.docs-page.js +6 -0
- package/es/components/Datagrid/useDatagrid.js +5 -2
- package/es/components/Datagrid/utils/DatagridActions.js +9 -10
- package/es/components/Datagrid/utils/getColTitle.js +25 -0
- package/es/components/NotificationsPanel/NotificationsPanel.js +8 -10
- package/es/components/OptionsTile/OptionsTile.js +2 -4
- package/es/components/PageHeader/PageHeaderUtils.js +10 -3
- package/es/components/TooltipTrigger/TooltipTrigger.js +62 -0
- package/es/components/TooltipTrigger/index.js +8 -0
- package/es/components/TooltipTrigger/useExample.js +49 -0
- package/es/components/UserProfileImage/UserProfileImage.js +7 -6
- package/es/global/js/hooks/useCreateComponentStepChange.js +98 -49
- package/es/global/js/hooks/useResizeObserver.js +19 -3
- package/es/global/js/hooks/useRetrieveStepData.js +1 -1
- package/es/global/js/utils/StoryDocsPage.js +0 -1
- package/es/global/js/utils/test-helper.js +97 -43
- package/es/settings.js +8 -2
- package/lib/components/AddSelect/AddSelectRow.js +2 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +5 -6
- package/lib/components/ButtonMenu/ButtonMenu.js +5 -1
- package/lib/components/ButtonSetWithOverflow/ButtonSetWithOverflow.js +20 -27
- package/lib/components/ComboButton/ComboButton.js +5 -0
- package/lib/components/CreateTearsheet/CreateTearsheet.js +30 -14
- package/lib/components/CreateTearsheet/CreateTearsheetStep.js +10 -4
- package/lib/components/CreateTearsheet/preview-components/MultiStepTearsheet.js +3 -0
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +1 -1
- package/lib/components/Datagrid/Datagrid/Datagrid.js +12 -7
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +17 -13
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +131 -10
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +7 -13
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +4 -26
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +122 -0
- package/lib/components/Datagrid/Datagrid.docs-page.js +6 -0
- package/lib/components/Datagrid/useDatagrid.js +5 -2
- package/lib/components/Datagrid/utils/DatagridActions.js +8 -9
- package/lib/components/Datagrid/utils/getColTitle.js +32 -0
- package/lib/components/NotificationsPanel/NotificationsPanel.js +8 -10
- package/lib/components/OptionsTile/OptionsTile.js +2 -4
- package/lib/components/PageHeader/PageHeaderUtils.js +10 -3
- package/lib/components/TooltipTrigger/TooltipTrigger.js +67 -0
- package/lib/components/TooltipTrigger/index.js +12 -0
- package/lib/components/TooltipTrigger/useExample.js +58 -0
- package/lib/components/UserProfileImage/UserProfileImage.js +6 -5
- package/lib/global/js/hooks/useCreateComponentStepChange.js +98 -49
- package/lib/global/js/hooks/useResizeObserver.js +19 -3
- package/lib/global/js/hooks/useRetrieveStepData.js +1 -1
- package/lib/global/js/utils/StoryDocsPage.js +0 -1
- package/lib/global/js/utils/test-helper.js +99 -44
- package/lib/settings.js +8 -2
- package/package.json +14 -14
- package/scss/components/APIKeyModal/_storybook-styles.scss +1 -1
- package/scss/components/AboutModal/_storybook-styles.scss +1 -1
- package/scss/components/ActionSet/_storybook-styles.scss +1 -1
- package/scss/components/CreateFullPage/_storybook-styles.scss +1 -1
- package/scss/components/CreateModal/_storybook-styles.scss +1 -1
- package/scss/components/CreateSidePanel/_storybook-styles.scss +1 -1
- package/scss/components/CreateTearsheet/_storybook-styles.scss +1 -1
- package/scss/components/CreateTearsheetNarrow/_storybook-styles.scss +1 -1
- package/scss/components/Datagrid/_storybook-styles.scss +1 -1
- package/scss/components/Datagrid/styles/_datagrid.scss +65 -0
- package/scss/components/EditSidePanel/_storybook-styles.scss +1 -1
- package/scss/components/EditTearsheet/_storybook-styles.scss +1 -1
- package/scss/components/EditTearsheetNarrow/_storybook-styles.scss +1 -1
- package/scss/components/EditUpdateCards/_storybook-styles.scss +1 -1
- package/scss/components/ExpressiveCard/_storybook-styles.scss +1 -1
- package/scss/components/NotificationsPanel/_storybook-styles.scss +1 -1
- package/scss/components/OptionsTile/_storybook-styles.scss +1 -1
- package/scss/components/PageHeader/_page-header.scss +8 -4
- package/scss/components/Tearsheet/_storybook-styles.scss +1 -1
- package/scss/components/TooltipTrigger/_index-with-carbon.scss +8 -0
- package/scss/components/TooltipTrigger/_index.scss +8 -0
- package/scss/components/TooltipTrigger/_storybook-styles.scss +6 -0
- package/scss/components/TooltipTrigger/_tooltip-trigger.scss +29 -0
- package/scss/components/WebTerminal/_storybook-styles.scss +1 -1
- package/scss/components/_index-with-carbon.scss +1 -0
- package/scss/components/_index.scss +1 -0
@@ -17,6 +17,7 @@ var _devtools = require("../../global/js/utils/devtools");
|
|
17
17
|
var _hooks = require("../../global/js/hooks");
|
18
18
|
var _settings = require("../../settings");
|
19
19
|
var _utils = require("./utils");
|
20
|
+
var _propsHelper = require("../../global/js/utils/props-helper");
|
20
21
|
var _NotificationsEmptyState = require("../EmptyStates/NotificationsEmptyState");
|
21
22
|
var _react2 = require("@carbon/react");
|
22
23
|
var _icons = require("@carbon/react/icons");
|
@@ -305,7 +306,7 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
|
|
305
306
|
}, notification.title), notification.description && notification.description.length && renderDescription(notification.id), notification.link && notification.link.text && notification.link.url && /*#__PURE__*/_react.default.createElement(_react2.Link, (0, _extends2.default)({
|
306
307
|
href: notification.link.url,
|
307
308
|
className: "".concat(blockClass, "__notifications-link")
|
308
|
-
}, notification.link
|
309
|
+
}, (0, _propsHelper.prepareProps)({}, notification.link, ['text', 'url'])), notification.link.text)), /*#__PURE__*/_react.default.createElement(_react2.IconButton, {
|
309
310
|
align: "left",
|
310
311
|
kind: "ghost",
|
311
312
|
size: "sm",
|
@@ -336,7 +337,7 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
|
|
336
337
|
className: "".concat(blockClass, "__header-container")
|
337
338
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
338
339
|
className: "".concat(blockClass, "__header-flex")
|
339
|
-
}, /*#__PURE__*/_react.default.createElement("
|
340
|
+
}, /*#__PURE__*/_react.default.createElement("h2", {
|
340
341
|
className: "".concat(blockClass, "__header")
|
341
342
|
}, title), /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
342
343
|
size: "sm",
|
@@ -345,7 +346,7 @@ var NotificationsPanel = /*#__PURE__*/_react.default.forwardRef(function (_ref,
|
|
345
346
|
onClick: function onClick() {
|
346
347
|
return onDismissAllNotifications();
|
347
348
|
}
|
348
|
-
}, dismissAllLabel)), /*#__PURE__*/_react.default.createElement(_react2.Toggle, {
|
349
|
+
}, dismissAllLabel)), onDoNotDisturbChange && /*#__PURE__*/_react.default.createElement(_react2.Toggle, {
|
349
350
|
size: "sm",
|
350
351
|
className: "".concat(blockClass, "__do-not-disturb-toggle"),
|
351
352
|
id: "".concat(blockClass, "__do-not-disturb-toggle-component"),
|
@@ -426,10 +427,7 @@ NotificationsPanel.propTypes = {
|
|
426
427
|
description: _propTypes.default.string,
|
427
428
|
link: _propTypes.default.shape({
|
428
429
|
url: _propTypes.default.string,
|
429
|
-
text: _propTypes.default.string
|
430
|
-
optional: _propTypes.default.shape({
|
431
|
-
// Add optional props here
|
432
|
-
})
|
430
|
+
text: _propTypes.default.string
|
433
431
|
}),
|
434
432
|
unread: _propTypes.default.bool,
|
435
433
|
onNotificationClick: _propTypes.default.func
|
@@ -447,11 +445,11 @@ NotificationsPanel.propTypes = {
|
|
447
445
|
*/
|
448
446
|
dismissSingleNotificationIconDescription: _propTypes.default.string,
|
449
447
|
/**
|
450
|
-
* Determines if the `Do not disturb` toggle is on or off when the component is rendered
|
448
|
+
* Optional: Determines if the `Do not disturb` toggle is on or off when the component is rendered
|
451
449
|
*/
|
452
450
|
doNotDisturbDefaultToggled: _propTypes.default.bool,
|
453
451
|
/**
|
454
|
-
* Label for Do not disturb toggle
|
452
|
+
* Optional: Label for Do not disturb toggle
|
455
453
|
*/
|
456
454
|
doNotDisturbLabel: _propTypes.default.string,
|
457
455
|
/**
|
@@ -499,7 +497,7 @@ NotificationsPanel.propTypes = {
|
|
499
497
|
*/
|
500
498
|
onDismissSingleNotification: _propTypes.default.func,
|
501
499
|
/**
|
502
|
-
*
|
500
|
+
* Optional: function that returns the current selected value of the disable notification toggle
|
503
501
|
*/
|
504
502
|
onDoNotDisturbChange: _propTypes.default.func,
|
505
503
|
/**
|
@@ -223,13 +223,11 @@ var OptionsTile = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
|
223
223
|
id: "".concat(id, "-toggle"),
|
224
224
|
className: "".concat(blockClass, "__toggle"),
|
225
225
|
toggled: enabled,
|
226
|
-
labelA: "",
|
227
|
-
labelB: "",
|
228
226
|
"aria-labelledby": titleId,
|
227
|
+
hideLabel: true,
|
229
228
|
onToggle: onToggle,
|
230
229
|
size: "sm",
|
231
|
-
disabled: isLocked
|
232
|
-
labelText: title
|
230
|
+
disabled: isLocked
|
233
231
|
})), isExpandable ? /*#__PURE__*/_react.default.createElement("details", {
|
234
232
|
open: isOpen,
|
235
233
|
ref: detailsRef
|
@@ -13,7 +13,7 @@ var _scrollableAncestor = require("../../global/js/utils/scrollableAncestor");
|
|
13
13
|
var _react2 = require("@carbon/react");
|
14
14
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
15
15
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /**
|
16
|
-
* Copyright IBM Corp. 2020,
|
16
|
+
* Copyright IBM Corp. 2020, 2023
|
17
17
|
*
|
18
18
|
* This source code is licensed under the Apache-2.0 license found in the
|
19
19
|
* LICENSE file in the root directory of this source tree.
|
@@ -71,11 +71,14 @@ var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(headerR
|
|
71
71
|
var scrollableContainer = (0, _scrollableAncestor.scrollableAncestor)(headerRef.current);
|
72
72
|
|
73
73
|
/* istanbul ignore next */
|
74
|
-
var scrollableContainerTop = scrollableContainer ? scrollableContainer.
|
74
|
+
var scrollableContainerTop = scrollableContainer ? scrollableContainer.getBoundingClientRect().top : 0;
|
75
|
+
|
76
|
+
/* istanbul ignore next */
|
77
|
+
var offsetMeasuringTop = offsetTopMeasuringRef.current ? offsetTopMeasuringRef.current.getBoundingClientRect().top : 0;
|
75
78
|
|
76
79
|
// The header offset calculation is either going to work out at 0 if we have no gap between scrolling container
|
77
80
|
// top and the measuring ref top, or the difference between. It does not change on scroll or resize.
|
78
|
-
update.headerOffset =
|
81
|
+
update.headerOffset = offsetMeasuringTop - scrollableContainerTop;
|
79
82
|
|
80
83
|
/* istanbul ignore next */
|
81
84
|
update.breadcrumbRowHeight = breadcrumbRowEl ? breadcrumbRowEl.clientHeight : 0;
|
@@ -133,6 +136,10 @@ var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(headerR
|
|
133
136
|
update.pageActionsSpaceAbove = titleRowEl.clientHeight - pageActionsEl.clientHeight + update.titleRowSpaceAbove - (isNaN(val) ? 0 : val);
|
134
137
|
}
|
135
138
|
}
|
139
|
+
if (!hasActionBar && pageActionsEl) {
|
140
|
+
// adjust headerTopValue when there are no page actions or action bar items (margin above title row)
|
141
|
+
update.headerTopValue -= update.titleRowSpaceAbove;
|
142
|
+
}
|
136
143
|
return _objectSpread(_objectSpread({}, previous), update);
|
137
144
|
});
|
138
145
|
};
|
@@ -0,0 +1,67 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.TooltipTrigger = 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 _settings = require("../../settings");
|
14
|
+
var _excluded = ["children", "className"];
|
15
|
+
/**
|
16
|
+
* Copyright IBM Corp. 2023, 2023
|
17
|
+
*
|
18
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
19
|
+
* LICENSE file in the root directory of this source tree.
|
20
|
+
*/
|
21
|
+
// Import portions of React that are needed.
|
22
|
+
// Other standard imports.
|
23
|
+
// The block part of our conventional BEM class names (blockClass__E--M).
|
24
|
+
var blockClass = "".concat(_settings.pkg.prefix, "--tooltip-trigger");
|
25
|
+
var componentName = 'TooltipTrigger';
|
26
|
+
|
27
|
+
// NOTE: the component SCSS is not imported here: it is rolled up separately.
|
28
|
+
|
29
|
+
/**
|
30
|
+
* This is an tooltip trigger as Carbon Tooltip requires an active element to work but provides
|
31
|
+
* no blanked button.
|
32
|
+
*/
|
33
|
+
var TooltipTrigger = function TooltipTrigger(_ref) {
|
34
|
+
var children = _ref.children,
|
35
|
+
className = _ref.className,
|
36
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
37
|
+
return /*#__PURE__*/_react.default.createElement("button", (0, _extends2.default)({
|
38
|
+
type: "button"
|
39
|
+
}, rest, {
|
40
|
+
className: (0, _classnames.default)(blockClass,
|
41
|
+
// Apply the block class to the main HTML element
|
42
|
+
className // Apply any supplied class names to the main HTML element.
|
43
|
+
)
|
44
|
+
}), children);
|
45
|
+
};
|
46
|
+
|
47
|
+
// Return a placeholder if not released and not enabled by feature flag.
|
48
|
+
exports.TooltipTrigger = TooltipTrigger;
|
49
|
+
exports.TooltipTrigger = TooltipTrigger = _settings.pkg.checkComponentEnabled(TooltipTrigger, componentName);
|
50
|
+
|
51
|
+
// The display name of the component, used by React. Note that displayName
|
52
|
+
// is used in preference to relying on function.name.
|
53
|
+
TooltipTrigger.displayName = componentName;
|
54
|
+
|
55
|
+
// The types and DocGen commentary for the component props,
|
56
|
+
// in alphabetical order (for consistency).
|
57
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
58
|
+
TooltipTrigger.propTypes = {
|
59
|
+
/**
|
60
|
+
* Child content of tooltip trigger
|
61
|
+
*/
|
62
|
+
children: _propTypes.default.node,
|
63
|
+
/**
|
64
|
+
* Provide an optional class to be applied to the containing node.
|
65
|
+
*/
|
66
|
+
className: _propTypes.default.string
|
67
|
+
};
|
@@ -0,0 +1,12 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
Object.defineProperty(exports, "TooltipTrigger", {
|
7
|
+
enumerable: true,
|
8
|
+
get: function get() {
|
9
|
+
return _TooltipTrigger.TooltipTrigger;
|
10
|
+
}
|
11
|
+
});
|
12
|
+
var _TooltipTrigger = require("./TooltipTrigger");
|
@@ -0,0 +1,58 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
5
|
+
value: true
|
6
|
+
});
|
7
|
+
exports.default = void 0;
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
|
+
var _react = require("react");
|
10
|
+
var _settings = require("../../settings");
|
11
|
+
/**
|
12
|
+
* Copyright IBM Corp. 2023, 2023
|
13
|
+
*
|
14
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
15
|
+
* LICENSE file in the root directory of this source tree.
|
16
|
+
*/
|
17
|
+
|
18
|
+
var useExample = function useExample(initialTime) {
|
19
|
+
// NOTE: hooks cannot be called conditionally.
|
20
|
+
//
|
21
|
+
// ** If the hook uses other hooks then they must be called,
|
22
|
+
// ** this could lead to unexpected behavior.
|
23
|
+
// ** As some hooks may still be called even if the condition is false.
|
24
|
+
|
25
|
+
var _useState = (0, _react.useState)(
|
26
|
+
// Disable hook in a safe way if possible, else use despite feature disabled.
|
27
|
+
// Either a console error or warning will be logged.
|
28
|
+
initialTime),
|
29
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
30
|
+
time = _useState2[0],
|
31
|
+
setTime = _useState2[1];
|
32
|
+
|
33
|
+
// Use of the feature flag to
|
34
|
+
var feature = 'ExampleComponent.useExample';
|
35
|
+
var tryFeature = initialTime !== undefined;
|
36
|
+
var featureEnabled = tryFeature && _settings.pkg.checkReportFeatureEnabled(feature);
|
37
|
+
if (tryFeature && !featureEnabled) {
|
38
|
+
// Output a useful message if the feature is disabled.
|
39
|
+
console.warn("Disabled feature \"".concat(feature, "\" does not change the initialTime."));
|
40
|
+
}
|
41
|
+
|
42
|
+
// Actual hook is code is below
|
43
|
+
(0, _react.useEffect)(function () {
|
44
|
+
if (!featureEnabled) {
|
45
|
+
return;
|
46
|
+
}
|
47
|
+
|
48
|
+
// turn off all or part of the feature
|
49
|
+
if (time > 0) {
|
50
|
+
setTimeout(function () {
|
51
|
+
setTime(Math.max(0, time - 0.1));
|
52
|
+
}, 100);
|
53
|
+
}
|
54
|
+
}, [featureEnabled, time]);
|
55
|
+
return [time];
|
56
|
+
};
|
57
|
+
var _default = useExample;
|
58
|
+
exports.default = _default;
|
@@ -15,6 +15,7 @@ require("../../global/js/utils/props-helper");
|
|
15
15
|
var _settings = require("../../settings");
|
16
16
|
var _icons = require("@carbon/react/icons");
|
17
17
|
var _react2 = require("@carbon/react");
|
18
|
+
var _TooltipTrigger = require("../TooltipTrigger");
|
18
19
|
var _excluded = ["backgroundColor", "className", "kind", "icon", "initials", "image", "imageDescription", "size", "theme", "tooltipText", "tooltipAlignment"];
|
19
20
|
/**
|
20
21
|
* Copyright IBM Corp. 2021, 2021
|
@@ -52,6 +53,7 @@ var UserProfileImage = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
52
53
|
_ref$tooltipAlignment = _ref.tooltipAlignment,
|
53
54
|
tooltipAlignment = _ref$tooltipAlignment === void 0 ? defaults.tooltipAlignment : _ref$tooltipAlignment,
|
54
55
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
56
|
+
var carbonPrefix = (0, _react2.usePrefix)();
|
55
57
|
var icons = {
|
56
58
|
user: {
|
57
59
|
md: function md(props) {
|
@@ -127,12 +129,11 @@ var UserProfileImage = /*#__PURE__*/_react.default.forwardRef(function (_ref, re
|
|
127
129
|
className: (0, _classnames.default)([blockClass, className, "".concat(blockClass, "--").concat(size), "".concat(blockClass, "--").concat(theme), "".concat(blockClass, "--").concat(backgroundColor || getRandomColor())])
|
128
130
|
}, (0, _devtools.getDevtoolsProps)(componentName)), /*#__PURE__*/_react.default.createElement(FillItem, null));
|
129
131
|
};
|
130
|
-
return FillItem && (tooltipText ? /*#__PURE__*/_react.default.createElement(_react2.
|
132
|
+
return FillItem && (tooltipText ? /*#__PURE__*/_react.default.createElement(_react2.Tooltip, {
|
133
|
+
align: tooltipAlignment,
|
131
134
|
label: tooltipText,
|
132
|
-
className: "".concat(blockClass, "__tooltip"),
|
133
|
-
|
134
|
-
align: tooltipAlignment
|
135
|
-
}, renderUserProfileImage()) : renderUserProfileImage());
|
135
|
+
className: "".concat(blockClass, "__tooltip ").concat(carbonPrefix, "--icon-tooltip")
|
136
|
+
}, /*#__PURE__*/_react.default.createElement(_TooltipTrigger.TooltipTrigger, null, renderUserProfileImage())) : renderUserProfileImage());
|
136
137
|
});
|
137
138
|
|
138
139
|
// Return a placeholder if not released and not enabled by feature flag
|
@@ -9,7 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
10
10
|
var _react = require("react");
|
11
11
|
/**
|
12
|
-
* Copyright IBM Corp. 2021,
|
12
|
+
* Copyright IBM Corp. 2021, 2023
|
13
13
|
*
|
14
14
|
* This source code is licensed under the Apache-2.0 license found in the
|
15
15
|
* LICENSE file in the root directory of this source tree.
|
@@ -19,16 +19,19 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
|
|
19
19
|
var firstIncludedStep = _ref.firstIncludedStep,
|
20
20
|
lastIncludedStep = _ref.lastIncludedStep,
|
21
21
|
stepData = _ref.stepData,
|
22
|
+
onPrevious = _ref.onPrevious,
|
22
23
|
onNext = _ref.onNext,
|
23
24
|
isSubmitDisabled = _ref.isSubmitDisabled,
|
24
25
|
setCurrentStep = _ref.setCurrentStep,
|
25
26
|
setIsSubmitting = _ref.setIsSubmitting,
|
26
|
-
|
27
|
+
_ref$setLoadingPrevio = _ref.setLoadingPrevious,
|
28
|
+
setLoadingPrevious = _ref$setLoadingPrevio === void 0 ? null : _ref$setLoadingPrevio,
|
29
|
+
_ref$loadingPrevious = _ref.loadingPrevious,
|
30
|
+
loadingPrevious = _ref$loadingPrevious === void 0 ? false : _ref$loadingPrevious,
|
27
31
|
onClose = _ref.onClose,
|
28
32
|
onRequestSubmit = _ref.onRequestSubmit,
|
29
33
|
componentName = _ref.componentName,
|
30
34
|
currentStep = _ref.currentStep,
|
31
|
-
shouldViewAll = _ref.shouldViewAll,
|
32
35
|
backButtonText = _ref.backButtonText,
|
33
36
|
cancelButtonText = _ref.cancelButtonText,
|
34
37
|
submitButtonText = _ref.submitButtonText,
|
@@ -50,6 +53,21 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
|
|
50
53
|
return prev;
|
51
54
|
});
|
52
55
|
}, [setCurrentStep, setIsSubmitting, stepData]);
|
56
|
+
var moveToPreviousStep = (0, _react.useCallback)(function () {
|
57
|
+
if (componentName !== 'CreateFullPage') {
|
58
|
+
setLoadingPrevious(false);
|
59
|
+
}
|
60
|
+
setCurrentStep(function (prev) {
|
61
|
+
// Find previous included step to render
|
62
|
+
// There will always be a previous step otherwise we will
|
63
|
+
// have disabled the back button since we have reached the first visible step
|
64
|
+
do {
|
65
|
+
var _stepData2;
|
66
|
+
prev--;
|
67
|
+
} while (!((_stepData2 = stepData[prev - 1]) !== null && _stepData2 !== void 0 && _stepData2.shouldIncludeStep));
|
68
|
+
return prev;
|
69
|
+
});
|
70
|
+
}, [setCurrentStep, stepData, setLoadingPrevious, componentName]);
|
53
71
|
|
54
72
|
// useEffect to handle multi step logic
|
55
73
|
(0, _react.useEffect)(function () {
|
@@ -58,7 +76,6 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
|
|
58
76
|
setCurrentStep(0);
|
59
77
|
}
|
60
78
|
setIsSubmitting(false);
|
61
|
-
setShouldViewAll(false);
|
62
79
|
onClose();
|
63
80
|
};
|
64
81
|
var handleOnRequestSubmit = /*#__PURE__*/function () {
|
@@ -88,104 +105,136 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
|
|
88
105
|
return _ref2.apply(this, arguments);
|
89
106
|
};
|
90
107
|
}();
|
91
|
-
var
|
108
|
+
var handlePrevious = /*#__PURE__*/function () {
|
92
109
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
93
110
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
94
111
|
while (1) switch (_context2.prev = _context2.next) {
|
112
|
+
case 0:
|
113
|
+
if (!(componentName === 'CreateFullPage')) {
|
114
|
+
_context2.next = 2;
|
115
|
+
break;
|
116
|
+
}
|
117
|
+
return _context2.abrupt("return");
|
118
|
+
case 2:
|
119
|
+
setLoadingPrevious(true);
|
120
|
+
if (!(typeof onPrevious === 'function')) {
|
121
|
+
_context2.next = 15;
|
122
|
+
break;
|
123
|
+
}
|
124
|
+
_context2.prev = 4;
|
125
|
+
_context2.next = 7;
|
126
|
+
return onPrevious();
|
127
|
+
case 7:
|
128
|
+
moveToPreviousStep();
|
129
|
+
_context2.next = 13;
|
130
|
+
break;
|
131
|
+
case 10:
|
132
|
+
_context2.prev = 10;
|
133
|
+
_context2.t0 = _context2["catch"](4);
|
134
|
+
console.warn("".concat(componentName, " onBack error: ").concat(_context2.t0));
|
135
|
+
case 13:
|
136
|
+
_context2.next = 16;
|
137
|
+
break;
|
138
|
+
case 15:
|
139
|
+
moveToPreviousStep();
|
140
|
+
case 16:
|
141
|
+
case "end":
|
142
|
+
return _context2.stop();
|
143
|
+
}
|
144
|
+
}, _callee2, null, [[4, 10]]);
|
145
|
+
}));
|
146
|
+
return function handlePrevious() {
|
147
|
+
return _ref3.apply(this, arguments);
|
148
|
+
};
|
149
|
+
}();
|
150
|
+
var handleNext = /*#__PURE__*/function () {
|
151
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
152
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
153
|
+
while (1) switch (_context3.prev = _context3.next) {
|
95
154
|
case 0:
|
96
155
|
setIsSubmitting(true);
|
97
156
|
if (!(typeof onNext === 'function')) {
|
98
|
-
|
157
|
+
_context3.next = 14;
|
99
158
|
break;
|
100
159
|
}
|
101
|
-
|
102
|
-
|
160
|
+
_context3.prev = 2;
|
161
|
+
_context3.next = 5;
|
103
162
|
return onNext();
|
104
163
|
case 5:
|
105
164
|
continueToNextStep();
|
106
|
-
|
165
|
+
_context3.next = 12;
|
107
166
|
break;
|
108
167
|
case 8:
|
109
|
-
|
110
|
-
|
168
|
+
_context3.prev = 8;
|
169
|
+
_context3.t0 = _context3["catch"](2);
|
111
170
|
setIsSubmitting(false);
|
112
|
-
console.warn("".concat(componentName, " onNext error: ").concat(
|
171
|
+
console.warn("".concat(componentName, " onNext error: ").concat(_context3.t0));
|
113
172
|
case 12:
|
114
|
-
|
173
|
+
_context3.next = 15;
|
115
174
|
break;
|
116
175
|
case 14:
|
117
176
|
continueToNextStep();
|
118
177
|
case 15:
|
119
178
|
case "end":
|
120
|
-
return
|
179
|
+
return _context3.stop();
|
121
180
|
}
|
122
|
-
},
|
181
|
+
}, _callee3, null, [[2, 8]]);
|
123
182
|
}));
|
124
183
|
return function handleNext() {
|
125
|
-
return
|
184
|
+
return _ref4.apply(this, arguments);
|
126
185
|
};
|
127
186
|
}();
|
128
187
|
var handleSubmit = /*#__PURE__*/function () {
|
129
|
-
var
|
130
|
-
return _regenerator.default.wrap(function
|
131
|
-
while (1) switch (
|
188
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
189
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
190
|
+
while (1) switch (_context4.prev = _context4.next) {
|
132
191
|
case 0:
|
133
192
|
setIsSubmitting(true);
|
134
193
|
// last step should have onNext as well
|
135
194
|
if (!(typeof onNext === 'function')) {
|
136
|
-
|
195
|
+
_context4.next = 15;
|
137
196
|
break;
|
138
197
|
}
|
139
|
-
|
140
|
-
|
198
|
+
_context4.prev = 2;
|
199
|
+
_context4.next = 5;
|
141
200
|
return onNext();
|
142
201
|
case 5:
|
143
|
-
|
202
|
+
_context4.next = 7;
|
144
203
|
return handleOnRequestSubmit();
|
145
204
|
case 7:
|
146
|
-
|
205
|
+
_context4.next = 13;
|
147
206
|
break;
|
148
207
|
case 9:
|
149
|
-
|
150
|
-
|
208
|
+
_context4.prev = 9;
|
209
|
+
_context4.t0 = _context4["catch"](2);
|
151
210
|
setIsSubmitting(false);
|
152
|
-
console.warn("".concat(componentName, " onNext error: ").concat(
|
211
|
+
console.warn("".concat(componentName, " onNext error: ").concat(_context4.t0));
|
153
212
|
case 13:
|
154
|
-
|
213
|
+
_context4.next = 17;
|
155
214
|
break;
|
156
215
|
case 15:
|
157
|
-
|
216
|
+
_context4.next = 17;
|
158
217
|
return handleOnRequestSubmit();
|
159
218
|
case 17:
|
160
219
|
case "end":
|
161
|
-
return
|
220
|
+
return _context4.stop();
|
162
221
|
}
|
163
|
-
},
|
222
|
+
}, _callee4, null, [[2, 9]]);
|
164
223
|
}));
|
165
224
|
return function handleSubmit() {
|
166
|
-
return
|
225
|
+
return _ref5.apply(this, arguments);
|
167
226
|
};
|
168
227
|
}();
|
169
228
|
if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 0) {
|
170
229
|
var buttons = [];
|
171
|
-
if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 1
|
230
|
+
if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 1) {
|
172
231
|
buttons.push({
|
173
232
|
key: 'create-action-button-back',
|
174
233
|
label: backButtonText,
|
175
|
-
onClick:
|
176
|
-
return setCurrentStep(function (prev) {
|
177
|
-
// Find previous included step to render
|
178
|
-
// There will always be a previous step otherwise we will
|
179
|
-
// have disabled the back button since we have reached the first visible step
|
180
|
-
do {
|
181
|
-
var _stepData2;
|
182
|
-
prev--;
|
183
|
-
} while (!((_stepData2 = stepData[prev - 1]) !== null && _stepData2 !== void 0 && _stepData2.shouldIncludeStep));
|
184
|
-
return prev;
|
185
|
-
});
|
186
|
-
},
|
234
|
+
onClick: handlePrevious,
|
187
235
|
kind: 'secondary',
|
188
|
-
disabled: currentStep === firstIncludedStep
|
236
|
+
disabled: currentStep === firstIncludedStep,
|
237
|
+
loading: loadingPrevious
|
189
238
|
});
|
190
239
|
}
|
191
240
|
buttons.push({
|
@@ -198,8 +247,8 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
|
|
198
247
|
});
|
199
248
|
buttons.push({
|
200
249
|
key: 'create-action-button-submit',
|
201
|
-
label:
|
202
|
-
onClick:
|
250
|
+
label: currentStep < lastIncludedStep ? nextButtonText : submitButtonText,
|
251
|
+
onClick: currentStep < lastIncludedStep ? handleNext : handleSubmit,
|
203
252
|
disabled: isSubmitDisabled,
|
204
253
|
kind: 'primary',
|
205
254
|
loading: isSubmitting,
|
@@ -207,6 +256,6 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
|
|
207
256
|
});
|
208
257
|
setCreateComponentActions(buttons);
|
209
258
|
}
|
210
|
-
}, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting,
|
259
|
+
}, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setModalIsOpen, moveToPreviousStep, onPrevious, setLoadingPrevious, loadingPrevious]);
|
211
260
|
};
|
212
261
|
exports.useCreateComponentStepChange = useCreateComponentStepChange;
|
@@ -15,22 +15,38 @@ var _react = require("react");
|
|
15
15
|
*/
|
16
16
|
|
17
17
|
var useResizeObserver = function useResizeObserver(ref, callback) {
|
18
|
-
var _useState = (0, _react.useState)(
|
18
|
+
var _useState = (0, _react.useState)(-1),
|
19
19
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
20
20
|
width = _useState2[0],
|
21
21
|
setWidth = _useState2[1];
|
22
|
-
var _useState3 = (0, _react.useState)(
|
22
|
+
var _useState3 = (0, _react.useState)(-1),
|
23
23
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
24
24
|
height = _useState4[0],
|
25
25
|
setHeight = _useState4[1];
|
26
26
|
var entriesToHandle = (0, _react.useRef)(null);
|
27
27
|
var cb = (0, _react.useRef)(callback);
|
28
28
|
(0, _react.useEffect)(function () {
|
29
|
-
// ref for callback removes it as dependency
|
29
|
+
// ref for callback removes it as dependency from useLayoutEffect
|
30
30
|
// This significantly reduces repeated calls if a function is redefined on every
|
31
31
|
// render
|
32
32
|
cb.current = callback;
|
33
33
|
}, [callback]);
|
34
|
+
(0, _react.useEffect)(function () {
|
35
|
+
var getInitialSize = function getInitialSize() {
|
36
|
+
if (ref.current) {
|
37
|
+
var _ref$current, _ref$current2;
|
38
|
+
var refComputedStyle = window.getComputedStyle(ref.current);
|
39
|
+
var initialWidth = (((_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.offsetWidth) || 0) - (parseFloat((refComputedStyle === null || refComputedStyle === void 0 ? void 0 : refComputedStyle.paddingLeft) || 0), parseFloat((refComputedStyle === null || refComputedStyle === void 0 ? void 0 : refComputedStyle.paddingRight) || 0));
|
40
|
+
var initialHeight = (((_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.offsetHeight) || 0) - (parseFloat((refComputedStyle === null || refComputedStyle === void 0 ? void 0 : refComputedStyle.paddingTop) || 0), parseFloat((refComputedStyle === null || refComputedStyle === void 0 ? void 0 : refComputedStyle.paddingLeft) || 0));
|
41
|
+
setWidth(initialWidth);
|
42
|
+
setHeight(initialHeight);
|
43
|
+
}
|
44
|
+
};
|
45
|
+
if (!(ref !== null && ref !== void 0 && ref.current) || width >= 0 && height >= 0) {
|
46
|
+
return;
|
47
|
+
}
|
48
|
+
getInitialSize();
|
49
|
+
}, [width, height, ref]);
|
34
50
|
(0, _react.useLayoutEffect)(function () {
|
35
51
|
if (!(ref !== null && ref !== void 0 && ref.current)) {
|
36
52
|
return;
|
@@ -8,7 +8,7 @@ exports.useRetrieveStepData = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
9
9
|
var _react = require("react");
|
10
10
|
/**
|
11
|
-
* Copyright IBM Corp. 2022,
|
11
|
+
* Copyright IBM Corp. 2022, 2023
|
12
12
|
*
|
13
13
|
* This source code is licensed under the Apache-2.0 license found in the
|
14
14
|
* LICENSE file in the root directory of this source tree.
|
@@ -89,7 +89,6 @@ var StoryDocsPage = function StoryDocsPage(_ref2) {
|
|
89
89
|
var isFullScreen = (csfFile === null || csfFile === void 0 || (_csfFile$meta = csfFile.meta) === null || _csfFile$meta === void 0 || (_csfFile$meta = _csfFile$meta.parameters) === null || _csfFile$meta === void 0 ? void 0 : _csfFile$meta.layout) === 'fullscreen' || false;
|
90
90
|
var storyHelperClass = isFullScreen ? 'c4p--story-docs-page--fullscreen' : '';
|
91
91
|
var processedBlocks = processBlocks(blocks, csfFile.stories, omitUnreferencedStories);
|
92
|
-
console.log(processBlocks);
|
93
92
|
var storyCount = (_processedBlocks$filt = processedBlocks === null || processedBlocks === void 0 ? void 0 : processedBlocks.filter(function (block) {
|
94
93
|
return !!block.story;
|
95
94
|
}).length) !== null && _processedBlocks$filt !== void 0 ? _processedBlocks$filt : 0;
|