@carbon/ibm-products 2.43.2-canary.96 → 2.43.2-canary.99

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.
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, objectSpread2 as _objectSpread2, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { useRef, useState, useCallback, useEffect } from 'react';
9
+ import React__default, { forwardRef, useRef, useState, useCallback, useEffect, createElement } from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import cx from 'classnames';
12
12
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
@@ -18,52 +18,36 @@ import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
18
18
  import { TagOverflowPopover } from './TagOverflowPopover.js';
19
19
  import { TagOverflowModal } from './TagOverflowModal.js';
20
20
 
21
- var _excluded = ["items", "tagComponent", "align", "showAllTagsLabel", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTarget", "allTagsModalTitle", "className", "containingElementRef", "measurementOffset", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowType", "onOverflowTagChange"],
21
+ var _excluded = ["align", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "allTagsModalTarget", "allTagsModalTitle", "className", "containingElementRef", "items", "maxVisible", "measurementOffset", "multiline", "overflowAlign", "overflowClassName", "overflowType", "onOverflowTagChange", "showAllTagsLabel", "tagComponent"],
22
22
  _excluded2 = ["className", "id"],
23
23
  _excluded3 = ["tagType"],
24
24
  _excluded4 = ["id", "label", "tagType", "onClose"];
25
25
  var blockClass = "".concat(pkg.prefix, "--tag-overflow");
26
26
  var componentName = 'TagOverflow';
27
27
  var allTagsModalSearchThreshold = 10;
28
-
29
- // Default values for props
30
- var defaults = {
31
- items: [],
32
- align: 'start',
33
- measurementOffset: 0,
34
- overflowAlign: 'bottom',
35
- overflowType: 'default',
36
- onOverflowTagChange: function onOverflowTagChange() {}
37
- };
38
-
39
- /**
40
- * TODO: A description of the component.
41
- */
42
- var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
43
- var _ref$items = _ref.items,
44
- items = _ref$items === void 0 ? defaults.items : _ref$items,
45
- tagComponent = _ref.tagComponent,
46
- _ref$align = _ref.align,
47
- align = _ref$align === void 0 ? defaults.align : _ref$align,
48
- showAllTagsLabel = _ref.showAllTagsLabel,
49
- allTagsModalSearchLabel = _ref.allTagsModalSearchLabel,
50
- allTagsModalSearchPlaceholderText = _ref.allTagsModalSearchPlaceholderText,
51
- allTagsModalTarget = _ref.allTagsModalTarget,
52
- allTagsModalTitle = _ref.allTagsModalTitle,
53
- className = _ref.className,
54
- containingElementRef = _ref.containingElementRef,
55
- _ref$measurementOffse = _ref.measurementOffset,
56
- measurementOffset = _ref$measurementOffse === void 0 ? defaults.measurementOffset : _ref$measurementOffse,
57
- maxVisible = _ref.maxVisible,
58
- multiline = _ref.multiline,
59
- _ref$overflowAlign = _ref.overflowAlign,
60
- overflowAlign = _ref$overflowAlign === void 0 ? defaults.overflowAlign : _ref$overflowAlign,
61
- overflowClassName = _ref.overflowClassName,
62
- _ref$overflowType = _ref.overflowType,
63
- overflowType = _ref$overflowType === void 0 ? defaults.overflowType : _ref$overflowType,
64
- _ref$onOverflowTagCha = _ref.onOverflowTagChange,
65
- onOverflowTagChange = _ref$onOverflowTagCha === void 0 ? defaults.onOverflowTagChange : _ref$onOverflowTagCha,
66
- rest = _objectWithoutProperties(_ref, _excluded);
28
+ var TagOverflow = /*#__PURE__*/forwardRef(function (props, ref) {
29
+ var _props$align = props.align,
30
+ align = _props$align === void 0 ? 'start' : _props$align,
31
+ allTagsModalSearchLabel = props.allTagsModalSearchLabel,
32
+ allTagsModalSearchPlaceholderText = props.allTagsModalSearchPlaceholderText,
33
+ allTagsModalTarget = props.allTagsModalTarget,
34
+ allTagsModalTitle = props.allTagsModalTitle,
35
+ className = props.className,
36
+ containingElementRef = props.containingElementRef,
37
+ items = props.items,
38
+ maxVisible = props.maxVisible,
39
+ _props$measurementOff = props.measurementOffset,
40
+ measurementOffset = _props$measurementOff === void 0 ? 0 : _props$measurementOff,
41
+ multiline = props.multiline,
42
+ _props$overflowAlign = props.overflowAlign,
43
+ overflowAlign = _props$overflowAlign === void 0 ? 'bottom' : _props$overflowAlign,
44
+ overflowClassName = props.overflowClassName,
45
+ _props$overflowType = props.overflowType,
46
+ overflowType = _props$overflowType === void 0 ? 'default' : _props$overflowType,
47
+ onOverflowTagChange = props.onOverflowTagChange,
48
+ showAllTagsLabel = props.showAllTagsLabel,
49
+ tagComponent = props.tagComponent,
50
+ rest = _objectWithoutProperties(props, _excluded);
67
51
  var localContainerRef = useRef(null);
68
52
  var containerRef = ref || localContainerRef;
69
53
  var itemRefs = useRef(null);
@@ -100,7 +84,9 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
100
84
  setShowAllModalOpen(false);
101
85
  };
102
86
  var handleResize = function handleResize() {
103
- setContainerWidth(resizeElm.current.offsetWidth);
87
+ if (typeof resizeElm !== 'function' && resizeElm.current) {
88
+ setContainerWidth(resizeElm.current.offsetWidth);
89
+ }
104
90
  };
105
91
  useResizeObserver(resizeElm, handleResize);
106
92
  var getMap = function getMap() {
@@ -116,7 +102,6 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
116
102
  }
117
103
  };
118
104
  var getVisibleItems = useCallback(function () {
119
- var _overflowRef$current;
120
105
  if (!itemRefs.current) {
121
106
  return items;
122
107
  }
@@ -128,13 +113,13 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
128
113
  var optionalContainingElement = containingElementRef === null || containingElementRef === void 0 ? void 0 : containingElementRef.current;
129
114
  var measurementOffsetValue = typeof measurementOffset === 'number' ? measurementOffset : 0;
130
115
  var spaceAvailable = optionalContainingElement ? optionalContainingElement.offsetWidth - measurementOffsetValue : containerWidth;
131
- var overflowContainerWidth = ((_overflowRef$current = overflowRef.current) === null || _overflowRef$current === void 0 ? void 0 : _overflowRef$current.offsetWidth) > overflowIndicatorWidth ? overflowRef.current.offsetWidth : overflowIndicatorWidth;
116
+ var overflowContainerWidth = overflowRef && overflowRef.current && overflowRef.current.offsetWidth > overflowIndicatorWidth ? overflowRef.current.offsetWidth : overflowIndicatorWidth;
132
117
  var maxWidth = spaceAvailable - overflowContainerWidth;
133
118
  var childrenWidth = 0;
134
119
  var maxReached = false;
135
120
  return items.reduce(function (prev, cur) {
136
121
  if (!maxReached) {
137
- var itemWidth = map.get(cur.id) + itemOffset;
122
+ var itemWidth = (map ? Number(map.get(cur.id)) : 0) + itemOffset;
138
123
  var fits = itemWidth + childrenWidth < maxWidth;
139
124
  if (fits) {
140
125
  childrenWidth += itemWidth;
@@ -145,12 +130,13 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
145
130
  }
146
131
  return prev;
147
132
  }, []);
148
- }, [itemRefs, overflowRef, containerWidth, items, multiline, maxVisible, containingElementRef, measurementOffset]);
149
- var getCustomComponent = function getCustomComponent(item) {
133
+ }, [containerWidth, containingElementRef, items, maxVisible, measurementOffset, multiline]);
134
+ var getCustomComponent = function getCustomComponent(item, tagComponent) {
150
135
  var className = item.className,
151
136
  id = item.id,
152
137
  other = _objectWithoutProperties(item, _excluded2);
153
- return /*#__PURE__*/React__default.createElement(tagComponent, _objectSpread2(_objectSpread2({}, other), {}, {
138
+ return /*#__PURE__*/createElement(tagComponent, _objectSpread2(_objectSpread2({}, other), {}, {
139
+ key: id,
154
140
  className: cx("".concat(blockClass, "__item"), className),
155
141
  ref: function ref(node) {
156
142
  return itemRefHandler(id, node);
@@ -164,9 +150,9 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
164
150
  visibleItemsArr = (_visibleItemsArr = visibleItemsArr) === null || _visibleItemsArr === void 0 ? void 0 : _visibleItemsArr.slice(0, maxVisible);
165
151
  }
166
152
  var hiddenItems = items === null || items === void 0 ? void 0 : items.slice(visibleItemsArr.length);
167
- var overflowItemsArr = hiddenItems === null || hiddenItems === void 0 ? void 0 : hiddenItems.map(function (_ref2) {
168
- var tagType = _ref2.tagType,
169
- other = _objectWithoutProperties(_ref2, _excluded3);
153
+ var overflowItemsArr = hiddenItems === null || hiddenItems === void 0 ? void 0 : hiddenItems.map(function (_ref) {
154
+ var tagType = _ref.tagType,
155
+ other = _objectWithoutProperties(_ref, _excluded3);
170
156
  return _objectSpread2({
171
157
  type: tagType
172
158
  }, other);
@@ -174,10 +160,10 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
174
160
  setVisibleItems(visibleItemsArr);
175
161
  setOverflowItems(overflowItemsArr);
176
162
  onOverflowTagChange === null || onOverflowTagChange === void 0 || onOverflowTagChange(overflowItemsArr);
177
- }, [containerWidth, items, maxVisible, getVisibleItems, onOverflowTagChange]);
163
+ }, [getVisibleItems, items, maxVisible, onOverflowTagChange]);
178
164
  var handleTagOnClose = useCallback(function (onClose, index) {
179
165
  onClose === null || onClose === void 0 || onClose();
180
- if (index <= visibleItems.length - 1) {
166
+ if (index <= (visibleItems === null || visibleItems === void 0 ? void 0 : visibleItems.length) - 1) {
181
167
  setPopoverOpen(false);
182
168
  }
183
169
  }, [visibleItems]);
@@ -185,10 +171,10 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
185
171
  className: cx(blockClass, className, "".concat(blockClass, "--align-").concat(align), _defineProperty({}, "".concat(blockClass, "--multiline"), multiline)),
186
172
  ref: containerRef,
187
173
  role: "main"
188
- }, getDevtoolsProps(componentName)), visibleItems.length > 0 && visibleItems.map(function (item, index) {
174
+ }, getDevtoolsProps(componentName)), (visibleItems === null || visibleItems === void 0 ? void 0 : visibleItems.length) > 0 && visibleItems.map(function (item, index) {
189
175
  // Render custom components
190
176
  if (tagComponent) {
191
- return getCustomComponent(item);
177
+ return getCustomComponent(item, tagComponent);
192
178
  } else {
193
179
  var id = item.id,
194
180
  label = item.label,
@@ -215,7 +201,7 @@ var TagOverflow = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
215
201
  }), /*#__PURE__*/React__default.createElement("span", {
216
202
  className: "".concat(blockClass, "__indicator"),
217
203
  ref: overflowRef
218
- }, overflowItems.length > 0 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TagOverflowPopover, {
204
+ }, (overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length) > 0 && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TagOverflowPopover, {
219
205
  allTagsModalSearchThreshold: allTagsModalSearchThreshold,
220
206
  className: overflowClassName,
221
207
  onShowAllClick: handleShowAllClick,
@@ -251,9 +237,9 @@ var tagTypes = Object.keys(TYPES);
251
237
  * The strings shown in the showAllModal are only shown if we have more than allTagsModalSearchLThreshold
252
238
  * @returns null if no problems
253
239
  */
254
- var string_required_if_more_than_10_tags = isRequiredIf(PropTypes.string, function (_ref3) {
255
- var items = _ref3.items;
256
- return items && items.length > allTagsModalSearchThreshold;
240
+ var string_required_if_more_than_10_tags = isRequiredIf(PropTypes.string, function (_ref2) {
241
+ var items = _ref2.items;
242
+ return (items === null || items === void 0 ? void 0 : items.length) > allTagsModalSearchThreshold;
257
243
  });
258
244
 
259
245
  // The types and DocGen commentary for the component props,
@@ -284,11 +270,6 @@ TagOverflow.propTypes = {
284
270
  * Provide an optional class to be applied to the containing node.
285
271
  */
286
272
  className: PropTypes.string,
287
- /**
288
- * Optional ref for custom resize container to measure available space
289
- * Default will measure the available space of the TagSet container itself.
290
- */
291
- containingElementRef: PropTypes.object,
292
273
  /**
293
274
  * The items to be shown in the TagOverflow. Each item is specified as an object with properties:
294
275
  * **label**\* (required) to supply the content,
@@ -299,6 +280,7 @@ TagOverflow.propTypes = {
299
280
  * If you want to render a custom component, pass it as tagComponent prop and
300
281
  * then pass the props required for your custom component as the properties of item object
301
282
  */
283
+ //@ts-ignore
302
284
  items: PropTypes.arrayOf(PropTypes.shape({
303
285
  id: PropTypes.string.isRequired,
304
286
  label: PropTypes.string.isRequired,
@@ -342,6 +324,7 @@ TagOverflow.propTypes = {
342
324
  /** Component definition of the items to be rendered inside TagOverflow.
343
325
  * If this is not passed, items will be rendered as Tag component
344
326
  */
327
+ //@ts-ignore
345
328
  tagComponent: PropTypes.elementType
346
329
  };
347
330
 
@@ -14,8 +14,7 @@ import { pkg } from '../../settings.js';
14
14
  import { prepareProps } from '../../global/js/utils/props-helper.js';
15
15
  import { usePortalTarget } from '../../global/js/hooks/usePortalTarget.js';
16
16
 
17
- var _excluded = ["allTags", "className", "title", "onClose", "open", "overflowType", "portalTarget", "searchLabel", "searchPlaceholder"],
18
- _excluded2 = ["label", "id", "filter"];
17
+ var _excluded = ["allTags", "className", "title", "onClose", "open", "overflowType", "portalTarget", "searchLabel", "searchPlaceholder"];
19
18
  var componentName = 'TagOverflowModal';
20
19
  var blockClass = "".concat(pkg.prefix, "--tag-overflow-modal");
21
20
 
@@ -77,13 +76,12 @@ var TagOverflowModal = function TagOverflowModal(_ref) {
77
76
  }, getFilteredItems().map(function (_ref2) {
78
77
  var label = _ref2.label,
79
78
  id = _ref2.id,
80
- filter = _ref2.filter,
81
- other = _objectWithoutProperties(_ref2, _excluded2);
79
+ filter = _ref2.filter;
82
80
  var isFilterable = overflowType === 'tag' ? filter : false;
83
- return /*#__PURE__*/React__default.createElement(Tag, _extends({}, other, {
81
+ return /*#__PURE__*/React__default.createElement(Tag, {
84
82
  key: id,
85
83
  filter: isFilterable
86
- }), label);
84
+ }, label);
87
85
  })), /*#__PURE__*/React__default.createElement("div", {
88
86
  className: "".concat(blockClass, "__fade")
89
87
  })));
@@ -1,2 +1,14 @@
1
- export const TagOverflowPopover: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
1
  import React from 'react';
2
+ import { TagOverflowItem } from './TagOverflow';
3
+ export interface Props {
4
+ allTagsModalSearchThreshold?: number;
5
+ className?: string;
6
+ onShowAllClick: () => void;
7
+ overflowAlign?: string;
8
+ overflowTags: TagOverflowItem[];
9
+ overflowType?: string;
10
+ popoverOpen?: boolean;
11
+ setPopoverOpen?: (x: boolean) => void;
12
+ showAllTagsLabel?: string;
13
+ }
14
+ export declare const TagOverflowPopover: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import { objectWithoutProperties as _objectWithoutProperties, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
- import React__default, { useRef } from 'react';
9
+ import React__default, { forwardRef, useRef } from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import cx from 'classnames';
12
12
  import { Popover, Tag, PopoverContent, Link } from '@carbon/react';
@@ -17,52 +17,48 @@ var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "
17
17
  _excluded2 = ["label", "id", "tagType", "filter", "onClose"];
18
18
  var componentName = 'TagOverflowPopover';
19
19
  var blockClass = "".concat(pkg.prefix, "--tag-overflow-popover");
20
-
21
- // Default values for props
22
- var defaults = {
23
- allTagsModalSearchThreshold: 10,
24
- overflowAlign: 'bottom'
25
- };
26
- var TagOverflowPopover = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
27
- var _ref$allTagsModalSear = _ref.allTagsModalSearchThreshold,
28
- allTagsModalSearchThreshold = _ref$allTagsModalSear === void 0 ? defaults.allTagsModalSearchThreshold : _ref$allTagsModalSear,
29
- className = _ref.className,
30
- onShowAllClick = _ref.onShowAllClick,
31
- _ref$overflowAlign = _ref.overflowAlign,
32
- overflowAlign = _ref$overflowAlign === void 0 ? defaults.overflowAlign : _ref$overflowAlign,
33
- overflowTags = _ref.overflowTags,
34
- overflowType = _ref.overflowType,
35
- showAllTagsLabel = _ref.showAllTagsLabel,
36
- popoverOpen = _ref.popoverOpen,
37
- setPopoverOpen = _ref.setPopoverOpen,
38
- rest = _objectWithoutProperties(_ref, _excluded);
39
- var localRef = useRef();
20
+ var TagOverflowPopover = /*#__PURE__*/forwardRef(function (props, ref) {
21
+ var _overflowTags$length;
22
+ var allTagsModalSearchThreshold = props.allTagsModalSearchThreshold,
23
+ className = props.className,
24
+ onShowAllClick = props.onShowAllClick,
25
+ overflowAlign = props.overflowAlign,
26
+ overflowTags = props.overflowTags,
27
+ overflowType = props.overflowType,
28
+ showAllTagsLabel = props.showAllTagsLabel,
29
+ popoverOpen = props.popoverOpen,
30
+ setPopoverOpen = props.setPopoverOpen,
31
+ rest = _objectWithoutProperties(props, _excluded);
32
+ var localRef = useRef(null);
40
33
  var overflowTagContent = useRef(null);
41
34
  useClickOutside(ref || localRef, function () {
42
35
  if (popoverOpen) {
43
- setPopoverOpen(false);
36
+ setPopoverOpen === null || setPopoverOpen === void 0 || setPopoverOpen(false);
44
37
  }
45
38
  });
46
39
  var handleShowAllTagsClick = function handleShowAllTagsClick(evt) {
47
40
  evt.stopPropagation();
48
41
  evt.preventDefault();
49
- setPopoverOpen(false);
50
- onShowAllClick();
42
+ setPopoverOpen === null || setPopoverOpen === void 0 || setPopoverOpen(false);
43
+ onShowAllClick === null || onShowAllClick === void 0 || onShowAllClick();
51
44
  };
52
- var handleEscKeyPress = function handleEscKeyPress(event) {
53
- var key = event.key;
45
+ var handleEscKeyPress = function handleEscKeyPress(evt) {
46
+ var key = evt.key;
54
47
  if (key === 'Escape') {
55
- setPopoverOpen(false);
48
+ setPopoverOpen === null || setPopoverOpen === void 0 || setPopoverOpen(false);
56
49
  }
57
50
  };
58
51
  var getOverflowPopoverItems = function getOverflowPopoverItems() {
59
- return overflowTags.filter(function (_, index) {
60
- return overflowTags.length > allTagsModalSearchThreshold ? index < allTagsModalSearchThreshold : index <= allTagsModalSearchThreshold;
52
+ var thresh = allTagsModalSearchThreshold !== null && allTagsModalSearchThreshold !== void 0 ? allTagsModalSearchThreshold : 0;
53
+ return overflowTags === null || overflowTags === void 0 ? void 0 : overflowTags.filter(function (_, index) {
54
+ return (overflowTags === null || overflowTags === void 0 ? void 0 : overflowTags.length) > thresh ? index < thresh : index <= thresh;
61
55
  });
62
56
  };
57
+ var visibleItems = getOverflowPopoverItems();
58
+ var hasItems = (visibleItems === null || visibleItems === void 0 ? void 0 : visibleItems.length) > 0;
63
59
  return /*#__PURE__*/React__default.createElement("span", _extends({}, rest, {
64
- "aria-hidden": overflowTags.length === 0,
65
- className: cx(blockClass, _defineProperty({}, "".concat(blockClass, "--hidden"), overflowTags.length === 0)),
60
+ "aria-hidden": (overflowTags === null || overflowTags === void 0 ? void 0 : overflowTags.length) === 0,
61
+ className: cx(blockClass, _defineProperty({}, "".concat(blockClass, "--hidden"), (overflowTags === null || overflowTags === void 0 ? void 0 : overflowTags.length) === 0)),
66
62
  ref: ref || localRef
67
63
  }), /*#__PURE__*/React__default.createElement(Popover, {
68
64
  align: overflowAlign,
@@ -73,21 +69,21 @@ var TagOverflowPopover = /*#__PURE__*/React__default.forwardRef(function (_ref,
73
69
  open: popoverOpen
74
70
  }, /*#__PURE__*/React__default.createElement(Tag, {
75
71
  onClick: function onClick() {
76
- return setPopoverOpen(!popoverOpen);
72
+ return setPopoverOpen === null || setPopoverOpen === void 0 ? void 0 : setPopoverOpen(!popoverOpen);
77
73
  },
78
74
  className: cx("".concat(blockClass, "__trigger"))
79
- }, "+", overflowTags.length), /*#__PURE__*/React__default.createElement(PopoverContent, null, /*#__PURE__*/React__default.createElement("div", {
75
+ }, "+", overflowTags === null || overflowTags === void 0 ? void 0 : overflowTags.length), /*#__PURE__*/React__default.createElement(PopoverContent, null, /*#__PURE__*/React__default.createElement("div", {
80
76
  ref: overflowTagContent,
81
77
  className: "".concat(blockClass, "__content")
82
78
  }, /*#__PURE__*/React__default.createElement("ul", {
83
79
  className: "".concat(blockClass, "__tag-list")
84
- }, getOverflowPopoverItems().map(function (_ref2) {
85
- var label = _ref2.label,
86
- id = _ref2.id,
87
- tagType = _ref2.tagType,
88
- filter = _ref2.filter,
89
- _onClose = _ref2.onClose,
90
- other = _objectWithoutProperties(_ref2, _excluded2);
80
+ }, hasItems && visibleItems.map(function (_ref) {
81
+ var label = _ref.label,
82
+ id = _ref.id,
83
+ tagType = _ref.tagType,
84
+ filter = _ref.filter,
85
+ _onClose = _ref.onClose,
86
+ other = _objectWithoutProperties(_ref, _excluded2);
91
87
  var typeValue = overflowType === 'tag' ? 'high-contrast' : tagType;
92
88
  var isFilterable = overflowType === 'tag' ? filter : false;
93
89
  return /*#__PURE__*/React__default.createElement("li", {
@@ -100,7 +96,7 @@ var TagOverflowPopover = /*#__PURE__*/React__default.forwardRef(function (_ref,
100
96
  type: typeValue,
101
97
  filter: isFilterable
102
98
  }), label) : label);
103
- })), overflowTags.length > allTagsModalSearchThreshold && /*#__PURE__*/React__default.createElement(Link, {
99
+ })), ((_overflowTags$length = overflowTags === null || overflowTags === void 0 ? void 0 : overflowTags.length) !== null && _overflowTags$length !== void 0 ? _overflowTags$length : 0) > (allTagsModalSearchThreshold !== null && allTagsModalSearchThreshold !== void 0 ? allTagsModalSearchThreshold : 0) && /*#__PURE__*/React__default.createElement(Link, {
104
100
  className: "".concat(blockClass, "__show-all-tags-link"),
105
101
  href: "",
106
102
  onClick: handleShowAllTagsClick,
@@ -128,6 +124,7 @@ TagOverflowPopover.propTypes = {
128
124
  /**
129
125
  * tags shown in overflow
130
126
  */
127
+ //@ts-ignore
131
128
  overflowTags: PropTypes.arrayOf(PropTypes.object).isRequired,
132
129
  /**
133
130
  * Type of rendering displayed inside of the tag overflow component
@@ -1,10 +1,41 @@
1
1
  /**
2
- * TODO: A description of the component.
2
+ * Copyright IBM Corp. 2024, 2024
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
3
6
  */
4
- export let TagOverflow: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
7
+ import React, { RefObject, ReactNode } from 'react';
8
+ export interface TagOverflowItem {
9
+ className?: string;
10
+ filter?: string;
11
+ id: string;
12
+ label: string;
13
+ onClose: () => void;
14
+ tagType?: 'red' | 'magenta' | 'purple' | 'blue' | 'cyan' | 'teal' | 'green' | 'gray' | 'cool-gray' | 'warm-gray' | 'high-contrast' | 'outline';
15
+ type?: string;
16
+ }
17
+ export interface Props {
18
+ align?: 'start' | 'center' | 'end';
19
+ allTagsModalSearchLabel?: string;
20
+ allTagsModalSearchPlaceholderText?: string;
21
+ allTagsModalTarget?: ReactNode;
22
+ allTagsModalTitle?: string;
23
+ className?: string;
24
+ containingElementRef?: RefObject<HTMLElement>;
25
+ items: TagOverflowItem[];
26
+ maxVisible?: number;
27
+ measurementOffset?: number;
28
+ multiline?: boolean;
29
+ overflowAlign?: 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top';
30
+ overflowClassName?: string;
31
+ overflowType?: 'default' | 'tag';
32
+ onOverflowTagChange?: (arr: TagOverflowItem[]) => void;
33
+ showAllTagsLabel?: string;
34
+ tagComponent?: string;
35
+ }
36
+ export declare let TagOverflow: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
5
37
  /**
6
38
  * The strings shown in the showAllModal are only shown if we have more than allTagsModalSearchLThreshold
7
39
  * @returns null if no problems
8
40
  */
9
- export const string_required_if_more_than_10_tags: (props: any, propName: any, componentName: any, location: any, propFullName: any, secret: any) => any;
10
- import React from 'react';
41
+ export declare const string_required_if_more_than_10_tags: (props: any, propName: any, componentName: any, location: any, propFullName: any, secret: any) => any;