@carbon/ibm-products 2.38.0-alpha.5 → 2.38.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. package/css/index-without-carbon-released-only.css +218 -0
  2. package/css/index-without-carbon-released-only.css.map +1 -1
  3. package/css/index-without-carbon-released-only.min.css +1 -1
  4. package/css/index-without-carbon-released-only.min.css.map +1 -1
  5. package/css/index.css +218 -0
  6. package/css/index.css.map +1 -1
  7. package/css/index.min.css +1 -1
  8. package/css/index.min.css.map +1 -1
  9. package/es/components/ActionSet/ActionSet.js +3 -2
  10. package/es/components/Checklist/Checklist.js +10 -10
  11. package/es/components/Checklist/ChecklistChart.d.ts +1 -1
  12. package/es/components/Checklist/ChecklistChart.js +6 -30
  13. package/es/components/Coachmark/Coachmark.d.ts +65 -2
  14. package/es/components/Coachmark/Coachmark.js +7 -10
  15. package/es/components/Coachmark/CoachmarkDragbar.d.ts +40 -2
  16. package/es/components/Coachmark/CoachmarkDragbar.js +3 -1
  17. package/es/components/Coachmark/CoachmarkHeader.d.ts +27 -2
  18. package/es/components/Coachmark/CoachmarkHeader.js +0 -1
  19. package/es/components/Coachmark/CoachmarkOverlay.d.ts +42 -2
  20. package/es/components/Coachmark/CoachmarkOverlay.js +18 -15
  21. package/es/components/Coachmark/CoachmarkTagline.d.ts +27 -2
  22. package/es/components/Coachmark/CoachmarkTagline.js +0 -1
  23. package/es/components/Coachmark/utils/enums.d.ts +20 -20
  24. package/es/components/Coachmark/utils/enums.js +22 -20
  25. package/es/components/CoachmarkFixed/CoachmarkFixed.d.ts +42 -2
  26. package/es/components/CoachmarkFixed/CoachmarkFixed.js +4 -2
  27. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +2 -1
  28. package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +25 -23
  29. package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
  30. package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +14 -24
  31. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +2 -0
  32. package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +4 -1
  33. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -3
  34. package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +11 -11
  35. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +5 -3
  36. package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +54 -44
  37. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +14 -8
  38. package/es/components/DataSpreadsheet/DataSpreadsheetHeader.js +5 -2
  39. package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +2 -1
  40. package/es/components/EditTearsheetNarrow/EditTearsheetNarrow.d.ts +19 -2
  41. package/es/components/SearchBar/SearchBar.d.ts +10 -1
  42. package/es/components/SearchBar/SearchBar.js +26 -20
  43. package/es/components/TagSet/TagSet.d.ts +87 -3
  44. package/es/components/TagSet/TagSet.js +20 -9
  45. package/es/components/TagSet/TagSetModal.d.ts +32 -26
  46. package/es/components/TagSet/TagSetModal.js +5 -5
  47. package/es/components/TagSet/TagSetOverflow.d.ts +45 -2
  48. package/es/components/TagSet/TagSetOverflow.js +14 -12
  49. package/es/components/WebTerminal/WebTerminal.js +2 -2
  50. package/es/components/WebTerminal/WebTerminalContentWrapper.d.ts +15 -2
  51. package/es/components/WebTerminal/hooks/index.d.ts +16 -11
  52. package/es/components/WebTerminal/hooks/index.js +1 -1
  53. package/es/global/js/package-settings.d.ts +1 -1
  54. package/es/global/js/package-settings.js +1 -1
  55. package/es/node_modules/@carbon/colors/es/index.js +4 -1
  56. package/es/settings.d.ts +1 -1
  57. package/lib/components/ActionSet/ActionSet.js +2 -1
  58. package/lib/components/Checklist/Checklist.js +10 -10
  59. package/lib/components/Checklist/ChecklistChart.d.ts +1 -1
  60. package/lib/components/Checklist/ChecklistChart.js +6 -30
  61. package/lib/components/Coachmark/Coachmark.d.ts +65 -2
  62. package/lib/components/Coachmark/Coachmark.js +6 -9
  63. package/lib/components/Coachmark/CoachmarkDragbar.d.ts +40 -2
  64. package/lib/components/Coachmark/CoachmarkDragbar.js +3 -1
  65. package/lib/components/Coachmark/CoachmarkHeader.d.ts +27 -2
  66. package/lib/components/Coachmark/CoachmarkHeader.js +0 -1
  67. package/lib/components/Coachmark/CoachmarkOverlay.d.ts +42 -2
  68. package/lib/components/Coachmark/CoachmarkOverlay.js +18 -15
  69. package/lib/components/Coachmark/CoachmarkTagline.d.ts +27 -2
  70. package/lib/components/Coachmark/CoachmarkTagline.js +0 -1
  71. package/lib/components/Coachmark/utils/enums.d.ts +20 -20
  72. package/lib/components/Coachmark/utils/enums.js +22 -20
  73. package/lib/components/CoachmarkFixed/CoachmarkFixed.d.ts +42 -2
  74. package/lib/components/CoachmarkFixed/CoachmarkFixed.js +4 -2
  75. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.d.ts +2 -1
  76. package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +25 -23
  77. package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +2 -2
  78. package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +13 -23
  79. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.d.ts +2 -0
  80. package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +4 -1
  81. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.d.ts +3 -3
  82. package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +11 -11
  83. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.d.ts +5 -3
  84. package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +54 -44
  85. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +13 -7
  86. package/lib/components/DataSpreadsheet/DataSpreadsheetHeader.js +5 -2
  87. package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +2 -1
  88. package/lib/components/EditTearsheetNarrow/EditTearsheetNarrow.d.ts +19 -2
  89. package/lib/components/SearchBar/SearchBar.d.ts +10 -1
  90. package/lib/components/SearchBar/SearchBar.js +26 -18
  91. package/lib/components/TagSet/TagSet.d.ts +87 -3
  92. package/lib/components/TagSet/TagSet.js +20 -9
  93. package/lib/components/TagSet/TagSetModal.d.ts +32 -26
  94. package/lib/components/TagSet/TagSetModal.js +3 -3
  95. package/lib/components/TagSet/TagSetOverflow.d.ts +45 -2
  96. package/lib/components/TagSet/TagSetOverflow.js +14 -12
  97. package/lib/components/WebTerminal/WebTerminal.js +2 -2
  98. package/lib/components/WebTerminal/WebTerminalContentWrapper.d.ts +15 -2
  99. package/lib/components/WebTerminal/hooks/index.d.ts +16 -11
  100. package/lib/components/WebTerminal/hooks/index.js +1 -1
  101. package/lib/global/js/package-settings.d.ts +1 -1
  102. package/lib/global/js/package-settings.js +1 -1
  103. package/lib/node_modules/@carbon/colors/es/index.js +6 -0
  104. package/lib/settings.d.ts +1 -1
  105. package/package.json +3 -3
  106. package/scss/components/Checklist/_carbon-imports.scss +2 -2
  107. package/scss/components/_index-released-only-with-carbon.scss +2 -1
  108. package/scss/components/_index-released-only.scss +2 -1
  109. package/scss/components/_index-with-carbon.scss +1 -0
  110. package/telemetry.yml +5 -8
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { slicedToArray as _slicedToArray, toConsumableArray as _toConsumableArray, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { slicedToArray as _slicedToArray, toConsumableArray as _toConsumableArray, extends as _extends, objectSpread2 as _objectSpread2, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { forwardRef, useState, useRef, useEffect, useCallback } from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import { FixedSizeList } from 'react-window';
@@ -19,6 +19,7 @@ import { checkActiveHeaderCell } from './utils/checkActiveHeaderCell.js';
19
19
  import { checkSelectedHeaderCell } from './utils/checkSelectedHeaderCell.js';
20
20
  import { getSpreadsheetWidth } from './utils/getSpreadsheetWidth.js';
21
21
  import { handleBodyCellClick, handleBodyCellHover, handleRowHeaderClick } from './utils/commonEventHandlers.js';
22
+ import { prepareProps } from '../../global/js/utils/props-helper.js';
22
23
  import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
23
24
  import { useSpreadsheetMouseUp } from './hooks/useSpreadsheetMouseUp.js';
24
25
 
@@ -195,10 +196,6 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
195
196
  }
196
197
  }
197
198
  }, [defaultColumn, ref, activeCellCoordinates, previousState === null || previousState === void 0 ? void 0 : previousState.rowHeight, selectionAreas, setActiveCellInsideSelectionArea, setSelectionAreas, visibleColumns]);
198
- //selectionAreas will be set when ever a selection area is made.
199
- useEffect(function () {
200
- removeDuplicateSelections();
201
- }, [selectionAreas, removeDuplicateSelections]);
202
199
 
203
200
  //this method will check for any duplicate selection area and remove.
204
201
  //same selections are those have the same height, width, top, left styles. These inline styles are being set in createCellSelection util.
@@ -237,6 +234,11 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
237
234
  }
238
235
  }, [ref, setSelectionAreas, setSelectionAreaData]);
239
236
 
237
+ //selectionAreas will be set when ever a selection area is made.
238
+ useEffect(function () {
239
+ removeDuplicateSelections();
240
+ }, [selectionAreas, removeDuplicateSelections]);
241
+
240
242
  // onClick fn for each cell in the data spreadsheet body,
241
243
  // adds the active cell highlight
242
244
 
@@ -299,9 +301,12 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
299
301
  var row = rows[index];
300
302
  if (rows && rows.length) {
301
303
  prepareRow(row);
302
- return /*#__PURE__*/React__default.createElement("div", _extends({}, row.getRowProps({
304
+ var rowProps = prepareProps(row.getRowProps({
303
305
  style: style
304
- }), {
306
+ }), 'key');
307
+ return /*#__PURE__*/React__default.createElement("div", _extends({
308
+ key: _objectSpread2({}, row.getRowProps().key)
309
+ }, rowProps, {
305
310
  className: cx("".concat(blockClass, "__tr")),
306
311
  "data-row-index": index,
307
312
  "aria-rowindex": index + 1,
@@ -322,10 +327,11 @@ var DataSpreadsheetBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
322
327
  }
323
328
  }, index + 1)), row.cells.map(function (cell, index) {
324
329
  var _cell$column;
330
+ var cellProps = prepareProps(cell.getCellProps(), 'key');
325
331
  return /*#__PURE__*/React__default.createElement("div", _extends({
326
332
  key: "cell_".concat(index),
327
333
  "aria-colindex": index + 1
328
- }, cell.getCellProps(), {
334
+ }, cellProps, {
329
335
  role: "gridcell",
330
336
  style: _objectSpread2(_objectSpread2({}, cell.getCellProps().style), {}, {
331
337
  display: 'grid',
@@ -17,6 +17,7 @@ import { handleHeaderCellSelection } from './utils/handleHeaderCellSelection.js'
17
17
  import { selectAllCells } from './utils/selectAllCells.js';
18
18
  import { getSpreadsheetWidth } from './utils/getSpreadsheetWidth.js';
19
19
  import { checkForHoldingKey } from './utils/checkForHoldingKey.js';
20
+ import { prepareProps } from '../../global/js/utils/props-helper.js';
20
21
  import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
21
22
  import { useSpreadsheetMouseMove } from './hooks/useSpreadsheetMouseMove.js';
22
23
 
@@ -134,9 +135,10 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
134
135
  className: cx("".concat(blockClass, "__header--container")),
135
136
  role: "rowgroup"
136
137
  }, headerGroups.map(function (headerGroup, index) {
138
+ var headerProps = prepareProps(headerGroup.getHeaderGroupProps(), 'key');
137
139
  return /*#__PURE__*/React__default.createElement("div", _extends({
138
140
  key: "header_".concat(index)
139
- }, headerGroup.getHeaderGroupProps(), {
141
+ }, headerProps, {
140
142
  style: _objectSpread2(_objectSpread2({}, headerGroup.getHeaderGroupProps().style), {}, {
141
143
  width: getSpreadsheetWidth({
142
144
  type: 'header',
@@ -166,12 +168,13 @@ var DataSpreadsheetHeader = /*#__PURE__*/forwardRef(function (_ref, ref) {
166
168
  onClick: handleSelectAllClick,
167
169
  className: cx("".concat(blockClass, "__th"), "".concat(blockClass, "--interactive-cell-element"), "".concat(blockClass, "__th--select-all"), _defineProperty({}, "".concat(blockClass, "__th--active-header"), (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column) === 'header' && (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header'))
168
170
  }, "\xA0")), headerGroup.headers.map(function (column, index) {
171
+ var colProps = prepareProps(column.getHeaderProps(), 'key');
169
172
  var selectedHeader = checkSelectedHeaderCell(index, selectionAreas, 'column', rows);
170
173
  return /*#__PURE__*/React__default.createElement("div", _extends({
171
174
  key: "column_".concat(index),
172
175
  role: "columnheader",
173
176
  className: "".concat(blockClass, "__columnheader")
174
- }, column.getHeaderProps()), /*#__PURE__*/React__default.createElement("button", {
177
+ }, colProps), /*#__PURE__*/React__default.createElement("button", {
175
178
  id: "".concat(blockClass, "__cell--header--").concat(index),
176
179
  "data-row-index": "header",
177
180
  "data-column-index": index,
@@ -15,12 +15,13 @@ var useMoveActiveCell = function useMoveActiveCell(_ref) {
15
15
  createActiveCell = _ref.createActiveCell,
16
16
  activeCellContent = _ref.activeCellContent,
17
17
  isActiveHeaderCellChanged = _ref.isActiveHeaderCellChanged;
18
+ var performCreateActiveCell;
18
19
  //new active cell is created when the activeCellContent changes or navigate through headers
19
20
  // Otherwise new active cell will display the old value in a glance
20
21
  useEffect(function () {
21
22
  performCreateActiveCell();
22
23
  }, [activeCellContent, performCreateActiveCell, isActiveHeaderCellChanged]);
23
- var performCreateActiveCell = useCallback(function () {
24
+ performCreateActiveCell = useCallback(function () {
24
25
  var activeCellPlacementElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"".concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row, "\"][data-column-index=\"").concat(activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.column, "\"]"));
25
26
  var shouldPlaceActiveCellInHeader = (activeCellCoordinates === null || activeCellCoordinates === void 0 ? void 0 : activeCellCoordinates.row) === 'header' && true;
26
27
  var selectAllElement = spreadsheetRef === null || spreadsheetRef === void 0 ? void 0 : spreadsheetRef.current.querySelector("[data-row-index=\"header\"][data-column-index=\"header\"]");
@@ -1,5 +1,22 @@
1
+ /**
2
+ * Copyright IBM Corp. 2022, 2022
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 React, { ReactNode } from 'react';
8
+ interface EditTearsheetNarrowProps {
9
+ /**
10
+ * Provide the contents of the EditTearsheetNarrow.
11
+ */
12
+ children: ReactNode;
13
+ /**
14
+ * Provide an optional class to be applied to the containing node.
15
+ */
16
+ className?: string;
17
+ }
1
18
  /**
2
19
  * Use a narrow tearsheet as an alternative to a modal when there is scrolling. See usage guidance for further information.
3
20
  */
4
- export let EditTearsheetNarrow: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
- import React from 'react';
21
+ export declare let EditTearsheetNarrow: React.ForwardRefExoticComponent<EditTearsheetNarrowProps & React.RefAttributes<HTMLDivElement>>;
22
+ export {};
@@ -5,6 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React, { PropsWithChildren } from 'react';
8
+ import PropTypes from 'prop-types';
8
9
  type Scopes = string[] | object[];
9
10
  interface SearchBarProps extends PropsWithChildren {
10
11
  /** @type {string} Optional additional class name. */
@@ -22,7 +23,7 @@ interface SearchBarProps extends PropsWithChildren {
22
23
  /** @type {Function} Function handler for when the user submits a search. */
23
24
  onSubmit?: (event: any) => void;
24
25
  /** @type {string} Placeholder text to be displayed in the search input. */
25
- placeHolderText: string;
26
+ placeholderText: string;
26
27
  /** @type {Function} Function to get the text for each scope to display in dropdown. */
27
28
  scopeToString?: () => void;
28
29
  /** @type {Array<any>} Array of allowed search scopes. */
@@ -50,4 +51,12 @@ interface SearchBarProps extends PropsWithChildren {
50
51
  }
51
52
  export declare let SearchBar: React.ForwardRefExoticComponent<SearchBarProps & React.RefAttributes<HTMLFormElement>>;
52
53
  declare const conditionalScopePropValidator: (props: any, propName: any, componentName: any, ...rest: any[]) => Error | null;
54
+ export declare const deprecatedProps: {
55
+ /**
56
+ * **Deprecated**
57
+ *
58
+ * Provide accessible label text for the scopes MultiSelect.
59
+ */
60
+ titleText: PropTypes.Requireable<string>;
61
+ };
53
62
  export {};
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, defineProperty as _defineProperty, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useState, useEffect } from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import cx from 'classnames';
@@ -13,7 +13,7 @@ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
13
  import { pkg } from '../../settings.js';
14
14
  import { MultiSelect, Search, Button } from '@carbon/react';
15
15
 
16
- var _excluded = ["className", "clearButtonLabelText", "hideScopesLabel", "labelText", "onChange", "onSubmit", "placeHolderText", "scopes", "scopesTypeLabel", "scopeToString", "selectedScopes", "sortItems", "submitLabel", "translateWithId", "value"];
16
+ var _excluded = ["className", "clearButtonLabelText", "hideScopesLabel", "labelText", "onChange", "onSubmit", "placeholderText", "scopes", "scopesTypeLabel", "scopeToString", "selectedScopes", "sortItems", "submitLabel", "translateWithId", "value"];
17
17
 
18
18
  // The block part of our conventional BEM class names (blockClass__E--M).
19
19
  var blockClass = "".concat(pkg.prefix, "--search-bar");
@@ -39,7 +39,7 @@ var SearchBar = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
39
39
  onChange = _ref$onChange === void 0 ? defaults.onChange : _ref$onChange,
40
40
  _ref$onSubmit = _ref.onSubmit,
41
41
  onSubmit = _ref$onSubmit === void 0 ? defaults.onSubmit : _ref$onSubmit,
42
- placeHolderText = _ref.placeHolderText,
42
+ placeholderText = _ref.placeholderText,
43
43
  _ref$scopes = _ref.scopes,
44
44
  scopes = _ref$scopes === void 0 ? [] : _ref$scopes,
45
45
  scopesTypeLabel = _ref.scopesTypeLabel,
@@ -113,30 +113,32 @@ var SearchBar = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
113
113
  setText(value);
114
114
  onChange(eventObject);
115
115
  };
116
+ var multiSelectProps = {
117
+ initialSelectedItems: selectedScopes,
118
+ items: scopes,
119
+ itemToString: scopeToString,
120
+ label: scopesTypeLabel,
121
+ sortItems: sortItems,
122
+ translateWithId: translateWithId
123
+ };
116
124
  return /*#__PURE__*/React__default.createElement("form", _extends({}, rest, {
117
125
  ref: ref
118
126
  }, getDevtoolsProps(componentName), {
119
127
  className: cx(blockClass, className, _defineProperty({}, "".concat(blockClass, "--hide-scopes-label"), hideScopesLabel)),
120
128
  onSubmit: handleSubmit
121
- }), scopes !== null && scopes !== void 0 && scopes.length ? /*#__PURE__*/React__default.createElement(MultiSelect, {
129
+ }), scopes !== null && scopes !== void 0 && scopes.length ? /*#__PURE__*/React__default.createElement(MultiSelect, _extends({}, multiSelectProps, {
122
130
  id: "".concat(blockClass, "__multi-select"),
123
131
  name: "search-scopes",
124
132
  className: "".concat(blockClass, "__scopes"),
125
- label: scopesTypeLabel,
126
133
  onChange: handleSearchScopeChange,
127
- initialSelectedItems: selectedScopes,
128
- items: scopes,
129
- itemToString: scopeToString,
130
- translateWithId: translateWithId,
131
- sortItems: sortItems,
132
134
  size: "lg"
133
- }) : null, /*#__PURE__*/React__default.createElement(Search, {
135
+ })) : null, /*#__PURE__*/React__default.createElement(Search, {
134
136
  className: "".concat(blockClass, "__input"),
135
137
  closeButtonLabelText: clearButtonLabelText,
136
138
  labelText: labelText || '',
137
139
  name: "search-input",
138
140
  onChange: handleInputChange,
139
- placeholder: placeHolderText,
141
+ placeholder: placeholderText,
140
142
  value: text,
141
143
  size: "lg"
142
144
  }), /*#__PURE__*/React__default.createElement(Button, {
@@ -164,11 +166,19 @@ var conditionalScopePropValidator = function conditionalScopePropValidator(props
164
166
  }
165
167
  return PropTypes.string.apply(PropTypes, [props, propName, componentName].concat(rest));
166
168
  };
169
+ var deprecatedProps = {
170
+ /**
171
+ * **Deprecated**
172
+ *
173
+ * Provide accessible label text for the scopes MultiSelect.
174
+ */
175
+ titleText: PropTypes.string
176
+ };
167
177
 
168
178
  // The types and DocGen commentary for the component props,
169
179
  // in alphabetical order (for consistency).
170
180
  // See https://www.npmjs.com/package/prop-types#usage.
171
- SearchBar.propTypes = {
181
+ SearchBar.propTypes = _objectSpread2({
172
182
  /** @type {string} Optional additional class name. */
173
183
  className: PropTypes.string,
174
184
  /** @type {string} The label text for the search text input. */
@@ -184,7 +194,7 @@ SearchBar.propTypes = {
184
194
  /** @type {Function} Function handler for when the user submits a search. */
185
195
  onSubmit: PropTypes.func,
186
196
  /** @type {string} Placeholder text to be displayed in the search input. */
187
- placeHolderText: PropTypes.string.isRequired,
197
+ placeholderText: PropTypes.string.isRequired,
188
198
  /** @type {Function} Function to get the text for each scope to display in dropdown. */
189
199
  scopeToString: PropTypes.func,
190
200
  /** @type {Array<any>} Array of allowed search scopes. */
@@ -206,16 +216,12 @@ SearchBar.propTypes = {
206
216
 
207
217
  /** @type {string} The label text for the search submit button. */
208
218
  submitLabel: PropTypes.string.isRequired,
209
- /**
210
- * Provide accessible label text for the scopes MultiSelect.
211
- */
212
- titleText: PropTypes.string,
213
219
  /** @type {func} Callback function for translating MultiSelect's child ListBoxMenuIcon SVG title. */
214
220
  translateWithId: PropTypes.func,
215
221
  // eslint-disable-line react/require-default-props
216
222
 
217
223
  /** @type {string} Search query value. */
218
224
  value: PropTypes.string
219
- };
225
+ }, deprecatedProps);
220
226
 
221
- export { SearchBar };
227
+ export { SearchBar, deprecatedProps };
@@ -1,8 +1,92 @@
1
- export let TagSet: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
1
+ import React, { ReactNode, PropsWithChildren } from 'react';
2
+ import { TagBaseProps } from '@carbon/type';
3
+ type Align = 'start' | 'center' | 'end';
4
+ type OverflowAlign = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top';
5
+ type OverflowType = 'default' | 'tag';
6
+ type TagType = {
7
+ label: string;
8
+ type?: keyof typeof tagTypes;
9
+ } & TagBaseProps;
10
+ interface TagSetProps extends PropsWithChildren {
11
+ /**
12
+ * align the Tags displayed by the TagSet. Default start.
13
+ */
14
+ align?: Align;
15
+ /**
16
+ * label text for the show all search. **Note: Required if more than 10 tags**
17
+ */
18
+ allTagsModalSearchLabel?: string;
19
+ /**
20
+ * placeholder text for the show all search. **Note: Required if more than 10 tags**
21
+ */
22
+ allTagsModalSearchPlaceholderText?: string;
23
+ /**
24
+ * portal target for the all tags modal
25
+ */
26
+ allTagsModalTarget?: ReactNode;
27
+ /**
28
+ * title for the show all modal. **Note: Required if more than 10 tags**
29
+ */
30
+ allTagsModalTitle?: string;
31
+ /**
32
+ * className
33
+ */
34
+ className?: string;
35
+ /**
36
+ * Optional ref for custom resize container to measure available space
37
+ * Default will measure the available space of the TagSet container itself.
38
+ */
39
+ containingElementRef?: React.RefObject<HTMLElement>;
40
+ /**
41
+ * maximum visible tags
42
+ */
43
+ maxVisible?: number;
44
+ /**
45
+ * Specify offset amount for measure available space, only used when `containingElementSelector`
46
+ * is also provided
47
+ */
48
+ measurementOffset?: number;
49
+ /**
50
+ * display tags in multiple lines
51
+ */
52
+ multiline?: boolean;
53
+ /**
54
+ * Handler to get overflow tags
55
+ */
56
+ onOverflowTagChange?: (value: ReactNode) => void;
57
+ /**
58
+ * overflowAlign from the standard tooltip. Default center.
59
+ */
60
+ overflowAlign?: OverflowAlign;
61
+ /**
62
+ * overflowClassName for the tooltip popup
63
+ */
64
+ overflowClassName?: string;
65
+ /**
66
+ * Type of rendering displayed inside of the tag overflow component
67
+ */
68
+ overflowType?: OverflowType;
69
+ /**
70
+ * label for the overflow show all tags link.
71
+ *
72
+ * **Note:** Required if more than 10 tags
73
+ */
74
+ showAllTagsLabel: string;
75
+ /**
76
+ * The tags to be shown in the TagSet. Each tag is specified as an object
77
+ * with properties: **label**\* (required) to supply the tag content, and
78
+ * other properties will be passed to the Carbon Tag component, such as
79
+ * **type**, **disabled**, **ref**, **className** , and any other Tag props.
80
+ *
81
+ * See https://react.carbondesignsystem.com/?path=/docs/components-tag--default
82
+ */
83
+ tags?: TagType[];
84
+ }
85
+ export declare let TagSet: React.ForwardRefExoticComponent<TagSetProps & React.RefAttributes<HTMLDivElement>>;
2
86
  /**
3
87
  * The strings shown in the showAllModal are only shown if we have more than allTagsModalSearchLThreshold
4
88
  * @returns null if no problems
5
89
  */
6
- export const string_required_if_more_than_10_tags: (props: any, propName: any, componentName: any, location: any, propFullName: any, secret: any) => any;
90
+ export declare const string_required_if_more_than_10_tags: (props: any, propName: any, componentName: any, location: any, propFullName: any, secret: any) => any;
91
+ declare const tagTypes: string[];
7
92
  export default TagSet;
8
- import React from 'react';
@@ -32,18 +32,26 @@ var defaults = {
32
32
  overflowType: 'default',
33
33
  onOverflowTagChange: function onOverflowTagChange() {}
34
34
  };
35
+
36
+ // interface TagType extends TagBaseProps
37
+ // {
38
+ // label: string;
39
+ // // we duplicate this prop to improve the DocGen
40
+ // type?: typeof tagTypes[number];
41
+ // }
42
+
35
43
  var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
36
44
  var _ref$align = _ref.align,
37
- align = _ref$align === void 0 ? defaults.align : _ref$align,
45
+ align = _ref$align === void 0 ? 'start' : _ref$align,
38
46
  allTagsModalTarget = _ref.allTagsModalTarget,
39
47
  className = _ref.className,
40
48
  maxVisible = _ref.maxVisible,
41
49
  multiline = _ref.multiline,
42
50
  _ref$overflowAlign = _ref.overflowAlign,
43
- overflowAlign = _ref$overflowAlign === void 0 ? defaults.overflowAlign : _ref$overflowAlign,
51
+ overflowAlign = _ref$overflowAlign === void 0 ? 'bottom' : _ref$overflowAlign,
44
52
  overflowClassName = _ref.overflowClassName,
45
53
  _ref$overflowType = _ref.overflowType,
46
- overflowType = _ref$overflowType === void 0 ? defaults.overflowType : _ref$overflowType,
54
+ overflowType = _ref$overflowType === void 0 ? 'default' : _ref$overflowType,
47
55
  allTagsModalTitle = _ref.allTagsModalTitle,
48
56
  allTagsModalSearchLabel = _ref.allTagsModalSearchLabel,
49
57
  allTagsModalSearchPlaceholderText = _ref.allTagsModalSearchPlaceholderText,
@@ -73,7 +81,7 @@ var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
73
81
  setShowAllModalOpen = _useState8[1];
74
82
  var localTagSetRef = useRef(null);
75
83
  var tagSetRef = ref || localTagSetRef;
76
- var sizingContainerRef = useRef();
84
+ var sizingContainerRef = useRef(null);
77
85
  var displayedArea = useRef(null);
78
86
  var _useState9 = useState([]),
79
87
  _useState10 = _slicedToArray(_useState9, 2),
@@ -98,7 +106,9 @@ var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
98
106
  key: index,
99
107
  className: "".concat(blockClass, "__sizing-tag"),
100
108
  ref: function ref(el) {
101
- return newSizingTags[index] = el;
109
+ if (el != null) {
110
+ newSizingTags[index] = el;
111
+ }
102
112
  }
103
113
  }, /*#__PURE__*/React__default.createElement(Tag, _extends({}, other, {
104
114
  // ensure id is not duplicated
@@ -155,7 +165,7 @@ var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
155
165
  }, [displayCount, overflowAlign, overflowClassName, overflowType, showAllTagsLabel, tags, onOverflowTagChange, popoverOpen, handleTagOnClose]);
156
166
  var checkFullyVisibleTags = useCallback(function () {
157
167
  if (multiline) {
158
- return setDisplayCount(maxVisible);
168
+ return setDisplayCount(maxVisible || 3);
159
169
  }
160
170
 
161
171
  // how many will fit?
@@ -163,7 +173,7 @@ var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
163
173
  if (sizingTags.length > 0) {
164
174
  var optionalContainingElement = containingElementRef === null || containingElementRef === void 0 ? void 0 : containingElementRef.current;
165
175
  var measurementOffsetValue = typeof measurementOffset === 'number' ? measurementOffset : 0;
166
- var spaceAvailable = optionalContainingElement ? optionalContainingElement.offsetWidth - measurementOffsetValue : tagSetRef.current.offsetWidth;
176
+ var spaceAvailable = optionalContainingElement ? optionalContainingElement.offsetWidth - measurementOffsetValue : tagSetRef === null || tagSetRef === void 0 ? void 0 : tagSetRef['current'].offsetWidth;
167
177
  for (var i in sizingTags) {
168
178
  var _sizingTags$i;
169
179
  var tagWidth = ((_sizingTags$i = sizingTags[i]) === null || _sizingTags$i === void 0 ? void 0 : _sizingTags$i.offsetWidth) || 0;
@@ -174,7 +184,7 @@ var TagSet = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
174
184
  break;
175
185
  }
176
186
  }
177
- if (willFit < sizingTags.length) {
187
+ if (willFit < sizingTags.length && overflowTag.current) {
178
188
  while (willFit > 0 && spaceAvailable < overflowTag.current.offsetWidth) {
179
189
  // Highly unlikely any useful tag is smaller
180
190
  willFit -= 1; // remove one tag
@@ -262,7 +272,7 @@ var TYPES = {
262
272
  outline: 'Outline'
263
273
  };
264
274
  var tagTypes = Object.keys(TYPES);
265
- TagSet.types = tagTypes;
275
+ TagSet['types'] = tagTypes;
266
276
  TagSet.propTypes = {
267
277
  /**
268
278
  * align the Tags displayed by the TagSet. Default start.
@@ -292,6 +302,7 @@ TagSet.propTypes = {
292
302
  * Optional ref for custom resize container to measure available space
293
303
  * Default will measure the available space of the TagSet container itself.
294
304
  */
305
+ /**@ts-ignore */
295
306
  containingElementRef: PropTypes.object,
296
307
  /**
297
308
  * maximum visible tags
@@ -1,29 +1,35 @@
1
- export function TagSetModal({ allTags, className, title, onClose, open, portalTarget: portalTargetIn, searchLabel, searchPlaceholder, ...rest }: {
2
- [x: string]: any;
3
- allTags: any;
4
- className: any;
5
- title: any;
6
- onClose: any;
7
- open: any;
8
- portalTarget: any;
9
- searchLabel?: string | undefined;
10
- searchPlaceholder: any;
11
- }): any;
12
- export namespace TagSetModal {
13
- export namespace propTypes {
14
- let allTags: PropTypes.Requireable<(PropTypes.InferProps<{
1
+ /// <reference path="../../../src/custom-typings/index.d.ts" />
2
+ import React, { ReactNode } from 'react';
3
+ import PropTypes from 'prop-types';
4
+ import { Tag } from '@carbon/react';
5
+ interface TagType {
6
+ label: string;
7
+ }
8
+ type AllTags = TagType[] & Omit<React.ComponentProps<Tag>, 'filter'>[];
9
+ interface TagSetModalProps {
10
+ allTags?: AllTags;
11
+ className?: string;
12
+ onClose?: () => void;
13
+ open?: boolean;
14
+ portalTarget?: ReactNode;
15
+ searchLabel?: string;
16
+ searchPlaceholder?: string;
17
+ title?: string;
18
+ }
19
+ export declare const TagSetModal: {
20
+ ({ allTags, className, title, onClose, open, portalTarget: portalTargetIn, searchLabel, searchPlaceholder, ...rest }: TagSetModalProps): any;
21
+ propTypes: {
22
+ allTags: PropTypes.Requireable<(PropTypes.InferProps<{
15
23
  label: PropTypes.Validator<string>;
16
24
  }> | null | undefined)[]>;
17
- let className: PropTypes.Requireable<string>;
18
- let onClose: PropTypes.Requireable<(...args: any[]) => any>;
19
- let open: PropTypes.Requireable<boolean>;
20
- let portalTarget: PropTypes.Requireable<PropTypes.ReactNodeLike>;
21
- let searchLabel: PropTypes.Requireable<string>;
22
- let searchPlaceholder: PropTypes.Requireable<string>;
23
- let title: PropTypes.Requireable<string>;
24
- }
25
- export { componentName as displayName };
26
- }
27
- import PropTypes from 'prop-types';
28
- declare const componentName: "TagSetModal";
25
+ className: PropTypes.Requireable<string>;
26
+ onClose: PropTypes.Requireable<(...args: any[]) => any>;
27
+ open: PropTypes.Requireable<boolean>;
28
+ portalTarget: PropTypes.Requireable<PropTypes.ReactNodeLike>;
29
+ searchLabel: PropTypes.Requireable<string>;
30
+ searchPlaceholder: PropTypes.Requireable<string>;
31
+ title: PropTypes.Requireable<string>;
32
+ };
33
+ displayName: string;
34
+ };
29
35
  export {};
@@ -5,11 +5,11 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends, objectSpread2 as _objectSpread2 } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import { objectSpread2 as _objectSpread2, objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
9
  import React__default, { useState, useEffect } from 'react';
10
10
  import PropTypes from '../../node_modules/prop-types/index.js';
11
11
  import cx from 'classnames';
12
- import { ComposedModal, ModalHeader, Search, ModalBody, Tag } from '@carbon/react';
12
+ import { Tag, ComposedModal, ModalHeader, Search, ModalBody } from '@carbon/react';
13
13
  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';
@@ -47,11 +47,11 @@ var TagSetModal = function TagSetModal(_ref) {
47
47
  useEffect(function () {
48
48
  var newFilteredModalTags = [];
49
49
  if (open) {
50
- if (search === '') {
51
- newFilteredModalTags = allTags.slice(0);
50
+ if (search === '' && allTags) {
51
+ newFilteredModalTags = allTags === null || allTags === void 0 ? void 0 : allTags.slice(0);
52
52
  } else {
53
53
  var lCaseSearch = search.toLocaleLowerCase();
54
- allTags.forEach(function (tag) {
54
+ allTags === null || allTags === void 0 || allTags.forEach(function (tag) {
55
55
  var _tag$dataSearch, _tag$label;
56
56
  var dataSearch = (_tag$dataSearch = tag['data-search']) === null || _tag$dataSearch === void 0 || (_tag$dataSearch = _tag$dataSearch.toLocaleLowerCase()) === null || _tag$dataSearch === void 0 ? void 0 : _tag$dataSearch.indexOf(lCaseSearch);
57
57
  var labelSearch = (_tag$label = tag.label) === null || _tag$label === void 0 || (_tag$label = _tag$label.toLocaleLowerCase()) === null || _tag$label === void 0 ? void 0 : _tag$label.indexOf(lCaseSearch);
@@ -1,2 +1,45 @@
1
- export const TagSetOverflow: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
2
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
+ type OverflowAlign = 'top' | 'top-left' | 'top-right' | 'bottom' | 'bottom-left' | 'bottom-right' | 'left' | 'left-bottom' | 'left-top' | 'right' | 'right-bottom' | 'right-top';
3
+ type OverflowType = 'default' | 'tag';
4
+ interface TagSetOverflowProps {
5
+ /**
6
+ * count of overflowTags over which a modal is offered
7
+ */
8
+ allTagsModalSearchThreshold?: number;
9
+ /**
10
+ * className
11
+ */
12
+ className?: string;
13
+ /**
14
+ * function to execute on clicking show all
15
+ */
16
+ onShowAllClick: () => void;
17
+ /**
18
+ * overflowAlign from the standard tooltip
19
+ */
20
+ overflowAlign?: OverflowAlign;
21
+ /** @type {Array<any>}
22
+ * tags shown in overflow
23
+ */
24
+ overflowTags: ReactNode[];
25
+ /**
26
+ * Type of rendering displayed inside of the tag overflow component
27
+ */
28
+ overflowType?: OverflowType;
29
+ /**
30
+ * Open state of the popover
31
+ */
32
+ popoverOpen?: boolean;
33
+ /**
34
+ * Setter function for the popoverOpen state value
35
+ */
36
+ setPopoverOpen?: ((value: boolean) => void) | undefined;
37
+ /**
38
+ * label for the overflow show all tags link
39
+ */
40
+ showAllTagsLabel?: string;
41
+ }
42
+ export declare const TagSetOverflow: React.ForwardRefExoticComponent<TagSetOverflowProps & {
43
+ children?: React.ReactNode;
44
+ } & React.RefAttributes<HTMLSpanElement>>;
45
+ export {};