@carbon/ibm-products 2.21.0 → 2.23.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +8 -4
- package/css/index-full-carbon.css +559 -357
- 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 +227 -267
- 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 +271 -295
- 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 +251 -298
- 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/Datagrid/Datagrid/DatagridContent.js +8 -3
- package/es/components/Datagrid/Datagrid/DatagridHeaderRow.js +14 -4
- package/es/components/Datagrid/Datagrid/DatagridRow.js +6 -1
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -3
- package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +2 -2
- package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +30 -72
- package/es/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.js +26 -0
- package/es/components/Datagrid/useDefaultStringRenderer.js +3 -3
- package/es/components/Datagrid/useRowIsMouseOver.js +3 -1
- package/es/components/Datagrid/useSortableColumns.js +15 -5
- package/es/components/DelimitedList/DelimitedList.docs-page.js +15 -0
- package/es/components/DelimitedList/DelimitedList.js +73 -0
- package/es/components/DelimitedList/index.js +8 -0
- package/es/components/FilterSummary/FilterSummary.js +100 -19
- package/es/components/SidePanel/SidePanel.js +145 -189
- package/es/components/TagSet/TagSet.js +31 -7
- package/es/components/TagSet/TagSetOverflow.js +13 -8
- package/es/components/index.js +2 -1
- package/es/global/js/hooks/useResizeObserver.js +5 -2
- package/es/global/js/package-settings.js +1 -0
- package/lib/components/Datagrid/Datagrid/DatagridContent.js +8 -3
- package/lib/components/Datagrid/Datagrid/DatagridHeaderRow.js +14 -4
- package/lib/components/Datagrid/Datagrid/DatagridRow.js +6 -1
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -3
- package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +2 -2
- package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +30 -72
- package/lib/components/Datagrid/Datagrid/addons/Slug/ColumnHeaderSlug.js +36 -0
- package/lib/components/Datagrid/useDefaultStringRenderer.js +3 -3
- package/lib/components/Datagrid/useRowIsMouseOver.js +3 -1
- package/lib/components/Datagrid/useSortableColumns.js +15 -5
- package/lib/components/DelimitedList/DelimitedList.docs-page.js +25 -0
- package/lib/components/DelimitedList/DelimitedList.js +78 -0
- package/lib/components/DelimitedList/index.js +12 -0
- package/lib/components/FilterSummary/FilterSummary.js +103 -23
- package/lib/components/SidePanel/SidePanel.js +145 -189
- package/lib/components/TagSet/TagSet.js +31 -7
- package/lib/components/TagSet/TagSetOverflow.js +12 -7
- package/lib/components/index.js +8 -1
- package/lib/global/js/hooks/useResizeObserver.js +5 -2
- package/lib/global/js/package-settings.js +1 -0
- package/package.json +9 -8
- package/scss/components/CreateSidePanel/_create-side-panel.scss +1 -38
- package/scss/components/Datagrid/_datagrid.scss +4 -0
- package/scss/components/Datagrid/styles/_datagrid.scss +24 -1
- package/scss/components/Datagrid/styles/_useStickyColumn.scss +2 -0
- package/scss/components/DelimitedList/_carbon-imports.scss +9 -0
- package/scss/components/DelimitedList/_delimited-list.scss +27 -0
- package/scss/components/DelimitedList/_index-with-carbon.scss +9 -0
- package/scss/components/DelimitedList/_index.scss +8 -0
- package/scss/components/EditSidePanel/_edit-side-panel.scss +0 -18
- package/scss/components/FilterSummary/_filter-summary.scss +22 -1
- package/scss/components/SidePanel/_side-panel-variables.scss +5 -1
- package/scss/components/SidePanel/_side-panel.scss +155 -187
- package/scss/components/_index-with-carbon.scss +1 -0
- package/scss/components/_index.scss +1 -0
- package/telemetry.yml +790 -0
@@ -99,47 +99,56 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
99
99
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
100
100
|
animationComplete = _useState2[0],
|
101
101
|
setAnimationComplete = _useState2[1];
|
102
|
-
var
|
103
|
-
|
104
|
-
|
105
|
-
setPanelHeight = _useState4[1];
|
106
|
-
var sidePanelRef = (0, _react.useRef)();
|
107
|
-
var sidePanelOverlayRef = (0, _react.useRef)();
|
102
|
+
var localRef = (0, _react.useRef)();
|
103
|
+
var sidePanelRef = ref || localRef;
|
104
|
+
var overlayRef = (0, _react.useRef)();
|
108
105
|
var startTrapRef = (0, _react.useRef)();
|
109
106
|
var endTrapRef = (0, _react.useRef)();
|
110
|
-
var
|
111
|
-
var
|
107
|
+
var innerContentRef = (0, _react.useRef)();
|
108
|
+
var closeRef = (0, _react.useRef)();
|
109
|
+
var animatedScrollRef = (0, _react.useRef)();
|
110
|
+
var headerRef = (0, _react.useRef)();
|
111
|
+
var titleRef = (0, _react.useRef)();
|
112
|
+
var collapsedTitleRef = (0, _react.useRef)();
|
113
|
+
var labelTextRef = (0, _react.useRef)();
|
114
|
+
var subtitleRef = (0, _react.useRef)();
|
112
115
|
var previousState = (0, _hooks.usePreviousValue)({
|
113
116
|
size: size,
|
114
117
|
open: open
|
115
118
|
});
|
119
|
+
var _useState3 = (0, _react.useState)(-1),
|
120
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
121
|
+
scrollAnimationDistance = _useState4[0],
|
122
|
+
setScrollAnimationDistance = _useState4[1];
|
123
|
+
var _useState5 = (0, _react.useState)(true),
|
124
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
125
|
+
doAnimateTitle = _useState6[0],
|
126
|
+
setDoAnimateTitle = _useState6[1];
|
127
|
+
(0, _react.useEffect)(function () {
|
128
|
+
setDoAnimateTitle(animateTitle);
|
129
|
+
}, [animateTitle]);
|
130
|
+
var handleScroll = (0, _react.useCallback)(function () {
|
131
|
+
var scrollTop = animatedScrollRef.current.scrollTop;
|
132
|
+
sidePanelRef.current.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), Math.min(scrollTop, scrollAnimationDistance) / scrollAnimationDistance);
|
133
|
+
}, [scrollAnimationDistance, sidePanelRef]);
|
116
134
|
var reducedMotion = typeof window !== 'undefined' && (_window = window) !== null && _window !== void 0 && _window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {
|
117
135
|
matches: true
|
118
136
|
};
|
119
|
-
var getActionsContainerElement = (0, _react.useCallback)(function () {
|
120
|
-
var sidePanelOuter = document.querySelector("#".concat(id));
|
121
|
-
return sidePanelOuter && sidePanelOuter.querySelector(".".concat(blockClass, "__actions-container"));
|
122
|
-
}, [id]);
|
123
137
|
|
124
138
|
// scroll panel to top going between steps
|
125
139
|
(0, _react.useEffect)(function () {
|
126
|
-
|
127
|
-
|
128
|
-
var
|
129
|
-
var scrollableSection = panelRef.current.querySelector(".".concat(blockClass, "__inner-content"));
|
130
|
-
var sidePanelOuter = document.querySelector("#".concat(id));
|
131
|
-
var initialTitleHeight = (_document$querySelect = document.querySelector(".".concat(blockClass, "__title-container"))) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.offsetHeight;
|
140
|
+
if (sidePanelRef && sidePanelRef.current) {
|
141
|
+
var _animatedScrollRef$cu;
|
142
|
+
var scrollableSection = (_animatedScrollRef$cu = animatedScrollRef.current) !== null && _animatedScrollRef$cu !== void 0 ? _animatedScrollRef$cu : innerContentRef.current;
|
132
143
|
scrollableSection.scrollTop = 0;
|
133
144
|
// The size of the panel has changed while it is still opened
|
134
|
-
// so we need to scroll it to the top and reset the
|
145
|
+
// so we need to scroll it to the top and reset the header
|
135
146
|
// height css custom property
|
136
147
|
if ((previousState === null || previousState === void 0 ? void 0 : previousState.size) !== size) {
|
137
|
-
var _sidePanelOuter$style;
|
138
148
|
scrollableSection.scrollTop = 0;
|
139
|
-
sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style = sidePanelOuter.style) === null || _sidePanelOuter$style === void 0 || _sidePanelOuter$style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(Number(initialTitleHeight), "px"));
|
140
149
|
}
|
141
150
|
}
|
142
|
-
}, [currentStep,
|
151
|
+
}, [currentStep, sidePanelRef, size, previousState === null || previousState === void 0 ? void 0 : previousState.size, id]);
|
143
152
|
|
144
153
|
// set initial focus when side panel opens
|
145
154
|
(0, _react.useEffect)(function () {
|
@@ -149,7 +158,7 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
149
158
|
if (primaryFocusElement) {
|
150
159
|
return primaryFocusElement;
|
151
160
|
} else {
|
152
|
-
return
|
161
|
+
return closeRef && closeRef.current;
|
153
162
|
}
|
154
163
|
};
|
155
164
|
var focusButton = function focusButton(focusContainerElement) {
|
@@ -157,19 +166,9 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
157
166
|
target === null || target === void 0 || target.focus();
|
158
167
|
};
|
159
168
|
if (open && animationComplete) {
|
160
|
-
focusButton(
|
169
|
+
focusButton(innerContentRef.current);
|
161
170
|
}
|
162
171
|
}, [selectorPrimaryFocus, open, animationComplete]);
|
163
|
-
(0, _react.useEffect)(function () {
|
164
|
-
if (open && actions && actions.length && animationComplete) {
|
165
|
-
var _sidePanelOuter$style2;
|
166
|
-
var sidePanelOuter = document.querySelector("#".concat(id));
|
167
|
-
var actionsContainer = getActionsContainerElement();
|
168
|
-
var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
|
169
|
-
actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
|
170
|
-
sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style2 = sidePanelOuter.style) === null || _sidePanelOuter$style2 === void 0 || _sidePanelOuter$style2.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
|
171
|
-
}
|
172
|
-
}, [actions, condensedActions, open, animationComplete, id, getActionsContainerElement]);
|
173
172
|
|
174
173
|
// Add console warning if labelText is provided without a title.
|
175
174
|
// This combination is not allowed.
|
@@ -178,120 +177,67 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
178
177
|
console.warn("".concat(componentName, ": The prop `labelText` was provided without a `title`. It is required to have a `title` when using the `labelText` prop."));
|
179
178
|
}
|
180
179
|
}, [labelText, title]);
|
180
|
+
var checkSetDoAnimateTitle = function checkSetDoAnimateTitle() {
|
181
|
+
if (sidePanelRef !== null && sidePanelRef !== void 0 && sidePanelRef.current && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
|
182
|
+
var _labelTextRef$current, _labelTextRef$current2, _subtitleRef$current$, _subtitleRef$current;
|
183
|
+
var titleEl = titleRef.current;
|
184
|
+
var labelHeight = (_labelTextRef$current = labelTextRef === null || labelTextRef === void 0 || (_labelTextRef$current2 = labelTextRef.current) === null || _labelTextRef$current2 === void 0 ? void 0 : _labelTextRef$current2.offsetHeight) !== null && _labelTextRef$current !== void 0 ? _labelTextRef$current : 0;
|
185
|
+
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;
|
181
186
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
var sidePanelOuter = document.querySelector("#".concat(id));
|
188
|
-
var actionsContainer = getActionsContainerElement();
|
189
|
-
var actionsHeight = (actionsContainer === null || actionsContainer === void 0 ? void 0 : actionsContainer.offsetHeight) + 16; // add additional 1rem spacing to bottom padding
|
190
|
-
actionsHeight = "".concat(Math.round(actionsHeight / 16), "rem");
|
191
|
-
sidePanelOuter === null || sidePanelOuter === void 0 || (_sidePanelOuter$style3 = sidePanelOuter.style) === null || _sidePanelOuter$style3 === void 0 || _sidePanelOuter$style3.setProperty("--".concat(blockClass, "--content-bottom-padding"), actionsHeight);
|
192
|
-
};
|
187
|
+
// Adjusts space at bottom of titles by changing where scrolling finishes
|
188
|
+
// Styles use border to save use of get computed style
|
189
|
+
var titleVerticalBorder = actionToolbarButtons ? titleEl.offsetHeight - titleEl.clientHeight : 0;
|
190
|
+
var _scrollAnimationDistance = labelHeight + subtitleHeight + titleVerticalBorder;
|
191
|
+
setScrollAnimationDistance(_scrollAnimationDistance);
|
193
192
|
|
194
|
-
|
193
|
+
// used to calculate the header moves
|
194
|
+
sidePanelRef.current.style.setProperty("--".concat(blockClass, "--scroll-animation-distance"), _scrollAnimationDistance);
|
195
|
+
var scrollEl = animatedScrollRef.current;
|
196
|
+
if (!scrollEl && animateTitle && !doAnimateTitle) {
|
197
|
+
// may be switching back based on resize
|
198
|
+
scrollEl = innerContentRef.current;
|
199
|
+
}
|
200
|
+
if (scrollEl) {
|
201
|
+
var _window2;
|
202
|
+
var innerComputed = (_window2 = window) === null || _window2 === void 0 ? void 0 : _window2.getComputedStyle(innerContentRef.current);
|
203
|
+
var innerPaddingHeight = innerComputed ? parseFloat(innerComputed === null || innerComputed === void 0 ? void 0 : innerComputed.paddingTop, 10) + parseFloat(innerComputed === null || innerComputed === void 0 ? void 0 : innerComputed.paddingBottom, 10) : 0;
|
204
|
+
var canDoAnimateTitle = (!!labelText || !!actionToolbarButtons || !!subtitle) && scrollEl.scrollHeight - scrollEl.clientHeight >= _scrollAnimationDistance + innerPaddingHeight;
|
205
|
+
if (doAnimateTitle !== canDoAnimateTitle) {
|
206
|
+
// will need updating on resize
|
207
|
+
setDoAnimateTitle(canDoAnimateTitle);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
}
|
211
|
+
};
|
195
212
|
(0, _react.useEffect)(function () {
|
196
|
-
if (
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
var panelOuterHeight = panelHeight;
|
206
|
-
var scrollSectionHeight = (_document$querySelect2 = document.querySelector(".".concat(blockClass, "__body-content"))) === null || _document$querySelect2 === void 0 ? void 0 : _document$querySelect2.offsetHeight;
|
207
|
-
var titleContainerHeight = (_document$querySelect3 = document.querySelector(".".concat(blockClass, "__title-container"))) === null || _document$querySelect3 === void 0 ? void 0 : _document$querySelect3.offsetHeight;
|
208
|
-
var labelTextHeight = (_document$querySelect4 = document.querySelector(".".concat(blockClass, "__label-text"))) === null || _document$querySelect4 === void 0 ? void 0 : _document$querySelect4.offsetHeight;
|
209
|
-
var totalScrollingContentHeight = titleContainerHeight + sidePanelSubtitleElementHeight + scrollSectionHeight;
|
210
|
-
// if the difference between the total scrolling height and the panel height is less than
|
211
|
-
// the subtitleElement height OR if the subtitle element height is 0, use that difference
|
212
|
-
// as the length of the scroll animation (otherwise the animation will not be able to complete
|
213
|
-
// because there is not enough scrolling distance to complete it).
|
214
|
-
sidePanelSubtitleElementHeight = totalScrollingContentHeight - panelOuterHeight < sidePanelSubtitleElementHeight ? totalScrollingContentHeight - panelOuterHeight : sidePanelSubtitleElementHeight === 0 ? 16 : sidePanelSubtitleElementHeight;
|
215
|
-
sidePanelSubtitleElementHeight = sidePanelSubtitleElementHeight < 0 ? (sidePanelScrollArea === null || sidePanelScrollArea === void 0 ? void 0 : sidePanelScrollArea.scrollHeight) - (sidePanelScrollArea === null || sidePanelScrollArea === void 0 ? void 0 : sidePanelScrollArea.clientHeight) : sidePanelSubtitleElementHeight;
|
216
|
-
/* istanbul ignore next */
|
217
|
-
sidePanelScrollArea && sidePanelScrollArea.addEventListener('scroll', function () {
|
218
|
-
var scrollTop = sidePanelScrollArea.scrollTop;
|
219
|
-
// if scrolling has occurred
|
220
|
-
if (scrollTop > 0) {
|
221
|
-
sidePanelOuter.classList.add("".concat(blockClass, "__with-condensed-header"));
|
222
|
-
// Set subtitle opacity calculation here
|
223
|
-
// as scroll progresses
|
224
|
-
var titleOpacity = Math.min(1, (sidePanelSubtitleElementHeight - scrollTop) / sidePanelSubtitleElementHeight);
|
225
|
-
titleOpacity = titleOpacity < 0 ? 0 : titleOpacity;
|
226
|
-
sidePanelOuter.style.setProperty("--".concat(blockClass, "--subtitle-opacity"), titleOpacity);
|
227
|
-
|
228
|
-
// Calculate divider opacity to avoid border
|
229
|
-
// abruptly appearing when scrolling starts.
|
230
|
-
// This approach uses a pseudo element and sets
|
231
|
-
// the opacity as scroll progresses.
|
232
|
-
var dividerOpacity = Math.min(scrollTop / sidePanelSubtitleElementHeight, 1);
|
233
|
-
sidePanelOuter.style.setProperty("--".concat(blockClass, "--divider-opacity"), "".concat(Math.min(1, dividerOpacity)));
|
234
|
-
|
235
|
-
// We need to know the height of the title element
|
236
|
-
// so that we know how far to place the action toolbar
|
237
|
-
// from the top since it is sticky
|
238
|
-
var titleTextHeight = Math.max(sidePanelTitleElement.offsetHeight);
|
239
|
-
sidePanelOuter.style.setProperty("--".concat(blockClass, "--title-height"), "".concat(titleTextHeight + 16, "px"));
|
240
|
-
|
241
|
-
// Set title y positioning
|
242
|
-
var titleYPosition = Math.min(scrollTop / sidePanelSubtitleElementHeight, 1);
|
243
|
-
sidePanelOuter.style.setProperty("--".concat(blockClass, "--title-y-position"), "".concat(-Math.abs(titleYPosition), "rem"));
|
244
|
-
|
245
|
-
// mark title with aria-hidden={true} if opacity reaches 0
|
246
|
-
if (titleOpacity === 0) {
|
247
|
-
sidePanelTitleElement.setAttribute('aria-hidden', 'true');
|
248
|
-
sidePanelCollapsedTitleElement.setAttribute('aria-hidden', 'false');
|
249
|
-
}
|
213
|
+
if (doAnimateTitle && animatedScrollRef.current) {
|
214
|
+
// only add scroll if the doAnimateTitle is already true
|
215
|
+
// should come back through if false and canDoAnimateTitle is true
|
216
|
+
animatedScrollRef.current.addEventListener('scroll', handleScroll);
|
217
|
+
}
|
218
|
+
if (!doAnimateTitle && sidePanelRef.current) {
|
219
|
+
sidePanelRef.current.style.setProperty("--".concat(blockClass, "--scroll-animation-progress"), 0);
|
220
|
+
}
|
221
|
+
}, [animatedScrollRef, doAnimateTitle, handleScroll, sidePanelRef]);
|
250
222
|
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
223
|
+
/* istanbul ignore next */
|
224
|
+
var handleResize = function handleResize() {
|
225
|
+
checkSetDoAnimateTitle();
|
226
|
+
};
|
255
227
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
sidePanelOuter.style.setProperty("--".concat(blockClass, "--title-container-height"), "".concat(titleContainerHeight, "px"));
|
261
|
-
} else {
|
262
|
-
sidePanelTitleElement.setAttribute('aria-hidden', 'false');
|
263
|
-
sidePanelCollapsedTitleElement.setAttribute('aria-hidden', 'true');
|
264
|
-
sidePanelOuter.classList.remove("".concat(blockClass, "__with-condensed-header"));
|
265
|
-
sidePanelOuter.style.setProperty("--".concat(blockClass, "--subtitle-opacity"), 1);
|
266
|
-
sidePanelOuter.style.setProperty("--".concat(blockClass, "--title-y-position"), 0);
|
267
|
-
sidePanelOuter.style.setProperty("--".concat(blockClass, "--divider-opacity"), 0);
|
268
|
-
sidePanelOuter.style.setProperty("--".concat(blockClass, "--collapsed-title-y-position"), "1rem");
|
269
|
-
sidePanelOuter.style.setProperty("--".concat(blockClass, "--label-text-height"), "0px");
|
270
|
-
}
|
271
|
-
});
|
272
|
-
}
|
273
|
-
if (open && !animateTitle) {
|
274
|
-
var _sidePanelOuter = document.querySelector("#".concat(id));
|
275
|
-
var _sidePanelTitleElement = document.querySelector(".".concat(blockClass, "__title-container .").concat(blockClass, "__title-text"));
|
276
|
-
var _sidePanelSubtitleElement = document.querySelector(".".concat(blockClass, "__subtitle-text"));
|
277
|
-
var actionToolbarElement = document.querySelector(".".concat(blockClass, "__action-toolbar"));
|
278
|
-
var _labelText = document.querySelector(".".concat(blockClass, "__label-text"));
|
279
|
-
var _sidePanelSubtitleElementHeight = (_sidePanelSubtitleElement === null || _sidePanelSubtitleElement === void 0 ? void 0 : _sidePanelSubtitleElement.offsetHeight) || 0;
|
280
|
-
var sidePanelActionBarElementHeight = (actionToolbarElement === null || actionToolbarElement === void 0 ? void 0 : actionToolbarElement.offsetHeight) || 0;
|
281
|
-
var titleHeight = (_sidePanelTitleElement === null || _sidePanelTitleElement === void 0 ? void 0 : _sidePanelTitleElement.offsetHeight) + 24;
|
282
|
-
var labelHeight = (_labelText === null || _labelText === void 0 ? void 0 : _labelText.offsetHeight) || 0;
|
283
|
-
_sidePanelOuter === null || _sidePanelOuter === void 0 || _sidePanelOuter.style.setProperty("--".concat(blockClass, "--title-text-height"), "".concat(titleHeight, "px"));
|
284
|
-
_sidePanelOuter === null || _sidePanelOuter === void 0 || _sidePanelOuter.style.setProperty("--".concat(blockClass, "--subtitle-container-height"), "".concat(_sidePanelSubtitleElementHeight, "px"));
|
285
|
-
_sidePanelOuter === null || _sidePanelOuter === void 0 || _sidePanelOuter.style.setProperty("--".concat(blockClass, "--action-bar-container-height"), "".concat(sidePanelActionBarElementHeight, "px"));
|
286
|
-
_sidePanelOuter === null || _sidePanelOuter === void 0 || _sidePanelOuter.style.setProperty("--".concat(blockClass, "--label-text-height"), "".concat(labelHeight, "px"));
|
228
|
+
// Calculate scroll distances
|
229
|
+
(0, _react.useEffect)(function () {
|
230
|
+
if (sidePanelRef !== null && sidePanelRef !== void 0 && sidePanelRef.current && open && animateTitle && animationComplete && titleRef !== null && titleRef !== void 0 && titleRef.current && title && title.length && !reducedMotion.matches) {
|
231
|
+
checkSetDoAnimateTitle();
|
287
232
|
}
|
288
|
-
|
233
|
+
|
234
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
235
|
+
}, [open, doAnimateTitle /* use do instead of animateTitle directly */, animationComplete, handleScroll, title, size, reducedMotion.matches, id, animatedScrollRef.current]);
|
289
236
|
|
290
237
|
// click outside functionality if `includeOverlay` prop is set
|
291
238
|
(0, _react.useEffect)(function () {
|
292
239
|
var handleOutsideClick = function handleOutsideClick(event) {
|
293
|
-
|
294
|
-
if (panelRef.current && sidePanelOverlayRef.current && sidePanelOverlayRef.current.contains(event.target) && onRequestClose) {
|
240
|
+
if (sidePanelRef.current && overlayRef.current && overlayRef.current.contains(event.target) && onRequestClose) {
|
295
241
|
onRequestClose();
|
296
242
|
}
|
297
243
|
};
|
@@ -309,7 +255,7 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
309
255
|
bodyElement.style.overflow = '';
|
310
256
|
document.removeEventListener('click', handleOutsideClick);
|
311
257
|
};
|
312
|
-
}, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside,
|
258
|
+
}, [includeOverlay, onRequestClose, open, preventCloseOnClickOutside, onUnmount, sidePanelRef]);
|
313
259
|
|
314
260
|
// initializes the side panel to close
|
315
261
|
var onAnimationEnd = function onAnimationEnd() {
|
@@ -372,13 +318,13 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
372
318
|
|
373
319
|
// adds focus trap functionality
|
374
320
|
/* istanbul ignore next */
|
375
|
-
var handleBlur = function handleBlur(
|
376
|
-
var oldActiveNode =
|
377
|
-
currentActiveNode =
|
321
|
+
var handleBlur = function handleBlur(_ref2) {
|
322
|
+
var oldActiveNode = _ref2.target,
|
323
|
+
currentActiveNode = _ref2.relatedTarget;
|
378
324
|
// focus trap should only be set if the side panel is a `slideOver` type
|
379
|
-
if (open &&
|
325
|
+
if (open && innerContentRef && !slideIn) {
|
380
326
|
(0, _wrapFocus.default)({
|
381
|
-
bodyNode:
|
327
|
+
bodyNode: innerContentRef.current,
|
382
328
|
startTrapRef: startTrapRef,
|
383
329
|
endTrapRef: endTrapRef,
|
384
330
|
currentActiveNode: currentActiveNode,
|
@@ -386,8 +332,23 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
386
332
|
});
|
387
333
|
}
|
388
334
|
};
|
389
|
-
var primaryActionContainerClassNames = (0, _classnames.default)(["".concat(blockClass, "__actions-container"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__actions-container
|
390
|
-
var mainPanelClassNames = (0, _classnames.default)([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)(
|
335
|
+
var primaryActionContainerClassNames = (0, _classnames.default)(["".concat(blockClass, "__actions-container"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__actions-container--condensed"), condensedActions)]);
|
336
|
+
var mainPanelClassNames = (0, _classnames.default)([blockClass, className, "".concat(blockClass, "__container"), "".concat(blockClass, "__container--").concat(size), (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(blockClass, "__container-right-placement"), placement === 'right'), "".concat(blockClass, "__container-left-placement"), placement === 'left'), "".concat(blockClass, "__container--slide-in"), slideIn), "".concat(blockClass, "__container--has-slug"), slug), "".concat(blockClass, "__container--condensed-actions"), condensedActions)]);
|
337
|
+
var renderTitle = function renderTitle() {
|
338
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
339
|
+
className: (0, _classnames.default)("".concat(blockClass, "__title"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__title--no-label"), !labelTextRef.current)),
|
340
|
+
ref: titleRef
|
341
|
+
}, /*#__PURE__*/_react.default.createElement("h2", {
|
342
|
+
className: "".concat(blockClass, "__title-text"),
|
343
|
+
title: title,
|
344
|
+
"aria-hidden": false
|
345
|
+
}, title), doAnimateTitle && !reducedMotion.matches && /*#__PURE__*/_react.default.createElement("h2", {
|
346
|
+
className: "".concat(blockClass, "__collapsed-title-text"),
|
347
|
+
title: title,
|
348
|
+
"aria-hidden": true,
|
349
|
+
ref: collapsedTitleRef
|
350
|
+
}, title));
|
351
|
+
};
|
391
352
|
var renderHeader = function renderHeader() {
|
392
353
|
var _slug$type;
|
393
354
|
var slugCloseSize = actions && actions.length && /l/.test(size) ? 'md' : 'sm';
|
@@ -398,8 +359,9 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
398
359
|
size: slugCloseSize
|
399
360
|
});
|
400
361
|
}
|
401
|
-
return /*#__PURE__*/_react.default.createElement(
|
402
|
-
className: (0, _classnames.default)("".concat(blockClass, "
|
362
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
363
|
+
className: (0, _classnames.default)("".concat(blockClass, "__header"), (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(blockClass, "--on-detail-step"), currentStep > 0), "".concat(blockClass, "__header--no-title-animation"), !doAnimateTitle), "".concat(blockClass, "__header--reduced-motion"), reducedMotion.matches)),
|
364
|
+
ref: headerRef
|
403
365
|
}, currentStep > 0 && /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
404
366
|
"aria-label": navigationBackIconDescription,
|
405
367
|
kind: "ghost",
|
@@ -414,8 +376,9 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
414
376
|
className: "".concat(blockClass, "__navigation-back-button"),
|
415
377
|
onClick: onNavigationBack
|
416
378
|
}), title && title.length && labelText && labelText.length && /*#__PURE__*/_react.default.createElement("p", {
|
417
|
-
className: "".concat(blockClass, "__label-text")
|
418
|
-
|
379
|
+
className: "".concat(blockClass, "__label-text"),
|
380
|
+
ref: labelTextRef
|
381
|
+
}, labelText), title && title.length && renderTitle(), /*#__PURE__*/_react.default.createElement("div", {
|
419
382
|
className: "".concat(blockClass, "__slug-and-close")
|
420
383
|
}, normalizedSlug, /*#__PURE__*/_react.default.createElement(_react2.Button, {
|
421
384
|
"aria-label": closeIconDescription,
|
@@ -429,22 +392,23 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
429
392
|
iconDescription: closeIconDescription,
|
430
393
|
className: "".concat(blockClass, "__close-button"),
|
431
394
|
onClick: onRequestClose,
|
432
|
-
ref:
|
395
|
+
ref: closeRef
|
433
396
|
})), subtitle && /*#__PURE__*/_react.default.createElement("p", {
|
434
|
-
className: (0, _classnames.default)("".concat(blockClass, "__subtitle-text"), (0, _defineProperty2.default)(
|
397
|
+
className: (0, _classnames.default)("".concat(blockClass, "__subtitle-text"), (0, _defineProperty2.default)({}, "".concat(blockClass, "__subtitle-text-no-animation-no-action-toolbar"), !doAnimateTitle && (!actionToolbarButtons || !actionToolbarButtons.length))),
|
398
|
+
ref: subtitleRef
|
435
399
|
}, subtitle), actionToolbarButtons && actionToolbarButtons.length && /*#__PURE__*/_react.default.createElement("div", {
|
436
|
-
className:
|
437
|
-
}, actionToolbarButtons.map(function (
|
438
|
-
var label =
|
439
|
-
kind =
|
440
|
-
icon =
|
441
|
-
tooltipPosition =
|
442
|
-
tooltipAlignment =
|
443
|
-
leading =
|
444
|
-
disabled =
|
445
|
-
className =
|
446
|
-
onClick =
|
447
|
-
rest = (0, _objectWithoutProperties2.default)(
|
400
|
+
className: "".concat(blockClass, "__action-toolbar")
|
401
|
+
}, actionToolbarButtons.map(function (_ref5) {
|
402
|
+
var label = _ref5.label,
|
403
|
+
kind = _ref5.kind,
|
404
|
+
icon = _ref5.icon,
|
405
|
+
tooltipPosition = _ref5.tooltipPosition,
|
406
|
+
tooltipAlignment = _ref5.tooltipAlignment,
|
407
|
+
leading = _ref5.leading,
|
408
|
+
disabled = _ref5.disabled,
|
409
|
+
className = _ref5.className,
|
410
|
+
onClick = _ref5.onClick,
|
411
|
+
rest = (0, _objectWithoutProperties2.default)(_ref5, _excluded2);
|
448
412
|
return /*#__PURE__*/_react.default.createElement(_react2.Button, (0, _extends2.default)({}, rest, {
|
449
413
|
key: label,
|
450
414
|
kind: kind || 'ghost',
|
@@ -460,24 +424,18 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
460
424
|
}), leading && label);
|
461
425
|
})));
|
462
426
|
};
|
463
|
-
var
|
464
|
-
return /*#__PURE__*/_react.default.createElement(
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
}, title), animateTitle && title && title.length && !reducedMotion.matches && /*#__PURE__*/_react.default.createElement("h2", {
|
469
|
-
className: "".concat(blockClass, "__collapsed-title-text"),
|
470
|
-
title: title,
|
471
|
-
"aria-hidden": true
|
472
|
-
}, title));
|
427
|
+
var renderMain = function renderMain() {
|
428
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
429
|
+
ref: innerContentRef,
|
430
|
+
className: (0, _classnames.default)("".concat(blockClass, "__inner-content"), (0, _defineProperty2.default)((0, _defineProperty2.default)({}, "".concat(blockClass, "__inner-content--static"), !doAnimateTitle), "".concat(blockClass, "--scrolls"), !doAnimateTitle))
|
431
|
+
}, children);
|
473
432
|
};
|
474
|
-
|
475
|
-
(0, _useResizeObserver.useResizeObserver)(contentRef, handleResize);
|
433
|
+
(0, _useResizeObserver.useResizeObserver)(sidePanelRef, handleResize, [open]);
|
476
434
|
return /*#__PURE__*/_react.default.createElement(_framerMotion.AnimatePresence, null, open && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_framerMotion.motion.div, (0, _extends2.default)({}, (0, _devtools.getDevtoolsProps)(componentName), rest, {
|
477
435
|
id: id,
|
478
436
|
className: mainPanelClassNames,
|
479
437
|
onBlur: handleBlur,
|
480
|
-
ref:
|
438
|
+
ref: sidePanelRef,
|
481
439
|
role: "complementary",
|
482
440
|
"aria-label": title,
|
483
441
|
onAnimationComplete: onAnimationEnd,
|
@@ -494,16 +452,14 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
494
452
|
tabIndex: "0",
|
495
453
|
role: "link",
|
496
454
|
className: "".concat(blockClass, "__visually-hidden")
|
497
|
-
}, "Focus sentinel"),
|
498
|
-
ref:
|
499
|
-
className:
|
500
|
-
},
|
501
|
-
className: "".concat(blockClass, "__body-content")
|
502
|
-
}, children), /*#__PURE__*/_react.default.createElement(_ActionSet.ActionSet, {
|
455
|
+
}, "Focus sentinel"), doAnimateTitle ? /*#__PURE__*/_react.default.createElement("div", {
|
456
|
+
ref: animatedScrollRef,
|
457
|
+
className: "".concat(blockClass, "__animated-scroll-wrapper ").concat(blockClass, "--scrolls")
|
458
|
+
}, renderHeader(), renderMain()) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderHeader(), renderMain()), /*#__PURE__*/_react.default.createElement(_ActionSet.ActionSet, {
|
503
459
|
actions: actions,
|
504
460
|
className: primaryActionContainerClassNames,
|
505
461
|
size: size === 'xs' ? 'sm' : size
|
506
|
-
})
|
462
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
507
463
|
ref: endTrapRef,
|
508
464
|
tabIndex: "0",
|
509
465
|
role: "link",
|
@@ -513,7 +469,7 @@ var SidePanel = exports.SidePanel = /*#__PURE__*/_react.default.forwardRef(funct
|
|
513
469
|
initial: "hidden",
|
514
470
|
animate: "visible",
|
515
471
|
exit: "exit",
|
516
|
-
ref:
|
472
|
+
ref: overlayRef,
|
517
473
|
className: "".concat(blockClass, "__overlay")
|
518
474
|
}))));
|
519
475
|
});
|
@@ -628,8 +584,8 @@ SidePanel.propTypes = {
|
|
628
584
|
* This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
|
629
585
|
* This prop is required when using the `slideIn` variant of the side panel.
|
630
586
|
*/
|
631
|
-
selectorPageContent: _propTypes.default.string.isRequired.if(function (
|
632
|
-
var slideIn =
|
587
|
+
selectorPageContent: _propTypes.default.string.isRequired.if(function (_ref7) {
|
588
|
+
var slideIn = _ref7.slideIn;
|
633
589
|
return slideIn;
|
634
590
|
}),
|
635
591
|
/**
|
@@ -656,8 +612,8 @@ SidePanel.propTypes = {
|
|
656
612
|
/**
|
657
613
|
* Sets the title text
|
658
614
|
*/
|
659
|
-
title: _propTypes.default.string.isRequired.if(function (
|
660
|
-
var labelText =
|
615
|
+
title: _propTypes.default.string.isRequired.if(function (_ref8) {
|
616
|
+
var labelText = _ref8.labelText;
|
661
617
|
return labelText;
|
662
618
|
})
|
663
619
|
};
|
@@ -20,10 +20,10 @@ var _useResizeObserver = require("../../global/js/hooks/useResizeObserver");
|
|
20
20
|
var _devtools = require("../../global/js/utils/devtools");
|
21
21
|
var _propsHelper = require("../../global/js/utils/props-helper");
|
22
22
|
var _settings = require("../../settings");
|
23
|
-
var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowType", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags", "containingElementRef", "measurementOffset"],
|
23
|
+
var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowType", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags", "containingElementRef", "measurementOffset", "onOverflowTagChange"],
|
24
24
|
_excluded2 = ["label", "id"],
|
25
|
-
_excluded3 = ["label"]; //
|
26
|
-
// Copyright IBM Corp. 2020,
|
25
|
+
_excluded3 = ["label", "onClose"]; //
|
26
|
+
// Copyright IBM Corp. 2020, 2024
|
27
27
|
//
|
28
28
|
// This source code is licensed under the Apache-2.0 license found in the
|
29
29
|
// LICENSE file in the root directory of this source tree.
|
@@ -41,7 +41,8 @@ var defaults = {
|
|
41
41
|
align: 'start',
|
42
42
|
measurementOffset: 0,
|
43
43
|
overflowAlign: 'bottom',
|
44
|
-
overflowType: 'default'
|
44
|
+
overflowType: 'default',
|
45
|
+
onOverflowTagChange: function onOverflowTagChange() {}
|
45
46
|
};
|
46
47
|
var TagSet = exports.TagSet = /*#__PURE__*/_react.default.forwardRef(function (_ref, ref) {
|
47
48
|
var _ref$align = _ref.align,
|
@@ -63,6 +64,8 @@ var TagSet = exports.TagSet = /*#__PURE__*/_react.default.forwardRef(function (_
|
|
63
64
|
containingElementRef = _ref.containingElementRef,
|
64
65
|
_ref$measurementOffse = _ref.measurementOffset,
|
65
66
|
measurementOffset = _ref$measurementOffse === void 0 ? defaults.measurementOffset : _ref$measurementOffse,
|
67
|
+
_ref$onOverflowTagCha = _ref.onOverflowTagChange,
|
68
|
+
onOverflowTagChange = _ref$onOverflowTagCha === void 0 ? defaults.onOverflowTagChange : _ref$onOverflowTagCha,
|
66
69
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
67
70
|
var _useState = (0, _react.useState)(3),
|
68
71
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
@@ -89,6 +92,10 @@ var TagSet = exports.TagSet = /*#__PURE__*/_react.default.forwardRef(function (_
|
|
89
92
|
sizingTags = _useState10[0],
|
90
93
|
setSizingTags = _useState10[1];
|
91
94
|
var overflowTag = (0, _react.useRef)(null);
|
95
|
+
var _useState11 = (0, _react.useState)(false),
|
96
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
97
|
+
popoverOpen = _useState12[0],
|
98
|
+
setPopoverOpen = _useState12[1];
|
92
99
|
var handleShowAllClick = function handleShowAllClick() {
|
93
100
|
setShowAllModalOpen(true);
|
94
101
|
};
|
@@ -112,13 +119,23 @@ var TagSet = exports.TagSet = /*#__PURE__*/_react.default.forwardRef(function (_
|
|
112
119
|
}) : []);
|
113
120
|
setSizingTags(newSizingTags);
|
114
121
|
}, [tags]);
|
122
|
+
var handleTagOnClose = (0, _react.useCallback)(function (onClose, index) {
|
123
|
+
onClose === null || onClose === void 0 || onClose();
|
124
|
+
if (index <= displayCount - 1) {
|
125
|
+
setPopoverOpen(false);
|
126
|
+
}
|
127
|
+
}, [displayCount]);
|
115
128
|
(0, _react.useEffect)(function () {
|
116
129
|
// create visible and overflow tags
|
117
130
|
var newDisplayedTags = tags && tags.length > 0 ? tags.map(function (_ref3, index) {
|
118
131
|
var label = _ref3.label,
|
132
|
+
_onClose = _ref3.onClose,
|
119
133
|
other = (0, _objectWithoutProperties2.default)(_ref3, _excluded3);
|
120
134
|
return /*#__PURE__*/_react.default.createElement(_react2.Tag, (0, _extends2.default)({}, other, {
|
121
|
-
key: "displayed-tag-".concat(index)
|
135
|
+
key: "displayed-tag-".concat(index),
|
136
|
+
onClose: function onClose() {
|
137
|
+
return handleTagOnClose(_onClose, index);
|
138
|
+
}
|
122
139
|
}), label);
|
123
140
|
}) : [];
|
124
141
|
|
@@ -141,10 +158,13 @@ var TagSet = exports.TagSet = /*#__PURE__*/_react.default.forwardRef(function (_
|
|
141
158
|
overflowType: overflowType,
|
142
159
|
showAllTagsLabel: showAllTagsLabel,
|
143
160
|
key: "displayed-tag-overflow",
|
144
|
-
ref: overflowTag
|
161
|
+
ref: overflowTag,
|
162
|
+
popoverOpen: popoverOpen,
|
163
|
+
setPopoverOpen: setPopoverOpen
|
145
164
|
}));
|
165
|
+
onOverflowTagChange === null || onOverflowTagChange === void 0 || onOverflowTagChange(newOverflowTags);
|
146
166
|
setDisplayedTags(newDisplayedTags);
|
147
|
-
}, [displayCount, overflowAlign, overflowClassName, overflowType, showAllTagsLabel, tags]);
|
167
|
+
}, [displayCount, overflowAlign, overflowClassName, overflowType, showAllTagsLabel, tags, onOverflowTagChange, popoverOpen, handleTagOnClose]);
|
148
168
|
var checkFullyVisibleTags = (0, _react.useCallback)(function () {
|
149
169
|
if (multiline) {
|
150
170
|
return setDisplayCount(maxVisible);
|
@@ -298,6 +318,10 @@ TagSet.propTypes = {
|
|
298
318
|
* display tags in multiple lines
|
299
319
|
*/
|
300
320
|
multiline: _propTypes.default.bool,
|
321
|
+
/**
|
322
|
+
* Handler to get overflow tags
|
323
|
+
*/
|
324
|
+
onOverflowTagChange: _propTypes.default.func,
|
301
325
|
/**
|
302
326
|
* overflowAlign from the standard tooltip. Default center.
|
303
327
|
*/
|
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
exports.TagSetOverflow = void 0;
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
11
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
12
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
13
12
|
var _react = _interopRequireWildcard(require("react"));
|
14
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
@@ -16,8 +15,8 @@ var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
15
|
var _react2 = require("@carbon/react");
|
17
16
|
var _hooks = require("../../global/js/hooks");
|
18
17
|
var _settings = require("../../settings");
|
19
|
-
var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowTags", "overflowType", "showAllTagsLabel"]; //
|
20
|
-
// Copyright IBM Corp. 2021,
|
18
|
+
var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"]; //
|
19
|
+
// Copyright IBM Corp. 2021, 2024
|
21
20
|
//
|
22
21
|
// This source code is licensed under the Apache-2.0 license found in the
|
23
22
|
// LICENSE file in the root directory of this source tree.
|
@@ -42,11 +41,9 @@ var TagSetOverflow = exports.TagSetOverflow = /*#__PURE__*/_react.default.forwar
|
|
42
41
|
overflowTags = _ref.overflowTags,
|
43
42
|
overflowType = _ref.overflowType,
|
44
43
|
showAllTagsLabel = _ref.showAllTagsLabel,
|
44
|
+
popoverOpen = _ref.popoverOpen,
|
45
|
+
setPopoverOpen = _ref.setPopoverOpen,
|
45
46
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
46
|
-
var _useState = (0, _react.useState)(false),
|
47
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
48
|
-
popoverOpen = _useState2[0],
|
49
|
-
setPopoverOpen = _useState2[1];
|
50
47
|
var localRef = (0, _react.useRef)();
|
51
48
|
var overflowTagContent = (0, _react.useRef)(null);
|
52
49
|
(0, _hooks.useClickOutside)(ref || localRef, function () {
|
@@ -134,6 +131,14 @@ TagSetOverflow.propTypes = {
|
|
134
131
|
* Type of rendering displayed inside of the tag overflow component
|
135
132
|
*/
|
136
133
|
overflowType: _propTypes.default.oneOf(['default', 'tag']),
|
134
|
+
/**
|
135
|
+
* Open state of the popover
|
136
|
+
*/
|
137
|
+
popoverOpen: _propTypes.default.bool,
|
138
|
+
/**
|
139
|
+
* Setter function for the popoverOpen state value
|
140
|
+
*/
|
141
|
+
setPopoverOpen: _propTypes.default.func,
|
137
142
|
/**
|
138
143
|
* label for the overflow show all tags link
|
139
144
|
*/
|