@carbon/ibm-products 2.36.0-alpha.27 → 2.37.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +5404 -5117
- 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 +4 -4
- 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 +820 -61
- 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 +329 -6
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/_virtual/_rollupPluginBabelHelpers.js +9 -10
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
- package/es/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
- package/es/components/Carousel/Carousel.d.ts +46 -2
- package/es/components/Carousel/Carousel.js +36 -21
- package/es/components/Carousel/CarouselItem.d.ts +19 -2
- package/es/components/Carousel/CarouselItem.js +0 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +261 -0
- package/es/components/ConditionBuilder/ConditionBuilder.js +45 -16
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +74 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
- package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
- package/es/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +112 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +151 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +59 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +52 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +162 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +40 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +82 -0
- package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
- package/es/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +85 -0
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +145 -0
- package/es/components/ConditionBuilder/utils/util.d.ts +4 -0
- package/es/components/ConditionBuilder/utils/util.js +16 -0
- package/es/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
- package/es/components/CreateTearsheet/CreateTearsheet.js +12 -32
- package/es/components/Datagrid/useParentDimensions.js +1 -1
- package/es/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
- package/es/components/EditUpdateCards/EditUpdateCards.js +3 -0
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
- package/es/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
- package/es/components/ExpressiveCard/ExpressiveCard.js +4 -0
- package/es/components/InlineTip/InlineTipButton.d.ts +21 -2
- package/es/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
- package/es/components/InterstitialScreen/InterstitialScreen.js +25 -14
- package/es/components/Nav/NavItem.js +1 -1
- package/es/components/NotificationsPanel/NotificationsPanel.js +5 -6
- package/es/components/PageHeader/PageHeader.js +12 -3
- package/es/components/SidePanel/SidePanel.js +1 -1
- package/es/components/SimpleHeader/SimpleHeader.d.ts +1 -5
- package/es/components/SimpleHeader/SimpleHeader.js +2 -4
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
- package/es/components/Tearsheet/TearsheetShell.d.ts +119 -10
- package/es/components/Tearsheet/TearsheetShell.js +18 -8
- package/es/components/UserProfileImage/UserProfileImage.d.ts +66 -2
- package/es/components/UserProfileImage/UserProfileImage.js +5 -3
- package/es/components/WebTerminal/WebTerminal.d.ts +46 -2
- package/es/components/WebTerminal/WebTerminal.js +2 -2
- package/es/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/es/global/js/hooks/usePrefersReducedMotion.js +28 -0
- package/es/global/js/utils/Wrap.d.ts +31 -2
- package/es/global/js/utils/Wrap.js +7 -9
- package/es/global/js/utils/getNodeTextContent.d.ts +1 -1
- package/es/global/js/utils/getNodeTextContent.js +1 -1
- package/es/global/js/utils/window.d.ts +2 -0
- package/es/global/js/utils/window.js +12 -0
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2780 -0
- package/lib/_virtual/_rollupPluginBabelHelpers.js +9 -10
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.d.ts +3 -1
- package/lib/components/BreadcrumbWithOverflow/BreadcrumbWithOverflow.js +8 -2
- package/lib/components/Carousel/Carousel.d.ts +46 -2
- package/lib/components/Carousel/Carousel.js +35 -20
- package/lib/components/Carousel/CarouselItem.d.ts +19 -2
- package/lib/components/Carousel/CarouselItem.js +0 -1
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +21 -0
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +270 -0
- package/lib/components/ConditionBuilder/ConditionBuilder.js +46 -17
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.d.ts +12 -0
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +48 -0
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +22 -0
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +83 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +18 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +90 -42
- package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.d.ts → ConditionBuilderProvider.d.ts} +5 -2
- package/lib/components/ConditionBuilder/ConditionBuilderContext/{DataTreeContext.js → ConditionBuilderProvider.js} +27 -8
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +22 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +121 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +31 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +44 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +28 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +159 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +67 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +60 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.d.ts +13 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ConditionBuilderItemOption.js +170 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +48 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.d.ts +11 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +90 -0
- package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.d.ts +15 -0
- package/lib/components/ConditionBuilder/ConditionConnector/ConditionConnector.js +93 -0
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +24 -0
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +153 -0
- package/lib/components/ConditionBuilder/utils/util.d.ts +4 -0
- package/lib/components/ConditionBuilder/utils/util.js +20 -0
- package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +106 -4
- package/lib/components/CreateTearsheet/CreateTearsheet.js +12 -32
- package/lib/components/Datagrid/useParentDimensions.js +1 -1
- package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +104 -2
- package/lib/components/EditUpdateCards/EditUpdateCards.js +3 -0
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NotificationsEmptyState/NotificationsEmptyState.js +1 -3
- package/lib/components/ExpressiveCard/ExpressiveCard.d.ts +97 -2
- package/lib/components/ExpressiveCard/ExpressiveCard.js +4 -0
- package/lib/components/InlineTip/InlineTipButton.d.ts +21 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.d.ts +100 -2
- package/lib/components/InterstitialScreen/InterstitialScreen.js +24 -13
- package/lib/components/Nav/NavItem.js +2 -2
- package/lib/components/NotificationsPanel/NotificationsPanel.js +5 -6
- package/lib/components/PageHeader/PageHeader.js +11 -2
- package/lib/components/SidePanel/SidePanel.js +1 -1
- package/lib/components/SimpleHeader/SimpleHeader.d.ts +1 -5
- package/lib/components/SimpleHeader/SimpleHeader.js +2 -4
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +4 -13
- package/lib/components/Tearsheet/TearsheetShell.d.ts +119 -10
- package/lib/components/Tearsheet/TearsheetShell.js +16 -6
- package/lib/components/UserProfileImage/UserProfileImage.d.ts +66 -2
- package/lib/components/UserProfileImage/UserProfileImage.js +5 -3
- package/lib/components/WebTerminal/WebTerminal.d.ts +46 -2
- package/lib/components/WebTerminal/WebTerminal.js +2 -2
- package/lib/global/js/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/lib/global/js/hooks/usePrefersReducedMotion.js +32 -0
- package/lib/global/js/utils/Wrap.d.ts +31 -2
- package/lib/global/js/utils/Wrap.js +7 -9
- package/lib/global/js/utils/getNodeTextContent.d.ts +1 -1
- package/lib/global/js/utils/getNodeTextContent.js +1 -1
- package/lib/global/js/utils/window.d.ts +2 -0
- package/lib/global/js/utils/window.js +16 -0
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-9.js +2912 -0
- package/package.json +5 -5
- package/scss/components/CoachmarkOverlayElements/_coachmark-overlay-elements.scss +1 -1
- package/scss/components/ConditionBuilder/_condition-builder.scss +26 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderCondition.scss +46 -0
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +194 -0
- package/scss/components/ConditionBuilder/styles/_index.scss +2 -0
- package/scss/components/Guidebanner/_guidebanner.scss +3 -0
- package/scss/components/InterstitialScreen/_interstitial-screen.scss +1 -6
- package/scss/components/Tearsheet/_tearsheet.scss +3 -1
- package/telemetry.yml +3 -0
- package/es/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
- package/es/global/js/utils/keyboardNavigation.d.ts +0 -27
- package/es/global/js/utils/keyboardNavigation.js +0 -33
- package/es/global/js/utils/wrapFocus.d.ts +0 -25
- package/es/global/js/utils/wrapFocus.js +0 -68
- package/es/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3004
- package/lib/components/ConditionBuilder/assets/sampleInput.d.ts +0 -58
- package/lib/global/js/utils/keyboardNavigation.d.ts +0 -27
- package/lib/global/js/utils/keyboardNavigation.js +0 -39
- package/lib/global/js/utils/wrapFocus.d.ts +0 -25
- package/lib/global/js/utils/wrapFocus.js +0 -73
- package/lib/node_modules/@carbon/icons-react/es/generated/bucket-8.js +0 -3136
@@ -6,7 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
|
-
import React__default, { useRef, useState, Children, useCallback, useEffect } from 'react';
|
9
|
+
import React__default, { useRef, useState, Children, useCallback, useEffect, isValidElement } from 'react';
|
10
10
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
11
11
|
import cx from 'classnames';
|
12
12
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
@@ -51,7 +51,6 @@ var defaults = {
|
|
51
51
|
skipButtonLabel: '',
|
52
52
|
startButtonLabel: 'Get started'
|
53
53
|
};
|
54
|
-
|
55
54
|
/**
|
56
55
|
* InterstitialScreen can be a full page or an overlay, and are
|
57
56
|
* shown on the first time a user accesses a new experience
|
@@ -106,7 +105,7 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
106
105
|
var childArray = Children.toArray(children);
|
107
106
|
var isMultiStep = childArray.length > 1;
|
108
107
|
var mediaIsDefined = (media === null || media === void 0 ? void 0 : media.render) || (media === null || media === void 0 ? void 0 : media.filePaths);
|
109
|
-
var bodyScrollRef = useRef();
|
108
|
+
var bodyScrollRef = useRef(null);
|
110
109
|
var mediaBreakpoints = {
|
111
110
|
xlg: (media === null || media === void 0 || (_media$breakpoints = media.breakpoints) === null || _media$breakpoints === void 0 ? void 0 : _media$breakpoints.xlg) || 0,
|
112
111
|
lg: (media === null || media === void 0 || (_media$breakpoints2 = media.breakpoints) === null || _media$breakpoints2 === void 0 ? void 0 : _media$breakpoints2.lg) || 0,
|
@@ -127,7 +126,8 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
127
126
|
onClose();
|
128
127
|
}, [onClose]);
|
129
128
|
var scrollBodyToTop = function scrollBodyToTop() {
|
130
|
-
|
129
|
+
var _bodyScrollRef$curren;
|
130
|
+
(_bodyScrollRef$curren = bodyScrollRef.current) === null || _bodyScrollRef$curren === void 0 || _bodyScrollRef$curren.scroll({
|
131
131
|
top: 0,
|
132
132
|
behavior: 'smooth'
|
133
133
|
});
|
@@ -197,10 +197,12 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
197
197
|
vertical: false,
|
198
198
|
currentIndex: progStep
|
199
199
|
}, childArray.map(function (child, idx) {
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
200
|
+
if ( /*#__PURE__*/isValidElement(child)) {
|
201
|
+
return /*#__PURE__*/React__default.createElement(ProgressStep, {
|
202
|
+
key: idx,
|
203
|
+
label: child.props.stepTitle
|
204
|
+
});
|
205
|
+
}
|
204
206
|
})))), /*#__PURE__*/React__default.createElement(ModalBody, {
|
205
207
|
className: bodyBlockClass
|
206
208
|
}, childElements), /*#__PURE__*/React__default.createElement(ModalFooter, null, renderFooter()));
|
@@ -226,10 +228,12 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
226
228
|
vertical: false,
|
227
229
|
currentIndex: progStep
|
228
230
|
}, childArray.map(function (child, idx) {
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
231
|
+
if ( /*#__PURE__*/isValidElement(child)) {
|
232
|
+
return /*#__PURE__*/React__default.createElement(ProgressStep, {
|
233
|
+
key: idx,
|
234
|
+
label: child.props.stepTitle
|
235
|
+
});
|
236
|
+
}
|
233
237
|
})))), childElements, renderFooter()));
|
234
238
|
};
|
235
239
|
var renderBody = function renderBody() {
|
@@ -252,7 +256,10 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
252
256
|
className: "".concat(blockClass, "__carousel")
|
253
257
|
}, /*#__PURE__*/React__default.createElement(Carousel, {
|
254
258
|
disableArrowScroll: true,
|
255
|
-
ref: scrollRef
|
259
|
+
ref: scrollRef,
|
260
|
+
onScroll: function onScroll(scrollPercent) {
|
261
|
+
scrollPercent === 0 && setProgStep(0);
|
262
|
+
}
|
256
263
|
}, children)) : childArray[0])), mediaIsDefined && /*#__PURE__*/React__default.createElement(Column, {
|
257
264
|
xlg: mediaBreakpoints.xlg,
|
258
265
|
lg: mediaBreakpoints.lg,
|
@@ -271,7 +278,10 @@ var InterstitialScreen = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
271
278
|
className: "".concat(blockClass, "__carousel")
|
272
279
|
}, /*#__PURE__*/React__default.createElement(Carousel, {
|
273
280
|
disableArrowScroll: true,
|
274
|
-
ref: scrollRef
|
281
|
+
ref: scrollRef,
|
282
|
+
onScroll: function onScroll(scrollPercent) {
|
283
|
+
scrollPercent === 0 && setProgStep(0);
|
284
|
+
}
|
275
285
|
}, children)) : /*#__PURE__*/React__default.createElement("div", null, childArray[0])));
|
276
286
|
};
|
277
287
|
var renderFooter = function renderFooter() {
|
@@ -379,6 +389,7 @@ InterstitialScreen.propTypes = {
|
|
379
389
|
* Medium and small breakpoints will be set to 0 internally to focus on the main content area.
|
380
390
|
* @see {@link MEDIA_PROP_TYPE}.
|
381
391
|
*/
|
392
|
+
/**@ts-ignore */
|
382
393
|
media: PropTypes.oneOfType([PropTypes.shape({
|
383
394
|
render: PropTypes.func,
|
384
395
|
breakpoints: PropTypes.shape({
|
@@ -12,7 +12,7 @@ import cx from 'classnames';
|
|
12
12
|
import { pkg } from '../../settings.js';
|
13
13
|
import uuidv4 from '../../global/js/utils/uuidv4.js';
|
14
14
|
import NavItemLink from './NavItemLink.js';
|
15
|
-
import { Launch } from '../../node_modules/@carbon/icons-react/es/generated/bucket-
|
15
|
+
import { Launch } from '../../node_modules/@carbon/icons-react/es/generated/bucket-9.js';
|
16
16
|
|
17
17
|
var _excluded = ["activeHref", "children", "className", "current", "disabled", "element", "href", "id", "label", "onClick", "tabIndex"];
|
18
18
|
|
@@ -13,6 +13,7 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
|
13
13
|
import { pkg } from '../../settings.js';
|
14
14
|
import { timeAgo } from './utils.js';
|
15
15
|
import { prepareProps } from '../../global/js/utils/props-helper.js';
|
16
|
+
import usePrefersReducedMotion from '../../global/js/hooks/usePrefersReducedMotion.js';
|
16
17
|
import { Button, Toggle, Link, IconButton } from '@carbon/react';
|
17
18
|
import { Settings, ErrorFilled, CheckmarkFilled, WarningAltFilled, InformationSquareFilled, Close, ChevronDown } from '@carbon/react/icons';
|
18
19
|
import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
|
@@ -153,9 +154,7 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
153
154
|
var previousState = usePreviousValue({
|
154
155
|
open: open
|
155
156
|
});
|
156
|
-
var reducedMotion =
|
157
|
-
matches: true
|
158
|
-
};
|
157
|
+
var reducedMotion = usePrefersReducedMotion();
|
159
158
|
useEffect(function () {
|
160
159
|
// Set the notifications passed to the state within this component
|
161
160
|
setAllNotifications(data);
|
@@ -174,10 +173,10 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
174
173
|
!open && setRender(false);
|
175
174
|
};
|
176
175
|
useEffect(function () {
|
177
|
-
if (!open && previousState !== null && previousState !== void 0 && previousState.open && reducedMotion
|
176
|
+
if (!open && previousState !== null && previousState !== void 0 && previousState.open && reducedMotion) {
|
178
177
|
setRender(false);
|
179
178
|
}
|
180
|
-
}, [open,
|
179
|
+
}, [open, previousState === null || previousState === void 0 ? void 0 : previousState.open, reducedMotion]);
|
181
180
|
var sortChronologically = function sortChronologically(arr) {
|
182
181
|
if (!arr || arr && !arr.length) {
|
183
182
|
return;
|
@@ -317,7 +316,7 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
317
316
|
id: blockClass,
|
318
317
|
className: cx(blockClass, className, "".concat(blockClass, "__container")),
|
319
318
|
style: {
|
320
|
-
animation: !reducedMotion
|
319
|
+
animation: !reducedMotion ? "".concat(open ? 'fade-in 250ms' : 'fade-out forwards 250ms') : null
|
321
320
|
},
|
322
321
|
onAnimationEnd: onAnimationEnd,
|
323
322
|
ref: ref || notificationPanelRef
|
@@ -11,7 +11,7 @@ import PropTypes from '../../node_modules/prop-types/index.js';
|
|
11
11
|
import { breakpoints, spacing10, baseFontSize } from '@carbon/layout';
|
12
12
|
import cx from 'classnames';
|
13
13
|
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
|
14
|
-
import { FlexGrid, Row, Column, Button, Tag } from '@carbon/react';
|
14
|
+
import { FlexGrid, Row, Column, Button, Tooltip, Tag } from '@carbon/react';
|
15
15
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
16
16
|
import { deprecateProp, prepareProps } from '../../global/js/utils/props-helper.js';
|
17
17
|
import { pkg } from '../../settings.js';
|
@@ -25,13 +25,14 @@ import { BreadcrumbWithOverflow } from '../BreadcrumbWithOverflow/BreadcrumbWith
|
|
25
25
|
import { ActionBar } from '../ActionBar/ActionBar.js';
|
26
26
|
import { ButtonSetWithOverflow } from '../ButtonSetWithOverflow/ButtonSetWithOverflow.js';
|
27
27
|
|
28
|
-
var _excluded = ["actionBarItems", "actionBarMenuOptionsClass", "actionBarOverflowAriaLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTitle", "hasBackgroundAlways", "breadcrumbOverflowAriaLabel", "breadcrumbs", "children", "className", "collapseHeader", "collapseHeaderIconDescription", "collapseTitle", "disableBreadcrumbScroll", "enableBreadcrumbScroll", "expandHeaderIconDescription", "fullWidthGrid", "hasCollapseHeaderToggle", "narrowGrid", "navigation", "pageActions", "pageActionsOverflowLabel", "pageActionsMenuOptionsClass", "showAllTagsLabel", "subtitle", "tags", "title", "withoutBackground"];
|
28
|
+
var _excluded = ["actionBarItems", "actionBarMenuOptionsClass", "actionBarOverflowAriaLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTitle", "hasBackgroundAlways", "breadcrumbOverflowAriaLabel", "breadcrumbs", "children", "className", "collapseHeader", "collapseHeaderIconDescription", "collapseTitle", "disableBreadcrumbScroll", "enableBreadcrumbScroll", "expandHeaderIconDescription", "fullWidthGrid", "hasCollapseHeaderToggle", "narrowGrid", "navigation", "pageActions", "pageActionsOverflowLabel", "pageActionsMenuOptionsClass", "showAllTagsLabel", "subtitle", "tags", "title", "withoutBackground", "breadcrumbOverflowTooltipAlign"];
|
29
29
|
var componentName = 'PageHeader';
|
30
30
|
|
31
31
|
// Default values for props
|
32
32
|
var defaults = {
|
33
33
|
fullWidthGrid: false,
|
34
|
-
narrowGrid: false
|
34
|
+
narrowGrid: false,
|
35
|
+
breadcrumbOverflowTooltipAlign: 'right'
|
35
36
|
};
|
36
37
|
var PageHeader = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
37
38
|
var _withoutBackground, _enableBreadcrumbScro;
|
@@ -66,6 +67,8 @@ var PageHeader = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
66
67
|
tags = _ref.tags,
|
67
68
|
title = _ref.title,
|
68
69
|
withoutBackground = _ref.withoutBackground,
|
70
|
+
_ref$breadcrumbOverfl = _ref.breadcrumbOverflowTooltipAlign,
|
71
|
+
breadcrumbOverflowTooltipAlign = _ref$breadcrumbOverfl === void 0 ? defaults.breadcrumbOverflowTooltipAlign : _ref$breadcrumbOverfl,
|
69
72
|
rest = _objectWithoutProperties(_ref, _excluded);
|
70
73
|
// handle deprecated props - START
|
71
74
|
// if withoutBackground is nullish check deprecated_hasBackgroundAlways and default false
|
@@ -337,6 +340,8 @@ var PageHeader = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
337
340
|
noTrailingSlash: !!title,
|
338
341
|
overflowAriaLabel: breadcrumbOverflowAriaLabel,
|
339
342
|
breadcrumbs: breadcrumbs && breadcrumbItemForTitle ? breadcrumbs.concat(breadcrumbItemForTitle) : breadcrumbItemForTitle ? [breadcrumbItemForTitle] : breadcrumbs // breadcrumbs may be null or undefined
|
343
|
+
,
|
344
|
+
overflowTooltipAlign: breadcrumbOverflowTooltipAlign
|
340
345
|
}) : null), /*#__PURE__*/React__default.createElement(Column, {
|
341
346
|
className: cx(["".concat(blockClass, "__action-bar-column ").concat(blockClass, "__action-bar-column--background"), _defineProperty(_defineProperty({}, "".concat(blockClass, "__action-bar-column--has-page-actions"), pageActions), "".concat(blockClass, "__action-bar-column--influenced-by-collapse-button"), spaceForCollapseButton)])
|
342
347
|
}, /*#__PURE__*/React__default.createElement("div", {
|
@@ -528,6 +533,10 @@ PageHeader.propTypes = _objectSpread2({
|
|
528
533
|
var breadcrumbs = _ref11.breadcrumbs;
|
529
534
|
return breadcrumbs && breadcrumbs.length > 0;
|
530
535
|
}),
|
536
|
+
/**
|
537
|
+
* align breadcrumb overflow tooltip
|
538
|
+
*/
|
539
|
+
breadcrumbOverflowTooltipAlign: Tooltip.propTypes.align,
|
531
540
|
/**
|
532
541
|
* Specifies the breadcrumb components to be shown in the breadcrumb area of
|
533
542
|
* the page header. Each item is specified as an object with optional fields
|
@@ -151,7 +151,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
151
151
|
titleItemsStyles(animationProgress);
|
152
152
|
}
|
153
153
|
}, [doAnimateTitle, panelRefValue === null || panelRefValue === void 0 ? void 0 : panelRefValue.style, scrollAnimationDistance, titleItemsStyles]);
|
154
|
-
var reducedMotion = typeof
|
154
|
+
var reducedMotion = typeof document !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
|
155
155
|
matches: true
|
156
156
|
};
|
157
157
|
|
@@ -16,7 +16,7 @@ export function SimpleHeader({ breadcrumbs, className, title, noTrailingSlash, m
|
|
16
16
|
breadcrumbs: any;
|
17
17
|
className: any;
|
18
18
|
title: any;
|
19
|
-
noTrailingSlash
|
19
|
+
noTrailingSlash?: boolean | undefined;
|
20
20
|
maxVisible: any;
|
21
21
|
overflowAriaLabel: any;
|
22
22
|
}): import("react/jsx-runtime").JSX.Element;
|
@@ -40,9 +40,5 @@ export namespace SimpleHeader {
|
|
40
40
|
export { overflowAriaLabel_required_if_breadcrumbs_exist as overflowAriaLabel };
|
41
41
|
export let title: PropTypes.Requireable<string>;
|
42
42
|
}
|
43
|
-
namespace defaultProps {
|
44
|
-
let noTrailingSlash_1: boolean;
|
45
|
-
export { noTrailingSlash_1 as noTrailingSlash };
|
46
|
-
}
|
47
43
|
}
|
48
44
|
import PropTypes from 'prop-types';
|
@@ -33,7 +33,8 @@ var SimpleHeader = function SimpleHeader(_ref) {
|
|
33
33
|
var breadcrumbs = _ref.breadcrumbs,
|
34
34
|
className = _ref.className,
|
35
35
|
title = _ref.title,
|
36
|
-
noTrailingSlash = _ref.noTrailingSlash,
|
36
|
+
_ref$noTrailingSlash = _ref.noTrailingSlash,
|
37
|
+
noTrailingSlash = _ref$noTrailingSlash === void 0 ? true : _ref$noTrailingSlash,
|
37
38
|
maxVisible = _ref.maxVisible,
|
38
39
|
overflowAriaLabel = _ref.overflowAriaLabel,
|
39
40
|
rest = _objectWithoutProperties(_ref, _excluded);
|
@@ -86,8 +87,5 @@ SimpleHeader.propTypes = {
|
|
86
87
|
/** Header title */
|
87
88
|
title: PropTypes.string
|
88
89
|
};
|
89
|
-
SimpleHeader.defaultProps = {
|
90
|
-
noTrailingSlash: true
|
91
|
-
};
|
92
90
|
|
93
91
|
export { SimpleHeader, overflowAriaLabel_required_if_breadcrumbs_exist };
|
@@ -8,11 +8,8 @@
|
|
8
8
|
import React, { ReactNode, PropsWithChildren } from 'react';
|
9
9
|
import PropTypes from 'prop-types';
|
10
10
|
import { ButtonProps } from '@carbon/react';
|
11
|
-
|
12
|
-
|
13
|
-
closeIconDescription: string;
|
14
|
-
};
|
15
|
-
interface TearsheetNarrowProps extends PropsWithChildren {
|
11
|
+
import { CloseIconDescriptionTypes } from './TearsheetShell';
|
12
|
+
interface TearsheetNarrowBaseProps extends PropsWithChildren {
|
16
13
|
/**
|
17
14
|
* The navigation actions to be shown as buttons in the action area at the
|
18
15
|
* bottom of the tearsheet. Each action is specified as an object with
|
@@ -36,13 +33,6 @@ interface TearsheetNarrowProps extends PropsWithChildren {
|
|
36
33
|
* An optional class or classes to be added to the outermost element.
|
37
34
|
*/
|
38
35
|
className?: string;
|
39
|
-
/**
|
40
|
-
* The accessibility title for the close icon (if shown).
|
41
|
-
*
|
42
|
-
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
43
|
-
* there are a no navigation actions and/or hasCloseIcon is true.
|
44
|
-
*/
|
45
|
-
closeIconDescription?: closeIconDescriptionTypes;
|
46
36
|
/**
|
47
37
|
* A description of the flow, displayed in the header area of the tearsheet.
|
48
38
|
*/
|
@@ -89,6 +79,7 @@ interface TearsheetNarrowProps extends PropsWithChildren {
|
|
89
79
|
*/
|
90
80
|
verticalPosition?: 'normal' | 'lower';
|
91
81
|
}
|
82
|
+
type TearsheetNarrowProps = TearsheetNarrowBaseProps & CloseIconDescriptionTypes;
|
92
83
|
/**
|
93
84
|
* A narrow tearsheet is a slimmer variant of the tearsheet, providing a dialog
|
94
85
|
* that keeps users in-context and focused by bringing actionable content front
|
@@ -97,7 +88,7 @@ interface TearsheetNarrowProps extends PropsWithChildren {
|
|
97
88
|
* A narrow tearsheet comprises 3 zones: a heading area including a title, the
|
98
89
|
* main content area, and a set of action buttons.
|
99
90
|
*/
|
100
|
-
export declare let TearsheetNarrow: React.ForwardRefExoticComponent<TearsheetNarrowProps & React.RefAttributes<
|
91
|
+
export declare let TearsheetNarrow: React.ForwardRefExoticComponent<TearsheetNarrowProps & React.RefAttributes<HTMLDivElement>>;
|
101
92
|
export declare const deprecatedProps: {
|
102
93
|
/**
|
103
94
|
* **Deprecated**
|
@@ -1,6 +1,107 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
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
|
+
/// <reference path="../../../src/custom-typings/index.d.ts" />
|
8
|
+
import React, { PropsWithChildren, ReactNode } from 'react';
|
9
|
+
import PropTypes from 'prop-types';
|
10
|
+
import { type ButtonProps } from '@carbon/react';
|
11
|
+
interface TearsheetShellProps extends PropsWithChildren {
|
12
|
+
actions?: ButtonProps[];
|
13
|
+
ariaLabel?: string;
|
14
|
+
/**
|
15
|
+
* An optional class or classes to be added to the outermost element.
|
16
|
+
*/
|
17
|
+
className?: string;
|
18
|
+
/**
|
19
|
+
* A description of the flow, displayed in the header area of the tearsheet.
|
20
|
+
*/
|
21
|
+
description?: ReactNode;
|
22
|
+
/**
|
23
|
+
* Enable a close icon ('x') in the header area of the tearsheet. By default,
|
24
|
+
* (when this prop is omitted, or undefined or null) a tearsheet does not
|
25
|
+
* display a close icon if there are navigation actions ("transactional
|
26
|
+
* tearsheet") and displays one if there are no navigation actions ("passive
|
27
|
+
* tearsheet"), and that behavior can be overridden if required by setting
|
28
|
+
* this prop to either true or false.
|
29
|
+
*/
|
30
|
+
hasCloseIcon?: boolean;
|
31
|
+
/**
|
32
|
+
* The content for the header actions area, displayed alongside the title in
|
33
|
+
* the header area of the tearsheet. This is typically a drop-down, or a set
|
34
|
+
* of small buttons, or similar. NB the headerActions is only applicable for
|
35
|
+
* wide tearsheets.
|
36
|
+
*/
|
37
|
+
headerActions?: ReactNode;
|
38
|
+
/**
|
39
|
+
* The content for the influencer section of the tearsheet, displayed
|
40
|
+
* alongside the main content. This is typically a menu, or filter, or
|
41
|
+
* progress indicator, or similar. NB the influencer is only applicable for
|
42
|
+
* wide tearsheets.
|
43
|
+
*/
|
44
|
+
influencer?: ReactNode;
|
45
|
+
/**
|
46
|
+
* The position of the influencer section, 'left' or 'right'.
|
47
|
+
*/
|
48
|
+
influencerPosition?: 'left' | 'right';
|
49
|
+
/**
|
50
|
+
* The width of the influencer: 'narrow' (the default) is 256px, and 'wide'
|
51
|
+
* is 320px.
|
52
|
+
*/
|
53
|
+
influencerWidth?: 'narrow' | 'wide';
|
54
|
+
/**
|
55
|
+
* A label for the tearsheet, displayed in the header area of the tearsheet
|
56
|
+
* to maintain context for the tearsheet (e.g. as the title changes from page
|
57
|
+
* to page of a multi-page task).
|
58
|
+
*/
|
59
|
+
label?: ReactNode;
|
60
|
+
/**
|
61
|
+
* Navigation content, such as a set of tabs, to be displayed at the bottom
|
62
|
+
* of the header area of the tearsheet. NB the navigation is only applicable
|
63
|
+
* for wide tearsheets.
|
64
|
+
*/
|
65
|
+
navigation?: ReactNode;
|
66
|
+
/**
|
67
|
+
* An optional handler that is called when the user closes the tearsheet (by
|
68
|
+
* clicking the close button, if enabled, or clicking outside, if enabled).
|
69
|
+
* Returning `false` here prevents the modal from closing.
|
70
|
+
*/
|
71
|
+
onClose?: () => void;
|
72
|
+
/**
|
73
|
+
* Specifies whether the tearsheet is currently open.
|
74
|
+
*/
|
75
|
+
open?: boolean;
|
76
|
+
/**
|
77
|
+
* The DOM element that the tearsheet should be rendered within. Defaults to document.body.
|
78
|
+
*/
|
79
|
+
portalTarget?: ReactNode;
|
80
|
+
selectorPrimaryFocus?: string;
|
81
|
+
/**
|
82
|
+
* Specifies the width of the tearsheet, 'narrow' or 'wide'.
|
83
|
+
*/
|
84
|
+
size: 'narrow' | 'wide';
|
85
|
+
/**
|
86
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component
|
87
|
+
*/
|
88
|
+
slug?: ReactNode;
|
89
|
+
/**
|
90
|
+
* The main title of the tearsheet, displayed in the header area.
|
91
|
+
*/
|
92
|
+
title?: ReactNode;
|
93
|
+
verticalPosition?: 'normal' | 'lower';
|
94
|
+
}
|
95
|
+
export type CloseIconDescriptionTypes = {
|
96
|
+
hasCloseIcon?: false;
|
97
|
+
closeIconDescription?: string;
|
98
|
+
} | {
|
99
|
+
hasCloseIcon: true;
|
100
|
+
closeIconDescription: string;
|
101
|
+
};
|
102
|
+
export declare const tearsheetShellWideProps: string[];
|
103
|
+
export declare const tearsheetIsPassive: (actions: any) => boolean;
|
104
|
+
export declare const tearsheetHasCloseIcon: (actions: any, hasCloseIcon: any) => any;
|
4
105
|
/**
|
5
106
|
* TearSheetShell is used internally by TearSheet and TearSheetNarrow
|
6
107
|
*
|
@@ -8,10 +109,18 @@ export function tearsheetHasCloseIcon(actions: any, hasCloseIcon: any): any;
|
|
8
109
|
*
|
9
110
|
* See the canvas tab for the component API details.
|
10
111
|
* */
|
11
|
-
export const TearsheetShell: React.ForwardRefExoticComponent<React.RefAttributes<
|
12
|
-
export const portalType: PropTypes.Requireable<object>;
|
13
|
-
export
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
112
|
+
export declare const TearsheetShell: React.ForwardRefExoticComponent<(TearsheetShellProps & CloseIconDescriptionTypes) & React.RefAttributes<HTMLDivElement>>;
|
113
|
+
export declare const portalType: PropTypes.Requireable<object>;
|
114
|
+
export declare const deprecatedProps: {
|
115
|
+
/**
|
116
|
+
* **Deprecated**
|
117
|
+
*
|
118
|
+
* The position of the top of tearsheet in the viewport. The 'normal'
|
119
|
+
* position is a short distance down from the top of the
|
120
|
+
* viewport, leaving room at the top for a global header bar to show through
|
121
|
+
* from below. The 'lower' position (the default) provides a little extra room at the top
|
122
|
+
* to allow an action bar navigation or breadcrumbs to also show through.
|
123
|
+
*/
|
124
|
+
verticalPosition: PropTypes.Requireable<string>;
|
125
|
+
};
|
126
|
+
export {};
|
@@ -5,7 +5,7 @@
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
6
|
*/
|
7
7
|
|
8
|
-
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty
|
8
|
+
import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
|
9
9
|
import React__default, { useRef, useState, useEffect } from 'react';
|
10
10
|
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
|
11
11
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
@@ -13,7 +13,7 @@ import cx from 'classnames';
|
|
13
13
|
import { pkg } from '../../settings.js';
|
14
14
|
import pconsole from '../../global/js/utils/pconsole.js';
|
15
15
|
import { getNodeTextContent } from '../../global/js/utils/getNodeTextContent.js';
|
16
|
-
import { usePrefix, ComposedModal, ModalHeader, Layer
|
16
|
+
import { Button, usePrefix, ComposedModal, ModalHeader, Layer } from '@carbon/react';
|
17
17
|
import { Wrap } from '../../global/js/utils/Wrap.js';
|
18
18
|
import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
|
19
19
|
import { useFocus } from '../../global/js/hooks/useFocus.js';
|
@@ -37,6 +37,7 @@ var maxDepth = 3;
|
|
37
37
|
// The 'sizes' array contains an array of the sizes for every stacked tearsheet.
|
38
38
|
// This is so we can opt-out of including the stacking scale effect when there
|
39
39
|
// are stacked tearsheets with mixed sizes (ie, using wide and narrow together)
|
40
|
+
|
40
41
|
var stack = {
|
41
42
|
open: [],
|
42
43
|
all: [],
|
@@ -94,6 +95,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
94
95
|
var _useFocus = useFocus(modalRef),
|
95
96
|
firstElement = _useFocus.firstElement,
|
96
97
|
keyDownListener = _useFocus.keyDownListener;
|
98
|
+
var modalRefValue = modalRef.current;
|
97
99
|
var wide = size === 'wide';
|
98
100
|
|
99
101
|
// Keep track of the stack depth and our position in it (1-based, 0=closed)
|
@@ -124,7 +126,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
124
126
|
}
|
125
127
|
handleStackChange.checkFocus = function () {
|
126
128
|
// if we are now the topmost tearsheet, ensure we have focus
|
127
|
-
if (open && position === depth &&
|
129
|
+
if (open && position === depth && modalRefValue && !modalRefValue.contains(document.activeElement)) {
|
128
130
|
handleStackChange.claimFocus();
|
129
131
|
}
|
130
132
|
};
|
@@ -152,8 +154,9 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
152
154
|
useEffect(function () {
|
153
155
|
var notify = function notify() {
|
154
156
|
return stack.all.forEach(function (handler) {
|
157
|
+
var _handler$checkFocus;
|
155
158
|
handler(Math.min(stack.open.length, maxDepth), stack.open.indexOf(handler) + 1);
|
156
|
-
handler.checkFocus();
|
159
|
+
(_handler$checkFocus = handler.checkFocus) === null || _handler$checkFocus === void 0 || _handler$checkFocus.call(handler);
|
157
160
|
});
|
158
161
|
};
|
159
162
|
|
@@ -192,10 +195,12 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
192
195
|
// If something within us is receiving focus but we are not the topmost
|
193
196
|
// stacked tearsheet, transfer focus to the topmost tearsheet instead
|
194
197
|
if (position < depth) {
|
195
|
-
|
198
|
+
var _stack$open$claimFocu, _stack$open;
|
199
|
+
(_stack$open$claimFocu = (_stack$open = stack.open[stack.open.length - 1]).claimFocus) === null || _stack$open$claimFocu === void 0 || _stack$open$claimFocu.call(_stack$open);
|
196
200
|
}
|
197
201
|
}
|
198
202
|
if (position <= depth) {
|
203
|
+
var _prevDepth$current;
|
199
204
|
// Include a modal header if and only if one or more of these is given.
|
200
205
|
// We can't use a Wrap for the ModalHeader because ComposedModal requires
|
201
206
|
// the direct child to be the ModalHeader instance.
|
@@ -216,7 +221,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
216
221
|
"aria-label": ariaLabel || getNodeTextContent(title),
|
217
222
|
className: cx(bc, className, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(bc, "--stacked-").concat(position, "-of-").concat(depth),
|
218
223
|
// Don't apply this on the initial open of a single tearsheet.
|
219
|
-
depth > 1 || depth === 1 && prevDepth.current > 1), "".concat(bc, "--wide"), wide), "".concat(bc, "--narrow"), !wide), "".concat(bc, "--has-slug"), slug), "".concat(bc, "--has-close"), effectiveHasCloseIcon)),
|
224
|
+
depth > 1 || depth === 1 && ((_prevDepth$current = prevDepth === null || prevDepth === void 0 ? void 0 : prevDepth.current) !== null && _prevDepth$current !== void 0 ? _prevDepth$current : 0) > 1), "".concat(bc, "--wide"), wide), "".concat(bc, "--narrow"), !wide), "".concat(bc, "--has-slug"), slug), "".concat(bc, "--has-close"), effectiveHasCloseIcon)),
|
220
225
|
slug: slug,
|
221
226
|
style: setScaleValues(),
|
222
227
|
containerClassName: cx("".concat(bc, "__container"), _defineProperty(_defineProperty({}, "".concat(bc, "__container--lower"), verticalPosition === 'lower'), "".concat(bc, "__container--mixed-size-stacking"), !areAllSameSizeVariant())),
|
@@ -264,7 +269,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
264
269
|
alwaysRender: includeActions
|
265
270
|
}, /*#__PURE__*/React__default.createElement(Wrap, {
|
266
271
|
className: "".concat(bc, "__content"),
|
267
|
-
alwaysRender: influencer && influencerPosition === 'right'
|
272
|
+
alwaysRender: !!(influencer && influencerPosition === 'right')
|
268
273
|
}, children), /*#__PURE__*/React__default.createElement(Wrap, {
|
269
274
|
className: cx(_defineProperty(_defineProperty({}, "".concat(bc, "__influencer"), true), "".concat(bc, "__influencer--wide"), influencerWidth === 'wide')),
|
270
275
|
neverRender: influencerPosition !== 'right'
|
@@ -272,7 +277,7 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
|
|
272
277
|
className: "".concat(bc, "__button-container")
|
273
278
|
}, /*#__PURE__*/React__default.createElement(ActionSet, {
|
274
279
|
actions: actions,
|
275
|
-
buttonSize: wide ? '2xl' :
|
280
|
+
buttonSize: wide ? '2xl' : undefined,
|
276
281
|
className: "".concat(bc, "__buttons"),
|
277
282
|
size: wide ? '2xl' : 'lg',
|
278
283
|
"aria-hidden": !open
|
@@ -323,6 +328,7 @@ TearsheetShell.propTypes = _objectSpread2({
|
|
323
328
|
*
|
324
329
|
* See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
|
325
330
|
*/
|
331
|
+
/**@ts-ignore*/
|
326
332
|
actions: PropTypes.arrayOf(
|
327
333
|
// NB we don't include the validator here, as the component wrapping this
|
328
334
|
// one should ensure appropriate validation is done.
|
@@ -347,6 +353,7 @@ TearsheetShell.propTypes = _objectSpread2({
|
|
347
353
|
* **Note:** This prop is only required if a close icon is shown, i.e. if
|
348
354
|
* there are a no navigation actions and/or hasCloseIcon is true.
|
349
355
|
*/
|
356
|
+
/**@ts-ignore*/
|
350
357
|
closeIconDescription: PropTypes.string.isRequired.if(function (_ref4) {
|
351
358
|
var actions = _ref4.actions,
|
352
359
|
hasCloseIcon = _ref4.hasCloseIcon;
|
@@ -364,6 +371,7 @@ TearsheetShell.propTypes = _objectSpread2({
|
|
364
371
|
* tearsheet"), and that behavior can be overridden if required by setting
|
365
372
|
* this prop to either true or false.
|
366
373
|
*/
|
374
|
+
/**@ts-ignore*/
|
367
375
|
hasCloseIcon: PropTypes.bool,
|
368
376
|
/**
|
369
377
|
* The content for the header actions area, displayed alongside the title in
|
@@ -413,10 +421,12 @@ TearsheetShell.propTypes = _objectSpread2({
|
|
413
421
|
/**
|
414
422
|
* The DOM element that the tearsheet should be rendered within. Defaults to document.body.
|
415
423
|
*/
|
424
|
+
/**@ts-ignore*/
|
416
425
|
portalTarget: portalType,
|
417
426
|
/**
|
418
427
|
* Specifies the width of the tearsheet, 'narrow' or 'wide'.
|
419
428
|
*/
|
429
|
+
/**@ts-ignore*/
|
420
430
|
size: PropTypes.oneOf(['narrow', 'wide']).isRequired,
|
421
431
|
/**
|
422
432
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `Tearsheet` component
|
@@ -1,5 +1,69 @@
|
|
1
1
|
/**
|
2
|
-
*
|
2
|
+
* Copyright IBM Corp. 2021, 2021
|
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.
|
3
6
|
*/
|
4
|
-
|
7
|
+
/// <reference path="../../../src/custom-typings/index.d.ts" />
|
5
8
|
import React from 'react';
|
9
|
+
import { CarbonIconType } from '@carbon/icons-react/lib/CarbonIcon';
|
10
|
+
import '../../global/js/utils/props-helper';
|
11
|
+
import { IconButton } from '@carbon/react';
|
12
|
+
type imageProps = {
|
13
|
+
/**
|
14
|
+
* When passing the image prop, supply a full path to the image to be displayed.
|
15
|
+
*/
|
16
|
+
image: string;
|
17
|
+
/**
|
18
|
+
* When passing the image prop use the imageDescription prop to describe the image for screen reader.
|
19
|
+
*/
|
20
|
+
imageDescription: string;
|
21
|
+
} | {
|
22
|
+
image?: never;
|
23
|
+
imageDescription?: never;
|
24
|
+
};
|
25
|
+
type UserProfileImageBaseProps = {
|
26
|
+
/**
|
27
|
+
* The background color passed should match one of the background colors in the library documentation:
|
28
|
+
* https://pages.github.ibm.com/cdai-design/pal/patterns/user-profile-images/
|
29
|
+
*/
|
30
|
+
backgroundColor?: string;
|
31
|
+
/**
|
32
|
+
* Provide an optional class to be applied to the containing node.
|
33
|
+
*/
|
34
|
+
className?: string;
|
35
|
+
/**
|
36
|
+
* Provide a custom icon to use if you need to use an icon other than the included ones
|
37
|
+
*/
|
38
|
+
icon?: () => CarbonIconType | null;
|
39
|
+
/**
|
40
|
+
* When passing the initials prop, either send the initials to be used or the user's display name. The first two capital letters of the display name will be used as the initials.
|
41
|
+
*/
|
42
|
+
initials?: string;
|
43
|
+
/**
|
44
|
+
* When passing the kind prop, use either "user" or "group". The values match up to the Carbon Library icons.
|
45
|
+
*/
|
46
|
+
kind?: 'user' | 'group';
|
47
|
+
/**
|
48
|
+
* Set the size of the avatar circle
|
49
|
+
*/
|
50
|
+
size: 'xl' | 'lg' | 'md';
|
51
|
+
/**
|
52
|
+
* Set theme in which the component will be rendered
|
53
|
+
*/
|
54
|
+
theme: 'light' | 'dark';
|
55
|
+
/**
|
56
|
+
* Specify how the trigger should align with the tooltip
|
57
|
+
*/
|
58
|
+
tooltipAlignment?: React.ComponentProps<typeof IconButton>['align'];
|
59
|
+
/**
|
60
|
+
* Pass in the display name to have it shown on hover
|
61
|
+
*/
|
62
|
+
tooltipText?: string;
|
63
|
+
};
|
64
|
+
type UserProfileImageProps = UserProfileImageBaseProps & imageProps;
|
65
|
+
/**
|
66
|
+
* The user profile avatar allows for an image of the user to be displayed by passing in the image prop. By default the component will display a user icon on a blue background.
|
67
|
+
*/
|
68
|
+
export declare let UserProfileImage: React.ForwardRefExoticComponent<UserProfileImageProps & React.RefAttributes<HTMLDivElement>>;
|
69
|
+
export {};
|