@carbon/ibm-products 2.58.0-rc.0 → 2.59.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/index-full-carbon.css +18 -14
- 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 +17 -4
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +18 -14
- 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 +18 -14
- 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/ConditionBuilder/ConditionBuilder.types.d.ts +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +1 -1
- package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -1
- package/es/components/InterstitialScreen/InterstitialScreen.js +10 -7
- package/es/components/NotificationsPanel/NotificationsPanel.js +12 -3
- package/es/components/PageHeader/PageHeader.js +11 -1
- package/es/components/ScrollGradient/ScrollGradient.js +34 -27
- package/es/components/StringFormatter/StringFormatter.js +9 -6
- package/es/components/TagOverflow/TagOverflow.d.ts +10 -1
- package/es/components/TagOverflow/TagOverflow.js +54 -146
- package/es/components/Tearsheet/Tearsheet.d.ts +6 -14
- package/es/components/Tearsheet/Tearsheet.js +2 -18
- package/es/components/Tearsheet/TearsheetNarrow.d.ts +6 -4
- package/es/components/Tearsheet/TearsheetNarrow.js +2 -10
- package/es/components/Tearsheet/TearsheetShell.d.ts +8 -8
- package/es/components/Tearsheet/TearsheetShell.js +40 -27
- package/es/components/TruncatedList/TruncatedList.js +7 -4
- package/es/components/WebTerminal/WebTerminal.js +15 -5
- package/es/global/js/hooks/useOverflowItems.d.ts +16 -0
- package/es/global/js/hooks/useOverflowItems.js +88 -0
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +1 -1
- package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -1
- package/lib/components/InterstitialScreen/InterstitialScreen.js +9 -6
- package/lib/components/NotificationsPanel/NotificationsPanel.js +12 -3
- package/lib/components/PageHeader/PageHeader.js +11 -1
- package/lib/components/ScrollGradient/ScrollGradient.js +32 -25
- package/lib/components/StringFormatter/StringFormatter.js +8 -5
- package/lib/components/TagOverflow/TagOverflow.d.ts +10 -1
- package/lib/components/TagOverflow/TagOverflow.js +52 -144
- package/lib/components/Tearsheet/Tearsheet.d.ts +6 -14
- package/lib/components/Tearsheet/Tearsheet.js +1 -17
- package/lib/components/Tearsheet/TearsheetNarrow.d.ts +6 -4
- package/lib/components/Tearsheet/TearsheetNarrow.js +1 -9
- package/lib/components/Tearsheet/TearsheetShell.d.ts +8 -8
- package/lib/components/Tearsheet/TearsheetShell.js +37 -24
- package/lib/components/TruncatedList/TruncatedList.js +7 -4
- package/lib/components/WebTerminal/WebTerminal.js +14 -4
- package/lib/global/js/hooks/useOverflowItems.d.ts +16 -0
- package/lib/global/js/hooks/useOverflowItems.js +90 -0
- package/package.json +5 -5
- package/scss/components/ConditionBuilder/_condition-builder.scss +0 -6
- package/scss/components/TagOverflow/_tag-overflow.scss +1 -6
- package/scss/components/Tearsheet/_tearsheet.scss +21 -6
@@ -16,12 +16,14 @@ var settings = require('../../settings.js');
|
|
16
16
|
var pconsole = require('../../global/js/utils/pconsole.js');
|
17
17
|
var getNodeTextContent = require('../../global/js/utils/getNodeTextContent.js');
|
18
18
|
var propsHelper = require('../../global/js/utils/props-helper.js');
|
19
|
+
var checkForOverflow = require('../../global/js/utils/checkForOverflow.js');
|
19
20
|
var react = require('@carbon/react');
|
20
21
|
var ActionSet = require('../ActionSet/ActionSet.js');
|
21
22
|
var Wrap = require('../../global/js/utils/Wrap.js');
|
22
23
|
var usePortalTarget = require('../../global/js/hooks/usePortalTarget.js');
|
23
24
|
var useFocus = require('../../global/js/hooks/useFocus.js');
|
24
25
|
var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
|
26
|
+
var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
|
25
27
|
|
26
28
|
var _excluded = ["actions", "decorator", "ariaLabel", "children", "className", "closeIconDescription", "currentStep", "description", "hasCloseIcon", "hasError", "headerActions", "influencer", "influencerPosition", "influencerWidth", "label", "navigation", "onClose", "open", "portalTarget", "selectorPrimaryFocus", "selectorsFloatingMenus", "size", "slug", "title", "verticalPosition", "launcherButtonRef"];
|
27
29
|
// The block part of our conventional BEM class names (bc__E--M).
|
@@ -69,7 +71,8 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
69
71
|
ariaLabel = _ref.ariaLabel,
|
70
72
|
children = _ref.children,
|
71
73
|
className = _ref.className,
|
72
|
-
|
74
|
+
_ref$closeIconDescrip = _ref.closeIconDescription,
|
75
|
+
closeIconDescription = _ref$closeIconDescrip === void 0 ? 'Close' : _ref$closeIconDescrip,
|
73
76
|
currentStep = _ref.currentStep,
|
74
77
|
description = _ref.description,
|
75
78
|
hasCloseIcon = _ref.hasCloseIcon,
|
@@ -106,12 +109,12 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
106
109
|
firstElement = _useFocus.firstElement,
|
107
110
|
keyDownListener = _useFocus.keyDownListener;
|
108
111
|
var modalRefValue = modalRef.current;
|
109
|
-
|
110
|
-
|
111
|
-
var
|
112
|
-
|
113
|
-
|
114
|
-
|
112
|
+
var descriptionRef = React.useRef(null);
|
113
|
+
var isOverflowing = checkForOverflow.checkHeightOverflow(descriptionRef.current);
|
114
|
+
var descriptionContent = /*#__PURE__*/React.createElement("span", {
|
115
|
+
ref: descriptionRef,
|
116
|
+
className: "".concat(bc, "__description-text")
|
117
|
+
}, description);
|
115
118
|
var wide = size === 'wide';
|
116
119
|
|
117
120
|
// Keep track of the stack depth and our position in it (1-based, 0=closed)
|
@@ -191,6 +194,25 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
191
194
|
}
|
192
195
|
};
|
193
196
|
}, [open, size]);
|
197
|
+
var areAllSameSizeVariant = function areAllSameSizeVariant() {
|
198
|
+
return new Set(stack.sizes).size === 1;
|
199
|
+
};
|
200
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
201
|
+
var setScaleValues = function setScaleValues() {
|
202
|
+
if (!areAllSameSizeVariant()) {
|
203
|
+
return _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), 1), "--".concat(bc, "--stacking-scale-factor-double"), 1);
|
204
|
+
}
|
205
|
+
return _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), (width - 32) / width), "--".concat(bc, "--stacking-scale-factor-double"), (width - 64) / width);
|
206
|
+
};
|
207
|
+
if (modalRef.current) {
|
208
|
+
Object.entries(setScaleValues()).map(function (_ref4) {
|
209
|
+
var _ref5 = _rollupPluginBabelHelpers.slicedToArray(_ref4, 2),
|
210
|
+
key = _ref5[0],
|
211
|
+
value = _ref5[1];
|
212
|
+
modalRef.current.style.setProperty(key, String(value));
|
213
|
+
});
|
214
|
+
}
|
215
|
+
}, [modalRef, width]);
|
194
216
|
if (position <= depth) {
|
195
217
|
var _prevDepth$current, _decorator$type, _decorator$type2;
|
196
218
|
// Include a modal header if and only if one or more of these is given.
|
@@ -200,15 +222,9 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
200
222
|
|
201
223
|
// Include an ActionSet if and only if one or more actions is given.
|
202
224
|
var includeActions = actions && (actions === null || actions === void 0 ? void 0 : actions.length) > 0;
|
203
|
-
var
|
225
|
+
var _areAllSameSizeVariant = function _areAllSameSizeVariant() {
|
204
226
|
return new Set(stack.sizes).size === 1;
|
205
227
|
};
|
206
|
-
var setScaleValues = function setScaleValues() {
|
207
|
-
if (!areAllSameSizeVariant()) {
|
208
|
-
return _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), 1), "--".concat(bc, "--stacking-scale-factor-double"), 1);
|
209
|
-
}
|
210
|
-
return _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "--".concat(bc, "--stacking-scale-factor-single"), (width - 32) / width), "--".concat(bc, "--stacking-scale-factor-double"), (width - 64) / width);
|
211
|
-
};
|
212
228
|
return renderPortalUse( /*#__PURE__*/React.createElement(react.unstable_FeatureFlags, {
|
213
229
|
enableExperimentalFocusWrapWithoutSentinels: true
|
214
230
|
}, /*#__PURE__*/React.createElement(react.ComposedModal, _rollupPluginBabelHelpers.extends({}, rest, {
|
@@ -217,8 +233,7 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
217
233
|
// Don't apply this on the initial open of a single tearsheet.
|
218
234
|
depth > 1 || depth === 1 && ((_prevDepth$current = prevDepth === null || prevDepth === void 0 ? void 0 : prevDepth.current) !== null && _prevDepth$current !== void 0 ? _prevDepth$current : 0) > 1), "".concat(bc, "--wide"), wide), "".concat(bc, "--narrow"), !wide), "".concat(bc, "--has-slug"), deprecated_slug), "".concat(bc, "--has-ai-label"), !!decorator && ((_decorator$type = decorator['type']) === null || _decorator$type === void 0 ? void 0 : _decorator$type.displayName) === 'AILabel'), "".concat(bc, "--has-decorator"), !!decorator && ((_decorator$type2 = decorator['type']) === null || _decorator$type2 === void 0 ? void 0 : _decorator$type2.displayName) !== 'AILabel'), "".concat(bc, "--has-close"), effectiveHasCloseIcon)),
|
219
235
|
decorator: decorator || deprecated_slug,
|
220
|
-
|
221
|
-
containerClassName: cx("".concat(bc, "__container"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(bc, "__container--lower"), verticalPosition === 'lower'), "".concat(bc, "__container--mixed-size-stacking"), !areAllSameSizeVariant())),
|
236
|
+
containerClassName: cx("".concat(bc, "__container"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(bc, "__container--lower"), verticalPosition === 'lower'), "".concat(bc, "__container--mixed-size-stacking"), !_areAllSameSizeVariant())),
|
222
237
|
onClose: onClose,
|
223
238
|
open: open,
|
224
239
|
selectorPrimaryFocus: selectorPrimaryFocus,
|
@@ -244,9 +259,11 @@ var TearsheetShell = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
244
259
|
element: "h3",
|
245
260
|
className: cx("".concat(bcModalHeader, "__heading"), "".concat(bc, "__heading"))
|
246
261
|
}, title), /*#__PURE__*/React.createElement(Wrap.Wrap, {
|
247
|
-
className: "".concat(bc, "__header-description")
|
248
|
-
|
249
|
-
|
262
|
+
className: "".concat(bc, "__header-description")
|
263
|
+
}, isOverflowing ? /*#__PURE__*/React.createElement(react.DefinitionTooltip, {
|
264
|
+
definition: description,
|
265
|
+
className: "".concat(bc, "__description-tooltip")
|
266
|
+
}, descriptionContent) : descriptionContent)), /*#__PURE__*/React.createElement(Wrap.Wrap, {
|
250
267
|
className: "".concat(bc, "__header-actions")
|
251
268
|
}, headerActions)), /*#__PURE__*/React.createElement(Wrap.Wrap, {
|
252
269
|
className: "".concat(bc, "__header-navigation")
|
@@ -356,11 +373,7 @@ TearsheetShell.propTypes = _rollupPluginBabelHelpers.objectSpread2({
|
|
356
373
|
* there are a no navigation actions and/or hasCloseIcon is true.
|
357
374
|
*/
|
358
375
|
/**@ts-ignore*/
|
359
|
-
closeIconDescription: index.default.string
|
360
|
-
var actions = _ref4.actions,
|
361
|
-
hasCloseIcon = _ref4.hasCloseIcon;
|
362
|
-
return tearsheetHasCloseIcon(actions, hasCloseIcon);
|
363
|
-
}),
|
376
|
+
closeIconDescription: index.default.string,
|
364
377
|
/**
|
365
378
|
* Optional prop that allows you to pass any component.
|
366
379
|
*/
|
@@ -14,6 +14,7 @@ var react = require('@carbon/react');
|
|
14
14
|
var index = require('../../_virtual/index.js');
|
15
15
|
var cx = require('classnames');
|
16
16
|
var devtools = require('../../global/js/utils/devtools.js');
|
17
|
+
var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
|
17
18
|
|
18
19
|
var _excluded = ["children", "className", "as", "buttonClassName", "collapsedItemsLimit", "expandedItemsLimit", "onClick", "viewLessLabel", "viewMoreLabel"];
|
19
20
|
|
@@ -100,6 +101,11 @@ exports.TruncatedList = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
100
101
|
setListHeight(_listHeight);
|
101
102
|
}
|
102
103
|
}, [childrenArray, minItems, maxItems, isCollapsed, listRef]);
|
104
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
105
|
+
if (listRef.current) {
|
106
|
+
listRef.current.style.height = "".concat(listHeight, "px");
|
107
|
+
}
|
108
|
+
}, [listHeight]);
|
103
109
|
return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
|
104
110
|
className: cx(blockClass, className, isCollapsed ? "".concat(blockClass, "--collapsed") : "".concat(blockClass, "--expanded"),
|
105
111
|
// If the list is expanded && showing all the items,
|
@@ -108,10 +114,7 @@ exports.TruncatedList = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
108
114
|
ref: ref
|
109
115
|
}, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React.createElement(List, {
|
110
116
|
className: "".concat(blockClass, "__list"),
|
111
|
-
ref: listRef
|
112
|
-
style: {
|
113
|
-
height: listHeight
|
114
|
-
}
|
117
|
+
ref: listRef
|
115
118
|
}, isCollapsed ? childrenArray.slice(0, minItems) : children), childrenArray.length > minItems && /*#__PURE__*/React.createElement(react.Button, {
|
116
119
|
className: cx("".concat(blockClass, "__button"), "".concat(settings.carbon.prefix, "--link"), buttonClassName),
|
117
120
|
kind: "ghost",
|
@@ -18,6 +18,7 @@ var carbonMotion = require('@carbon/motion');
|
|
18
18
|
var settings = require('../../settings.js');
|
19
19
|
var usePrefersReducedMotion = require('../../global/js/hooks/usePrefersReducedMotion.js');
|
20
20
|
var index$1 = require('./hooks/index.js');
|
21
|
+
var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
|
21
22
|
|
22
23
|
var _excluded = ["actions", "children", "className", "closeIconDescription", "documentationLinks", "documentationLinksIconDescription", "isInitiallyOpen", "webTerminalAriaLabel"];
|
23
24
|
|
@@ -51,6 +52,8 @@ exports.WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
51
52
|
_ref$webTerminalAriaL = _ref.webTerminalAriaLabel,
|
52
53
|
webTerminalAriaLabel = _ref$webTerminalAriaL === void 0 ? defaults.webTerminalAriaLabel : _ref$webTerminalAriaL,
|
53
54
|
rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
|
55
|
+
var localRef = React.useRef();
|
56
|
+
var webTerminalRef = ref !== null && ref !== void 0 ? ref : localRef;
|
54
57
|
var _useWebTerminal = index$1.useWebTerminal(),
|
55
58
|
open = _useWebTerminal.open,
|
56
59
|
closeWebTerminal = _useWebTerminal.closeWebTerminal,
|
@@ -61,6 +64,16 @@ exports.WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
61
64
|
setRender = _useState2[1];
|
62
65
|
var shouldReduceMotion = usePrefersReducedMotion.default();
|
63
66
|
var webTerminalAnimationName = "".concat(open ? 'web-terminal-entrance' : 'web-terminal-exit forwards', " ").concat(carbonMotion.moderate02);
|
67
|
+
useIsomorphicEffect.useIsomorphicEffect(function () {
|
68
|
+
var timeout = setTimeout(function () {
|
69
|
+
if (webTerminalRef.current && !shouldReduceMotion) {
|
70
|
+
webTerminalRef.current.style.animation = webTerminalAnimationName;
|
71
|
+
}
|
72
|
+
}, 0);
|
73
|
+
return function () {
|
74
|
+
return clearTimeout(timeout);
|
75
|
+
};
|
76
|
+
}, [shouldReduceMotion, webTerminalAnimationName, webTerminalRef]);
|
64
77
|
var showDocumentationLinks = React.useMemo(function () {
|
65
78
|
return documentationLinks.length > 0;
|
66
79
|
}, [documentationLinks]);
|
@@ -98,11 +111,8 @@ exports.WebTerminal = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
98
111
|
closeWebTerminal === null || closeWebTerminal === void 0 || closeWebTerminal();
|
99
112
|
};
|
100
113
|
return shouldRender ? /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rest), devtools.getDevtoolsProps(componentName)), {
|
101
|
-
ref:
|
114
|
+
ref: webTerminalRef,
|
102
115
|
className: cx([blockClass, className, _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--open"), open), "".concat(blockClass, "--closed"), !open)]),
|
103
|
-
style: {
|
104
|
-
animation: !shouldReduceMotion ? webTerminalAnimationName : ''
|
105
|
-
},
|
106
116
|
onAnimationEnd: onAnimationEnd
|
107
117
|
}), /*#__PURE__*/React.createElement("header", {
|
108
118
|
"aria-label": webTerminalAriaLabel,
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2025, 2025
|
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 { RefObject } from 'react';
|
8
|
+
type Item = {
|
9
|
+
id: string;
|
10
|
+
};
|
11
|
+
export declare const useOverflowItems: <T extends Item>(items: T[] | undefined, containerRef: RefObject<HTMLDivElement>, offsetRef?: RefObject<HTMLDivElement>, maxItems?: number, onChange?: (hiddenItems: T[]) => void) => {
|
12
|
+
visibleItems: T[];
|
13
|
+
itemRefHandler: (id: string, node: HTMLDivElement | null) => () => void;
|
14
|
+
hiddenItems: T[];
|
15
|
+
};
|
16
|
+
export {};
|
@@ -0,0 +1,90 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright IBM Corp. 2020, 2025
|
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
|
+
var _rollupPluginBabelHelpers = require('../../../_virtual/_rollupPluginBabelHelpers.js');
|
11
|
+
var React = require('react');
|
12
|
+
var useResizeObserver = require('./useResizeObserver.js');
|
13
|
+
|
14
|
+
var useOverflowItems = function useOverflowItems() {
|
15
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
16
|
+
var containerRef = arguments.length > 1 ? arguments[1] : undefined;
|
17
|
+
var offsetRef = arguments.length > 2 ? arguments[2] : undefined;
|
18
|
+
var maxItems = arguments.length > 3 ? arguments[3] : undefined;
|
19
|
+
var onChange = arguments.length > 4 ? arguments[4] : undefined;
|
20
|
+
var itemsRef = React.useRef(null);
|
21
|
+
var _useState = React.useState(0),
|
22
|
+
_useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
|
23
|
+
maxWidth = _useState2[0],
|
24
|
+
setMaxWidth = _useState2[1];
|
25
|
+
var visibleItemCount = React.useRef(0);
|
26
|
+
var handleResize = function handleResize() {
|
27
|
+
if (containerRef.current) {
|
28
|
+
var _offsetRef$current;
|
29
|
+
var offset = (offsetRef === null || offsetRef === void 0 || (_offsetRef$current = offsetRef.current) === null || _offsetRef$current === void 0 ? void 0 : _offsetRef$current.offsetWidth) || 0;
|
30
|
+
var newMax = containerRef.current.offsetWidth - offset;
|
31
|
+
setMaxWidth(newMax);
|
32
|
+
}
|
33
|
+
};
|
34
|
+
useResizeObserver.useResizeObserver(containerRef, handleResize);
|
35
|
+
var getMap = function getMap() {
|
36
|
+
if (!itemsRef.current) {
|
37
|
+
itemsRef.current = new Map();
|
38
|
+
}
|
39
|
+
return itemsRef.current;
|
40
|
+
};
|
41
|
+
var itemRefHandler = function itemRefHandler(id, node) {
|
42
|
+
var map = getMap();
|
43
|
+
if (node) {
|
44
|
+
var _getComputedStyle;
|
45
|
+
var style = (_getComputedStyle = getComputedStyle) === null || _getComputedStyle === void 0 ? void 0 : _getComputedStyle(node);
|
46
|
+
var totalWidth = node.offsetWidth + parseInt(style.marginLeft) + parseInt(style.marginRight);
|
47
|
+
map.set(id, totalWidth);
|
48
|
+
}
|
49
|
+
return function () {
|
50
|
+
map.delete(id);
|
51
|
+
};
|
52
|
+
};
|
53
|
+
var getVisibleItems = function getVisibleItems() {
|
54
|
+
if (!containerRef) {
|
55
|
+
return items;
|
56
|
+
}
|
57
|
+
var map = getMap();
|
58
|
+
var maxReached = false;
|
59
|
+
var accumulatedWidth = 0;
|
60
|
+
var visibleItems = items.slice(0, maxItems).reduce(function (prev, cur) {
|
61
|
+
if (maxReached) {
|
62
|
+
return prev;
|
63
|
+
}
|
64
|
+
var itemWidth = map.get(cur.id) || 0;
|
65
|
+
var willFit = accumulatedWidth + itemWidth <= maxWidth;
|
66
|
+
if (willFit) {
|
67
|
+
accumulatedWidth += itemWidth;
|
68
|
+
prev.push(cur);
|
69
|
+
} else {
|
70
|
+
maxReached = true;
|
71
|
+
}
|
72
|
+
return prev;
|
73
|
+
}, []);
|
74
|
+
return visibleItems;
|
75
|
+
};
|
76
|
+
var visibleItems = getVisibleItems();
|
77
|
+
var hiddenItems = items.slice(visibleItems.length);
|
78
|
+
// only call the change handler when the number of visible items has changed
|
79
|
+
if (visibleItems.length !== visibleItemCount.current) {
|
80
|
+
visibleItemCount.current = visibleItems.length;
|
81
|
+
onChange === null || onChange === void 0 || onChange(hiddenItems);
|
82
|
+
}
|
83
|
+
return {
|
84
|
+
visibleItems: visibleItems,
|
85
|
+
itemRefHandler: itemRefHandler,
|
86
|
+
hiddenItems: hiddenItems
|
87
|
+
};
|
88
|
+
};
|
89
|
+
|
90
|
+
exports.useOverflowItems = useOverflowItems;
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@carbon/ibm-products",
|
3
3
|
"description": "Carbon for IBM Products",
|
4
|
-
"version": "2.
|
4
|
+
"version": "2.59.0-rc.0",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"main": "lib/index.js",
|
7
7
|
"module": "es/index.js",
|
@@ -72,7 +72,7 @@
|
|
72
72
|
"@rollup/plugin-typescript": "^12.1.1",
|
73
73
|
"@types/react-table": "^7.7.20",
|
74
74
|
"babel-plugin-dev-expression": "^0.2.3",
|
75
|
-
"babel-preset-ibm-cloud-cognitive": "^0.
|
75
|
+
"babel-preset-ibm-cloud-cognitive": "^0.17.0-rc.0",
|
76
76
|
"chalk": "^4.1.2",
|
77
77
|
"change-case": "4.1.2",
|
78
78
|
"classnames": "^2.5.1",
|
@@ -81,7 +81,7 @@
|
|
81
81
|
"fs-extra": "^11.2.0",
|
82
82
|
"glob": "^10.3.10",
|
83
83
|
"jest": "^29.7.0",
|
84
|
-
"jest-config-ibm-cloud-cognitive": "^1.
|
84
|
+
"jest-config-ibm-cloud-cognitive": "^1.18.0-rc.0",
|
85
85
|
"jest-environment-jsdom": "^29.7.0",
|
86
86
|
"namor": "^1.1.2",
|
87
87
|
"npm-check-updates": "^17.1.11",
|
@@ -96,7 +96,7 @@
|
|
96
96
|
"dependencies": {
|
97
97
|
"@babel/runtime": "^7.23.9",
|
98
98
|
"@carbon/feature-flags": "^0.24.0",
|
99
|
-
"@carbon/ibm-products-styles": "^2.
|
99
|
+
"@carbon/ibm-products-styles": "^2.55.0-rc.0",
|
100
100
|
"@carbon/telemetry": "^0.1.0",
|
101
101
|
"@dnd-kit/core": "^6.0.8",
|
102
102
|
"@dnd-kit/modifiers": "^7.0.0",
|
@@ -120,5 +120,5 @@
|
|
120
120
|
"react": "^16.8.6 || ^17.0.1 || ^18.2.0",
|
121
121
|
"react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
|
122
122
|
},
|
123
|
-
"gitHead": "
|
123
|
+
"gitHead": "4fef191d8edeab2fd1bb5ecd379a12b79c043889"
|
124
124
|
}
|
@@ -24,12 +24,6 @@
|
|
24
24
|
// The block part of our conventional BEM class names (blockClass__E--M).
|
25
25
|
$block-class: #{c4p-settings.$pkg-prefix}--condition-builder;
|
26
26
|
|
27
|
-
// .#{$block-class} {
|
28
|
-
// // TODO: Styles.
|
29
|
-
// }
|
30
|
-
.#{$block-class} {
|
31
|
-
padding: $spacing-06;
|
32
|
-
}
|
33
27
|
.#{$block-class}__condition-builder__group {
|
34
28
|
display: flex;
|
35
29
|
}
|
@@ -26,13 +26,8 @@ $block-class: #{c4p-settings.$pkg-prefix}--tag-overflow;
|
|
26
26
|
$block-class-overflow: #{$block-class}-popover;
|
27
27
|
$block-class-modal: #{$block-class}-modal;
|
28
28
|
|
29
|
-
.#{$block-class} {
|
29
|
+
.#{$block-class}__visible-tags {
|
30
30
|
display: flex;
|
31
|
-
width: 100%;
|
32
|
-
min-width: $spacing-12;
|
33
|
-
align-items: center;
|
34
|
-
justify-content: flex-start;
|
35
|
-
white-space: nowrap;
|
36
31
|
}
|
37
32
|
|
38
33
|
.#{$block-class}--align-end {
|
@@ -247,15 +247,9 @@ $motion-duration: $duration-moderate-02;
|
|
247
247
|
}
|
248
248
|
|
249
249
|
.#{$block-class}__header-description {
|
250
|
-
display: -webkit-box;
|
251
|
-
overflow: hidden;
|
252
250
|
max-width: 100%;
|
253
251
|
margin-top: $spacing-05;
|
254
252
|
@include type.type-style('body-compact-01');
|
255
|
-
|
256
|
-
-webkit-box-orient: vertical;
|
257
|
-
-webkit-line-clamp: 2;
|
258
|
-
|
259
253
|
@include breakpoint-up('md') {
|
260
254
|
max-width: 60%;
|
261
255
|
}
|
@@ -263,6 +257,27 @@ $motion-duration: $duration-moderate-02;
|
|
263
257
|
word-break: break-word;
|
264
258
|
}
|
265
259
|
|
260
|
+
.#{$block-class}__description-tooltip .#{$carbon-prefix}--definition-term {
|
261
|
+
border-bottom: 0;
|
262
|
+
letter-spacing: inherit;
|
263
|
+
word-break: break-word;
|
264
|
+
}
|
265
|
+
|
266
|
+
// overwrites the existing styles to make the popover bigger because in some cases the narrow space can be too constricting for the description
|
267
|
+
.#{$block-class}__description-tooltip {
|
268
|
+
display: inline-flex;
|
269
|
+
.#{$carbon-prefix}--popover-content.#{$carbon-prefix}--definition-tooltip {
|
270
|
+
max-inline-size: fit-content;
|
271
|
+
}
|
272
|
+
}
|
273
|
+
|
274
|
+
.#{$block-class}__description-text {
|
275
|
+
display: -webkit-box;
|
276
|
+
overflow: hidden;
|
277
|
+
-webkit-box-orient: vertical;
|
278
|
+
-webkit-line-clamp: 2;
|
279
|
+
}
|
280
|
+
|
266
281
|
&.#{$block-class}--narrow .#{$block-class}__header-description {
|
267
282
|
margin-top: $spacing-03;
|
268
283
|
}
|