@carbon/ibm-products 2.56.1 → 2.57.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +66 -20
- 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 +28 -12
- 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 +28 -12
- 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 +29 -12
- 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/APIKeyModal/APIKeyDownloader.d.ts +1 -1
- package/es/components/APIKeyModal/APIKeyDownloader.js +1 -1
- package/es/components/APIKeyModal/APIKeyModal.d.ts +13 -0
- package/es/components/APIKeyModal/APIKeyModal.js +69 -25
- package/es/components/APIKeyModal/APIKeyModal.types.d.ts +16 -2
- package/es/components/Card/Card.js +3 -4
- package/es/components/Coachmark/CoachmarkOverlay.js +4 -0
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +12 -0
- package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +39 -8
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +9 -5
- package/es/components/CreateTearsheet/CreateTearsheet.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +31 -2
- package/es/components/FilterSummary/FilterSummary.js +1 -1
- package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +1 -1
- package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +1 -1
- package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +1 -1
- package/es/components/InterstitialScreen/InterstitialScreen.js +2 -3
- package/es/components/PageHeader/PageHeader.js +13 -3
- package/es/components/PageHeader/PageHeaderTitle.js +10 -29
- package/es/components/ProductiveCard/ProductiveCard.d.ts +6 -2
- package/es/components/ProductiveCard/ProductiveCard.js +7 -5
- package/es/components/SidePanel/SidePanel.d.ts +6 -1
- package/es/components/SidePanel/SidePanel.js +41 -26
- package/es/components/TagOverflow/TagOverflow.js +2 -5
- package/es/components/Tearsheet/TearsheetShell.d.ts +4 -0
- package/es/components/Tearsheet/TearsheetShell.js +5 -37
- package/es/global/js/hooks/useFocus.d.ts +1 -1
- package/es/global/js/hooks/useFocus.js +7 -4
- package/es/global/js/utils/checkForOverflow.d.ts +5 -0
- package/es/global/js/utils/checkForOverflow.js +31 -0
- package/lib/components/APIKeyModal/APIKeyDownloader.d.ts +1 -1
- package/lib/components/APIKeyModal/APIKeyDownloader.js +1 -1
- package/lib/components/APIKeyModal/APIKeyModal.d.ts +13 -0
- package/lib/components/APIKeyModal/APIKeyModal.js +68 -22
- package/lib/components/APIKeyModal/APIKeyModal.types.d.ts +16 -2
- package/lib/components/Card/Card.js +3 -4
- package/lib/components/Coachmark/CoachmarkOverlay.js +4 -0
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.d.ts +12 -0
- package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +39 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +9 -5
- package/lib/components/CreateTearsheet/CreateTearsheet.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +30 -1
- package/lib/components/FilterSummary/FilterSummary.js +1 -1
- package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +1 -1
- package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +1 -1
- package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.js +1 -1
- package/lib/components/InterstitialScreen/InterstitialScreen.js +2 -3
- package/lib/components/PageHeader/PageHeader.js +12 -2
- package/lib/components/PageHeader/PageHeaderTitle.js +8 -27
- package/lib/components/ProductiveCard/ProductiveCard.d.ts +6 -2
- package/lib/components/ProductiveCard/ProductiveCard.js +7 -5
- package/lib/components/SidePanel/SidePanel.d.ts +6 -1
- package/lib/components/SidePanel/SidePanel.js +41 -26
- package/lib/components/TagOverflow/TagOverflow.js +1 -4
- package/lib/components/Tearsheet/TearsheetShell.d.ts +4 -0
- package/lib/components/Tearsheet/TearsheetShell.js +5 -37
- package/lib/global/js/hooks/useFocus.d.ts +1 -1
- package/lib/global/js/hooks/useFocus.js +7 -4
- package/lib/global/js/utils/checkForOverflow.d.ts +5 -0
- package/lib/global/js/utils/checkForOverflow.js +34 -0
- package/package.json +8 -8
- package/scss/components/APIKeyModal/_api-key-modal.scss +4 -0
- package/scss/components/PageHeader/_page-header.scss +18 -6
- package/scss/components/SidePanel/_side-panel.scss +13 -6
- package/telemetry.yml +4 -0
@@ -21,6 +21,7 @@ var cx = require('classnames');
|
|
21
21
|
var devtools = require('../../global/js/utils/devtools.js');
|
22
22
|
var settings = require('../../settings.js');
|
23
23
|
var useResizeObserver = require('../../global/js/hooks/useResizeObserver.js');
|
24
|
+
var checkForOverflow = require('../../global/js/utils/checkForOverflow.js');
|
24
25
|
var useWindowScroll = require('../../global/js/hooks/useWindowScroll.js');
|
25
26
|
var useWindowResize = require('../../global/js/hooks/useWindowResize.js');
|
26
27
|
var BreadcrumbWithOverflow = require('../BreadcrumbWithOverflow/BreadcrumbWithOverflow.js');
|
@@ -363,6 +364,12 @@ exports.PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
363
364
|
}
|
364
365
|
};
|
365
366
|
var displayedBreadcrumbs = getBreadcrumbs();
|
367
|
+
var subtitleRef = React.useRef(null);
|
368
|
+
var isOverflowing = checkForOverflow.checkHeightOverflow(subtitleRef.current);
|
369
|
+
var subtitleContent = /*#__PURE__*/React.createElement("span", {
|
370
|
+
ref: subtitleRef,
|
371
|
+
className: "".concat(PageHeaderUtils.blockClass, "__subtitle-text")
|
372
|
+
}, subtitle);
|
366
373
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
367
374
|
className: "".concat(PageHeaderUtils.blockClass, "--offset-top-measuring-element"),
|
368
375
|
ref: offsetTopMeasuringRef
|
@@ -414,11 +421,14 @@ exports.PageHeader = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
414
421
|
blockClass: PageHeaderUtils.blockClass,
|
415
422
|
hasBreadcrumbRow: hasBreadcrumbRow,
|
416
423
|
title: title
|
417
|
-
}) : null), thePageActions(false, pageActionsInBreadcrumbRow)) : null, subtitle
|
424
|
+
}) : null), thePageActions(false, pageActionsInBreadcrumbRow)) : null, subtitle && /*#__PURE__*/React.createElement(react.Row, {
|
418
425
|
className: "".concat(PageHeaderUtils.blockClass, "__subtitle-row")
|
419
426
|
}, /*#__PURE__*/React.createElement(react.Column, {
|
420
427
|
className: "".concat(PageHeaderUtils.blockClass, "__subtitle")
|
421
|
-
},
|
428
|
+
}, isOverflowing ? /*#__PURE__*/React.createElement(react.DefinitionTooltip, {
|
429
|
+
definition: subtitle,
|
430
|
+
className: "".concat(PageHeaderUtils.blockClass, "__subtitle-tooltip")
|
431
|
+
}, subtitleContent) : subtitleContent)), children ? /*#__PURE__*/React.createElement(react.Row, {
|
422
432
|
className: "".concat(PageHeaderUtils.blockClass, "__available-row")
|
423
433
|
}, /*#__PURE__*/React.createElement(react.Column, {
|
424
434
|
className: "".concat(PageHeaderUtils.blockClass, "__available-column")
|
@@ -13,6 +13,7 @@ var index = require('../../_virtual/index.js');
|
|
13
13
|
var cx = require('classnames');
|
14
14
|
var react = require('@carbon/react');
|
15
15
|
var EditInPlace = require('../EditInPlace/EditInPlace.js');
|
16
|
+
var checkForOverflow = require('../../global/js/utils/checkForOverflow.js');
|
16
17
|
|
17
18
|
var _excluded = ["text", "content", "loading", "icon", "asText", "onChange", "onSave", "editDescription", "editableLabel", "cancelDescription", "saveDescription", "tooltipAlignment"];
|
18
19
|
|
@@ -45,31 +46,18 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
|
|
45
46
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(title, _excluded);
|
46
47
|
var titleText;
|
47
48
|
var isEditable = !!onSave;
|
48
|
-
var
|
49
|
-
|
50
|
-
isEllipsisApplied = _useState2[0],
|
51
|
-
setIsEllipsisApplied = _useState2[1];
|
52
|
-
var longTitleRef = React.useRef(undefined);
|
53
|
-
var titleRef = React.useRef(undefined);
|
54
|
-
React.useLayoutEffect(function () {
|
55
|
-
setIsEllipsisApplied(isEllipsisActive());
|
56
|
-
}, [longTitleRef, titleRef, title]);
|
57
|
-
var isEllipsisActive = function isEllipsisActive() {
|
58
|
-
if (longTitleRef.current) {
|
59
|
-
var _longTitleRef$current, _longTitleRef$current2;
|
60
|
-
return ((_longTitleRef$current = longTitleRef.current) === null || _longTitleRef$current === void 0 ? void 0 : _longTitleRef$current.offsetWidth) < ((_longTitleRef$current2 = longTitleRef.current) === null || _longTitleRef$current2 === void 0 ? void 0 : _longTitleRef$current2.scrollWidth);
|
61
|
-
} else if (titleRef.current) {
|
62
|
-
var _titleRef$current, _titleRef$current2;
|
63
|
-
return ((_titleRef$current = titleRef.current) === null || _titleRef$current === void 0 ? void 0 : _titleRef$current.offsetWidth) < ((_titleRef$current2 = titleRef.current) === null || _titleRef$current2 === void 0 ? void 0 : _titleRef$current2.scrollWidth);
|
64
|
-
}
|
65
|
-
return false;
|
66
|
-
};
|
49
|
+
var titleRef = React.useRef();
|
50
|
+
var isEllipsisApplied = checkForOverflow.checkWidthOverflow(titleRef.current);
|
67
51
|
if (text || !content) {
|
68
52
|
if (text === undefined && typeof title === 'string') {
|
69
53
|
text = title;
|
70
54
|
asText = title;
|
71
55
|
}
|
72
56
|
var TitleIcon = icon;
|
57
|
+
var titleContent = /*#__PURE__*/React.createElement("span", {
|
58
|
+
ref: titleRef,
|
59
|
+
className: "".concat(blockClass, "__titleText")
|
60
|
+
}, text);
|
73
61
|
titleInnards = /*#__PURE__*/React.createElement(React.Fragment, null, icon && !loading ? /*#__PURE__*/React.createElement("span", {
|
74
62
|
className: "".concat(blockClass, "__title-icon-wrapper")
|
75
63
|
}, /*#__PURE__*/React.createElement(TitleIcon, {
|
@@ -92,14 +80,7 @@ var PageHeaderTitle = function PageHeaderTitle(_ref) {
|
|
92
80
|
align: tooltipAlignment,
|
93
81
|
definition: text,
|
94
82
|
className: "".concat(blockClass, "__tooltip")
|
95
|
-
},
|
96
|
-
ref: longTitleRef,
|
97
|
-
className: "".concat(blockClass, "__titleText")
|
98
|
-
}, text)) : /*#__PURE__*/React.createElement("span", {
|
99
|
-
ref: titleRef,
|
100
|
-
className: "".concat(blockClass, "__titleText"),
|
101
|
-
title: !loading ? asText : null
|
102
|
-
}, text));
|
83
|
+
}, titleContent) : titleContent);
|
103
84
|
} else {
|
104
85
|
titleInnards = content;
|
105
86
|
titleText = asText;
|
@@ -66,7 +66,8 @@ export interface ProductiveCardProps extends PropsWithChildren {
|
|
66
66
|
*/
|
67
67
|
overflowActions?: overflowAction[];
|
68
68
|
/**
|
69
|
-
*
|
69
|
+
* Sets the text for the OverflowMenu aria label and the OverflowMenu trigger button tooltip.
|
70
|
+
* Overrides `iconDescription` prop.
|
70
71
|
*/
|
71
72
|
overflowAriaLabel?: string;
|
72
73
|
/**
|
@@ -120,7 +121,10 @@ export interface ProductiveCardProps extends PropsWithChildren {
|
|
120
121
|
*/
|
121
122
|
titleSize?: 'default' | 'large';
|
122
123
|
/**
|
123
|
-
*
|
124
|
+
* Sets the text for the OverflowMenu trigger button tooltip and OverflowMenu aria label,
|
125
|
+
* gets overridden by the `overflowAriaLabel` prop.
|
126
|
+
*
|
127
|
+
* @deprecated Please use the `overflowAriaLabel` prop instead.
|
124
128
|
*/
|
125
129
|
iconDescription?: string;
|
126
130
|
}
|
@@ -15,16 +15,14 @@ var settings = require('../../settings.js');
|
|
15
15
|
var propsHelper = require('../../global/js/utils/props-helper.js');
|
16
16
|
var Card = require('../Card/Card.js');
|
17
17
|
|
18
|
-
var _excluded = ["actionsPlacement"
|
18
|
+
var _excluded = ["actionsPlacement"];
|
19
19
|
var componentName = 'ProductiveCard';
|
20
20
|
exports.ProductiveCard = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
21
21
|
var _ref$actionsPlacement = _ref.actionsPlacement,
|
22
22
|
actionsPlacement = _ref$actionsPlacement === void 0 ? 'top' : _ref$actionsPlacement,
|
23
|
-
iconDescription = _ref.iconDescription,
|
24
23
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
25
24
|
var validProps = propsHelper.prepareProps(rest, ['media', 'mediaPosition', 'pictogram', 'primaryButtonClick', 'productive', 'secondaryButtonKind']);
|
26
25
|
return /*#__PURE__*/React.createElement(Card.Card, _rollupPluginBabelHelpers.extends({}, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, validProps), {}, {
|
27
|
-
iconDescription: iconDescription,
|
28
26
|
actionsPlacement: actionsPlacement,
|
29
27
|
ref: ref,
|
30
28
|
productive: true
|
@@ -71,7 +69,10 @@ exports.ProductiveCard.propTypes = {
|
|
71
69
|
*/
|
72
70
|
description: index.default.oneOfType([index.default.string, index.default.object, index.default.node]),
|
73
71
|
/**
|
74
|
-
*
|
72
|
+
* Sets the text for the OverflowMenu trigger button tooltip and OverflowMenu aria label,
|
73
|
+
* gets overridden by the `overflowAriaLabel` prop.
|
74
|
+
*
|
75
|
+
* @deprecated Please use the `overflowAriaLabel` prop instead.
|
75
76
|
*/
|
76
77
|
iconDescription: index.default.string,
|
77
78
|
/**
|
@@ -101,7 +102,8 @@ exports.ProductiveCard.propTypes = {
|
|
101
102
|
onKeyDown: index.default.func
|
102
103
|
})),
|
103
104
|
/**
|
104
|
-
*
|
105
|
+
* Sets the text for the OverflowMenu aria label and the OverflowMenu trigger button tooltip.
|
106
|
+
* Overrides `iconDescription` prop.
|
105
107
|
*/
|
106
108
|
overflowAriaLabel: index.default.string,
|
107
109
|
/**
|
@@ -110,14 +110,19 @@ type SidePanelBaseProps = {
|
|
110
110
|
*/
|
111
111
|
slideIn?: boolean;
|
112
112
|
/**
|
113
|
-
* @deprecated please use the `
|
113
|
+
* @deprecated please use the `decorator` instead
|
114
114
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
|
115
115
|
*/
|
116
116
|
slug?: ReactNode;
|
117
117
|
/**
|
118
|
+
* @deprecated please use the `decorator` instead
|
118
119
|
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
119
120
|
*/
|
120
121
|
aiLabel?: ReactNode;
|
122
|
+
/**
|
123
|
+
* Provide a `decorator` component to be rendered inside the `SidePanel` component
|
124
|
+
*/
|
125
|
+
decorator?: ReactNode;
|
121
126
|
/**
|
122
127
|
* Sets the subtitle text
|
123
128
|
*/
|
@@ -26,7 +26,7 @@ var usePrefersReducedMotion = require('../../global/js/hooks/usePrefersReducedMo
|
|
26
26
|
var useFocus = require('../../global/js/hooks/useFocus.js');
|
27
27
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
28
28
|
|
29
|
-
var _excluded = ["actionToolbarButtons", "actions", "aiLabel", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "id", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "slug", "subtitle", "title", "launcherButtonRef"],
|
29
|
+
var _excluded = ["actionToolbarButtons", "actions", "aiLabel", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "decorator", "id", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "slug", "subtitle", "title", "launcherButtonRef"],
|
30
30
|
_excluded2 = ["label", "kind", "hasIconOnly", "icon", "renderIcon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
|
31
31
|
var blockClass = "".concat(settings.pkg.prefix, "--side-panel");
|
32
32
|
var componentName = 'SidePanel';
|
@@ -59,6 +59,7 @@ exports.SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
59
59
|
condensedActions = _ref.condensedActions,
|
60
60
|
_ref$currentStep = _ref.currentStep,
|
61
61
|
currentStep = _ref$currentStep === void 0 ? defaults.currentStep : _ref$currentStep,
|
62
|
+
decorator = _ref.decorator,
|
62
63
|
_ref$id = _ref.id,
|
63
64
|
id = _ref$id === void 0 ? blockClass : _ref$id,
|
64
65
|
includeOverlay = _ref.includeOverlay,
|
@@ -268,7 +269,7 @@ exports.SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
268
269
|
if (!open) {
|
269
270
|
onUnmount === null || onUnmount === void 0 || onUnmount();
|
270
271
|
}
|
271
|
-
setAnimationComplete(
|
272
|
+
setAnimationComplete(!animationComplete);
|
272
273
|
};
|
273
274
|
|
274
275
|
// Set the internal state `animationComplete` to true if
|
@@ -322,22 +323,24 @@ exports.SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
322
323
|
}
|
323
324
|
}, [slideIn, selectorPageContent, placement, size, shouldReduceMotion, open]);
|
324
325
|
React.useEffect(function () {
|
325
|
-
if (open) {
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
primeFocusEl === null || primeFocusEl === void 0
|
332
|
-
}
|
333
|
-
} else if (!slideIn) {
|
334
|
-
firstElement === null || firstElement === void 0 || firstElement.focus();
|
326
|
+
if (open && animationComplete) {
|
327
|
+
if (selectorPrimaryFocus && useFocus.getSpecificElement(sidePanelRef === null || sidePanelRef === void 0 ? void 0 : sidePanelRef.current, selectorPrimaryFocus)) {
|
328
|
+
var _window2;
|
329
|
+
var primeFocusEl = useFocus.getSpecificElement(sidePanelRef === null || sidePanelRef === void 0 ? void 0 : sidePanelRef.current, selectorPrimaryFocus);
|
330
|
+
if (primeFocusEl && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(primeFocusEl)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none') {
|
331
|
+
setTimeout(function () {
|
332
|
+
return primeFocusEl === null || primeFocusEl === void 0 ? void 0 : primeFocusEl.focus();
|
333
|
+
}, 0);
|
335
334
|
}
|
336
|
-
}
|
335
|
+
} else if (!slideIn) {
|
336
|
+
setTimeout(function () {
|
337
|
+
return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
|
338
|
+
}, 0);
|
339
|
+
}
|
337
340
|
}
|
338
341
|
}, [animationComplete, firstElement, open, selectorPrimaryFocus, sidePanelRef, slideIn]);
|
339
342
|
var primaryActionContainerClassNames = cx(["".concat(blockClass, "__actions-container"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__actions-container--condensed"), condensedActions)]);
|
340
|
-
var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--right-placement"), placement === 'right'), "".concat(blockClass, "--left-placement"), placement === 'left'), "".concat(blockClass, "--slide-in"), slideIn), "".concat(blockClass, "--has-ai-label"),
|
343
|
+
var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--right-placement"), placement === 'right'), "".concat(blockClass, "--left-placement"), placement === 'left'), "".concat(blockClass, "--slide-in"), slideIn), "".concat(blockClass, "--has-decorator"), decorator), "".concat(blockClass, "--has-slug"), slug), "".concat(blockClass, "--has-ai-label"), aiLabel), "".concat(blockClass, "--condensed-actions"), condensedActions), "".concat(blockClass, "--has-overlay"), includeOverlay)]);
|
341
344
|
var renderTitle = function renderTitle() {
|
342
345
|
return /*#__PURE__*/React.createElement("div", {
|
343
346
|
className: cx("".concat(blockClass, "__title"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__title--no-label"), !labelTextRef.current)),
|
@@ -353,23 +356,29 @@ exports.SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
353
356
|
}, title));
|
354
357
|
};
|
355
358
|
var renderHeader = function renderHeader() {
|
356
|
-
var _slug$type, _aiLabel$type;
|
357
|
-
var
|
358
|
-
var
|
359
|
+
var _slug$type, _aiLabel$type, _decorator$type;
|
360
|
+
var closeSize = actions && actions.length && /l/.test(size) ? 'md' : 'sm';
|
361
|
+
var normalizedDecorator;
|
359
362
|
/**
|
360
363
|
* slug is deprecated
|
361
364
|
* can remove this condition in future release
|
362
365
|
*/
|
363
|
-
if (slug && ((_slug$type = slug['type']) === null || _slug$type === void 0 ? void 0 : _slug$type.displayName) === '
|
364
|
-
|
366
|
+
if (slug && ((_slug$type = slug['type']) === null || _slug$type === void 0 ? void 0 : _slug$type.displayName) === 'AILabel') {
|
367
|
+
normalizedDecorator = /*#__PURE__*/React.cloneElement(slug, {
|
365
368
|
// slug size is sm unless actions and size > md
|
366
|
-
size:
|
369
|
+
size: closeSize
|
367
370
|
});
|
368
371
|
}
|
369
372
|
if (aiLabel && ((_aiLabel$type = aiLabel['type']) === null || _aiLabel$type === void 0 ? void 0 : _aiLabel$type.displayName) === 'AILabel') {
|
370
|
-
|
373
|
+
normalizedDecorator = /*#__PURE__*/React.cloneElement(aiLabel, {
|
371
374
|
// aiLabel size is sm unless actions and size > md
|
372
|
-
size:
|
375
|
+
size: closeSize
|
376
|
+
});
|
377
|
+
}
|
378
|
+
if ((decorator === null || decorator === void 0 || (_decorator$type = decorator['type']) === null || _decorator$type === void 0 ? void 0 : _decorator$type.displayName) === 'AILabel') {
|
379
|
+
normalizedDecorator = /*#__PURE__*/React.cloneElement(decorator, {
|
380
|
+
// decorator size is sm unless actions and size > md
|
381
|
+
size: closeSize
|
373
382
|
});
|
374
383
|
}
|
375
384
|
return /*#__PURE__*/React.createElement("div", {
|
@@ -377,7 +386,7 @@ exports.SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
377
386
|
ref: headerRef
|
378
387
|
}, currentStep > 0 && /*#__PURE__*/React.createElement(react.Button, {
|
379
388
|
kind: "ghost",
|
380
|
-
size:
|
389
|
+
size: closeSize,
|
381
390
|
disabled: false,
|
382
391
|
renderIcon: function renderIcon(props) {
|
383
392
|
return /*#__PURE__*/React.createElement(icons.ArrowLeft, _rollupPluginBabelHelpers.extends({
|
@@ -391,8 +400,8 @@ exports.SidePanel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
391
400
|
className: "".concat(blockClass, "__label-text"),
|
392
401
|
ref: labelTextRef
|
393
402
|
}, labelText), title && title.length && renderTitle(), /*#__PURE__*/React.createElement("div", {
|
394
|
-
className: "".concat(blockClass, "
|
395
|
-
},
|
403
|
+
className: "".concat(blockClass, "__decorator-and-close")
|
404
|
+
}, normalizedDecorator, /*#__PURE__*/React.createElement(react.IconButton, {
|
396
405
|
className: "".concat(blockClass, "__close-button"),
|
397
406
|
label: closeIconDescription,
|
398
407
|
onClick: onRequestClose,
|
@@ -495,7 +504,13 @@ var deprecatedProps = {
|
|
495
504
|
* **deprecated**
|
496
505
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
|
497
506
|
*/
|
498
|
-
slug: index.default.node
|
507
|
+
slug: index.default.node,
|
508
|
+
/**
|
509
|
+
* **deprecated**
|
510
|
+
* Please use the `decorator` instead
|
511
|
+
* Optional prop that is intended for any scenario where something is being generated by AI to reinforce AI transparency, accountability, and explainability at the UI level.
|
512
|
+
*/
|
513
|
+
aiLabel: index.default.node
|
499
514
|
};
|
500
515
|
exports.SidePanel.propTypes = _rollupPluginBabelHelpers.objectSpread2({
|
501
516
|
/**
|
@@ -191,9 +191,6 @@ exports.TagOverflow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
191
191
|
return itemRefHandler(id, node);
|
192
192
|
},
|
193
193
|
key: id
|
194
|
-
}, /*#__PURE__*/React.createElement(react.Tooltip, {
|
195
|
-
align: overflowAlign,
|
196
|
-
label: label
|
197
194
|
}, typeof _onClose === 'function' || filter ? /*#__PURE__*/React.createElement(react.DismissibleTag, _rollupPluginBabelHelpers.extends({}, other, {
|
198
195
|
className: "".concat(blockClass, "__item--tag"),
|
199
196
|
type: tagType,
|
@@ -204,7 +201,7 @@ exports.TagOverflow = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
204
201
|
})) : /*#__PURE__*/React.createElement(react.Tag, _rollupPluginBabelHelpers.extends({}, other, {
|
205
202
|
className: "".concat(blockClass, "__item--tag"),
|
206
203
|
type: tagType
|
207
|
-
}), label))
|
204
|
+
}), label));
|
208
205
|
}
|
209
206
|
}), /*#__PURE__*/React.createElement("span", {
|
210
207
|
className: "".concat(blockClass, "__indicator"),
|
@@ -19,6 +19,10 @@ interface TearsheetShellProps extends PropsWithChildren {
|
|
19
19
|
* An optional class or classes to be added to the outermost element.
|
20
20
|
*/
|
21
21
|
className?: string;
|
22
|
+
/**
|
23
|
+
* Used to track the current step on components which use `StepsContext` and `TearsheetShell`
|
24
|
+
*/
|
25
|
+
currentStep?: number;
|
22
26
|
/**
|
23
27
|
* A description of the flow, displayed in the header area of the tearsheet.
|
24
28
|
*/
|
@@ -23,7 +23,7 @@ var usePortalTarget = require('../../global/js/hooks/usePortalTarget.js');
|
|
23
23
|
var useFocus = require('../../global/js/hooks/useFocus.js');
|
24
24
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
25
25
|
|
26
|
-
var _excluded = ["actions", "aiLabel", "ariaLabel", "children", "className", "closeIconDescription", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "selectorsFloatingMenus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
|
26
|
+
var _excluded = ["actions", "aiLabel", "ariaLabel", "children", "className", "closeIconDescription", "currentStep", "description", "hasCloseIcon", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "selectorsFloatingMenus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
|
27
27
|
// The block part of our conventional BEM class names (bc__E--M).
|
28
28
|
var bc = "".concat(settings.pkg.prefix, "--tearsheet");
|
29
29
|
var componentName = 'TearsheetShell';
|
@@ -70,6 +70,7 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
70
70
|
children = _ref.children,
|
71
71
|
className = _ref.className,
|
72
72
|
closeIconDescription = _ref.closeIconDescription,
|
73
|
+
currentStep = _ref.currentStep,
|
73
74
|
description = _ref.description,
|
74
75
|
hasCloseIcon = _ref.hasCloseIcon,
|
75
76
|
headerActions = _ref.headerActions,
|
@@ -102,8 +103,7 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
102
103
|
var prevOpen = usePreviousValue.usePreviousValue(open);
|
103
104
|
var _useFocus = useFocus.useFocus(modalRef, selectorPrimaryFocus),
|
104
105
|
firstElement = _useFocus.firstElement,
|
105
|
-
keyDownListener = _useFocus.keyDownListener
|
106
|
-
specifiedElement = _useFocus.specifiedElement;
|
106
|
+
keyDownListener = _useFocus.keyDownListener;
|
107
107
|
var modalRefValue = modalRef.current;
|
108
108
|
|
109
109
|
// Function to strip html tags out of a string.
|
@@ -139,23 +139,12 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
139
139
|
setDepth(newDepth);
|
140
140
|
setPosition(newPosition);
|
141
141
|
}
|
142
|
-
handleStackChange.checkFocus = function () {
|
143
|
-
// if we are now the topmost tearsheet, ensure we have focus
|
144
|
-
if (open && position === depth && modalRefValue && !modalRefValue.contains(document.activeElement)) {
|
145
|
-
handleStackChange.claimFocus();
|
146
|
-
}
|
147
|
-
};
|
148
|
-
|
149
|
-
// Callback to give the tearsheet the opportunity to claim focus
|
150
|
-
handleStackChange.claimFocus = function () {
|
151
|
-
useFocus.claimFocus(firstElement, modalRef, selectorPrimaryFocus);
|
152
|
-
};
|
153
142
|
React.useEffect(function () {
|
154
|
-
if (open) {
|
143
|
+
if (open && position === depth) {
|
155
144
|
// Focusing the first element or selectorPrimaryFocus element
|
156
145
|
useFocus.claimFocus(firstElement, modalRef, selectorPrimaryFocus);
|
157
146
|
}
|
158
|
-
}, [firstElement, modalRef, open, selectorPrimaryFocus]);
|
147
|
+
}, [currentStep, depth, firstElement, modalRef, modalRefValue, open, position, selectorPrimaryFocus]);
|
159
148
|
React.useEffect(function () {
|
160
149
|
if (prevOpen && !open && launcherButtonRef) {
|
161
150
|
setTimeout(function () {
|
@@ -163,22 +152,10 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
163
152
|
}, 0);
|
164
153
|
}
|
165
154
|
}, [launcherButtonRef, open, prevOpen]);
|
166
|
-
React.useEffect(function () {
|
167
|
-
if (open && position !== depth) {
|
168
|
-
setTimeout(function () {
|
169
|
-
if (selectorPrimaryFocus) {
|
170
|
-
return specifiedElement === null || specifiedElement === void 0 ? void 0 : specifiedElement.focus();
|
171
|
-
}
|
172
|
-
firstElement === null || firstElement === void 0 || firstElement.focus();
|
173
|
-
}, 0);
|
174
|
-
}
|
175
|
-
}, [position, depth, firstElement, open, specifiedElement, selectorPrimaryFocus]);
|
176
155
|
React.useEffect(function () {
|
177
156
|
var notify = function notify() {
|
178
157
|
return stack.all.forEach(function (handler) {
|
179
|
-
var _handler$checkFocus;
|
180
158
|
handler(Math.min(stack.open.length, maxDepth), stack.open.indexOf(handler) + 1);
|
181
|
-
(_handler$checkFocus = handler.checkFocus) === null || _handler$checkFocus === void 0 || _handler$checkFocus.call(handler);
|
182
159
|
});
|
183
160
|
};
|
184
161
|
|
@@ -213,14 +190,6 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
213
190
|
}
|
214
191
|
};
|
215
192
|
}, [open, size]);
|
216
|
-
function handleFocus() {
|
217
|
-
// If something within us is receiving focus but we are not the topmost
|
218
|
-
// stacked tearsheet, transfer focus to the topmost tearsheet instead
|
219
|
-
if (position < depth) {
|
220
|
-
var _stack$open$claimFocu, _stack$open;
|
221
|
-
(_stack$open$claimFocu = (_stack$open = stack.open[stack.open.length - 1]).claimFocus) === null || _stack$open$claimFocu === void 0 || _stack$open$claimFocu.call(_stack$open);
|
222
|
-
}
|
223
|
-
}
|
224
193
|
if (position <= depth) {
|
225
194
|
var _prevDepth$current;
|
226
195
|
// Include a modal header if and only if one or more of these is given.
|
@@ -252,7 +221,6 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
252
221
|
onClose: onClose,
|
253
222
|
open: open,
|
254
223
|
selectorPrimaryFocus: selectorPrimaryFocus,
|
255
|
-
onFocus: handleFocus,
|
256
224
|
onKeyDown: keyDownListener,
|
257
225
|
preventCloseOnClickOutside: !isPassive,
|
258
226
|
ref: modalRef,
|
@@ -12,4 +12,4 @@ export function useFocus(modalRef: any, selectorPrimaryFocus: any): {
|
|
12
12
|
specified: any;
|
13
13
|
};
|
14
14
|
};
|
15
|
-
export function claimFocus(firstElement: any, modalRef: any, selectorPrimaryFocus?: string | undefined):
|
15
|
+
export function claimFocus(firstElement: any, modalRef: any, selectorPrimaryFocus?: string | undefined): void;
|
@@ -118,12 +118,15 @@ var claimFocus = function claimFocus(firstElement, modalRef) {
|
|
118
118
|
var _window2;
|
119
119
|
var specifiedEl = getSpecificElement(modalRef === null || modalRef === void 0 ? void 0 : modalRef.current, selectorPrimaryFocus);
|
120
120
|
if (specifiedEl && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(specifiedEl)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none') {
|
121
|
-
|
121
|
+
setTimeout(function () {
|
122
|
+
return specifiedEl.focus();
|
123
|
+
}, 0);
|
122
124
|
}
|
125
|
+
} else {
|
126
|
+
setTimeout(function () {
|
127
|
+
return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
|
128
|
+
}, 0);
|
123
129
|
}
|
124
|
-
setTimeout(function () {
|
125
|
-
return firstElement === null || firstElement === void 0 ? void 0 : firstElement.focus();
|
126
|
-
}, 0);
|
127
130
|
};
|
128
131
|
|
129
132
|
exports.claimFocus = claimFocus;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
// Copyright IBM Corp. 2024, 2024
|
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
|
+
/**
|
17
|
+
* used to calculate if a element is overflowing the width or height of an area
|
18
|
+
*/
|
19
|
+
|
20
|
+
var checkWidthOverflow = function checkWidthOverflow(el) {
|
21
|
+
if (el) {
|
22
|
+
return (el === null || el === void 0 ? void 0 : el.offsetWidth) < (el === null || el === void 0 ? void 0 : el.scrollWidth);
|
23
|
+
}
|
24
|
+
return false;
|
25
|
+
};
|
26
|
+
var checkHeightOverflow = function checkHeightOverflow(el) {
|
27
|
+
if (el) {
|
28
|
+
return (el === null || el === void 0 ? void 0 : el.offsetHeight) < (el === null || el === void 0 ? void 0 : el.scrollHeight);
|
29
|
+
}
|
30
|
+
return false;
|
31
|
+
};
|
32
|
+
|
33
|
+
exports.checkHeightOverflow = checkHeightOverflow;
|
34
|
+
exports.checkWidthOverflow = checkWidthOverflow;
|
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.57.0-rc.0",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -72,7 +72,7 @@
|
|
72
72
|
"@rollup/plugin-typescript": "^12.1.1",
|
73
73
|
"@types/react-table": "^7.7.20",
|
74
74
|
"babel-plugin-dev-expression": "^0.2.3",
|
75
|
-
"babel-preset-ibm-cloud-cognitive": "^0.
|
75
|
+
"babel-preset-ibm-cloud-cognitive": "^0.15.0-rc.0",
|
76
76
|
"chalk": "^4.1.2",
|
77
77
|
"change-case": "4.1.2",
|
78
78
|
"classnames": "^2.5.1",
|
@@ -81,10 +81,10 @@
|
|
81
81
|
"fs-extra": "^11.2.0",
|
82
82
|
"glob": "^10.3.10",
|
83
83
|
"jest": "^29.7.0",
|
84
|
-
"jest-config-ibm-cloud-cognitive": "^1.
|
84
|
+
"jest-config-ibm-cloud-cognitive": "^1.16.0-rc.0",
|
85
85
|
"jest-environment-jsdom": "^29.7.0",
|
86
86
|
"namor": "^1.1.2",
|
87
|
-
"npm-check-updates": "^
|
87
|
+
"npm-check-updates": "^17.1.11",
|
88
88
|
"npm-run-all": "^4.1.5",
|
89
89
|
"rimraf": "^5.0.5",
|
90
90
|
"rollup": "^4.27.3",
|
@@ -96,14 +96,14 @@
|
|
96
96
|
"dependencies": {
|
97
97
|
"@babel/runtime": "^7.23.9",
|
98
98
|
"@carbon/feature-flags": "^0.24.0",
|
99
|
-
"@carbon/ibm-products-styles": "^2.
|
99
|
+
"@carbon/ibm-products-styles": "^2.53.0-rc.0",
|
100
100
|
"@carbon/telemetry": "^0.1.0",
|
101
101
|
"@dnd-kit/core": "^6.0.8",
|
102
102
|
"@dnd-kit/modifiers": "^7.0.0",
|
103
103
|
"@dnd-kit/sortable": "^8.0.0",
|
104
104
|
"@dnd-kit/utilities": "^3.2.2",
|
105
105
|
"@ibm/telemetry-js": "^1.5.0",
|
106
|
-
"framer-motion": "^
|
106
|
+
"framer-motion": "^11.11.17",
|
107
107
|
"immutability-helper": "^3.1.1",
|
108
108
|
"lodash": "^4.17.21",
|
109
109
|
"lottie-web": "^5.12.2",
|
@@ -114,11 +114,11 @@
|
|
114
114
|
"@carbon/grid": "^11.29.0",
|
115
115
|
"@carbon/layout": "^11.28.0",
|
116
116
|
"@carbon/motion": "^11.24.0",
|
117
|
-
"@carbon/react": "^1.
|
117
|
+
"@carbon/react": "^1.72.0",
|
118
118
|
"@carbon/themes": "^11.43.0",
|
119
119
|
"@carbon/type": "^11.33.0",
|
120
120
|
"react": "^16.8.6 || ^17.0.1 || ^18.2.0",
|
121
121
|
"react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
|
122
122
|
},
|
123
|
-
"gitHead": "
|
123
|
+
"gitHead": "3e6fe0b818ce98391ed417642a5dd66af9fb6980"
|
124
124
|
}
|
@@ -538,14 +538,8 @@ $right-section-alt-width: 100% - $left-section-alt-width;
|
|
538
538
|
}
|
539
539
|
|
540
540
|
.#{$block-class}__subtitle-row {
|
541
|
-
display: -webkit-box;
|
542
|
-
overflow: hidden;
|
543
|
-
max-width: 100%;
|
544
541
|
margin-top: $spacing-03;
|
545
542
|
|
546
|
-
-webkit-box-orient: vertical;
|
547
|
-
-webkit-line-clamp: 2;
|
548
|
-
|
549
543
|
@include breakpoint-up('md') {
|
550
544
|
max-width: $left-section-std-width;
|
551
545
|
}
|
@@ -559,6 +553,24 @@ $right-section-alt-width: 100% - $left-section-alt-width;
|
|
559
553
|
@include type.type-style('body-01');
|
560
554
|
}
|
561
555
|
|
556
|
+
.#{$block-class}__subtitle-tooltip .#{$carbon-prefix}--definition-term {
|
557
|
+
border-bottom: 0;
|
558
|
+
letter-spacing: inherit;
|
559
|
+
}
|
560
|
+
|
561
|
+
// overwrites the existing styles to make the popover bigger because in some cases the narrow space can be too constricting for the header
|
562
|
+
.#{$block-class}__subtitle-tooltip
|
563
|
+
.#{$carbon-prefix}--popover-content.#{$carbon-prefix}--definition-tooltip {
|
564
|
+
max-inline-size: fit-content;
|
565
|
+
}
|
566
|
+
|
567
|
+
.#{$block-class}__subtitle-text {
|
568
|
+
display: -webkit-box;
|
569
|
+
overflow: hidden;
|
570
|
+
-webkit-box-orient: vertical;
|
571
|
+
-webkit-line-clamp: 2;
|
572
|
+
}
|
573
|
+
|
562
574
|
.#{$block-class}__available-row {
|
563
575
|
@include type.type-style('body-01');
|
564
576
|
|