@carbon/ibm-products 2.34.0 → 2.35.0
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +31910 -32273
- 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 +38 -17
- 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 +568 -24320
- 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 +2145 -17925
- 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/ActionSet/ActionSet.d.ts +38 -2
- package/es/components/ActionSet/ActionSet.js +3 -5
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilder.d.ts +5 -0
- package/es/components/ConditionBuilder/ConditionBuilder.js +125 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +10 -0
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +92 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.d.ts +38 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.js +88 -0
- package/es/components/ConditionBuilder/assets/sampleInput.d.ts +58 -0
- package/es/components/ConditionBuilder/index.d.ts +1 -0
- package/es/components/CreateFullPage/CreateFullPage.js +3 -19
- package/es/components/CreateFullPage/CreateFullPageStep.js +22 -7
- package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.d.ts +82 -2
- package/es/components/Datagrid/Datagrid/addons/stateReducer.js +2 -1
- package/es/components/Datagrid/useEditableCell.js +15 -0
- package/es/components/DelimitedList/DelimitedList.d.ts +27 -2
- package/es/components/DelimitedList/DelimitedList.js +0 -1
- package/es/components/EditInPlace/EditInPlace.d.ts +97 -5
- package/es/components/EditInPlace/EditInPlace.js +10 -6
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -3
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -2
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -3
- package/es/components/ExportModal/ExportModal.d.ts +110 -2
- package/es/components/ExportModal/ExportModal.js +10 -4
- package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +1 -1
- package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +2 -2
- package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +5 -9
- package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +1 -1
- package/es/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.js +92 -0
- package/es/components/FilterPanel/index.d.ts +1 -0
- package/es/components/HTTPErrors/HTTPError403/HTTPError403.d.ts +40 -2
- package/es/components/HTTPErrors/HTTPError403/HTTPError403.js +1 -1
- package/es/components/HTTPErrors/HTTPError404/HTTPError404.d.ts +40 -2
- package/es/components/HTTPErrors/HTTPError404/HTTPError404.js +1 -1
- package/es/components/ImportModal/ImportModal.d.ts +136 -2
- package/es/components/ImportModal/ImportModal.js +3 -2
- package/es/components/InlineTip/InlineTip.d.ts +90 -2
- package/es/components/InlineTip/InlineTip.js +3 -2
- package/es/components/Nav/Nav.js +1 -1
- package/es/components/Nav/NavList.js +7 -7
- package/es/components/NotificationsPanel/NotificationsPanel.js +1 -1
- package/es/components/PageHeader/PageHeader.js +3 -3
- package/es/components/PageHeader/PageHeaderUtils.d.ts +1 -1
- package/es/components/PageHeader/PageHeaderUtils.js +4 -3
- package/es/components/SidePanel/SidePanel.js +52 -36
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.d.ts +23 -2
- package/es/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +6 -5
- package/es/components/TagOverflow/TagOverflow.d.ts +5 -0
- package/es/components/TagOverflow/TagOverflow.js +209 -0
- package/es/components/TagOverflow/constants.d.ts +14 -0
- package/es/components/TagOverflow/constants.js +30 -0
- package/es/components/TagOverflow/index.d.ts +1 -0
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +105 -6
- package/es/components/Tearsheet/TearsheetNarrow.js +6 -1
- package/es/components/Toolbar/Toolbar.d.ts +23 -5
- package/es/components/Toolbar/Toolbar.js +30 -26
- package/es/components/UserAvatar/UserAvatar.js +4 -2
- package/es/components/index.d.ts +4 -2
- package/es/global/js/package-settings.d.ts +3 -0
- package/es/global/js/package-settings.js +3 -0
- package/es/index.js +4 -0
- package/es/settings.d.ts +3 -0
- package/lib/components/ActionSet/ActionSet.d.ts +38 -2
- package/lib/components/ActionSet/ActionSet.js +3 -5
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilder.d.ts +5 -0
- package/lib/components/ConditionBuilder/ConditionBuilder.js +132 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.d.ts +10 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +100 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.d.ts +38 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataTreeContext.js +98 -0
- package/lib/components/ConditionBuilder/assets/sampleInput.d.ts +58 -0
- package/lib/components/ConditionBuilder/index.d.ts +1 -0
- package/lib/components/CreateFullPage/CreateFullPage.js +2 -18
- package/lib/components/CreateFullPage/CreateFullPageStep.js +20 -5
- package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.d.ts +82 -2
- package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +2 -1
- package/lib/components/Datagrid/useEditableCell.js +19 -0
- package/lib/components/DelimitedList/DelimitedList.d.ts +27 -2
- package/lib/components/DelimitedList/DelimitedList.js +0 -1
- package/lib/components/EditInPlace/EditInPlace.d.ts +97 -5
- package/lib/components/EditInPlace/EditInPlace.js +10 -6
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/ErrorEmptyState/ErrorEmptyState.js +1 -3
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NoDataEmptyState/NoDataEmptyState.js +1 -2
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -3
- package/lib/components/ExportModal/ExportModal.d.ts +110 -2
- package/lib/components/ExportModal/ExportModal.js +10 -4
- package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +1 -1
- package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +2 -2
- package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +5 -9
- package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +1 -1
- package/lib/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelSearch/FilterPanelSearch.js +99 -0
- package/lib/components/FilterPanel/index.d.ts +1 -0
- package/lib/components/HTTPErrors/HTTPError403/HTTPError403.d.ts +40 -2
- package/lib/components/HTTPErrors/HTTPError403/HTTPError403.js +1 -1
- package/lib/components/HTTPErrors/HTTPError404/HTTPError404.d.ts +40 -2
- package/lib/components/HTTPErrors/HTTPError404/HTTPError404.js +1 -1
- package/lib/components/ImportModal/ImportModal.d.ts +136 -2
- package/lib/components/ImportModal/ImportModal.js +3 -2
- package/lib/components/InlineTip/InlineTip.d.ts +90 -2
- package/lib/components/InlineTip/InlineTip.js +3 -2
- package/lib/components/Nav/Nav.js +1 -1
- package/lib/components/Nav/NavList.js +7 -7
- package/lib/components/NotificationsPanel/NotificationsPanel.js +1 -1
- package/lib/components/PageHeader/PageHeader.js +3 -3
- package/lib/components/PageHeader/PageHeaderUtils.d.ts +1 -1
- package/lib/components/PageHeader/PageHeaderUtils.js +4 -3
- package/lib/components/SidePanel/SidePanel.js +52 -36
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.d.ts +23 -2
- package/lib/components/SteppedAnimatedMedia/SteppedAnimatedMedia.js +6 -5
- package/lib/components/TagOverflow/TagOverflow.d.ts +5 -0
- package/lib/components/TagOverflow/TagOverflow.js +216 -0
- package/lib/components/TagOverflow/constants.d.ts +14 -0
- package/lib/components/TagOverflow/constants.js +34 -0
- package/lib/components/TagOverflow/index.d.ts +1 -0
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +105 -6
- package/lib/components/Tearsheet/TearsheetNarrow.js +6 -1
- package/lib/components/Toolbar/Toolbar.d.ts +23 -5
- package/lib/components/Toolbar/Toolbar.js +30 -26
- package/lib/components/UserAvatar/UserAvatar.js +4 -2
- package/lib/components/index.d.ts +4 -2
- package/lib/global/js/package-settings.d.ts +3 -0
- package/lib/global/js/package-settings.js +3 -0
- package/lib/index.js +17 -0
- package/lib/settings.d.ts +3 -0
- package/package.json +3 -3
- package/scss/components/Coachmark/_coachmark-dragbar.scss +0 -1
- package/scss/components/Coachmark/_coachmark-tagline.scss +2 -2
- package/scss/components/ConditionBuilder/_carbon-imports.scss +9 -0
- package/scss/components/ConditionBuilder/_condition-builder.scss +25 -0
- package/scss/components/ConditionBuilder/_index-with-carbon.scss +9 -0
- package/scss/components/ConditionBuilder/_index.scss +8 -0
- package/scss/components/CreateFullPage/_create-full-page.scss +10 -10
- package/scss/components/Datagrid/styles/_useNestedRows.scss +5 -1
- package/scss/components/FilterPanel/_carbon-imports.scss +5 -0
- package/scss/components/FilterPanel/_filter-panel-accordion-item.scss +1 -3
- package/scss/components/FilterPanel/_filter-panel-checkbox-with-overflow.scss +0 -2
- package/scss/components/FilterPanel/_filter-panel-checkbox.scss +0 -1
- package/scss/components/FilterPanel/_filter-panel-search.scss +38 -0
- package/scss/components/FilterPanel/_index-with-carbon.scss +1 -0
- package/scss/components/FilterPanel/_index.scss +1 -0
- package/scss/components/Guidebanner/_guidebanner.scss +1 -1
- package/scss/components/InlineTip/_inline-tip.scss +1 -1
- package/scss/components/ProductiveCard/_productive-card.scss +13 -0
- package/scss/components/SidePanel/_side-panel.scss +9 -9
- package/scss/components/TagOverflow/_carbon-imports.scss +9 -0
- package/scss/components/TagOverflow/_index-with-carbon.scss +9 -0
- package/scss/components/TagOverflow/_index.scss +8 -0
- package/scss/components/TagOverflow/_tag-overflow.scss +55 -0
- package/scss/components/Tearsheet/_tearsheet.scss +10 -0
- package/scss/components/UserAvatar/_user-avatar.scss +1 -0
- package/scss/components/_index-with-carbon.scss +2 -0
- package/scss/components/_index.scss +2 -0
@@ -1,7 +1,95 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2023, 2023
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
import React, { ReactNode } from 'react';
|
8
|
+
type MediaType = {
|
9
|
+
render?: () => ReactNode;
|
10
|
+
filePaths?: string[];
|
11
|
+
};
|
12
|
+
interface InlineTipProps {
|
13
|
+
/**
|
14
|
+
* Optional "call to action" ghost button or link that can appear
|
15
|
+
* directly below the content. This component comes with pre-styled
|
16
|
+
* elements available to use: `InlineTipLink` and `InlineTipButton`.
|
17
|
+
*/
|
18
|
+
action?: ReactNode;
|
19
|
+
/**
|
20
|
+
* Provide the contents of the InlineTip.
|
21
|
+
*/
|
22
|
+
children: ReactNode;
|
23
|
+
/**
|
24
|
+
* Provide an optional class to be applied to the containing node.
|
25
|
+
*/
|
26
|
+
className?: string;
|
27
|
+
/**
|
28
|
+
* Tooltip text and aria label for the Close button icon.
|
29
|
+
*/
|
30
|
+
closeIconDescription?: string;
|
31
|
+
/**
|
32
|
+
* The label for the collapse button.
|
33
|
+
* This button is not visible if `media` is specified.
|
34
|
+
*/
|
35
|
+
collapseButtonLabel?: string;
|
36
|
+
/**
|
37
|
+
* If set to `true`, it will truncate the body text to
|
38
|
+
* one line and expose an expand/collapse button toggle.
|
39
|
+
*
|
40
|
+
* This feature is disabled if `media` is specified.
|
41
|
+
*/
|
42
|
+
collapsible?: boolean;
|
43
|
+
/**
|
44
|
+
* The label for the expand button.
|
45
|
+
* This button is not visible if `media` is specified.
|
46
|
+
*/
|
47
|
+
expandButtonLabel?: string;
|
48
|
+
/**
|
49
|
+
* The object describing an image in one of two shapes.
|
50
|
+
* - If a single media element is required, use `{render}`.
|
51
|
+
* - If a stepped animation is required, use `{filePaths}`.
|
52
|
+
*
|
53
|
+
* Enabling `media` disables the `collapsible` feature.
|
54
|
+
*/
|
55
|
+
media: MediaType;
|
56
|
+
/**
|
57
|
+
* Set to `true` to arrange the information in a format
|
58
|
+
* that is easier to read in a limited space.
|
59
|
+
*/
|
60
|
+
narrow?: boolean;
|
61
|
+
/**
|
62
|
+
* Function to call when the tertiary button is clicked.
|
63
|
+
*/
|
64
|
+
onClick?: () => void;
|
65
|
+
/**
|
66
|
+
* Function to call when the InlineTip is closed via the "X" button.
|
67
|
+
*/
|
68
|
+
onClose?: () => void;
|
69
|
+
/**
|
70
|
+
* Defining the label will show a the tertiary button with the crossroads icon.
|
71
|
+
* You will still need to define the `onClose` method to trigger a callback.
|
72
|
+
*/
|
73
|
+
tertiaryButtonLabel?: string;
|
74
|
+
/**
|
75
|
+
* The title of the InlineTip.
|
76
|
+
*/
|
77
|
+
title: string;
|
78
|
+
/**
|
79
|
+
* If true, insert 1 rem of "space" on the left of the component.
|
80
|
+
* This will allow the component's content to line up with other
|
81
|
+
* content on the page under special circumstances.
|
82
|
+
*
|
83
|
+
* This will only be applied when `narrow` is false.
|
84
|
+
*/
|
85
|
+
withLeftGutter?: boolean;
|
86
|
+
}
|
1
87
|
/**
|
2
88
|
* Inline tips are messages embedded within other components that
|
3
89
|
* provide an ambient way to deliver learning content without
|
4
90
|
* distracting the user from their flow.
|
5
91
|
*/
|
6
|
-
export let InlineTip: React.ForwardRefExoticComponent<
|
7
|
-
|
92
|
+
export declare let InlineTip: React.ForwardRefExoticComponent<InlineTipProps & {
|
93
|
+
children?: React.ReactNode;
|
94
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
95
|
+
export {};
|
@@ -35,9 +35,9 @@ var defaults = {
|
|
35
35
|
narrow: false,
|
36
36
|
withLeftGutter: false,
|
37
37
|
onClick: function onClick() {},
|
38
|
-
onClose: function onClose() {}
|
38
|
+
onClose: function onClose() {},
|
39
|
+
title: 'Use case-specific heading'
|
39
40
|
};
|
40
|
-
|
41
41
|
/**
|
42
42
|
* Inline tips are messages embedded within other components that
|
43
43
|
* provide an ambient way to deliver learning content without
|
@@ -187,6 +187,7 @@ InlineTip.propTypes = {
|
|
187
187
|
*
|
188
188
|
* Enabling `media` disables the `collapsible` feature.
|
189
189
|
*/
|
190
|
+
/**@ts-ignore*/
|
190
191
|
media: PropTypes.oneOfType([PropTypes.shape({
|
191
192
|
render: PropTypes.func
|
192
193
|
}), PropTypes.shape({
|
package/es/components/Nav/Nav.js
CHANGED
@@ -102,7 +102,7 @@ var Nav = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
102
102
|
*/
|
103
103
|
var handleListClick = function handleListClick(id) {
|
104
104
|
Object.keys(navigationLists.current).forEach(function (key) {
|
105
|
-
if (key !== id && !navigationLists.current[key].
|
105
|
+
if (key !== id && !navigationLists.current[key].isExpandedOnPageLoad) {
|
106
106
|
navigationLists.current[key].close();
|
107
107
|
}
|
108
108
|
});
|
@@ -22,7 +22,7 @@ var defaults = {
|
|
22
22
|
className: '',
|
23
23
|
children: null,
|
24
24
|
id: '',
|
25
|
-
|
25
|
+
isExpandedOnPageLoad: false,
|
26
26
|
onItemClick: function onItemClick() {},
|
27
27
|
onListClick: function onListClick() {},
|
28
28
|
tabIndex: 0,
|
@@ -41,8 +41,8 @@ var NavList = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
41
41
|
icon = _ref$icon === void 0 ? defaults.icon : _ref$icon,
|
42
42
|
_ref$id = _ref.id,
|
43
43
|
id = _ref$id === void 0 ? defaults.id : _ref$id,
|
44
|
-
_ref$isExpandedOnPage = _ref.
|
45
|
-
|
44
|
+
_ref$isExpandedOnPage = _ref.isExpandedOnPageLoad,
|
45
|
+
isExpandedOnPageLoad = _ref$isExpandedOnPage === void 0 ? defaults.isExpandedOnPageLoad : _ref$isExpandedOnPage,
|
46
46
|
_ref$navigationItemTi = _ref.navigationItemTitle,
|
47
47
|
navigationItemTitle = _ref$navigationItemTi === void 0 ? defaults.navigationItemTitle : _ref$navigationItemTi,
|
48
48
|
_ref$onItemClick = _ref.onItemClick,
|
@@ -53,7 +53,7 @@ var NavList = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
53
53
|
tabIndex = _ref$tabIndex === void 0 ? defaults.tabIndex : _ref$tabIndex,
|
54
54
|
_ref$title = _ref.title,
|
55
55
|
title = _ref$title === void 0 ? defaults.title : _ref$title;
|
56
|
-
var _useState = useState(
|
56
|
+
var _useState = useState(isExpandedOnPageLoad),
|
57
57
|
_useState2 = _slicedToArray(_useState, 2),
|
58
58
|
open = _useState2[0],
|
59
59
|
setOpen = _useState2[1];
|
@@ -65,7 +65,7 @@ var NavList = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
65
65
|
var childProps = _ref3.props;
|
66
66
|
return childProps.href;
|
67
67
|
});
|
68
|
-
setOpen(hrefs.includes(activeHref) ||
|
68
|
+
setOpen(hrefs.includes(activeHref) || isExpandedOnPageLoad);
|
69
69
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
70
70
|
}, []);
|
71
71
|
|
@@ -99,7 +99,7 @@ var NavList = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
99
99
|
useImperativeHandle(ref, function () {
|
100
100
|
return {
|
101
101
|
close: close,
|
102
|
-
|
102
|
+
isExpandedOnPageLoad: isExpandedOnPageLoad
|
103
103
|
};
|
104
104
|
});
|
105
105
|
var newChildren = React__default.Children.map(children, function (child, index) {
|
@@ -150,7 +150,7 @@ NavList.propTypes = {
|
|
150
150
|
/** @type {string} ID of a list. */
|
151
151
|
id: propTypesExports.string,
|
152
152
|
/** @type {boolean} State of a list. */
|
153
|
-
|
153
|
+
isExpandedOnPageLoad: propTypesExports.bool,
|
154
154
|
/** @type {boolean} Title of nav. */
|
155
155
|
navigationItemTitle: propTypesExports.string,
|
156
156
|
/** @type {Function} Click handler for an item. */
|
@@ -317,7 +317,7 @@ var NotificationsPanel = /*#__PURE__*/React__default.forwardRef(function (_ref,
|
|
317
317
|
id: blockClass,
|
318
318
|
className: cx(blockClass, className, "".concat(blockClass, "__container")),
|
319
319
|
style: {
|
320
|
-
animation: !reducedMotion.matches ? "".concat(open ? 'fade-in 250ms' : 'fade-out 250ms') : null
|
320
|
+
animation: !reducedMotion.matches ? "".concat(open ? 'fade-in 250ms' : 'fade-out forwards 250ms') : null
|
321
321
|
},
|
322
322
|
onAnimationEnd: onAnimationEnd,
|
323
323
|
ref: ref || notificationPanelRef
|
@@ -186,7 +186,7 @@ var PageHeader = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
186
186
|
checkUpdateVerticalSpace();
|
187
187
|
};
|
188
188
|
var handleCollapseToggle = function handleCollapseToggle() {
|
189
|
-
utilSetCollapsed(!fullyCollapsed, metrics.headerOffset, metrics.headerTopValue);
|
189
|
+
utilSetCollapsed(!fullyCollapsed, headerRef, metrics.headerOffset, metrics.headerTopValue);
|
190
190
|
};
|
191
191
|
|
192
192
|
// use effects
|
@@ -305,9 +305,9 @@ var PageHeader = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
305
305
|
};
|
306
306
|
useEffect(function () {
|
307
307
|
if (collapseHeader === true) {
|
308
|
-
utilSetCollapsed(collapseHeader, metrics.headerOffset, metrics.headerTopValue);
|
308
|
+
utilSetCollapsed(collapseHeader, headerRef, metrics.headerOffset, metrics.headerTopValue);
|
309
309
|
}
|
310
|
-
}, [collapseHeader, metrics.headerOffset, metrics.headerTopValue]);
|
310
|
+
}, [collapseHeader, metrics.headerOffset, metrics.headerTopValue, headerRef]);
|
311
311
|
useResizeObserver(sizingContainerRef, handleResizeActionBarColumn);
|
312
312
|
useResizeObserver(headerRef, handleResize);
|
313
313
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
export const blockClass: string;
|
2
2
|
export function utilCheckUpdateVerticalSpace(headerRef: {}, offsetTopMeasuringRef: {}, navigation: {}, enableBreadcrumbScroll: boolean, hasActionBar: boolean, widthIsNarrow: boolean, setMetrics: () => any): void;
|
3
|
-
export function utilSetCollapsed(collapse: any, headerOffset: any, headerTopValue: any): void;
|
3
|
+
export function utilSetCollapsed(collapse: any, headerRef: any, headerOffset: any, headerTopValue: any): void;
|
4
4
|
export function utilGetBreadcrumbItemForTitle(blockClass: any, collapseTitle: any, title: any): {
|
5
5
|
label: any;
|
6
6
|
title: any;
|
@@ -139,16 +139,17 @@ var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(headerR
|
|
139
139
|
};
|
140
140
|
|
141
141
|
// Trigger a window scroll, if necessary, to set the collapsed state.
|
142
|
-
var utilSetCollapsed = function utilSetCollapsed(collapse, headerOffset, headerTopValue) {
|
142
|
+
var utilSetCollapsed = function utilSetCollapsed(collapse, headerRef, headerOffset, headerTopValue) {
|
143
143
|
/* don't know how to test resize */
|
144
144
|
/* istanbul ignore else */
|
145
|
+
var scrollableTarget = scrollableAncestor(headerRef.current);
|
145
146
|
if (collapse) {
|
146
|
-
|
147
|
+
scrollableTarget.scrollTo({
|
147
148
|
top: headerOffset - headerTopValue,
|
148
149
|
behavior: 'smooth'
|
149
150
|
});
|
150
151
|
} else {
|
151
|
-
|
152
|
+
scrollableTarget.scrollTo({
|
152
153
|
top: 0,
|
153
154
|
behavior: 'smooth'
|
154
155
|
});
|
@@ -10,7 +10,6 @@ import React__default, { useState, useRef, useEffect, useCallback } from 'react'
|
|
10
10
|
import { motion, useReducedMotion, AnimatePresence } from 'framer-motion';
|
11
11
|
import PropTypes from '../../node_modules/prop-types/index.js';
|
12
12
|
import cx from 'classnames';
|
13
|
-
import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
|
14
13
|
import { moderate02 } from '@carbon/motion';
|
15
14
|
import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
|
16
15
|
import { allPropTypes } from '../../global/js/utils/props-helper.js';
|
@@ -110,14 +109,48 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
110
109
|
keyDownListener = _useFocus.keyDownListener;
|
111
110
|
var panelRefValue = sidePanelRef.current;
|
112
111
|
var shouldReduceMotion = useReducedMotion();
|
112
|
+
|
113
|
+
// Title animation on scroll related state
|
114
|
+
var _useState7 = useState(0),
|
115
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
116
|
+
labelTextHeight = _useState8[0],
|
117
|
+
setLabelTextHeight = _useState8[1];
|
118
|
+
useEffect(function () {
|
119
|
+
if (open && !(titleRef !== null && titleRef !== void 0 && titleRef.current)) {
|
120
|
+
setDoAnimateTitle(false);
|
121
|
+
} else {
|
122
|
+
setDoAnimateTitle(animateTitle);
|
123
|
+
}
|
124
|
+
}, [animateTitle, open]);
|
125
|
+
var titleItemsStyles = useCallback(function (progress) {
|
126
|
+
if (subtitleRef !== null && subtitleRef !== void 0 && subtitleRef.current) {
|
127
|
+
var _subtitleEl$style;
|
128
|
+
var subtitleEl = subtitleRef === null || subtitleRef === void 0 ? void 0 : subtitleRef.current;
|
129
|
+
var height = subtitleEl === null || subtitleEl === void 0 ? void 0 : subtitleEl.clientHeight;
|
130
|
+
var calculatedMargin = height * progress;
|
131
|
+
subtitleEl === null || subtitleEl === void 0 || (_subtitleEl$style = subtitleEl.style) === null || _subtitleEl$style === void 0 || _subtitleEl$style.setProperty('margin-top', "".concat(-calculatedMargin, "px"));
|
132
|
+
}
|
133
|
+
if (labelTextRef !== null && labelTextRef !== void 0 && labelTextRef.current) {
|
134
|
+
var _labelTextRef$current;
|
135
|
+
var _calculatedMargin = labelTextHeight * progress;
|
136
|
+
labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current = labelTextRef.current) === null || _labelTextRef$current === void 0 || (_labelTextRef$current = _labelTextRef$current.style) === null || _labelTextRef$current === void 0 || _labelTextRef$current.setProperty('margin-top', "".concat(-_calculatedMargin, "px"));
|
137
|
+
}
|
138
|
+
}, [labelTextHeight]);
|
113
139
|
useEffect(function () {
|
114
|
-
|
115
|
-
|
140
|
+
if (open && animateTitle && labelTextRef !== null && labelTextRef !== void 0 && labelTextRef.current) {
|
141
|
+
var _labelTextRef$current2;
|
142
|
+
setLabelTextHeight(Number((labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current2 = labelTextRef.current) === null || _labelTextRef$current2 === void 0 ? void 0 : _labelTextRef$current2.clientHeight) || null));
|
143
|
+
}
|
144
|
+
}, [animateTitle, labelTextRef, open]);
|
116
145
|
var handleScroll = useCallback(function () {
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
146
|
+
if (doAnimateTitle && innerContentRef !== null && innerContentRef !== void 0 && innerContentRef.current) {
|
147
|
+
var _innerContentRef$curr;
|
148
|
+
var scrollTop = innerContentRef === null || innerContentRef === void 0 || (_innerContentRef$curr = innerContentRef.current) === null || _innerContentRef$curr === void 0 ? void 0 : _innerContentRef$curr.scrollTop;
|
149
|
+
var animationProgress = Math.min(Number(scrollTop), scrollAnimationDistance) / scrollAnimationDistance;
|
150
|
+
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), animationProgress.toString());
|
151
|
+
titleItemsStyles(animationProgress);
|
152
|
+
}
|
153
|
+
}, [doAnimateTitle, panelRefValue === null || panelRefValue === void 0 ? void 0 : panelRefValue.style, scrollAnimationDistance, titleItemsStyles]);
|
121
154
|
var reducedMotion = typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
|
122
155
|
matches: true
|
123
156
|
};
|
@@ -125,8 +158,8 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
125
158
|
// scroll panel to top going between steps
|
126
159
|
useEffect(function () {
|
127
160
|
if (sidePanelRef && panelRefValue) {
|
128
|
-
var _animatedScrollRef$
|
129
|
-
var scrollableSection = (_animatedScrollRef$
|
161
|
+
var _animatedScrollRef$cu;
|
162
|
+
var scrollableSection = (_animatedScrollRef$cu = animatedScrollRef.current) !== null && _animatedScrollRef$cu !== void 0 ? _animatedScrollRef$cu : innerContentRef.current;
|
130
163
|
if (scrollableSection) {
|
131
164
|
scrollableSection.scrollTop = 0;
|
132
165
|
}
|
@@ -149,9 +182,9 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
149
182
|
var checkSetDoAnimateTitle = function checkSetDoAnimateTitle() {
|
150
183
|
var canDoAnimateTitle = false;
|
151
184
|
if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
|
152
|
-
var _labelTextRef$
|
185
|
+
var _labelTextRef$current3, _labelTextRef$current4, _subtitleRef$current$, _subtitleRef$current;
|
153
186
|
var titleEl = titleRef.current;
|
154
|
-
var labelHeight = (_labelTextRef$
|
187
|
+
var labelHeight = (_labelTextRef$current3 = labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current4 = labelTextRef.current) === null || _labelTextRef$current4 === void 0 ? void 0 : _labelTextRef$current4.offsetHeight) !== null && _labelTextRef$current3 !== void 0 ? _labelTextRef$current3 : 0;
|
155
188
|
var subtitleHeight = (_subtitleRef$current$ = subtitleRef === null || subtitleRef === void 0 || (_subtitleRef$current = subtitleRef.current) === null || _subtitleRef$current === void 0 ? void 0 : _subtitleRef$current.offsetHeight) !== null && _subtitleRef$current$ !== void 0 ? _subtitleRef$current$ : 0;
|
156
189
|
|
157
190
|
// Adjusts space at bottom of titles by changing where scrolling finishes
|
@@ -162,11 +195,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
162
195
|
|
163
196
|
// used to calculate the header moves
|
164
197
|
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-distance"), _scrollAnimationDistance.toString());
|
165
|
-
var scrollEl =
|
166
|
-
if (!scrollEl && animateTitle && !doAnimateTitle) {
|
167
|
-
// may be switching back based on resize
|
168
|
-
scrollEl = innerContentRef.current;
|
169
|
-
}
|
198
|
+
var scrollEl = innerContentRef.current;
|
170
199
|
if (scrollEl) {
|
171
200
|
var _window2;
|
172
201
|
var innerComputed = (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.getComputedStyle(innerContentRef.current);
|
@@ -180,20 +209,10 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
180
209
|
}
|
181
210
|
};
|
182
211
|
useEffect(function () {
|
183
|
-
if (doAnimateTitle && animatedScrollRef.current) {
|
184
|
-
// only add scroll if the doAnimateTitle is already true
|
185
|
-
// should come back through if false and canDoAnimateTitle is true
|
186
|
-
animatedScrollRef.current.addEventListener('scroll', handleScroll);
|
187
|
-
}
|
188
212
|
if (!doAnimateTitle && sidePanelRef.current) {
|
189
213
|
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), '0');
|
190
214
|
}
|
191
|
-
}, [
|
192
|
-
|
193
|
-
/* istanbul ignore next */
|
194
|
-
var handleResize = function handleResize() {
|
195
|
-
checkSetDoAnimateTitle();
|
196
|
-
};
|
215
|
+
}, [doAnimateTitle, handleScroll, sidePanelRef, innerContentRef, open, panelRefValue === null || panelRefValue === void 0 ? void 0 : panelRefValue.style]);
|
197
216
|
|
198
217
|
// Calculate scroll distances
|
199
218
|
useEffect(function () {
|
@@ -202,7 +221,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
202
221
|
}
|
203
222
|
|
204
223
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
205
|
-
}, [open, doAnimateTitle /* use do instead of animateTitle directly */, animationComplete, handleScroll, title, size, reducedMotion.matches, id
|
224
|
+
}, [open, doAnimateTitle /* use do instead of animateTitle directly */, animationComplete, handleScroll, title, size, reducedMotion.matches, id]);
|
206
225
|
|
207
226
|
// click outside functionality if `includeOverlay` prop is set
|
208
227
|
useEffect(function () {
|
@@ -301,7 +320,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
301
320
|
}
|
302
321
|
}, [animationComplete, firstElement, open, selectorPrimaryFocus]);
|
303
322
|
var primaryActionContainerClassNames = cx(["".concat(blockClass, "__actions-container"), _defineProperty({}, "".concat(blockClass, "__actions-container--condensed"), condensedActions)]);
|
304
|
-
var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
323
|
+
var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(blockClass, "--right-placement"), placement === 'right'), "".concat(blockClass, "--left-placement"), placement === 'left'), "".concat(blockClass, "--slide-in"), slideIn), "".concat(blockClass, "--has-slug"), slug), "".concat(blockClass, "--condensed-actions"), condensedActions), "".concat(blockClass, "--has-overlay"), includeOverlay)]);
|
305
324
|
var renderTitle = function renderTitle() {
|
306
325
|
return /*#__PURE__*/React__default.createElement("div", {
|
307
326
|
className: cx("".concat(blockClass, "__title"), _defineProperty({}, "".concat(blockClass, "__title--no-label"), !labelTextRef.current)),
|
@@ -394,10 +413,10 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
394
413
|
var renderMain = function renderMain() {
|
395
414
|
return /*#__PURE__*/React__default.createElement("div", {
|
396
415
|
ref: innerContentRef,
|
397
|
-
|
416
|
+
onScroll: handleScroll,
|
417
|
+
className: cx("".concat(blockClass, "__inner-content"), "".concat(blockClass, "--scrolls"), "".concat(!doAnimateTitle ? "".concat(blockClass, "__inner-content--no-animated-title") : ''))
|
398
418
|
}, children);
|
399
419
|
};
|
400
|
-
useResizeObserver(sidePanelRef, handleResize, [open]);
|
401
420
|
return /*#__PURE__*/React__default.createElement(AnimatePresence, null, open && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(motion.div, _extends({}, getDevtoolsProps(componentName), rest, {
|
402
421
|
id: id,
|
403
422
|
className: mainPanelClassNames,
|
@@ -415,11 +434,8 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
|
|
415
434
|
shouldReduceMotion: shouldReduceMotion
|
416
435
|
},
|
417
436
|
onKeyDown: keyDownListener
|
418
|
-
}),
|
419
|
-
|
420
|
-
className: "".concat(blockClass, "__animated-scroll-wrapper ").concat(blockClass, "--scrolls")
|
421
|
-
}, renderHeader(), renderMain()) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, renderHeader(), renderMain()), /*#__PURE__*/React__default.createElement(MotionActionSet, {
|
422
|
-
actions: actions,
|
437
|
+
}), /*#__PURE__*/React__default.createElement(React__default.Fragment, null, renderHeader(), renderMain()), /*#__PURE__*/React__default.createElement(MotionActionSet, {
|
438
|
+
actions: actions !== null && actions !== void 0 ? actions : [],
|
423
439
|
className: primaryActionContainerClassNames,
|
424
440
|
size: size === 'xs' ? 'sm' : size,
|
425
441
|
custom: shouldReduceMotion,
|
@@ -1,5 +1,26 @@
|
|
1
1
|
/**
|
2
|
-
*
|
2
|
+
* Copyright IBM Corp. 2023, 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.
|
3
6
|
*/
|
4
|
-
export const SteppedAnimatedMedia: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
|
5
7
|
import React from 'react';
|
8
|
+
interface SteppedAnimatedMediaProps {
|
9
|
+
/**
|
10
|
+
* Optional class name for this component.
|
11
|
+
*/
|
12
|
+
className?: string;
|
13
|
+
/**
|
14
|
+
* The file path(s) to json formatted Lottie animation files.
|
15
|
+
*/
|
16
|
+
filePaths: string[] | undefined;
|
17
|
+
/**
|
18
|
+
* Which animation step from the filePaths array to play.
|
19
|
+
*/
|
20
|
+
playStep?: number;
|
21
|
+
}
|
22
|
+
/**
|
23
|
+
* The SteppedAnimatedMedia is a Novice to Pro internal component and is not intended for general use.
|
24
|
+
*/
|
25
|
+
export declare const SteppedAnimatedMedia: React.ForwardRefExoticComponent<SteppedAnimatedMediaProps & React.RefAttributes<HTMLDivElement>>;
|
26
|
+
export {};
|
@@ -26,7 +26,6 @@ var componentName = 'SteppedAnimatedMedia';
|
|
26
26
|
var defaults = {
|
27
27
|
playStep: 0
|
28
28
|
};
|
29
|
-
|
30
29
|
/**
|
31
30
|
* The SteppedAnimatedMedia is a Novice to Pro internal component and is not intended for general use.
|
32
31
|
*/
|
@@ -41,8 +40,9 @@ var SteppedAnimatedMedia = /*#__PURE__*/React__default.forwardRef(function (_ref
|
|
41
40
|
jsonData = _useState2[0],
|
42
41
|
setJsonData = _useState2[1];
|
43
42
|
var animRef = useRef();
|
44
|
-
var backupRef = useRef();
|
43
|
+
var backupRef = useRef(null);
|
45
44
|
var localRef = ref !== null && ref !== void 0 ? ref : backupRef;
|
45
|
+
var localRefValue = localRef.current;
|
46
46
|
// load animation source
|
47
47
|
useEffect(function () {
|
48
48
|
var isJsonFile = function isJsonFile(filePath) {
|
@@ -89,11 +89,11 @@ var SteppedAnimatedMedia = /*#__PURE__*/React__default.forwardRef(function (_ref
|
|
89
89
|
useEffect(function () {
|
90
90
|
var _window;
|
91
91
|
var prefersReducedMotion = (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : true;
|
92
|
-
if (
|
92
|
+
if (localRefValue) {
|
93
93
|
var _animRef$current, _animRef$current2, _animRef$current3;
|
94
94
|
(_animRef$current = animRef.current) === null || _animRef$current === void 0 || _animRef$current.destroy();
|
95
95
|
animRef.current = lottie.loadAnimation({
|
96
|
-
container:
|
96
|
+
container: localRefValue,
|
97
97
|
renderer: 'svg',
|
98
98
|
animationData: jsonData[clamp(playStep, 0, jsonData.length - 1)],
|
99
99
|
loop: false,
|
@@ -108,7 +108,7 @@ var SteppedAnimatedMedia = /*#__PURE__*/React__default.forwardRef(function (_ref
|
|
108
108
|
var _animRef$current4;
|
109
109
|
return (_animRef$current4 = animRef.current) === null || _animRef$current4 === void 0 ? void 0 : _animRef$current4.destroy();
|
110
110
|
};
|
111
|
-
}, [jsonData,
|
111
|
+
}, [jsonData, localRefValue, playStep]);
|
112
112
|
if (!jsonData) {
|
113
113
|
return null;
|
114
114
|
}
|
@@ -127,6 +127,7 @@ SteppedAnimatedMedia.propTypes = {
|
|
127
127
|
/**
|
128
128
|
* The file path(s) to json formatted Lottie animation files.
|
129
129
|
*/
|
130
|
+
/**@ts-ignore*/
|
130
131
|
filePaths: PropTypes.arrayOf(PropTypes.string).isRequired,
|
131
132
|
/**
|
132
133
|
* Which animation step from the filePaths array to play.
|