@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.
Files changed (60) hide show
  1. package/css/index-full-carbon.css +18 -14
  2. package/css/index-full-carbon.css.map +1 -1
  3. package/css/index-full-carbon.min.css +1 -1
  4. package/css/index-full-carbon.min.css.map +1 -1
  5. package/css/index-without-carbon-released-only.css +17 -4
  6. package/css/index-without-carbon-released-only.css.map +1 -1
  7. package/css/index-without-carbon-released-only.min.css +1 -1
  8. package/css/index-without-carbon-released-only.min.css.map +1 -1
  9. package/css/index-without-carbon.css +18 -14
  10. package/css/index-without-carbon.css.map +1 -1
  11. package/css/index-without-carbon.min.css +1 -1
  12. package/css/index-without-carbon.min.css.map +1 -1
  13. package/css/index.css +18 -14
  14. package/css/index.css.map +1 -1
  15. package/css/index.min.css +1 -1
  16. package/css/index.min.css.map +1 -1
  17. package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +1 -1
  18. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +1 -1
  19. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -1
  20. package/es/components/InterstitialScreen/InterstitialScreen.js +10 -7
  21. package/es/components/NotificationsPanel/NotificationsPanel.js +12 -3
  22. package/es/components/PageHeader/PageHeader.js +11 -1
  23. package/es/components/ScrollGradient/ScrollGradient.js +34 -27
  24. package/es/components/StringFormatter/StringFormatter.js +9 -6
  25. package/es/components/TagOverflow/TagOverflow.d.ts +10 -1
  26. package/es/components/TagOverflow/TagOverflow.js +54 -146
  27. package/es/components/Tearsheet/Tearsheet.d.ts +6 -14
  28. package/es/components/Tearsheet/Tearsheet.js +2 -18
  29. package/es/components/Tearsheet/TearsheetNarrow.d.ts +6 -4
  30. package/es/components/Tearsheet/TearsheetNarrow.js +2 -10
  31. package/es/components/Tearsheet/TearsheetShell.d.ts +8 -8
  32. package/es/components/Tearsheet/TearsheetShell.js +40 -27
  33. package/es/components/TruncatedList/TruncatedList.js +7 -4
  34. package/es/components/WebTerminal/WebTerminal.js +15 -5
  35. package/es/global/js/hooks/useOverflowItems.d.ts +16 -0
  36. package/es/global/js/hooks/useOverflowItems.js +88 -0
  37. package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +1 -1
  38. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +1 -1
  39. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +1 -1
  40. package/lib/components/InterstitialScreen/InterstitialScreen.js +9 -6
  41. package/lib/components/NotificationsPanel/NotificationsPanel.js +12 -3
  42. package/lib/components/PageHeader/PageHeader.js +11 -1
  43. package/lib/components/ScrollGradient/ScrollGradient.js +32 -25
  44. package/lib/components/StringFormatter/StringFormatter.js +8 -5
  45. package/lib/components/TagOverflow/TagOverflow.d.ts +10 -1
  46. package/lib/components/TagOverflow/TagOverflow.js +52 -144
  47. package/lib/components/Tearsheet/Tearsheet.d.ts +6 -14
  48. package/lib/components/Tearsheet/Tearsheet.js +1 -17
  49. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +6 -4
  50. package/lib/components/Tearsheet/TearsheetNarrow.js +1 -9
  51. package/lib/components/Tearsheet/TearsheetShell.d.ts +8 -8
  52. package/lib/components/Tearsheet/TearsheetShell.js +37 -24
  53. package/lib/components/TruncatedList/TruncatedList.js +7 -4
  54. package/lib/components/WebTerminal/WebTerminal.js +14 -4
  55. package/lib/global/js/hooks/useOverflowItems.d.ts +16 -0
  56. package/lib/global/js/hooks/useOverflowItems.js +90 -0
  57. package/package.json +5 -5
  58. package/scss/components/ConditionBuilder/_condition-builder.scss +0 -6
  59. package/scss/components/TagOverflow/_tag-overflow.scss +1 -6
  60. package/scss/components/Tearsheet/_tearsheet.scss +21 -6
@@ -15,6 +15,7 @@ var devtools = require('../../global/js/utils/devtools.js');
15
15
  var settings = require('../../settings.js');
16
16
  var lodash = require('lodash');
17
17
  var constants = require('./constants.js');
18
+ var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
18
19
 
19
20
  var _excluded = ["children", "className", "color", "onScroll", "scrollElementClassName", "getScrollElementRef", "hideStartGradient"];
20
21
  var blockClass = "".concat(settings.pkg.prefix, "--scroll-gradient");
@@ -44,6 +45,13 @@ exports.ScrollGradient = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
44
45
  _ref$hideStartGradien = _ref.hideStartGradient,
45
46
  hideStartGradient = _ref$hideStartGradien === void 0 ? defaults.hideStartGradient : _ref$hideStartGradien,
46
47
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
48
+ var scrollContainer = React.useRef(undefined);
49
+ var contentChildrenContainer = React.useRef(undefined);
50
+ var _useIsOverflow = constants.useIsOverflow(scrollContainer),
51
+ xScrollable = _useIsOverflow.xScrollable,
52
+ yScrollable = _useIsOverflow.yScrollable;
53
+ var gradientRight = yScrollable && scrollContainer.current && contentChildrenContainer.current ? scrollContainer.current.offsetWidth - contentChildrenContainer.current.offsetWidth : 0;
54
+ var gradientBottom = xScrollable && scrollContainer.current && contentChildrenContainer.current ? scrollContainer.current.offsetHeight - contentChildrenContainer.current.offsetHeight : 0;
47
55
  var _useState = React.useState(constants.ScrollStates.NONE),
48
56
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
49
57
  verticalPosition = _useState2[0],
@@ -52,8 +60,26 @@ exports.ScrollGradient = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
52
60
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
53
61
  horizontalPosition = _useState4[0],
54
62
  setHorizontalPosition = _useState4[1];
55
- var scrollContainer = React.useRef(undefined);
56
- var contentChildrenContainer = React.useRef(undefined);
63
+ var startVerticalRef = React.useRef(null);
64
+ var startHorizontalRef = React.useRef(null);
65
+ var endVerticalRef = React.useRef(null);
66
+ var endHorizontalRef = React.useRef(null);
67
+ useIsomorphicEffect.useIsomorphicEffect(function () {
68
+ // start vertical styles
69
+ startVerticalRef.current.style.right = gradientRight;
70
+ startVerticalRef.current.style.backgroundImage = "linear-gradient(0deg, transparent, ".concat(color, " 90%)");
71
+ // start horizontal styles
72
+ startHorizontalRef.current.backgroundImage = "linear-gradient(-90deg, transparent, ".concat(color, " 90%)");
73
+ startHorizontalRef.current.bottom = gradientBottom;
74
+ // end vertical styles
75
+ endVerticalRef.current.style.right = gradientRight;
76
+ endVerticalRef.current.style.bottom = gradientBottom;
77
+ endVerticalRef.current.style.backgroundImage = "linear-gradient(0deg, ".concat(color, " 10%, transparent)");
78
+ // end horizontal styles
79
+ endHorizontalRef.current.style.right = gradientRight;
80
+ endHorizontalRef.current.style.bottom = gradientBottom;
81
+ endHorizontalRef.current.style.backgroundImage = "linear-gradient(-90deg, ".concat(color, " 10%, transparent)");
82
+ }, [color, gradientRight, gradientBottom]);
57
83
  var updateScrollState = lodash.throttle(function () {
58
84
  var updatedVerticalVal = constants.getScrollState(scrollContainer.current, constants.ScrollDirection.Y);
59
85
  var updatedHorizontalVal = constants.getScrollState(scrollContainer.current, constants.ScrollDirection.X);
@@ -71,11 +97,6 @@ exports.ScrollGradient = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
71
97
  React.useEffect(function () {
72
98
  scrollHandler();
73
99
  }, [scrollHandler]);
74
- var _useIsOverflow = constants.useIsOverflow(scrollContainer),
75
- xScrollable = _useIsOverflow.xScrollable,
76
- yScrollable = _useIsOverflow.yScrollable;
77
- var gradientRight = yScrollable && scrollContainer.current && contentChildrenContainer.current ? scrollContainer.current.offsetWidth - contentChildrenContainer.current.offsetWidth : 0;
78
- var gradientBottom = xScrollable && scrollContainer.current && contentChildrenContainer.current ? scrollContainer.current.offsetHeight - contentChildrenContainer.current.offsetHeight : 0;
79
100
  return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
80
101
  className: cx(blockClass, "".concat(blockClass, "--x-").concat(horizontalPosition.toLowerCase()), "".concat(blockClass, "--y-").concat(verticalPosition.toLowerCase()), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--x-scrollable"), xScrollable), "".concat(blockClass, "--y-scrollable"), yScrollable), className),
81
102
  ref: ref,
@@ -89,37 +110,23 @@ exports.ScrollGradient = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
89
110
  ref: contentChildrenContainer,
90
111
  className: "".concat(blockClass, "__content-children")
91
112
  }, children)), !hideStartGradient && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
113
+ ref: startVerticalRef,
92
114
  className: "".concat(blockClass, "__start-vertical"),
93
- style: {
94
- right: gradientRight,
95
- backgroundImage: "linear-gradient(0deg, transparent, ".concat(color, " 90%)")
96
- },
97
115
  role: "presentation",
98
116
  "aria-hidden": true
99
117
  }), /*#__PURE__*/React.createElement("div", {
118
+ ref: startHorizontalRef,
100
119
  className: "".concat(blockClass, "__start-horizontal"),
101
- style: {
102
- backgroundImage: "linear-gradient(-90deg, transparent, ".concat(color, " 90%)"),
103
- bottom: gradientBottom
104
- },
105
120
  role: "presentation",
106
121
  "aria-hidden": true
107
122
  })), /*#__PURE__*/React.createElement("div", {
123
+ ref: endVerticalRef,
108
124
  className: "".concat(blockClass, "__end-vertical"),
109
- style: {
110
- right: gradientRight,
111
- bottom: gradientBottom,
112
- backgroundImage: "linear-gradient(0deg, ".concat(color, " 10%, transparent)")
113
- },
114
125
  role: "presentation",
115
126
  "aria-hidden": true
116
127
  }), /*#__PURE__*/React.createElement("div", {
128
+ ref: endHorizontalRef,
117
129
  className: "".concat(blockClass, "__end-horizontal"),
118
- style: {
119
- right: gradientRight,
120
- bottom: gradientBottom,
121
- backgroundImage: "linear-gradient(-90deg, ".concat(color, " 10%, transparent)")
122
- },
123
130
  role: "presentation",
124
131
  "aria-hidden": true
125
132
  }));
@@ -16,6 +16,7 @@ var settings = require('../../settings.js');
16
16
  var react = require('@carbon/react');
17
17
  var enums = require('./utils/enums.js');
18
18
  var propsHelper = require('../../global/js/utils/props-helper.js');
19
+ var useIsomorphicEffect = require('../../global/js/hooks/useIsomorphicEffect.js');
19
20
 
20
21
  var _excluded = ["className", "lines", "tooltipDirection", "truncate", "width", "value"];
21
22
  var blockClass = "".concat(settings.pkg.prefix, "--string-formatter");
@@ -43,12 +44,14 @@ exports.StringFormatter = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
43
44
  width = _ref$width === void 0 ? defaults.width : _ref$width,
44
45
  value = _ref.value,
45
46
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded);
47
+ var contentRef = React.useRef(null);
48
+ useIsomorphicEffect.useIsomorphicEffect(function () {
49
+ contentRef.current.style.maxWidth = width;
50
+ contentRef.current.style.WebkitLineClamp = lines;
51
+ }, [lines, width]);
46
52
  var stringFormatterContent = /*#__PURE__*/React.createElement("span", {
47
- className: cx("".concat(blockClass, "--content"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--truncate"), truncate)),
48
- style: {
49
- maxWidth: width,
50
- WebkitLineClamp: lines
51
- }
53
+ ref: contentRef,
54
+ className: cx("".concat(blockClass, "--content"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--truncate"), truncate))
52
55
  }, value);
53
56
  return /*#__PURE__*/React.createElement("span", _rollupPluginBabelHelpers.extends({}, rest, {
54
57
  className: cx(blockClass, className),
@@ -26,10 +26,19 @@ export interface TagOverflowProps {
26
26
  allTagsModalTitle?: string;
27
27
  autoAlign?: boolean;
28
28
  className?: string;
29
- containingElementRef?: RefObject<HTMLElement>;
29
+ /**
30
+ * @deprecated The `containingElementRef` prop is no longer going to be used in favor of the forwarded ref.
31
+ */
32
+ containingElementRef?: RefObject<HTMLDivElement>;
30
33
  items: TagOverflowItem[];
31
34
  maxVisible?: number;
35
+ /**
36
+ * @deprecated The `measurementOffset` prop is no longer going to be used. This value will now be calculated automatically.
37
+ */
32
38
  measurementOffset?: number;
39
+ /**
40
+ * @deprecated The `multiline` prop is no longer going to be used. This component should only be used when you need to hide overflowing items.
41
+ */
33
42
  multiline?: boolean;
34
43
  overflowAlign?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top';
35
44
  overflowClassName?: string;
@@ -18,12 +18,11 @@ var cx = require('classnames');
18
18
  var devtools = require('../../global/js/utils/devtools.js');
19
19
  var propsHelper = require('../../global/js/utils/props-helper.js');
20
20
  var settings = require('../../settings.js');
21
- var useResizeObserver = require('../../global/js/hooks/useResizeObserver.js');
21
+ var useOverflowItems = require('../../global/js/hooks/useOverflowItems.js');
22
22
 
23
- var _excluded = ["align", "allTagsModalAriaLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTarget", "allTagsModalTitle", "autoAlign", "className", "containingElementRef", "items", "maxVisible", "measurementOffset", "multiline", "overflowAlign", "overflowClassName", "overflowType", "onOverflowTagChange", "showAllTagsLabel", "tagComponent"],
24
- _excluded2 = ["className", "id"],
25
- _excluded3 = ["tagType"],
26
- _excluded4 = ["id", "label", "tagType", "onClose", "filter"];
23
+ var _excluded = ["align", "allTagsModalAriaLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTarget", "allTagsModalTitle", "autoAlign", "className", "items", "maxVisible", "overflowAlign", "overflowClassName", "overflowType", "onOverflowTagChange", "showAllTagsLabel", "tagComponent"],
24
+ _excluded2 = ["className"],
25
+ _excluded3 = ["id", "label", "tagType", "onClose", "filter"];
27
26
  var blockClass = "".concat(settings.pkg.prefix, "--tag-overflow");
28
27
  var componentName = 'TagOverflow';
29
28
  var allTagsModalSearchThreshold = 10;
@@ -37,12 +36,8 @@ exports.TagOverflow = /*#__PURE__*/React.forwardRef(function (props, ref) {
37
36
  allTagsModalTitle = props.allTagsModalTitle,
38
37
  autoAlign = props.autoAlign,
39
38
  className = props.className,
40
- containingElementRef = props.containingElementRef,
41
39
  items = props.items,
42
40
  maxVisible = props.maxVisible,
43
- _props$measurementOff = props.measurementOffset,
44
- measurementOffset = _props$measurementOff === void 0 ? 0 : _props$measurementOff,
45
- multiline = props.multiline,
46
41
  _props$overflowAlign = props.overflowAlign,
47
42
  overflowAlign = _props$overflowAlign === void 0 ? 'bottom' : _props$overflowAlign,
48
43
  overflowClassName = props.overflowClassName,
@@ -52,119 +47,33 @@ exports.TagOverflow = /*#__PURE__*/React.forwardRef(function (props, ref) {
52
47
  showAllTagsLabel = props.showAllTagsLabel,
53
48
  tagComponent = props.tagComponent,
54
49
  rest = _rollupPluginBabelHelpers.objectWithoutProperties(props, _excluded);
55
- var localContainerRef = React.useRef(null);
56
- var containerRef = ref || localContainerRef;
57
- var itemRefs = React.useRef(null);
58
- var overflowRef = React.useRef(null);
59
- // itemOffset is the value of margin applied on each items
60
- // This value is required for calculating how many items will fit within the container
61
- var itemOffset = 4;
62
- var overflowIndicatorWidth = 40;
63
- var _useState = React.useState(0),
50
+ var containerRef = React.useRef(null);
51
+ var offsetRef = React.useRef(null);
52
+ var _useState = React.useState(false),
64
53
  _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
65
- containerWidth = _useState2[0],
66
- setContainerWidth = _useState2[1];
67
- var _useState3 = React.useState([]),
54
+ showAllModalOpen = _useState2[0],
55
+ setShowAllModalOpen = _useState2[1];
56
+ var _useState3 = React.useState(false),
68
57
  _useState4 = _rollupPluginBabelHelpers.slicedToArray(_useState3, 2),
69
- visibleItems = _useState4[0],
70
- setVisibleItems = _useState4[1];
71
- var _useState5 = React.useState([]),
72
- _useState6 = _rollupPluginBabelHelpers.slicedToArray(_useState5, 2),
73
- overflowItems = _useState6[0],
74
- setOverflowItems = _useState6[1];
75
- var _useState7 = React.useState(false),
76
- _useState8 = _rollupPluginBabelHelpers.slicedToArray(_useState7, 2),
77
- showAllModalOpen = _useState8[0],
78
- setShowAllModalOpen = _useState8[1];
79
- var _useState9 = React.useState(false),
80
- _useState10 = _rollupPluginBabelHelpers.slicedToArray(_useState9, 2),
81
- popoverOpen = _useState10[0],
82
- setPopoverOpen = _useState10[1];
83
- var resizeElm = containingElementRef && containingElementRef.current ? containingElementRef : containerRef;
58
+ popoverOpen = _useState4[0],
59
+ setPopoverOpen = _useState4[1];
60
+ var _useOverflowItems = useOverflowItems.useOverflowItems(items, containerRef, offsetRef, maxVisible, onOverflowTagChange),
61
+ visibleItems = _useOverflowItems.visibleItems,
62
+ overflowItems = _useOverflowItems.hiddenItems,
63
+ itemRefHandler = _useOverflowItems.itemRefHandler;
84
64
  var handleShowAllClick = function handleShowAllClick() {
85
65
  setShowAllModalOpen(true);
86
66
  };
87
67
  var handleModalClose = function handleModalClose() {
88
68
  setShowAllModalOpen(false);
89
69
  };
90
- var handleResize = function handleResize() {
91
- if (typeof resizeElm !== 'function' && resizeElm.current) {
92
- setContainerWidth(resizeElm.current.offsetWidth);
93
- }
94
- };
95
- useResizeObserver.useResizeObserver(resizeElm, handleResize);
96
- var getMap = function getMap() {
97
- if (!itemRefs.current) {
98
- itemRefs.current = new Map();
99
- }
100
- return itemRefs.current;
101
- };
102
- var itemRefHandler = function itemRefHandler(id, node) {
103
- var map = getMap();
104
- if (id && node && map.get(id) !== node.offsetWidth) {
105
- map.set(id, node.offsetWidth);
106
- }
107
- };
108
- var getVisibleItems = React.useCallback(function () {
109
- if (!itemRefs.current) {
110
- return items;
111
- }
112
- if (multiline) {
113
- var _visibleItems = maxVisible ? items === null || items === void 0 ? void 0 : items.slice(0, maxVisible) : items;
114
- return _visibleItems;
115
- }
116
- var map = getMap();
117
- var optionalContainingElement = containingElementRef === null || containingElementRef === void 0 ? void 0 : containingElementRef.current;
118
- var measurementOffsetValue = typeof measurementOffset === 'number' ? measurementOffset : 0;
119
- var spaceAvailable = optionalContainingElement ? optionalContainingElement.offsetWidth - measurementOffsetValue : containerWidth;
120
- var overflowContainerWidth = overflowRef && overflowRef.current && overflowRef.current.offsetWidth > overflowIndicatorWidth ? overflowRef.current.offsetWidth : overflowIndicatorWidth;
121
- var maxWidth = spaceAvailable - overflowContainerWidth;
122
- var childrenWidth = 0;
123
- var maxReached = false;
124
- return items.reduce(function (prev, cur) {
125
- if (!maxReached) {
126
- var itemWidth = (map ? Number(map.get(cur.id)) : 0) + itemOffset;
127
- var fits = itemWidth + childrenWidth < maxWidth;
128
- if (fits) {
129
- childrenWidth += itemWidth;
130
- prev.push(cur);
131
- } else {
132
- maxReached = true;
133
- }
134
- }
135
- return prev;
136
- }, []);
137
- }, [containerWidth, containingElementRef, items, maxVisible, measurementOffset, multiline]);
138
70
  var getCustomComponent = function getCustomComponent(item, tagComponent) {
139
71
  var className = item.className,
140
- id = item.id,
141
72
  other = _rollupPluginBabelHelpers.objectWithoutProperties(item, _excluded2);
142
73
  return /*#__PURE__*/React.createElement(tagComponent, _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, other), {}, {
143
- key: id,
144
- className: cx("".concat(blockClass, "__item"), className),
145
- ref: function ref(node) {
146
- return itemRefHandler(id, node);
147
- }
74
+ className: cx("".concat(blockClass, "__item"), className)
148
75
  }));
149
76
  };
150
- React.useEffect(function () {
151
- var visibleItemsArr = getVisibleItems();
152
- if (maxVisible && maxVisible < visibleItemsArr.length) {
153
- var _visibleItemsArr;
154
- visibleItemsArr = (_visibleItemsArr = visibleItemsArr) === null || _visibleItemsArr === void 0 ? void 0 : _visibleItemsArr.slice(0, maxVisible);
155
- }
156
- var hiddenItems = items === null || items === void 0 ? void 0 : items.slice(visibleItemsArr.length);
157
- var overflowItemsArr = hiddenItems === null || hiddenItems === void 0 ? void 0 : hiddenItems.map(function (_ref) {
158
- var tagType = _ref.tagType,
159
- other = _rollupPluginBabelHelpers.objectWithoutProperties(_ref, _excluded3);
160
- return _rollupPluginBabelHelpers.objectSpread2({
161
- type: tagType
162
- }, other);
163
- });
164
- setVisibleItems(visibleItemsArr);
165
- setOverflowItems(overflowItemsArr);
166
- onOverflowTagChange === null || onOverflowTagChange === void 0 || onOverflowTagChange(overflowItemsArr);
167
- }, [getVisibleItems, items, maxVisible, onOverflowTagChange]);
168
77
  var handleTagOnClose = React.useCallback(function (onClose, index) {
169
78
  onClose === null || onClose === void 0 || onClose();
170
79
  if (index <= (visibleItems === null || visibleItems === void 0 ? void 0 : visibleItems.length) - 1) {
@@ -172,41 +81,40 @@ exports.TagOverflow = /*#__PURE__*/React.forwardRef(function (props, ref) {
172
81
  }
173
82
  }, [visibleItems]);
174
83
  return /*#__PURE__*/React.createElement("div", _rollupPluginBabelHelpers.extends({}, rest, {
175
- className: cx(blockClass, className, "".concat(blockClass, "--align-").concat(align), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--multiline"), multiline)),
84
+ className: cx(blockClass, className)
85
+ }, devtools.getDevtoolsProps(componentName), {
86
+ ref: ref
87
+ }), /*#__PURE__*/React.createElement("div", {
88
+ className: cx("".concat(blockClass, "__visible-tags"), "".concat(blockClass, "--align-").concat(align)),
176
89
  ref: containerRef
177
- }, devtools.getDevtoolsProps(componentName)), (visibleItems === null || visibleItems === void 0 ? void 0 : visibleItems.length) > 0 && visibleItems.map(function (item, index) {
178
- // Render custom components
179
- if (tagComponent) {
180
- return getCustomComponent(item, tagComponent);
181
- } else {
182
- var id = item.id,
183
- label = item.label,
184
- tagType = item.tagType,
185
- _onClose = item.onClose,
186
- filter = item.filter,
187
- other = _rollupPluginBabelHelpers.objectWithoutProperties(item, _excluded4);
188
- // If there is no template prop, then render items as Tags
189
- return /*#__PURE__*/React.createElement("div", {
190
- ref: function ref(node) {
191
- return itemRefHandler(id, node);
192
- },
193
- key: id
194
- }, typeof _onClose === 'function' || filter ? /*#__PURE__*/React.createElement(react.DismissibleTag, _rollupPluginBabelHelpers.extends({}, other, {
195
- className: "".concat(blockClass, "__item--tag"),
196
- type: tagType,
197
- onClose: function onClose() {
198
- return handleTagOnClose(_onClose, index);
199
- },
200
- text: label
201
- })) : /*#__PURE__*/React.createElement(react.Tag, _rollupPluginBabelHelpers.extends({}, other, {
202
- className: "".concat(blockClass, "__item--tag"),
203
- type: tagType
204
- }), label));
205
- }
206
- }), /*#__PURE__*/React.createElement("span", {
90
+ }, visibleItems.map(function (item, index) {
91
+ var id = item.id,
92
+ label = item.label,
93
+ tagType = item.tagType,
94
+ _onClose = item.onClose,
95
+ filter = item.filter,
96
+ other = _rollupPluginBabelHelpers.objectWithoutProperties(item, _excluded3);
97
+ return /*#__PURE__*/React.createElement("div", {
98
+ className: "".concat(blockClass, "__tag-container"),
99
+ ref: function ref(node) {
100
+ itemRefHandler(id, node);
101
+ },
102
+ key: id
103
+ }, tagComponent ? getCustomComponent(item, tagComponent) : typeof _onClose === 'function' || filter ? /*#__PURE__*/React.createElement(react.DismissibleTag, _rollupPluginBabelHelpers.extends({}, other, {
104
+ className: "".concat(blockClass, "__item--tag"),
105
+ type: tagType,
106
+ onClose: function onClose() {
107
+ return handleTagOnClose(_onClose, index);
108
+ },
109
+ text: label
110
+ })) : /*#__PURE__*/React.createElement(react.Tag, _rollupPluginBabelHelpers.extends({}, other, {
111
+ className: "".concat(blockClass, "__item--tag"),
112
+ type: tagType
113
+ }), label));
114
+ }), overflowItems.length > 0 && /*#__PURE__*/React.createElement("div", {
207
115
  className: "".concat(blockClass, "__indicator"),
208
- ref: overflowRef
209
- }, (overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length) > 0 && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(TagOverflowPopover.TagOverflowPopover, {
116
+ ref: offsetRef
117
+ }, /*#__PURE__*/React.createElement(TagOverflowPopover.TagOverflowPopover, {
210
118
  allTagsModalSearchThreshold: allTagsModalSearchThreshold,
211
119
  className: overflowClassName,
212
120
  onShowAllClick: handleShowAllClick,
@@ -215,7 +123,7 @@ exports.TagOverflow = /*#__PURE__*/React.forwardRef(function (props, ref) {
215
123
  overflowType: overflowType,
216
124
  showAllTagsLabel: showAllTagsLabel,
217
125
  key: "tag-overflow-popover",
218
- ref: overflowRef,
126
+ ref: offsetRef,
219
127
  popoverOpen: popoverOpen,
220
128
  setPopoverOpen: setPopoverOpen,
221
129
  autoAlign: autoAlign
@@ -244,8 +152,8 @@ var tagTypes = Object.keys(constants.TYPES);
244
152
  * The strings shown in the showAllModal are only shown if we have more than allTagsModalSearchLThreshold
245
153
  * @returns null if no problems
246
154
  */
247
- var string_required_if_more_than_10_tags = propsHelper.isRequiredIf(index.default.string, function (_ref2) {
248
- var items = _ref2.items;
155
+ var string_required_if_more_than_10_tags = propsHelper.isRequiredIf(index.default.string, function (_ref) {
156
+ var items = _ref.items;
249
157
  return (items === null || items === void 0 ? void 0 : items.length) > allTagsModalSearchThreshold;
250
158
  });
251
159
 
@@ -8,19 +8,6 @@
8
8
  import { type ButtonProps } from '@carbon/react';
9
9
  import React, { PropsWithChildren, ReactNode } from 'react';
10
10
  import PropTypes from 'prop-types';
11
- /**
12
- * The accessibility title for the close icon (if shown).
13
- *
14
- * **Note:** This prop is only required if a close icon is shown, i.e. if
15
- * there are a no navigation actions and/or hasCloseIcon is true.
16
- */
17
- export type CloseIconDescriptionTypes = {
18
- hasCloseIcon?: false;
19
- closeIconDescription?: string;
20
- } | {
21
- hasCloseIcon: true;
22
- closeIconDescription: string;
23
- };
24
11
  export interface TearsheetAction extends ButtonProps<'button'> {
25
12
  label?: string;
26
13
  }
@@ -48,6 +35,11 @@ export interface TearsheetProps extends PropsWithChildren {
48
35
  * An optional class or classes to be added to the outermost element.
49
36
  */
50
37
  className?: string;
38
+ /**
39
+ * The accessibility title for the close icon (if shown).
40
+ *
41
+ */
42
+ closeIconDescription?: string;
51
43
  /**
52
44
  * A description of the flow, displayed in the header area of the tearsheet.
53
45
  */
@@ -145,7 +137,7 @@ export interface TearsheetProps extends PropsWithChildren {
145
137
  * panel on either the left or right side, the main content area, and a set of
146
138
  * action buttons.
147
139
  */
148
- export declare let Tearsheet: React.ForwardRefExoticComponent<(TearsheetProps & CloseIconDescriptionTypes) & React.RefAttributes<HTMLDivElement>>;
140
+ export declare let Tearsheet: React.ForwardRefExoticComponent<TearsheetProps & React.RefAttributes<HTMLDivElement>>;
149
141
  export declare const deprecatedProps: {
150
142
  /**
151
143
  * **Deprecated**
@@ -21,14 +21,6 @@ var _excluded = ["influencerPosition", "influencerWidth"];
21
21
  var componentName = 'Tearsheet';
22
22
 
23
23
  // NOTE: the component SCSS is not imported here: it is rolled up separately.
24
-
25
- /**
26
- * The accessibility title for the close icon (if shown).
27
- *
28
- * **Note:** This prop is only required if a close icon is shown, i.e. if
29
- * there are a no navigation actions and/or hasCloseIcon is true.
30
- */
31
-
32
24
  // The types and DocGen commentary for the component props,
33
25
  // in alphabetical order (for consistency).
34
26
  // See https://www.npmjs.com/package/prop-types#usage.
@@ -124,15 +116,8 @@ exports.Tearsheet.propTypes = _rollupPluginBabelHelpers.objectSpread2({
124
116
  /**
125
117
  * The accessibility title for the close icon (if shown).
126
118
  *
127
- * **Note:** This prop is only required if a close icon is shown, i.e. if
128
- * there are a no navigation actions and/or hasCloseIcon is true.
129
119
  */
130
- /**@ts-ignore */
131
- closeIconDescription: index.default.string.isRequired.if(function (_ref2) {
132
- var actions = _ref2.actions,
133
- hasCloseIcon = _ref2.hasCloseIcon;
134
- return TearsheetShell.tearsheetHasCloseIcon(actions, hasCloseIcon);
135
- }),
120
+ closeIconDescription: index.default.string,
136
121
  /**
137
122
  * A description of the flow, displayed in the header area of the tearsheet.
138
123
  */
@@ -145,7 +130,6 @@ exports.Tearsheet.propTypes = _rollupPluginBabelHelpers.objectSpread2({
145
130
  * tearsheet"), and that behavior can be overridden if required by setting
146
131
  * this prop to either true or false.
147
132
  */
148
- /**@ts-ignore */
149
133
  hasCloseIcon: index.default.bool,
150
134
  /**
151
135
  * The content for the header actions area, displayed alongside the title in
@@ -6,10 +6,9 @@
6
6
  */
7
7
  /// <reference path="../../../src/custom-typings/index.d.ts" />
8
8
  import { ButtonProps } from '@carbon/react';
9
- import { CloseIconDescriptionTypes } from './TearsheetShell';
10
9
  import React, { PropsWithChildren, ReactNode } from 'react';
11
10
  import PropTypes from 'prop-types';
12
- interface TearsheetNarrowBaseProps extends PropsWithChildren {
11
+ export interface TearsheetNarrowProps extends PropsWithChildren {
13
12
  /**
14
13
  * The navigation actions to be shown as buttons in the action area at the
15
14
  * bottom of the tearsheet. Each action is specified as an object with
@@ -33,6 +32,11 @@ interface TearsheetNarrowBaseProps extends PropsWithChildren {
33
32
  * An optional class or classes to be added to the outermost element.
34
33
  */
35
34
  className?: string;
35
+ /**
36
+ * The accessibility title for the close icon (if shown).
37
+ *
38
+ */
39
+ closeIconDescription?: string;
36
40
  /**
37
41
  * A description of the flow, displayed in the header area of the tearsheet.
38
42
  */
@@ -90,7 +94,6 @@ interface TearsheetNarrowBaseProps extends PropsWithChildren {
90
94
  */
91
95
  verticalPosition?: 'normal' | 'lower';
92
96
  }
93
- export type TearsheetNarrowProps = TearsheetNarrowBaseProps & CloseIconDescriptionTypes;
94
97
  /**
95
98
  * A narrow tearsheet is a slimmer variant of the tearsheet, providing a dialog
96
99
  * that keeps users in-context and focused by bringing actionable content front
@@ -112,4 +115,3 @@ export declare const deprecatedProps: {
112
115
  */
113
116
  verticalPosition: PropTypes.Requireable<string>;
114
117
  };
115
- export {};
@@ -109,15 +109,8 @@ exports.TearsheetNarrow.propTypes = _rollupPluginBabelHelpers.objectSpread2({
109
109
  /**
110
110
  * The accessibility title for the close icon (if shown).
111
111
  *
112
- * **Note:** This prop is only required if a close icon is shown, i.e. if
113
- * there are a no navigation actions and/or hasCloseIcon is true.
114
112
  */
115
- /**@ts-ignore */
116
- closeIconDescription: index.default.string.isRequired.if(function (_ref2) {
117
- var actions = _ref2.actions,
118
- hasCloseIcon = _ref2.hasCloseIcon;
119
- return TearsheetShell.tearsheetHasCloseIcon(actions, hasCloseIcon);
120
- }),
113
+ closeIconDescription: index.default.string,
121
114
  /**
122
115
  * A description of the flow, displayed in the header area of the tearsheet.
123
116
  */
@@ -128,7 +121,6 @@ exports.TearsheetNarrow.propTypes = _rollupPluginBabelHelpers.objectSpread2({
128
121
  * the tearsheet is read-only or has no navigation actions (sometimes called
129
122
  * a "passive tearsheet").
130
123
  */
131
- /**@ts-ignore*/
132
124
  hasCloseIcon: index.default.bool,
133
125
  /**
134
126
  * A label for the tearsheet, displayed in the header area of the tearsheet
@@ -14,6 +14,13 @@ interface TearsheetShellProps extends PropsWithChildren {
14
14
  * An optional class or classes to be added to the outermost element.
15
15
  */
16
16
  className?: string;
17
+ /**
18
+ * The accessibility title for the close icon (if shown).
19
+ *
20
+ * **Note:** This prop is only required if a close icon is shown, i.e. if
21
+ * there are a no navigation actions and/or hasCloseIcon is true.
22
+ */
23
+ closeIconDescription?: string;
17
24
  /**
18
25
  * Used to track the current step on components which use `StepsContext` and `TearsheetShell`
19
26
  */
@@ -118,13 +125,6 @@ interface TearsheetShellProps extends PropsWithChildren {
118
125
  */
119
126
  slug?: ReactNode;
120
127
  }
121
- export type CloseIconDescriptionTypes = {
122
- hasCloseIcon?: false;
123
- closeIconDescription?: string;
124
- } | {
125
- hasCloseIcon: true;
126
- closeIconDescription: string;
127
- };
128
128
  export declare const tearsheetShellWideProps: string[];
129
129
  export declare const tearsheetIsPassive: (actions: any) => boolean;
130
130
  export declare const tearsheetHasCloseIcon: (actions: any, hasCloseIcon: any) => any;
@@ -135,7 +135,7 @@ export declare const tearsheetHasCloseIcon: (actions: any, hasCloseIcon: any) =>
135
135
  *
136
136
  * See the canvas tab for the component API details.
137
137
  * */
138
- export declare const TearsheetShell: React.ForwardRefExoticComponent<(TearsheetShellProps & CloseIconDescriptionTypes) & React.RefAttributes<HTMLDivElement>>;
138
+ export declare const TearsheetShell: React.ForwardRefExoticComponent<TearsheetShellProps & React.RefAttributes<HTMLDivElement>>;
139
139
  export declare const portalType: PropTypes.Requireable<object>;
140
140
  export declare const deprecatedProps: {
141
141
  /**