@carbon/ibm-products 2.34.0 → 2.36.0-alpha.27
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +32448 -32421
- 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 +105 -91
- 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 +765 -24496
- 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 +2543 -18127
- 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/Coachmark/utils/enums.d.ts +36 -22
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.d.ts +26 -2
- package/es/components/CoachmarkBeacon/CoachmarkBeacon.js +1 -3
- package/es/components/CoachmarkFixed/CoachmarkFixed.js +1 -1
- package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.d.ts +28 -2
- package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +0 -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.d.ts +121 -4
- package/es/components/CreateFullPage/CreateFullPage.js +14 -26
- package/es/components/CreateFullPage/CreateFullPageStep.js +22 -7
- package/es/components/CreateTearsheet/CreateTearsheet.js +2 -0
- package/es/components/CreateTearsheetNarrow/CreateTearsheetNarrow.d.ts +82 -2
- package/es/components/Datagrid/Datagrid/DatagridRow.js +4 -3
- package/es/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +2 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +10 -6
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -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/EditFullPage/EditFullPage.d.ts +19 -2
- package/es/components/EditFullPage/EditFullPage.js +3 -3
- 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/NoTagsEmptyState/NoTagsEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -3
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -3
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +61 -2
- package/es/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -2
- 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/FullPageError/FullPageError.d.ts +2 -1
- package/es/components/FullPageError/FullPageError.js +24 -49
- 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/HTTPErrors/HTTPErrorOther/HTTPErrorOther.d.ts +40 -2
- package/es/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.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/InlineTip/InlineTipLink.d.ts +19 -2
- package/es/components/InterstitialScreenView/InterstitialScreenView.d.ts +23 -2
- package/es/components/InterstitialScreenView/InterstitialScreenView.js +0 -1
- package/es/components/InterstitialScreenViewModule/InterstitialScreenViewModule.d.ts +23 -2
- package/es/components/Nav/Nav.js +1 -1
- package/es/components/Nav/NavList.js +7 -7
- package/es/components/NonLinearReading/NonLinearReading.d.ts +28 -2
- package/es/components/NonLinearReading/NonLinearReading.js +2 -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/SearchBar/SearchBar.d.ts +51 -3
- package/es/components/SearchBar/SearchBar.js +5 -6
- package/es/components/SidePanel/SidePanel.js +62 -41
- 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.d.ts +47 -2
- package/es/components/TruncatedList/TruncatedList.js +5 -4
- 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/Coachmark/utils/enums.d.ts +36 -22
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.d.ts +26 -2
- package/lib/components/CoachmarkBeacon/CoachmarkBeacon.js +1 -3
- package/lib/components/CoachmarkFixed/CoachmarkFixed.js +1 -1
- package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.d.ts +28 -2
- package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +0 -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.d.ts +121 -4
- package/lib/components/CreateFullPage/CreateFullPage.js +13 -25
- package/lib/components/CreateFullPage/CreateFullPageStep.js +20 -5
- package/lib/components/CreateTearsheet/CreateTearsheet.js +2 -0
- package/lib/components/CreateTearsheetNarrow/CreateTearsheetNarrow.d.ts +82 -2
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +4 -3
- package/lib/components/Datagrid/Datagrid/addons/CustomizeColumns/DraggableItemsList.js +2 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +11 -7
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +6 -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/EditFullPage/EditFullPage.d.ts +19 -2
- package/lib/components/EditFullPage/EditFullPage.js +3 -3
- 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/NoTagsEmptyState/NoTagsEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NoTagsEmptyState/NoTagsEmptyState.js +1 -3
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/NotFoundEmptyState/NotFoundEmptyState.js +1 -3
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.d.ts +61 -2
- package/lib/components/EmptyStates/UnauthorizedEmptyState/UnauthorizedEmptyState.js +1 -2
- 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/FullPageError/FullPageError.d.ts +2 -1
- package/lib/components/FullPageError/FullPageError.js +24 -49
- 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/HTTPErrors/HTTPErrorOther/HTTPErrorOther.d.ts +40 -2
- package/lib/components/HTTPErrors/HTTPErrorOther/HTTPErrorOther.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/InlineTip/InlineTipLink.d.ts +19 -2
- package/lib/components/InterstitialScreenView/InterstitialScreenView.d.ts +23 -2
- package/lib/components/InterstitialScreenView/InterstitialScreenView.js +0 -1
- package/lib/components/InterstitialScreenViewModule/InterstitialScreenViewModule.d.ts +23 -2
- package/lib/components/Nav/Nav.js +1 -1
- package/lib/components/Nav/NavList.js +7 -7
- package/lib/components/NonLinearReading/NonLinearReading.d.ts +28 -2
- package/lib/components/NonLinearReading/NonLinearReading.js +2 -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/SearchBar/SearchBar.d.ts +51 -3
- package/lib/components/SearchBar/SearchBar.js +5 -6
- package/lib/components/SidePanel/SidePanel.js +62 -41
- 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.d.ts +47 -2
- package/lib/components/TruncatedList/TruncatedList.js +5 -4
- 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 +5 -5
- 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/Datagrid/styles/_useSortableColumns.scss +2 -0
- 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/FullPageError/_full-page-error.scss +10 -10
- 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 +7 -3
- package/scss/components/_index-with-carbon.scss +2 -0
- package/scss/components/_index.scss +2 -0
@@ -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');
|
@@ -34,7 +33,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
34
33
|
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
35
34
|
|
36
35
|
var _excluded = ["actionToolbarButtons", "actions", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "id", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "slug", "subtitle", "title"],
|
37
|
-
_excluded2 = ["label", "kind", "icon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
|
36
|
+
_excluded2 = ["label", "kind", "hasIconOnly", "icon", "renderIcon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
|
38
37
|
var blockClass = "".concat(settings.pkg.prefix, "--side-panel");
|
39
38
|
var componentName = 'SidePanel';
|
40
39
|
// `any` is a work around until ActionSet is migrated to TS
|
@@ -119,14 +118,48 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
119
118
|
keyDownListener = _useFocus.keyDownListener;
|
120
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];
|
127
|
+
React.useEffect(function () {
|
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]);
|
122
148
|
React.useEffect(function () {
|
123
|
-
|
124
|
-
|
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
|
-
|
129
|
-
|
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]);
|
130
163
|
var reducedMotion = typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
|
131
164
|
matches: true
|
132
165
|
};
|
@@ -134,8 +167,8 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
134
167
|
// scroll panel to top going between steps
|
135
168
|
React.useEffect(function () {
|
136
169
|
if (sidePanelRef && panelRefValue) {
|
137
|
-
var _animatedScrollRef$
|
138
|
-
var scrollableSection = (_animatedScrollRef$
|
170
|
+
var _animatedScrollRef$cu;
|
171
|
+
var scrollableSection = (_animatedScrollRef$cu = animatedScrollRef.current) !== null && _animatedScrollRef$cu !== void 0 ? _animatedScrollRef$cu : innerContentRef.current;
|
139
172
|
if (scrollableSection) {
|
140
173
|
scrollableSection.scrollTop = 0;
|
141
174
|
}
|
@@ -158,9 +191,9 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
158
191
|
var checkSetDoAnimateTitle = function checkSetDoAnimateTitle() {
|
159
192
|
var canDoAnimateTitle = false;
|
160
193
|
if (panelRefValue && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
|
161
|
-
var _labelTextRef$
|
194
|
+
var _labelTextRef$current3, _labelTextRef$current4, _subtitleRef$current$, _subtitleRef$current;
|
162
195
|
var titleEl = titleRef.current;
|
163
|
-
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;
|
164
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;
|
165
198
|
|
166
199
|
// Adjusts space at bottom of titles by changing where scrolling finishes
|
@@ -171,11 +204,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
171
204
|
|
172
205
|
// used to calculate the header moves
|
173
206
|
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-distance"), _scrollAnimationDistance.toString());
|
174
|
-
var scrollEl =
|
175
|
-
if (!scrollEl && animateTitle && !doAnimateTitle) {
|
176
|
-
// may be switching back based on resize
|
177
|
-
scrollEl = innerContentRef.current;
|
178
|
-
}
|
207
|
+
var scrollEl = innerContentRef.current;
|
179
208
|
if (scrollEl) {
|
180
209
|
var _window2;
|
181
210
|
var innerComputed = (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.getComputedStyle(innerContentRef.current);
|
@@ -189,20 +218,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
189
218
|
}
|
190
219
|
};
|
191
220
|
React.useEffect(function () {
|
192
|
-
if (doAnimateTitle && animatedScrollRef.current) {
|
193
|
-
// only add scroll if the doAnimateTitle is already true
|
194
|
-
// should come back through if false and canDoAnimateTitle is true
|
195
|
-
animatedScrollRef.current.addEventListener('scroll', handleScroll);
|
196
|
-
}
|
197
221
|
if (!doAnimateTitle && sidePanelRef.current) {
|
198
222
|
panelRefValue === null || panelRefValue === void 0 || panelRefValue.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), '0');
|
199
223
|
}
|
200
|
-
}, [
|
201
|
-
|
202
|
-
/* istanbul ignore next */
|
203
|
-
var handleResize = function handleResize() {
|
204
|
-
checkSetDoAnimateTitle();
|
205
|
-
};
|
224
|
+
}, [doAnimateTitle, handleScroll, sidePanelRef, innerContentRef, open, panelRefValue === null || panelRefValue === void 0 ? void 0 : panelRefValue.style]);
|
206
225
|
|
207
226
|
// Calculate scroll distances
|
208
227
|
React.useEffect(function () {
|
@@ -211,7 +230,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
211
230
|
}
|
212
231
|
|
213
232
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
214
|
-
}, [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]);
|
215
234
|
|
216
235
|
// click outside functionality if `includeOverlay` prop is set
|
217
236
|
React.useEffect(function () {
|
@@ -310,7 +329,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
310
329
|
}
|
311
330
|
}, [animationComplete, firstElement, open, selectorPrimaryFocus]);
|
312
331
|
var primaryActionContainerClassNames = cx__default["default"](["".concat(blockClass, "__actions-container"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__actions-container--condensed"), condensedActions)]);
|
313
|
-
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)]);
|
314
333
|
var renderTitle = function renderTitle() {
|
315
334
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
316
335
|
className: cx__default["default"]("".concat(blockClass, "__title"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__title--no-label"), !labelTextRef.current)),
|
@@ -377,7 +396,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
377
396
|
}, actionToolbarButtons.map(function (_ref4) {
|
378
397
|
var label = _ref4.label,
|
379
398
|
kind = _ref4.kind,
|
399
|
+
_ref4$hasIconOnly = _ref4.hasIconOnly,
|
400
|
+
hasIconOnly = _ref4$hasIconOnly === void 0 ? false : _ref4$hasIconOnly,
|
380
401
|
icon = _ref4.icon,
|
402
|
+
renderIcon = _ref4.renderIcon,
|
381
403
|
tooltipPosition = _ref4.tooltipPosition,
|
382
404
|
tooltipAlignment = _ref4.tooltipAlignment,
|
383
405
|
leading = _ref4.leading,
|
@@ -389,11 +411,13 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
389
411
|
key: label,
|
390
412
|
kind: kind || 'ghost',
|
391
413
|
size: "sm",
|
392
|
-
renderIcon: icon,
|
393
|
-
iconDescription: label
|
414
|
+
renderIcon: renderIcon || icon,
|
415
|
+
iconDescription: label
|
416
|
+
}, hasIconOnly && {
|
394
417
|
tooltipPosition: tooltipPosition || 'bottom',
|
395
|
-
tooltipAlignment: tooltipAlignment || 'start'
|
396
|
-
|
418
|
+
tooltipAlignment: tooltipAlignment || 'start'
|
419
|
+
}, {
|
420
|
+
hasIconOnly: hasIconOnly,
|
397
421
|
disabled: disabled,
|
398
422
|
className: cx__default["default"](["".concat(blockClass, "__action-toolbar-button"), className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__action-toolbar-leading-button"), leading)]),
|
399
423
|
onClick: onClick
|
@@ -403,10 +427,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
403
427
|
var renderMain = function renderMain() {
|
404
428
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
405
429
|
ref: innerContentRef,
|
406
|
-
|
430
|
+
onScroll: handleScroll,
|
431
|
+
className: cx__default["default"]("".concat(blockClass, "__inner-content"), "".concat(blockClass, "--scrolls"), "".concat(!doAnimateTitle ? "".concat(blockClass, "__inner-content--no-animated-title") : ''))
|
407
432
|
}, children);
|
408
433
|
};
|
409
|
-
useResizeObserver.useResizeObserver(sidePanelRef, handleResize, [open]);
|
410
434
|
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, {
|
411
435
|
id: id,
|
412
436
|
className: mainPanelClassNames,
|
@@ -424,11 +448,8 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
|
|
424
448
|
shouldReduceMotion: shouldReduceMotion
|
425
449
|
},
|
426
450
|
onKeyDown: keyDownListener
|
427
|
-
}),
|
428
|
-
|
429
|
-
className: "".concat(blockClass, "__animated-scroll-wrapper ").concat(blockClass, "--scrolls")
|
430
|
-
}, renderHeader(), renderMain()) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, renderHeader(), renderMain()), /*#__PURE__*/React__default["default"].createElement(MotionActionSet, {
|
431
|
-
actions: actions,
|
451
|
+
}), /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, renderHeader(), renderMain()), /*#__PURE__*/React__default["default"].createElement(MotionActionSet, {
|
452
|
+
actions: actions !== null && actions !== void 0 ? actions : [],
|
432
453
|
className: primaryActionContainerClassNames,
|
433
454
|
size: size === 'xs' ? 'sm' : size,
|
434
455
|
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 {};
|
@@ -37,7 +37,6 @@ var componentName = 'SteppedAnimatedMedia';
|
|
37
37
|
var defaults = {
|
38
38
|
playStep: 0
|
39
39
|
};
|
40
|
-
|
41
40
|
/**
|
42
41
|
* The SteppedAnimatedMedia is a Novice to Pro internal component and is not intended for general use.
|
43
42
|
*/
|
@@ -52,8 +51,9 @@ var SteppedAnimatedMedia = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
52
51
|
jsonData = _useState2[0],
|
53
52
|
setJsonData = _useState2[1];
|
54
53
|
var animRef = React.useRef();
|
55
|
-
var backupRef = React.useRef();
|
54
|
+
var backupRef = React.useRef(null);
|
56
55
|
var localRef = ref !== null && ref !== void 0 ? ref : backupRef;
|
56
|
+
var localRefValue = localRef.current;
|
57
57
|
// load animation source
|
58
58
|
React.useEffect(function () {
|
59
59
|
var isJsonFile = function isJsonFile(filePath) {
|
@@ -100,11 +100,11 @@ var SteppedAnimatedMedia = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
100
100
|
React.useEffect(function () {
|
101
101
|
var _window;
|
102
102
|
var prefersReducedMotion = (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)').matches : true;
|
103
|
-
if (
|
103
|
+
if (localRefValue) {
|
104
104
|
var _animRef$current, _animRef$current2, _animRef$current3;
|
105
105
|
(_animRef$current = animRef.current) === null || _animRef$current === void 0 || _animRef$current.destroy();
|
106
106
|
animRef.current = lottie__default["default"].loadAnimation({
|
107
|
-
container:
|
107
|
+
container: localRefValue,
|
108
108
|
renderer: 'svg',
|
109
109
|
animationData: jsonData[clamp__default["default"](playStep, 0, jsonData.length - 1)],
|
110
110
|
loop: false,
|
@@ -119,7 +119,7 @@ var SteppedAnimatedMedia = /*#__PURE__*/React__default["default"].forwardRef(fun
|
|
119
119
|
var _animRef$current4;
|
120
120
|
return (_animRef$current4 = animRef.current) === null || _animRef$current4 === void 0 ? void 0 : _animRef$current4.destroy();
|
121
121
|
};
|
122
|
-
}, [jsonData,
|
122
|
+
}, [jsonData, localRefValue, playStep]);
|
123
123
|
if (!jsonData) {
|
124
124
|
return null;
|
125
125
|
}
|
@@ -138,6 +138,7 @@ SteppedAnimatedMedia.propTypes = {
|
|
138
138
|
/**
|
139
139
|
* The file path(s) to json formatted Lottie animation files.
|
140
140
|
*/
|
141
|
+
/**@ts-ignore*/
|
141
142
|
filePaths: index["default"].arrayOf(index["default"].string).isRequired,
|
142
143
|
/**
|
143
144
|
* Which animation step from the filePaths array to play.
|
@@ -0,0 +1,216 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
13
|
+
var React = require('react');
|
14
|
+
var index = require('../../node_modules/prop-types/index.js');
|
15
|
+
var cx = require('classnames');
|
16
|
+
var devtools = require('../../global/js/utils/devtools.js');
|
17
|
+
var settings = require('../../settings.js');
|
18
|
+
var react = require('@carbon/react');
|
19
|
+
var constants = require('./constants.js');
|
20
|
+
var useResizeObserver = require('../../global/js/hooks/useResizeObserver.js');
|
21
|
+
var TagSet = require('../TagSet/TagSet.js');
|
22
|
+
|
23
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
24
|
+
|
25
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
26
|
+
var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
|
27
|
+
|
28
|
+
var _excluded = ["className", "items", "tagComponent", "maxVisible", "multiline"],
|
29
|
+
_excluded2 = ["className", "id"];
|
30
|
+
var blockClass = "".concat(settings.pkg.prefix, "--tag-overflow");
|
31
|
+
var componentName = 'TagOverflow';
|
32
|
+
|
33
|
+
// Default values for props
|
34
|
+
var defaults = {
|
35
|
+
items: []
|
36
|
+
};
|
37
|
+
|
38
|
+
/**
|
39
|
+
* TODO: A description of the component.
|
40
|
+
*/
|
41
|
+
exports.TagOverflow = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
|
42
|
+
var className = _ref.className,
|
43
|
+
_ref$items = _ref.items,
|
44
|
+
items = _ref$items === void 0 ? defaults.items : _ref$items,
|
45
|
+
tagComponent = _ref.tagComponent,
|
46
|
+
maxVisible = _ref.maxVisible,
|
47
|
+
multiline = _ref.multiline,
|
48
|
+
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
49
|
+
var localContainerRef = React.useRef(null);
|
50
|
+
var containerRef = ref || localContainerRef;
|
51
|
+
var itemRefs = React.useRef(null);
|
52
|
+
var overflowRef = React.useRef(null);
|
53
|
+
// measurementOffset is the value of margin applied on each items
|
54
|
+
// This value is required for calculating how many items will fit within the container
|
55
|
+
var measurementOffset = 4;
|
56
|
+
var overflowIndicatorWidth = 40;
|
57
|
+
var _useState = React.useState(0),
|
58
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
59
|
+
containerWidth = _useState2[0],
|
60
|
+
setContainerWidth = _useState2[1];
|
61
|
+
var _useState3 = React.useState([]),
|
62
|
+
_useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
|
63
|
+
visibleItems = _useState4[0],
|
64
|
+
setVisibleItems = _useState4[1];
|
65
|
+
var _useState5 = React.useState([]),
|
66
|
+
_useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
|
67
|
+
overflowItems = _useState6[0],
|
68
|
+
setOverflowItems = _useState6[1];
|
69
|
+
var handleResize = function handleResize() {
|
70
|
+
setContainerWidth(containerRef.current.offsetWidth);
|
71
|
+
};
|
72
|
+
useResizeObserver.useResizeObserver(containerRef, handleResize);
|
73
|
+
var getMap = function getMap() {
|
74
|
+
if (!itemRefs.current) {
|
75
|
+
itemRefs.current = new Map();
|
76
|
+
}
|
77
|
+
return itemRefs.current;
|
78
|
+
};
|
79
|
+
var itemRefHandler = function itemRefHandler(id, node) {
|
80
|
+
var map = getMap();
|
81
|
+
if (id && node && map.get(id) !== node.offsetWidth) {
|
82
|
+
map.set(id, node.offsetWidth);
|
83
|
+
}
|
84
|
+
};
|
85
|
+
var getVisibleItems = React.useCallback(function () {
|
86
|
+
if (!itemRefs.current) {
|
87
|
+
return items;
|
88
|
+
}
|
89
|
+
if (multiline) {
|
90
|
+
var _visibleItems = maxVisible ? items === null || items === void 0 ? void 0 : items.slice(0, maxVisible) : items;
|
91
|
+
return _visibleItems;
|
92
|
+
}
|
93
|
+
var map = getMap();
|
94
|
+
var overflowContainerWidth = overflowRef.current.offsetWidth > overflowIndicatorWidth ? overflowRef.current.offsetWidth : overflowIndicatorWidth;
|
95
|
+
var maxWidth = containerWidth - overflowContainerWidth;
|
96
|
+
var childrenWidth = 0;
|
97
|
+
var maxReached = false;
|
98
|
+
return items.reduce(function (prev, cur) {
|
99
|
+
if (!maxReached) {
|
100
|
+
var itemWidth = map.get(cur.id) + measurementOffset;
|
101
|
+
var fits = itemWidth + childrenWidth < maxWidth;
|
102
|
+
if (fits) {
|
103
|
+
childrenWidth += itemWidth;
|
104
|
+
prev.push(cur);
|
105
|
+
} else {
|
106
|
+
maxReached = true;
|
107
|
+
}
|
108
|
+
}
|
109
|
+
return prev;
|
110
|
+
}, []);
|
111
|
+
}, [itemRefs, overflowRef, containerWidth, items, multiline, maxVisible]);
|
112
|
+
var getCustomComponent = function getCustomComponent(item) {
|
113
|
+
var className = item.className,
|
114
|
+
id = item.id,
|
115
|
+
other = _rollupPluginBabelHelpers.objectWithoutProperties(item, _excluded2);
|
116
|
+
return /*#__PURE__*/React__default["default"].createElement(tagComponent, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, other), {}, {
|
117
|
+
className: cx__default["default"]("".concat(blockClass, "__item"), className),
|
118
|
+
ref: function ref(node) {
|
119
|
+
return itemRefHandler(id, node);
|
120
|
+
}
|
121
|
+
}));
|
122
|
+
};
|
123
|
+
React.useEffect(function () {
|
124
|
+
var visibleItemsArr = getVisibleItems();
|
125
|
+
if (maxVisible && maxVisible < visibleItemsArr.length) {
|
126
|
+
var _visibleItemsArr;
|
127
|
+
visibleItemsArr = (_visibleItemsArr = visibleItemsArr) === null || _visibleItemsArr === void 0 ? void 0 : _visibleItemsArr.slice(0, maxVisible);
|
128
|
+
}
|
129
|
+
var hiddenItems = items === null || items === void 0 ? void 0 : items.slice(visibleItemsArr.length);
|
130
|
+
var overflowItemsArr = hiddenItems === null || hiddenItems === void 0 ? void 0 : hiddenItems.map(function (item) {
|
131
|
+
return {
|
132
|
+
type: item.tagType,
|
133
|
+
label: item.label
|
134
|
+
};
|
135
|
+
});
|
136
|
+
setVisibleItems(visibleItemsArr);
|
137
|
+
setOverflowItems(overflowItemsArr);
|
138
|
+
}, [containerWidth, items, maxVisible, getVisibleItems]);
|
139
|
+
return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
|
140
|
+
className: cx__default["default"](blockClass, className, _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--multiline"), multiline)),
|
141
|
+
ref: containerRef,
|
142
|
+
role: "main"
|
143
|
+
}, devtools.getDevtoolsProps(componentName)), visibleItems.length > 0 && visibleItems.map(function (item) {
|
144
|
+
// Render custom components
|
145
|
+
if (tagComponent) {
|
146
|
+
return getCustomComponent(item);
|
147
|
+
} else {
|
148
|
+
// If there is no template prop, then render items as Tags
|
149
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
150
|
+
ref: function ref(node) {
|
151
|
+
return itemRefHandler(item.id, node);
|
152
|
+
},
|
153
|
+
key: item.id
|
154
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.Tooltip, {
|
155
|
+
align: "bottom",
|
156
|
+
label: item.label
|
157
|
+
}, /*#__PURE__*/React__default["default"].createElement(react.Tag, {
|
158
|
+
className: "".concat(blockClass, "__item--tag"),
|
159
|
+
type: item.tagType
|
160
|
+
}, item.label)));
|
161
|
+
}
|
162
|
+
}), /*#__PURE__*/React__default["default"].createElement("span", {
|
163
|
+
className: "".concat(blockClass, "__indicator"),
|
164
|
+
ref: overflowRef
|
165
|
+
}, overflowItems.length > 0 && /*#__PURE__*/React__default["default"].createElement(TagSet.TagSet, {
|
166
|
+
tags: overflowItems,
|
167
|
+
allTagsModalTitle: "All tags",
|
168
|
+
containingElementRef: overflowRef,
|
169
|
+
allTagsModalSearchLabel: "Search all tags",
|
170
|
+
allTagsModalSearchPlaceholderText: "Search all tags",
|
171
|
+
showAllTagsLabel: "Show all tags"
|
172
|
+
})));
|
173
|
+
});
|
174
|
+
|
175
|
+
// Return a placeholder if not released and not enabled by feature flag
|
176
|
+
exports.TagOverflow = settings.pkg.checkComponentEnabled(exports.TagOverflow, componentName);
|
177
|
+
|
178
|
+
// The display name of the component, used by React. Note that displayName
|
179
|
+
// is used in preference to relying on function.name.
|
180
|
+
exports.TagOverflow.displayName = componentName;
|
181
|
+
var tagTypes = Object.keys(constants.TYPES);
|
182
|
+
|
183
|
+
// The types and DocGen commentary for the component props,
|
184
|
+
// in alphabetical order (for consistency).
|
185
|
+
// See https://www.npmjs.com/package/prop-types#usage.
|
186
|
+
exports.TagOverflow.propTypes = {
|
187
|
+
/**
|
188
|
+
* Provide an optional class to be applied to the containing node.
|
189
|
+
*/
|
190
|
+
className: index["default"].string,
|
191
|
+
/**
|
192
|
+
* The items to be shown in the TagOverflow. Each item is specified as an object with properties:
|
193
|
+
* **label**\* (required) to supply the item content,
|
194
|
+
* **id**\* (required) to uniquely identify the each item.
|
195
|
+
* **tagType** the type value to be passed to the Carbon Tag component
|
196
|
+
* if you are passing an tagComponent prop for rendering custom components,
|
197
|
+
* then pass the props required for your custom component as the properties of item object
|
198
|
+
*/
|
199
|
+
items: index["default"].arrayOf(index["default"].shape({
|
200
|
+
id: index["default"].string.isRequired,
|
201
|
+
label: index["default"].string.isRequired,
|
202
|
+
tagType: index["default"].oneOf(tagTypes)
|
203
|
+
}).isRequired),
|
204
|
+
/**
|
205
|
+
* maximum visible items
|
206
|
+
*/
|
207
|
+
maxVisible: index["default"].number,
|
208
|
+
/**
|
209
|
+
* display items in multiple lines
|
210
|
+
*/
|
211
|
+
multiline: index["default"].bool,
|
212
|
+
/** Component definition of the items to be rendered inside TagOverflow.
|
213
|
+
* If this is not passed, items will be rendered as Tag component
|
214
|
+
*/
|
215
|
+
tagComponent: index["default"].elementType
|
216
|
+
};
|
@@ -0,0 +1,14 @@
|
|
1
|
+
export const TYPES: {
|
2
|
+
red: string;
|
3
|
+
magenta: string;
|
4
|
+
purple: string;
|
5
|
+
blue: string;
|
6
|
+
cyan: string;
|
7
|
+
teal: string;
|
8
|
+
green: string;
|
9
|
+
gray: string;
|
10
|
+
'cool-gray': string;
|
11
|
+
'warm-gray': string;
|
12
|
+
'high-contrast': string;
|
13
|
+
outline: string;
|
14
|
+
};
|
@@ -0,0 +1,34 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2024
|
3
|
+
*
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
6
|
+
*/
|
7
|
+
|
8
|
+
'use strict';
|
9
|
+
|
10
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
+
|
12
|
+
// Copyright IBM Corp. 2024, 2024
|
13
|
+
//
|
14
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
15
|
+
// LICENSE file in the root directory of this source tree.
|
16
|
+
//
|
17
|
+
|
18
|
+
// Copied from @carbon/react/es/components/Tag/Tag.js
|
19
|
+
var TYPES = {
|
20
|
+
red: 'Red',
|
21
|
+
magenta: 'Magenta',
|
22
|
+
purple: 'Purple',
|
23
|
+
blue: 'Blue',
|
24
|
+
cyan: 'Cyan',
|
25
|
+
teal: 'Teal',
|
26
|
+
green: 'Green',
|
27
|
+
gray: 'Gray',
|
28
|
+
'cool-gray': 'Cool-Gray',
|
29
|
+
'warm-gray': 'Warm-Gray',
|
30
|
+
'high-contrast': 'High-Contrast',
|
31
|
+
outline: 'Outline'
|
32
|
+
};
|
33
|
+
|
34
|
+
exports.TYPES = TYPES;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { TagOverflow } from "./TagOverflow";
|