@carbon/ibm-products 2.33.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 +31990 -32061
- 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 +636 -24096
- 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 +2342 -17830
- 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/CreateSidePanel/CreateSidePanel.d.ts +81 -2
- package/es/components/CreateSidePanel/CreateSidePanel.js +5 -2
- package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.d.ts +82 -2
- package/es/components/DataSpreadsheet/DataSpreadsheet.js +5 -117
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +12 -111
- package/es/components/DataSpreadsheet/utils/commonEventHandlers.d.ts +4 -0
- package/es/components/DataSpreadsheet/utils/commonEventHandlers.js +304 -0
- package/es/components/Datagrid/Datagrid/DatagridContent.js +2 -1
- package/es/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridRefBody.js +3 -1
- package/es/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +6 -2
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +1 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +4 -0
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
- package/es/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
- 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/EditSidePanel/EditSidePanel.d.ts +92 -2
- package/es/components/EditSidePanel/EditSidePanel.js +8 -10
- 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.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +83 -0
- package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +94 -0
- package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +8 -10
- package/es/components/FilterPanel/FilterPanelCheckbox/index.d.ts +1 -0
- package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.d.ts +10 -0
- package/es/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +157 -0
- package/es/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.d.ts +5 -0
- package/es/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.js +72 -0
- package/es/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +2 -2
- 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 +5 -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/OptionsTile/OptionsTile.d.ts +77 -3
- package/es/components/OptionsTile/OptionsTile.js +9 -20
- 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/RemoveModal/RemoveModal.d.ts +81 -7
- package/es/components/RemoveModal/RemoveModal.js +1 -0
- package/es/components/ScrollGradient/ScrollGradient.d.ts +5 -0
- package/es/components/ScrollGradient/ScrollGradient.js +156 -0
- package/es/components/ScrollGradient/constants.d.ts +15 -0
- package/es/components/ScrollGradient/constants.js +121 -0
- package/es/components/ScrollGradient/index.d.ts +1 -0
- package/es/components/SidePanel/SidePanel.d.ts +144 -2
- package/es/components/SidePanel/SidePanel.js +100 -75
- package/es/components/StatusIcon/StatusIcon.d.ts +34 -2
- package/es/components/StatusIcon/StatusIcon.js +97 -95
- 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/TruncatedList/TruncatedList.js +5 -3
- package/es/components/UserAvatar/UserAvatar.js +7 -4
- package/es/components/index.d.ts +5 -2
- package/es/global/js/package-settings.d.ts +8 -0
- package/es/global/js/package-settings.js +8 -0
- package/es/index.js +9 -0
- package/es/settings.d.ts +8 -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/CreateSidePanel/CreateSidePanel.d.ts +81 -2
- package/lib/components/CreateSidePanel/CreateSidePanel.js +5 -2
- package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.d.ts +82 -2
- package/lib/components/DataSpreadsheet/DataSpreadsheet.js +5 -117
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +12 -111
- package/lib/components/DataSpreadsheet/utils/commonEventHandlers.d.ts +4 -0
- package/lib/components/DataSpreadsheet/utils/commonEventHandlers.js +311 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +2 -1
- package/lib/components/Datagrid/Datagrid/DatagridEmptyBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridRefBody.js +3 -1
- package/lib/components/Datagrid/Datagrid/DatagridSimpleBody.js +4 -1
- package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +5 -1
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/Columns.d.ts +1 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/InlineEditCell/InlineEditCell.js +4 -0
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.d.ts +2 -1
- package/lib/components/Datagrid/Datagrid/addons/InlineEdit/handleGridKeyPress.js +4 -3
- 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/EditSidePanel/EditSidePanel.d.ts +92 -2
- package/lib/components/EditSidePanel/EditSidePanel.js +8 -10
- 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.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelAccordion/FilterPanelAccordion.js +90 -0
- package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelAccordionItem/FilterPanelAccordionItem.js +101 -0
- package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +8 -10
- package/lib/components/FilterPanel/FilterPanelCheckbox/index.d.ts +1 -0
- package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.d.ts +10 -0
- package/lib/components/FilterPanel/FilterPanelCheckboxWithOverflow/FilterPanelCheckboxWithOverflow.js +164 -0
- package/lib/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.d.ts +5 -0
- package/lib/components/FilterPanel/FilterPanelGroup/FilterPanelGroup.js +79 -0
- package/lib/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +2 -2
- 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 +5 -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/OptionsTile/OptionsTile.d.ts +77 -3
- package/lib/components/OptionsTile/OptionsTile.js +9 -20
- 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/RemoveModal/RemoveModal.d.ts +81 -7
- package/lib/components/RemoveModal/RemoveModal.js +1 -0
- package/lib/components/ScrollGradient/ScrollGradient.d.ts +5 -0
- package/lib/components/ScrollGradient/ScrollGradient.js +163 -0
- package/lib/components/ScrollGradient/constants.d.ts +15 -0
- package/lib/components/ScrollGradient/constants.js +128 -0
- package/lib/components/ScrollGradient/index.d.ts +1 -0
- package/lib/components/SidePanel/SidePanel.d.ts +144 -2
- package/lib/components/SidePanel/SidePanel.js +100 -75
- package/lib/components/StatusIcon/StatusIcon.d.ts +34 -2
- package/lib/components/StatusIcon/StatusIcon.js +97 -95
- 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/TruncatedList/TruncatedList.js +5 -3
- package/lib/components/UserAvatar/UserAvatar.js +7 -4
- package/lib/components/index.d.ts +5 -2
- package/lib/global/js/package-settings.d.ts +8 -0
- package/lib/global/js/package-settings.js +8 -0
- package/lib/index.js +42 -0
- package/lib/settings.d.ts +8 -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 +54 -0
- package/scss/components/FilterPanel/_filter-panel-accordion.scss +6 -0
- package/scss/components/FilterPanel/_filter-panel-checkbox-with-overflow.scss +60 -0
- package/scss/components/FilterPanel/_filter-panel-checkbox.scss +24 -3
- package/scss/components/FilterPanel/_filter-panel-group.scss +39 -0
- package/scss/components/FilterPanel/_filter-panel-label.scss +0 -8
- package/scss/components/FilterPanel/_filter-panel-search.scss +38 -0
- package/scss/components/FilterPanel/_filter-panel.scss +2 -0
- package/scss/components/FilterPanel/_index-with-carbon.scss +5 -0
- package/scss/components/FilterPanel/_index.scss +5 -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/ScrollGradient/_carbon-imports.scss +9 -0
- package/scss/components/ScrollGradient/_index-with-carbon.scss +9 -0
- package/scss/components/ScrollGradient/_index.scss +8 -0
- package/scss/components/ScrollGradient/_scroll-gradient.scss +102 -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 +38 -4
- package/scss/components/_index-with-carbon.scss +3 -0
- package/scss/components/_index.scss +3 -0
@@ -1,5 +1,147 @@
|
|
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, { ReactNode } from 'react';
|
9
|
+
import { ButtonProps } from '@carbon/react';
|
10
|
+
type SidePanelBaseProps = {
|
11
|
+
/**
|
12
|
+
* Sets the action toolbar buttons
|
13
|
+
*/
|
14
|
+
actionToolbarButtons?: ButtonProps[];
|
15
|
+
/**
|
16
|
+
* The primary actions to be shown in the side panel. Each action is
|
17
|
+
* specified as an object that will render expressive Buttons. Any Button
|
18
|
+
* props can be passed in and any other fields in the object will be
|
19
|
+
* passed through to the button element as HTML attributes.
|
20
|
+
*
|
21
|
+
* See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
|
22
|
+
*/
|
23
|
+
actions?: ButtonProps[];
|
24
|
+
/**
|
25
|
+
* Determines if the title will animate on scroll
|
26
|
+
*/
|
27
|
+
animateTitle?: boolean;
|
28
|
+
/**
|
29
|
+
* Sets the body content of the side panel
|
30
|
+
*/
|
31
|
+
children: ReactNode;
|
32
|
+
/**
|
33
|
+
* Sets an optional className to be added to the side panel outermost element
|
34
|
+
*/
|
35
|
+
className?: string;
|
36
|
+
/**
|
37
|
+
* Sets the close button icon description
|
38
|
+
*/
|
39
|
+
closeIconDescription?: string;
|
40
|
+
/**
|
41
|
+
* Determines whether the side panel should render the condensed version (affects action buttons primarily)
|
42
|
+
*/
|
43
|
+
condensedActions?: boolean;
|
44
|
+
/**
|
45
|
+
* Sets the current step of the side panel
|
46
|
+
*/
|
47
|
+
currentStep?: number;
|
48
|
+
/**
|
49
|
+
* Unique identifier
|
50
|
+
*/
|
51
|
+
id?: string;
|
52
|
+
/**
|
53
|
+
* Determines whether the side panel should render with an overlay
|
54
|
+
*/
|
55
|
+
includeOverlay?: boolean;
|
56
|
+
/**
|
57
|
+
* Sets the label text which will display above the title text
|
58
|
+
*/
|
59
|
+
labelText?: string;
|
60
|
+
/**
|
61
|
+
* Sets the icon description for the navigation back icon button
|
62
|
+
*/
|
63
|
+
navigationBackIconDescription?: string;
|
64
|
+
/**
|
65
|
+
* Changes the current side panel page to the previous page
|
66
|
+
*/
|
67
|
+
onNavigationBack?(): void;
|
68
|
+
/**
|
69
|
+
* Specify a handler for closing the side panel.
|
70
|
+
* This handler closes the modal, e.g. changing `open` prop.
|
71
|
+
*/
|
72
|
+
onRequestClose?(): void;
|
73
|
+
/**
|
74
|
+
* Optional function called when the side panel exit animation is complete.
|
75
|
+
* This handler can be used for any state cleanup needed before the panel is removed from the DOM.
|
76
|
+
*/
|
77
|
+
onUnmount?(): void;
|
78
|
+
/**
|
79
|
+
* Determines whether the side panel should render or not
|
80
|
+
*/
|
81
|
+
open: boolean;
|
82
|
+
/**
|
83
|
+
* Determines if the side panel is on the right or left
|
84
|
+
*/
|
85
|
+
placement?: 'left' | 'right';
|
86
|
+
/**
|
87
|
+
* Prevent closing on click outside of the panel
|
88
|
+
*/
|
89
|
+
preventCloseOnClickOutside?: boolean;
|
90
|
+
/**
|
91
|
+
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
92
|
+
* This prop is required when using the `slideIn` variant of the side panel.
|
93
|
+
*/
|
94
|
+
selectorPageContent?: string;
|
95
|
+
/**
|
96
|
+
* Specify a CSS selector that matches the DOM element that should
|
97
|
+
* be focused when the side panel opens
|
98
|
+
*/
|
99
|
+
selectorPrimaryFocus?: string;
|
100
|
+
/**
|
101
|
+
* Sets the size of the side panel
|
102
|
+
*/
|
103
|
+
size: 'xs' | 'sm' | 'md' | 'lg' | '2xl';
|
104
|
+
/**
|
105
|
+
* Determines if this panel slides in
|
106
|
+
*/
|
107
|
+
slideIn?: boolean;
|
108
|
+
/**
|
109
|
+
* **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
|
110
|
+
*/
|
111
|
+
slug?: ReactNode;
|
112
|
+
/**
|
113
|
+
* Sets the subtitle text
|
114
|
+
*/
|
115
|
+
subtitle?: ReactNode;
|
116
|
+
/**
|
117
|
+
* Sets the title text
|
118
|
+
*/
|
119
|
+
title?: string;
|
120
|
+
};
|
121
|
+
type SidePanelSlideInProps = {
|
122
|
+
/**
|
123
|
+
* Determines if this panel slides in
|
124
|
+
*/
|
125
|
+
slideIn?: false;
|
126
|
+
/**
|
127
|
+
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
128
|
+
* This prop is required when using the `slideIn` variant of the side panel.
|
129
|
+
*/
|
130
|
+
selectorPageContent?: string;
|
131
|
+
} | {
|
132
|
+
/**
|
133
|
+
* Determines if this panel slides in
|
134
|
+
*/
|
135
|
+
slideIn: true;
|
136
|
+
/**
|
137
|
+
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
138
|
+
* This prop is required when using the `slideIn` variant of the side panel. Required for slideIn panels.
|
139
|
+
*/
|
140
|
+
selectorPageContent: string;
|
141
|
+
};
|
142
|
+
type SidePanelProps = SidePanelBaseProps & SidePanelSlideInProps;
|
1
143
|
/**
|
2
144
|
* Side panels keep users in-context of a page while performing tasks like navigating, editing, viewing details, or configuring something new.
|
3
145
|
*/
|
4
|
-
export let SidePanel: React.ForwardRefExoticComponent<React.RefAttributes<
|
5
|
-
|
146
|
+
export declare let SidePanel: React.ForwardRefExoticComponent<SidePanelProps & React.RefAttributes<HTMLDivElement>>;
|
147
|
+
export {};
|
@@ -14,7 +14,6 @@ var React = require('react');
|
|
14
14
|
var framerMotion = require('framer-motion');
|
15
15
|
var index = require('../../node_modules/prop-types/index.js');
|
16
16
|
var cx = require('classnames');
|
17
|
-
var useResizeObserver = require('../../global/js/hooks/useResizeObserver.js');
|
18
17
|
var carbonMotion = require('@carbon/motion');
|
19
18
|
var devtools = require('../../global/js/utils/devtools.js');
|
20
19
|
var propsHelper = require('../../global/js/utils/props-helper.js');
|
@@ -37,8 +36,8 @@ var _excluded = ["actionToolbarButtons", "actions", "animateTitle", "children",
|
|
37
36
|
_excluded2 = ["label", "kind", "icon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
|
38
37
|
var blockClass = "".concat(settings.pkg.prefix, "--side-panel");
|
39
38
|
var componentName = 'SidePanel';
|
40
|
-
|
41
|
-
|
39
|
+
// `any` is a work around until ActionSet is migrated to TS
|
40
|
+
var MotionActionSet = framerMotion.motion(ActionSet.ActionSet);
|
42
41
|
|
43
42
|
// Default values for props
|
44
43
|
var defaults = {
|
@@ -49,7 +48,6 @@ var defaults = {
|
|
49
48
|
placement: 'right',
|
50
49
|
size: 'md'
|
51
50
|
};
|
52
|
-
var MotionActionSet = framerMotion.motion(ActionSet.ActionSet);
|
53
51
|
|
54
52
|
/**
|
55
53
|
* Side panels keep users in-context of a page while performing tasks like navigating, editing, viewing details, or configuring something new.
|
@@ -93,16 +91,16 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
93
91
|
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
94
92
|
animationComplete = _useState2[0],
|
95
93
|
setAnimationComplete = _useState2[1];
|
96
|
-
var localRef = React.useRef();
|
94
|
+
var localRef = React.useRef(null);
|
97
95
|
var sidePanelRef = ref || localRef;
|
98
|
-
var overlayRef = React.useRef();
|
99
|
-
var innerContentRef = React.useRef();
|
100
|
-
var closeRef = React.useRef();
|
101
|
-
var animatedScrollRef = React.useRef();
|
102
|
-
var headerRef = React.useRef();
|
103
|
-
var titleRef = React.useRef();
|
104
|
-
var labelTextRef = React.useRef();
|
105
|
-
var subtitleRef = React.useRef();
|
96
|
+
var overlayRef = React.useRef(null);
|
97
|
+
var innerContentRef = React.useRef(null);
|
98
|
+
var closeRef = React.useRef(null);
|
99
|
+
var animatedScrollRef = React.useRef(null);
|
100
|
+
var headerRef = React.useRef(null);
|
101
|
+
var titleRef = React.useRef(null);
|
102
|
+
var labelTextRef = React.useRef(null);
|
103
|
+
var subtitleRef = React.useRef(null);
|
106
104
|
var previousState = usePreviousValue.usePreviousValue({
|
107
105
|
size: size,
|
108
106
|
open: open
|
@@ -118,32 +116,70 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
118
116
|
var _useFocus = useFocus.useFocus(sidePanelRef),
|
119
117
|
firstElement = _useFocus.firstElement,
|
120
118
|
keyDownListener = _useFocus.keyDownListener;
|
119
|
+
var panelRefValue = sidePanelRef.current;
|
121
120
|
var shouldReduceMotion = framerMotion.useReducedMotion();
|
121
|
+
|
122
|
+
// Title animation on scroll related state
|
123
|
+
var _useState7 = React.useState(0),
|
124
|
+
_useState8 = _rollupPluginBabelHelpers.slicedToArray(_useState7, 2),
|
125
|
+
labelTextHeight = _useState8[0],
|
126
|
+
setLabelTextHeight = _useState8[1];
|
122
127
|
React.useEffect(function () {
|
123
|
-
|
124
|
-
|
128
|
+
if (open && !(titleRef !== null && titleRef !== void 0 && titleRef.current)) {
|
129
|
+
setDoAnimateTitle(false);
|
130
|
+
} else {
|
131
|
+
setDoAnimateTitle(animateTitle);
|
132
|
+
}
|
133
|
+
}, [animateTitle, open]);
|
134
|
+
var titleItemsStyles = React.useCallback(function (progress) {
|
135
|
+
if (subtitleRef !== null && subtitleRef !== void 0 && subtitleRef.current) {
|
136
|
+
var _subtitleEl$style;
|
137
|
+
var subtitleEl = subtitleRef === null || subtitleRef === void 0 ? void 0 : subtitleRef.current;
|
138
|
+
var height = subtitleEl === null || subtitleEl === void 0 ? void 0 : subtitleEl.clientHeight;
|
139
|
+
var calculatedMargin = height * progress;
|
140
|
+
subtitleEl === null || subtitleEl === void 0 || (_subtitleEl$style = subtitleEl.style) === null || _subtitleEl$style === void 0 || _subtitleEl$style.setProperty('margin-top', "".concat(-calculatedMargin, "px"));
|
141
|
+
}
|
142
|
+
if (labelTextRef !== null && labelTextRef !== void 0 && labelTextRef.current) {
|
143
|
+
var _labelTextRef$current;
|
144
|
+
var _calculatedMargin = labelTextHeight * progress;
|
145
|
+
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"));
|
146
|
+
}
|
147
|
+
}, [labelTextHeight]);
|
148
|
+
React.useEffect(function () {
|
149
|
+
if (open && animateTitle && labelTextRef !== null && labelTextRef !== void 0 && labelTextRef.current) {
|
150
|
+
var _labelTextRef$current2;
|
151
|
+
setLabelTextHeight(Number((labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current2 = labelTextRef.current) === null || _labelTextRef$current2 === void 0 ? void 0 : _labelTextRef$current2.clientHeight) || null));
|
152
|
+
}
|
153
|
+
}, [animateTitle, labelTextRef, open]);
|
125
154
|
var handleScroll = React.useCallback(function () {
|
126
|
-
|
127
|
-
|
128
|
-
|
155
|
+
if (doAnimateTitle && innerContentRef !== null && innerContentRef !== void 0 && innerContentRef.current) {
|
156
|
+
var _innerContentRef$curr;
|
157
|
+
var scrollTop = innerContentRef === null || innerContentRef === void 0 || (_innerContentRef$curr = innerContentRef.current) === null || _innerContentRef$curr === void 0 ? void 0 : _innerContentRef$curr.scrollTop;
|
158
|
+
var animationProgress = Math.min(Number(scrollTop), scrollAnimationDistance) / scrollAnimationDistance;
|
159
|
+
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), animationProgress.toString());
|
160
|
+
titleItemsStyles(animationProgress);
|
161
|
+
}
|
162
|
+
}, [doAnimateTitle, panelRefValue === null || panelRefValue === void 0 ? void 0 : panelRefValue.style, scrollAnimationDistance, titleItemsStyles]);
|
129
163
|
var reducedMotion = typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
|
130
164
|
matches: true
|
131
165
|
};
|
132
166
|
|
133
167
|
// scroll panel to top going between steps
|
134
168
|
React.useEffect(function () {
|
135
|
-
if (sidePanelRef &&
|
169
|
+
if (sidePanelRef && panelRefValue) {
|
136
170
|
var _animatedScrollRef$cu;
|
137
171
|
var scrollableSection = (_animatedScrollRef$cu = animatedScrollRef.current) !== null && _animatedScrollRef$cu !== void 0 ? _animatedScrollRef$cu : innerContentRef.current;
|
138
|
-
scrollableSection
|
172
|
+
if (scrollableSection) {
|
173
|
+
scrollableSection.scrollTop = 0;
|
174
|
+
}
|
139
175
|
// The size of the panel has changed while it is still opened
|
140
176
|
// so we need to scroll it to the top and reset the header
|
141
177
|
// height css custom property
|
142
|
-
if (
|
178
|
+
if (previousState && previousState['size'] !== size && scrollableSection) {
|
143
179
|
scrollableSection.scrollTop = 0;
|
144
180
|
}
|
145
181
|
}
|
146
|
-
}, [currentStep, sidePanelRef, size, previousState
|
182
|
+
}, [currentStep, sidePanelRef, size, previousState, id, panelRefValue]);
|
147
183
|
|
148
184
|
// Add console warning if labelText is provided without a title.
|
149
185
|
// This combination is not allowed.
|
@@ -154,10 +190,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
154
190
|
}, [labelText, title]);
|
155
191
|
var checkSetDoAnimateTitle = function checkSetDoAnimateTitle() {
|
156
192
|
var canDoAnimateTitle = false;
|
157
|
-
if (
|
158
|
-
var _labelTextRef$
|
193
|
+
if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
|
194
|
+
var _labelTextRef$current3, _labelTextRef$current4, _subtitleRef$current$, _subtitleRef$current;
|
159
195
|
var titleEl = titleRef.current;
|
160
|
-
var labelHeight = (_labelTextRef$
|
196
|
+
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;
|
161
197
|
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;
|
162
198
|
|
163
199
|
// Adjusts space at bottom of titles by changing where scrolling finishes
|
@@ -167,12 +203,8 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
167
203
|
setScrollAnimationDistance(_scrollAnimationDistance);
|
168
204
|
|
169
205
|
// used to calculate the header moves
|
170
|
-
|
171
|
-
var scrollEl =
|
172
|
-
if (!scrollEl && animateTitle && !doAnimateTitle) {
|
173
|
-
// may be switching back based on resize
|
174
|
-
scrollEl = innerContentRef.current;
|
175
|
-
}
|
206
|
+
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-distance"), _scrollAnimationDistance.toString());
|
207
|
+
var scrollEl = innerContentRef.current;
|
176
208
|
if (scrollEl) {
|
177
209
|
var _window2;
|
178
210
|
var innerComputed = (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.getComputedStyle(innerContentRef.current);
|
@@ -186,34 +218,24 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
186
218
|
}
|
187
219
|
};
|
188
220
|
React.useEffect(function () {
|
189
|
-
if (doAnimateTitle && animatedScrollRef.current) {
|
190
|
-
// only add scroll if the doAnimateTitle is already true
|
191
|
-
// should come back through if false and canDoAnimateTitle is true
|
192
|
-
animatedScrollRef.current.addEventListener('scroll', handleScroll);
|
193
|
-
}
|
194
221
|
if (!doAnimateTitle && sidePanelRef.current) {
|
195
|
-
|
222
|
+
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), '0');
|
196
223
|
}
|
197
|
-
}, [
|
198
|
-
|
199
|
-
/* istanbul ignore next */
|
200
|
-
var handleResize = function handleResize() {
|
201
|
-
checkSetDoAnimateTitle();
|
202
|
-
};
|
224
|
+
}, [doAnimateTitle, handleScroll, sidePanelRef, innerContentRef, open, panelRefValue === null || panelRefValue === void 0 ? void 0 : panelRefValue.style]);
|
203
225
|
|
204
226
|
// Calculate scroll distances
|
205
227
|
React.useEffect(function () {
|
206
|
-
if (
|
228
|
+
if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
|
207
229
|
checkSetDoAnimateTitle();
|
208
230
|
}
|
209
231
|
|
210
232
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
211
|
-
}, [open, doAnimateTitle /* use do instead of animateTitle directly */, animationComplete, handleScroll, title, size, reducedMotion.matches, id
|
233
|
+
}, [open, doAnimateTitle /* use do instead of animateTitle directly */, animationComplete, handleScroll, title, size, reducedMotion.matches, id]);
|
212
234
|
|
213
235
|
// click outside functionality if `includeOverlay` prop is set
|
214
236
|
React.useEffect(function () {
|
215
237
|
var handleOutsideClick = function handleOutsideClick(event) {
|
216
|
-
if (
|
238
|
+
if (panelRefValue && overlayRef.current && overlayRef.current.contains(event.target) && onRequestClose) {
|
217
239
|
onRequestClose();
|
218
240
|
}
|
219
241
|
};
|
@@ -231,7 +253,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
231
253
|
bodyElement.style.overflow = '';
|
232
254
|
document.removeEventListener('click', handleOutsideClick);
|
233
255
|
};
|
234
|
-
}, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, onUnmount, sidePanelRef]);
|
256
|
+
}, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, onUnmount, sidePanelRef, panelRefValue]);
|
235
257
|
|
236
258
|
// initializes the side panel to close
|
237
259
|
var onAnimationEnd = function onAnimationEnd() {
|
@@ -250,43 +272,43 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
250
272
|
}, [reducedMotion.matches]);
|
251
273
|
|
252
274
|
// initializes the side panel to open
|
253
|
-
var
|
275
|
+
var onAnimationStart = function onAnimationStart() {
|
254
276
|
setAnimationComplete(false);
|
255
277
|
};
|
256
278
|
|
257
279
|
// used to reset margins of the slide in panel when closed/closing
|
258
280
|
React.useEffect(function () {
|
259
281
|
if (!open && slideIn) {
|
260
|
-
var pageContentElement = document.querySelector(selectorPageContent);
|
282
|
+
var pageContentElement = selectorPageContent ? document.querySelector(selectorPageContent) : null;
|
261
283
|
if (placement && placement === 'right' && pageContentElement) {
|
262
|
-
pageContentElement.style.marginInlineEnd = 0;
|
284
|
+
pageContentElement.style.marginInlineEnd = '0';
|
263
285
|
} else if (pageContentElement) {
|
264
|
-
pageContentElement.style.marginInlineStart = 0;
|
286
|
+
pageContentElement.style.marginInlineStart = '0';
|
265
287
|
}
|
266
288
|
}
|
267
289
|
}, [open, placement, selectorPageContent, slideIn]);
|
268
290
|
React.useEffect(function () {
|
269
|
-
if (!open && previousState
|
291
|
+
if (!open && previousState && previousState['open'] && reducedMotion.matches) {
|
270
292
|
onUnmount === null || onUnmount === void 0 || onUnmount();
|
271
293
|
}
|
272
|
-
}, [open, onUnmount, reducedMotion.matches, previousState
|
294
|
+
}, [open, onUnmount, reducedMotion.matches, previousState]);
|
273
295
|
|
274
296
|
// used to set margins of content for slide in panel version
|
275
297
|
React.useEffect(function () {
|
276
298
|
if (open && slideIn) {
|
277
|
-
var pageContentElement = document.querySelector(selectorPageContent);
|
299
|
+
var pageContentElement = selectorPageContent ? document.querySelector(selectorPageContent) : null;
|
278
300
|
if (pageContentElement) {
|
279
301
|
pageContentElement.style.inlineSize = 'auto';
|
280
302
|
} else {
|
281
303
|
pconsole["default"].warn('SidePanel prop `selectorPageContent` was not provided a selector that matches any element on your page. If an element is not found, the panel will render as a slide over.');
|
282
304
|
}
|
283
305
|
if (placement && placement === 'right' && pageContentElement) {
|
284
|
-
pageContentElement.style.marginInlineEnd = 0;
|
285
|
-
pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-end ".concat(carbonMotion.moderate02) :
|
306
|
+
pageContentElement.style.marginInlineEnd = '0';
|
307
|
+
pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-end ".concat(carbonMotion.moderate02) : '';
|
286
308
|
pageContentElement.style.marginInlineEnd = constants.SIDE_PANEL_SIZES[size];
|
287
309
|
} else if (pageContentElement) {
|
288
|
-
pageContentElement.style.marginInlineStart = 0;
|
289
|
-
pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-start ".concat(carbonMotion.moderate02) :
|
310
|
+
pageContentElement.style.marginInlineStart = '0';
|
311
|
+
pageContentElement.style.transition = !reducedMotion.matches ? "margin-inline-start ".concat(carbonMotion.moderate02) : '';
|
290
312
|
pageContentElement.style.marginInlineStart = constants.SIDE_PANEL_SIZES[size];
|
291
313
|
}
|
292
314
|
}
|
@@ -294,10 +316,12 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
294
316
|
React.useEffect(function () {
|
295
317
|
if (open) {
|
296
318
|
setTimeout(function () {
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
primeFocusEl
|
319
|
+
if (selectorPrimaryFocus) {
|
320
|
+
var _document;
|
321
|
+
var primeFocusEl = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(selectorPrimaryFocus);
|
322
|
+
if (primeFocusEl) {
|
323
|
+
primeFocusEl === null || primeFocusEl === void 0 || primeFocusEl.focus();
|
324
|
+
}
|
301
325
|
} else {
|
302
326
|
firstElement === null || firstElement === void 0 || firstElement.focus();
|
303
327
|
}
|
@@ -305,7 +329,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
305
329
|
}
|
306
330
|
}, [animationComplete, firstElement, open, selectorPrimaryFocus]);
|
307
331
|
var primaryActionContainerClassNames = cx__default["default"](["".concat(blockClass, "__actions-container"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__actions-container--condensed"), condensedActions)]);
|
308
|
-
var mainPanelClassNames = cx__default["default"]([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(
|
332
|
+
var mainPanelClassNames = cx__default["default"]([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-slug"), slug), "".concat(blockClass, "--condensed-actions"), condensedActions), "".concat(blockClass, "--has-overlay"), includeOverlay)]);
|
309
333
|
var renderTitle = function renderTitle() {
|
310
334
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
311
335
|
className: cx__default["default"]("".concat(blockClass, "__title"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__title--no-label"), !labelTextRef.current)),
|
@@ -324,7 +348,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
324
348
|
var _slug$type;
|
325
349
|
var slugCloseSize = actions && actions.length && /l/.test(size) ? 'md' : 'sm';
|
326
350
|
var normalizedSlug;
|
327
|
-
if (slug && (
|
351
|
+
if (slug && ((_slug$type = slug['type']) === null || _slug$type === void 0 ? void 0 : _slug$type.displayName) === 'Slug') {
|
328
352
|
normalizedSlug = /*#__PURE__*/React__default["default"].cloneElement(slug, {
|
329
353
|
// slug size is sm unless actions and size > md
|
330
354
|
size: slugCloseSize
|
@@ -398,10 +422,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
398
422
|
var renderMain = function renderMain() {
|
399
423
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
400
424
|
ref: innerContentRef,
|
401
|
-
|
425
|
+
onScroll: handleScroll,
|
426
|
+
className: cx__default["default"]("".concat(blockClass, "__inner-content"), "".concat(blockClass, "--scrolls"), "".concat(!doAnimateTitle ? "".concat(blockClass, "__inner-content--no-animated-title") : ''))
|
402
427
|
}, children);
|
403
428
|
};
|
404
|
-
useResizeObserver.useResizeObserver(sidePanelRef, handleResize, [open]);
|
405
429
|
return /*#__PURE__*/React__default["default"].createElement(framerMotion.AnimatePresence, null, open && /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(framerMotion.motion.div, _rollupPluginBabelHelpers["extends"]({}, devtools.getDevtoolsProps(componentName), rest, {
|
406
430
|
id: id,
|
407
431
|
className: mainPanelClassNames,
|
@@ -409,9 +433,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
409
433
|
role: "complementary",
|
410
434
|
"aria-label": title,
|
411
435
|
onAnimationComplete: onAnimationEnd,
|
412
|
-
onAnimationStart:
|
413
|
-
return _onAnimationStart();
|
414
|
-
},
|
436
|
+
onAnimationStart: onAnimationStart,
|
415
437
|
variants: variants.panelVariants,
|
416
438
|
initial: "hidden",
|
417
439
|
animate: "visible",
|
@@ -421,11 +443,8 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
421
443
|
shouldReduceMotion: shouldReduceMotion
|
422
444
|
},
|
423
445
|
onKeyDown: keyDownListener
|
424
|
-
}),
|
425
|
-
|
426
|
-
className: "".concat(blockClass, "__animated-scroll-wrapper ").concat(blockClass, "--scrolls")
|
427
|
-
}, renderHeader(), renderMain()) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, renderHeader(), renderMain()), /*#__PURE__*/React__default["default"].createElement(MotionActionSet, {
|
428
|
-
actions: actions,
|
446
|
+
}), /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, renderHeader(), renderMain()), /*#__PURE__*/React__default["default"].createElement(MotionActionSet, {
|
447
|
+
actions: actions !== null && actions !== void 0 ? actions : [],
|
429
448
|
className: primaryActionContainerClassNames,
|
430
449
|
size: size === 'xs' ? 'sm' : size,
|
431
450
|
custom: shouldReduceMotion,
|
@@ -471,7 +490,8 @@ exports.SidePanel.propTypes = {
|
|
471
490
|
*
|
472
491
|
* See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
|
473
492
|
*/
|
474
|
-
actions: propsHelper.allPropTypes([
|
493
|
+
actions: propsHelper.allPropTypes([/**@ts-ignore*/
|
494
|
+
ActionSet.ActionSet.validateActions(), index["default"].arrayOf(index["default"].shape(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, react.Button.propTypes), {}, {
|
475
495
|
kind: index["default"].oneOf(['ghost', 'danger--ghost', 'secondary', 'danger', 'primary']),
|
476
496
|
tooltipPosition: index["default"].oneOf(['top', 'right', 'bottom', 'left']),
|
477
497
|
tooltipAlignment: index["default"].oneOf(['start', 'center', 'end']),
|
@@ -550,6 +570,7 @@ exports.SidePanel.propTypes = {
|
|
550
570
|
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
551
571
|
* This prop is required when using the `slideIn` variant of the side panel.
|
552
572
|
*/
|
573
|
+
/**@ts-ignore*/
|
553
574
|
selectorPageContent: index["default"].string.isRequired.if(function (_ref6) {
|
554
575
|
var slideIn = _ref6.slideIn;
|
555
576
|
return slideIn;
|
@@ -558,14 +579,17 @@ exports.SidePanel.propTypes = {
|
|
558
579
|
* Specify a CSS selector that matches the DOM element that should
|
559
580
|
* be focused when the side panel opens
|
560
581
|
*/
|
582
|
+
/**@ts-ignore*/
|
561
583
|
selectorPrimaryFocus: index["default"].string,
|
562
584
|
/**
|
563
585
|
* Sets the size of the side panel
|
564
586
|
*/
|
587
|
+
/**@ts-ignore*/
|
565
588
|
size: index["default"].oneOf(['xs', 'sm', 'md', 'lg', '2xl']),
|
566
589
|
/**
|
567
590
|
* Determines if this panel slides in
|
568
591
|
*/
|
592
|
+
/**@ts-ignore*/
|
569
593
|
slideIn: index["default"].bool,
|
570
594
|
/**
|
571
595
|
* **Experimental:** Provide a `Slug` component to be rendered inside the `SidePanel` component
|
@@ -578,6 +602,7 @@ exports.SidePanel.propTypes = {
|
|
578
602
|
/**
|
579
603
|
* Sets the title text
|
580
604
|
*/
|
605
|
+
/**@ts-ignore*/
|
581
606
|
title: index["default"].string.isRequired.if(function (_ref7) {
|
582
607
|
var labelText = _ref7.labelText;
|
583
608
|
return labelText;
|
@@ -1,3 +1,10 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2021, 2022
|
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, { PropsWithChildren } from 'react';
|
1
8
|
/**
|
2
9
|
The `StatusIcon` component follows the Carbon guidelines for status icons with
|
3
10
|
some added specifications around illustration usage. For additional usage
|
@@ -7,5 +14,30 @@ _Status icons_ are an important method of communicating severity level
|
|
7
14
|
information to users. The shapes and colors, communicate severity that enable
|
8
15
|
users to quickly assess and identify status and respond accordingly.
|
9
16
|
*/
|
10
|
-
|
11
|
-
|
17
|
+
type Size = 'sm' | 'md' | 'lg' | 'xl';
|
18
|
+
type Theme = 'light' | 'dark';
|
19
|
+
type Kind = 'fatal' | 'critical' | 'major-warning' | 'minor-warning' | 'undefined' | 'unknown' | 'normal' | 'info' | 'in-progress' | 'running' | 'pending';
|
20
|
+
interface StatusIconProps extends PropsWithChildren {
|
21
|
+
/**
|
22
|
+
* Provide an optional class to be applied to the modal root node.
|
23
|
+
*/
|
24
|
+
className?: string;
|
25
|
+
/**
|
26
|
+
* A required prop that provides a title element and tooltip for the icon for accessibility purposes
|
27
|
+
*/
|
28
|
+
iconDescription: string;
|
29
|
+
/**
|
30
|
+
* A required prop that displays the respective icon associated with the status
|
31
|
+
*/
|
32
|
+
kind: Kind;
|
33
|
+
/**
|
34
|
+
* A required prop that displays the size of the icon associate with the status
|
35
|
+
*/
|
36
|
+
size: Size;
|
37
|
+
/**
|
38
|
+
* A required prop that displays the theme of the icon associated with the status
|
39
|
+
*/
|
40
|
+
theme: Theme;
|
41
|
+
}
|
42
|
+
export declare let StatusIcon: React.ForwardRefExoticComponent<StatusIconProps & React.RefAttributes<React.ReactSVGElement | null>>;
|
43
|
+
export {};
|