@carbon/ibm-products 2.49.1 → 2.50.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 (116) hide show
  1. package/css/index-full-carbon.css +1180 -1148
  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 +3 -0
  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 +5 -0
  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 +27 -20
  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/AboutModal/AboutModal.js +23 -6
  18. package/es/components/ActionBar/ActionBar.d.ts +5 -1
  19. package/es/components/ActionBar/ActionBar.js +13 -3
  20. package/es/components/ActionBar/ActionBarOverflowItems.d.ts +12 -3
  21. package/es/components/ActionBar/ActionBarOverflowItems.js +13 -3
  22. package/es/components/Carousel/Carousel.js +1 -2
  23. package/es/components/Coachmark/CoachmarkDragbar.js +0 -1
  24. package/es/components/Coachmark/CoachmarkHeader.js +0 -1
  25. package/es/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +0 -1
  26. package/es/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +0 -1
  27. package/es/components/CoachmarkStack/CoachmarkStackHome.js +1 -2
  28. package/es/components/ConditionBuilder/ConditionBuilder.js +1 -3
  29. package/es/components/CreateTearsheet/CreateTearsheet.d.ts +6 -0
  30. package/es/components/CreateTearsheet/CreateTearsheet.js +13 -1
  31. package/es/components/CreateTearsheet/CreateTearsheetStep.d.ts +18 -0
  32. package/es/components/CreateTearsheet/CreateTearsheetStep.js +30 -3
  33. package/es/components/Datagrid/Datagrid/DatagridContent.js +4 -1
  34. package/es/components/Datagrid/Datagrid/DatagridSelectAll.js +4 -21
  35. package/es/components/Datagrid/Datagrid/DatagridVirtualBody.js +7 -2
  36. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -3
  37. package/es/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +4 -1
  38. package/es/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +3 -1
  39. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -1
  40. package/es/components/Datagrid/Datagrid/addons/stateReducer.d.ts +7 -0
  41. package/es/components/Datagrid/Datagrid/addons/stateReducer.js +99 -41
  42. package/es/components/Datagrid/types/index.d.ts +2 -0
  43. package/es/components/Datagrid/useDisableSelectRows.js +18 -3
  44. package/es/components/Datagrid/useFlexResize.d.ts +0 -6
  45. package/es/components/Datagrid/useFlexResize.js +33 -17
  46. package/es/components/Datagrid/useSortableColumns.js +2 -1
  47. package/es/components/EditUpdateCards/EditUpdateCards.d.ts +1 -1
  48. package/es/components/EditUpdateCards/EditUpdateCards.js +1 -2
  49. package/es/components/PageHeader/PageHeader.js +12 -2
  50. package/es/components/PageHeader/PageHeaderUtils.js +0 -5
  51. package/es/components/SidePanel/SidePanel.js +6 -6
  52. package/es/components/TagOverflow/TagOverflow.d.ts +1 -1
  53. package/es/components/TagOverflow/TagOverflow.js +1 -2
  54. package/es/components/TagSet/TagSet.d.ts +8 -6
  55. package/es/components/TagSet/TagSet.js +38 -30
  56. package/es/components/TagSet/TagSetOverflow.d.ts +4 -0
  57. package/es/components/TagSet/TagSetOverflow.js +8 -2
  58. package/es/components/Tearsheet/Tearsheet.d.ts +1 -1
  59. package/es/components/Tearsheet/TearsheetNarrow.d.ts +1 -1
  60. package/es/components/Tearsheet/TearsheetShell.d.ts +1 -1
  61. package/es/components/Tearsheet/TearsheetShell.js +2 -1
  62. package/es/global/js/hooks/useCreateComponentStepChange.d.ts +3 -1
  63. package/es/global/js/hooks/useCreateComponentStepChange.js +18 -2
  64. package/es/global/js/utils/Wrap.d.ts +4 -0
  65. package/lib/components/AboutModal/AboutModal.js +22 -5
  66. package/lib/components/ActionBar/ActionBar.d.ts +5 -1
  67. package/lib/components/ActionBar/ActionBar.js +13 -3
  68. package/lib/components/ActionBar/ActionBarOverflowItems.d.ts +12 -3
  69. package/lib/components/ActionBar/ActionBarOverflowItems.js +13 -3
  70. package/lib/components/Carousel/Carousel.js +1 -2
  71. package/lib/components/Coachmark/CoachmarkDragbar.js +0 -1
  72. package/lib/components/Coachmark/CoachmarkHeader.js +0 -1
  73. package/lib/components/CoachmarkOverlayElement/CoachmarkOverlayElement.js +0 -1
  74. package/lib/components/CoachmarkOverlayElements/CoachmarkOverlayElements.js +0 -1
  75. package/lib/components/CoachmarkStack/CoachmarkStackHome.js +1 -2
  76. package/lib/components/ConditionBuilder/ConditionBuilder.js +1 -3
  77. package/lib/components/CreateTearsheet/CreateTearsheet.d.ts +6 -0
  78. package/lib/components/CreateTearsheet/CreateTearsheet.js +13 -1
  79. package/lib/components/CreateTearsheet/CreateTearsheetStep.d.ts +18 -0
  80. package/lib/components/CreateTearsheet/CreateTearsheetStep.js +29 -2
  81. package/lib/components/Datagrid/Datagrid/DatagridContent.js +4 -1
  82. package/lib/components/Datagrid/Datagrid/DatagridSelectAll.js +3 -20
  83. package/lib/components/Datagrid/Datagrid/DatagridVirtualBody.js +7 -2
  84. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterFlyout.js +6 -3
  85. package/lib/components/Datagrid/Datagrid/addons/Filtering/FilterPanel.js +4 -1
  86. package/lib/components/Datagrid/Datagrid/addons/Filtering/hooks/useFilters.js +3 -1
  87. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +1 -1
  88. package/lib/components/Datagrid/Datagrid/addons/stateReducer.d.ts +7 -0
  89. package/lib/components/Datagrid/Datagrid/addons/stateReducer.js +99 -40
  90. package/lib/components/Datagrid/types/index.d.ts +2 -0
  91. package/lib/components/Datagrid/useDisableSelectRows.js +18 -3
  92. package/lib/components/Datagrid/useFlexResize.d.ts +0 -6
  93. package/lib/components/Datagrid/useFlexResize.js +32 -16
  94. package/lib/components/Datagrid/useSortableColumns.js +2 -1
  95. package/lib/components/EditUpdateCards/EditUpdateCards.d.ts +1 -1
  96. package/lib/components/EditUpdateCards/EditUpdateCards.js +1 -2
  97. package/lib/components/PageHeader/PageHeader.js +11 -1
  98. package/lib/components/PageHeader/PageHeaderUtils.js +0 -5
  99. package/lib/components/SidePanel/SidePanel.js +6 -6
  100. package/lib/components/TagOverflow/TagOverflow.d.ts +1 -1
  101. package/lib/components/TagOverflow/TagOverflow.js +1 -2
  102. package/lib/components/TagSet/TagSet.d.ts +8 -6
  103. package/lib/components/TagSet/TagSet.js +38 -30
  104. package/lib/components/TagSet/TagSetOverflow.d.ts +4 -0
  105. package/lib/components/TagSet/TagSetOverflow.js +8 -2
  106. package/lib/components/Tearsheet/Tearsheet.d.ts +1 -1
  107. package/lib/components/Tearsheet/TearsheetNarrow.d.ts +1 -1
  108. package/lib/components/Tearsheet/TearsheetShell.d.ts +1 -1
  109. package/lib/components/Tearsheet/TearsheetShell.js +2 -1
  110. package/lib/global/js/hooks/useCreateComponentStepChange.d.ts +3 -1
  111. package/lib/global/js/hooks/useCreateComponentStepChange.js +18 -2
  112. package/lib/global/js/utils/Wrap.d.ts +4 -0
  113. package/package.json +12 -12
  114. package/scss/components/Datagrid/styles/_useSortableColumns.scss +1 -0
  115. package/scss/components/Tearsheet/_tearsheet.scss +2 -0
  116. package/telemetry.yml +6 -0
@@ -10,32 +10,47 @@
10
10
  Object.defineProperty(exports, '__esModule', { value: true });
11
11
 
12
12
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
13
-
14
- /* eslint-disable no-unreachable */
15
- /**
16
- * Copyright IBM Corp. 2020, 2024
17
- *
18
- * This source code is licensed under the Apache-2.0 license found in the
19
- * LICENSE file in the root directory of this source tree.
20
- */
13
+ var React = require('react');
21
14
 
22
15
  var useFlexResize = function useFlexResize(hooks) {
16
+ var _useState = React.useState(),
17
+ _useState2 = _rollupPluginBabelHelpers.slicedToArray(_useState, 2),
18
+ spacerColumn = _useState2[0],
19
+ setSpacerColumn = _useState2[1];
20
+ var useInstance = function useInstance(instance) {
21
+ var enableSpacerColumn = instance.enableSpacerColumn;
22
+ React.useEffect(function () {
23
+ setSpacerColumn(enableSpacerColumn);
24
+ });
25
+ };
26
+ var spacer = {
27
+ id: 'spacer',
28
+ width: 0,
29
+ disableSortBy: true,
30
+ disableResizing: true
31
+ };
23
32
  hooks.visibleColumns.push(function (columns) {
24
33
  // always move actions to the end
25
34
  var actionsIdx = columns.findIndex(function (col) {
26
35
  return col.isAction;
27
36
  });
28
- if (actionsIdx === -1) {
29
- var _lastCol = columns.at(-1);
30
- _lastCol.isFlexCol = true;
37
+ if (!spacerColumn && actionsIdx === -1) {
38
+ var lastCol = columns.at(-1);
39
+ lastCol.isFlexCol = true;
31
40
  return _rollupPluginBabelHelpers.toConsumableArray(columns);
41
+ } else if (spacerColumn & actionsIdx === -1) {
42
+ return [].concat(_rollupPluginBabelHelpers.toConsumableArray(columns), [spacer]);
32
43
  }
33
44
  var cols = _rollupPluginBabelHelpers.toConsumableArray(columns);
34
45
  var actions = cols.splice(actionsIdx, 1)[0];
35
- cols.splice(columns.length, 0, actions);
36
- // the last non-action action column should flex remaining space
37
- var lastCol = columns.at(-2);
38
- lastCol.isFlexCol = true;
46
+ if (spacerColumn) {
47
+ cols.splice(columns.length, 0, spacer, actions);
48
+ } else {
49
+ cols.splice(columns.length, 0, actions);
50
+ // the last non-action action column should flex remaining space
51
+ var _lastCol = columns.at(-2);
52
+ _lastCol.isFlexCol = true;
53
+ }
39
54
  return cols;
40
55
  });
41
56
  var changeProps = function changeProps(props, data) {
@@ -43,7 +58,7 @@ var useFlexResize = function useFlexResize(hooks) {
43
58
  if (!column && data.cell) {
44
59
  column = data.cell.column;
45
60
  }
46
- if (column.isFlexCol) {
61
+ if (column.isFlexCol || column.id === spacer.id) {
47
62
  return [props, {
48
63
  style: {
49
64
  flex: '1 1 0'
@@ -62,6 +77,7 @@ var useFlexResize = function useFlexResize(hooks) {
62
77
  hooks.getCellProps.push(function (props, data) {
63
78
  return changeProps(props, data);
64
79
  });
80
+ hooks.useInstance.push(useInstance);
65
81
  };
66
82
  var useFlexResize$1 = useFlexResize;
67
83
 
@@ -104,6 +104,7 @@ var useSortableColumns = function useSortableColumns(hooks) {
104
104
  instance.toggleSortBy(key, newSortDesc, false);
105
105
  };
106
106
  var sortableColumns = visibleColumns.map(function (column) {
107
+ var _column$minWidth;
107
108
  var icon = function icon(col, props) {
108
109
  var iconProps = _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({
109
110
  size: 16
@@ -158,7 +159,7 @@ var useSortableColumns = function useSortableColumns(hooks) {
158
159
  };
159
160
  return _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, column), {}, {
160
161
  Header: Header,
161
- minWidth: column.disableSortBy === true ? 0 : column.minWidth ? column.minWidth : 90
162
+ minWidth: column.disableSortBy ? 0 : (_column$minWidth = column.minWidth) !== null && _column$minWidth !== void 0 ? _column$minWidth : column.isAction ? 50 : 90
162
163
  });
163
164
  });
164
165
  return (_instance$customizeCo = instance.customizeColumnsProps) !== null && _instance$customizeCo !== void 0 && _instance$customizeCo.isTearsheetOpen ? visibleColumns : _rollupPluginBabelHelpers.toConsumableArray(sortableColumns);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright IBM Corp. 2022, 2022
2
+ * Copyright IBM Corp. 2022, 2024
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
@@ -92,8 +92,7 @@ exports.EditUpdateCards = /*#__PURE__*/React__default["default"].forwardRef(func
92
92
  className, // Apply any supplied class names to the main HTML element.
93
93
  // example: `${blockClass}__template-string-class-${kind}-n-${size}`,
94
94
  _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__actions-bottom"), actionsPlacement === 'bottom')),
95
- ref: ref,
96
- role: "main"
95
+ ref: ref
97
96
  }, devtools.getDevtoolsProps(componentName)), /*#__PURE__*/React__default["default"].createElement(ProductiveCard.ProductiveCard, _rollupPluginBabelHelpers["extends"]({
98
97
  actionIcons: actionIcons,
99
98
  actionsPlacement: actionsPlacement,
@@ -102,6 +102,7 @@ exports.PageHeader = /*#__PURE__*/React__default["default"].forwardRef(function
102
102
  var headerRef = ref || localHeaderRef;
103
103
  var sizingContainerRef = React.useRef(null);
104
104
  var offsetTopMeasuringRef = React.useRef(null);
105
+ var overflowMenuRef = React.useRef(null);
105
106
 
106
107
  // state based on props only
107
108
  var hasActionBar = actionBarItems && actionBarItems.length > 0;
@@ -175,14 +176,22 @@ exports.PageHeader = /*#__PURE__*/React__default["default"].forwardRef(function
175
176
  _useState26 = _rollupPluginBabelHelpers.slicedToArray(_useState25, 2),
176
177
  widthIsNarrow = _useState26[0],
177
178
  setWidthIsNarrow = _useState26[1];
179
+ var prefix = react.usePrefix();
178
180
 
179
181
  // handlers
180
182
  var handleActionBarWidthChange = function handleActionBarWidthChange(_ref2) {
183
+ var _overflowMenuRef$curr;
181
184
  var minWidth = _ref2.minWidth,
182
185
  maxWidth = _ref2.maxWidth;
186
+ var overflowMenuWidth = 0;
187
+ var overflowMenu = overflowMenuRef === null || overflowMenuRef === void 0 || (_overflowMenuRef$curr = overflowMenuRef.current) === null || _overflowMenuRef$curr === void 0 ? void 0 : _overflowMenuRef$curr.querySelector(".".concat(prefix, "--overflow-menu"));
188
+ if (overflowMenu) {
189
+ overflowMenuWidth = overflowMenu.offsetWidth;
190
+ }
191
+
183
192
  /* don't know how to test resize */
184
193
  /* istanbul ignore next */
185
- setActionBarMaxWidth(maxWidth);
194
+ setActionBarMaxWidth(maxWidth + overflowMenuWidth);
186
195
  /* don't know how to test resize */
187
196
  /* istanbul ignore next */
188
197
  setActionBarMinWidth(minWidth);
@@ -400,6 +409,7 @@ exports.PageHeader = /*#__PURE__*/React__default["default"].forwardRef(function
400
409
  menuOptionsClass: "".concat(cx__default["default"](actionBarMenuOptionsClass, "".concat(PageHeaderUtils.blockClass, "__action-bar-menu-options"))),
401
410
  onWidthChange: handleActionBarWidthChange,
402
411
  overflowAriaLabel: actionBarOverflowAriaLabel,
412
+ overflowMenuRef: overflowMenuRef,
403
413
  rightAlign: true
404
414
  })) : widthIsNarrow && thePageActions(true, pageActionsInBreadcrumbRow))))) : null, !collapseTitle && (title || pageActions) ? /*#__PURE__*/React__default["default"].createElement(react.Row, {
405
415
  className: cx__default["default"]("".concat(PageHeaderUtils.blockClass, "__title-row"), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(PageHeaderUtils.blockClass, "__title-row--no-breadcrumb-row"), !hasBreadcrumbRow), "".concat(PageHeaderUtils.blockClass, "__title-row--under-action-bar"), hasActionBar || widthIsNarrow), "".concat(PageHeaderUtils.blockClass, "__title-row--has-page-actions"), !!pageActions), "".concat(PageHeaderUtils.blockClass, "__title-row--sticky"), !!pageActions && !actionBarItems && hasBreadcrumbRow))
@@ -107,11 +107,6 @@ var utilCheckUpdateVerticalSpace = function utilCheckUpdateVerticalSpace(headerR
107
107
  // adjust top for sticky with navigation
108
108
  update.headerTopValue += update.navigationRowHeight;
109
109
  }
110
- if (!hasActionBar && !widthIsNarrow) {
111
- // Add difference between $spacing-08 and $spacing-07 to ensure space below breadcrumb is correct on scroll
112
- // $spacing-07 is used as size for breadcrumb when no action bar otherwise $spacing-08
113
- update.headerTopValue += 8;
114
- }
115
110
  if (!enableBreadcrumbScroll || !navigation) {
116
111
  // adjust sticky top if no navigation or breadcrumb is to stay on screen
117
112
  update.headerTopValue += update.breadcrumbRowHeight;
@@ -25,8 +25,8 @@ var carbonMotion = require('@carbon/motion');
25
25
  var pconsole = require('../../global/js/utils/pconsole.js');
26
26
  var settings = require('../../settings.js');
27
27
  var usePrefersReducedMotion = require('../../global/js/hooks/usePrefersReducedMotion.js');
28
- var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
29
28
  var useFocus = require('../../global/js/hooks/useFocus.js');
29
+ var usePreviousValue = require('../../global/js/hooks/usePreviousValue.js');
30
30
 
31
31
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
32
32
 
@@ -330,10 +330,10 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
330
330
  React.useEffect(function () {
331
331
  if (open) {
332
332
  setTimeout(function () {
333
- if (selectorPrimaryFocus) {
334
- var _document;
335
- var primeFocusEl = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(selectorPrimaryFocus);
336
- if (primeFocusEl) {
333
+ if (selectorPrimaryFocus && useFocus.getSpecificElement(sidePanelRef === null || sidePanelRef === void 0 ? void 0 : sidePanelRef.current, selectorPrimaryFocus)) {
334
+ var _window2;
335
+ var primeFocusEl = useFocus.getSpecificElement(sidePanelRef === null || sidePanelRef === void 0 ? void 0 : sidePanelRef.current, selectorPrimaryFocus);
336
+ if (primeFocusEl && ((_window2 = window) === null || _window2 === void 0 || (_window2 = _window2.getComputedStyle(primeFocusEl)) === null || _window2 === void 0 ? void 0 : _window2.display) !== 'none') {
337
337
  primeFocusEl === null || primeFocusEl === void 0 || primeFocusEl.focus();
338
338
  }
339
339
  } else if (!slideIn) {
@@ -341,7 +341,7 @@ exports.SidePanel = /*#__PURE__*/React__default["default"].forwardRef(function (
341
341
  }
342
342
  }, 0);
343
343
  }
344
- }, [animationComplete, firstElement, open, selectorPrimaryFocus, slideIn]);
344
+ }, [animationComplete, firstElement, open, selectorPrimaryFocus, sidePanelRef, slideIn]);
345
345
  var primaryActionContainerClassNames = cx__default["default"](["".concat(blockClass, "__actions-container"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__actions-container--condensed"), condensedActions)]);
346
346
  var mainPanelClassNames = cx__default["default"]([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--right-placement"), placement === 'right'), "".concat(blockClass, "--left-placement"), placement === 'left'), "".concat(blockClass, "--slide-in"), slideIn), "".concat(blockClass, "--has-slug"), slug), "".concat(blockClass, "--condensed-actions"), condensedActions), "".concat(blockClass, "--has-overlay"), includeOverlay)]);
347
347
  var renderTitle = function renderTitle() {
@@ -7,7 +7,7 @@
7
7
  import React, { ReactNode, RefObject } from 'react';
8
8
  export interface TagOverflowItem {
9
9
  className?: string;
10
- filter?: string;
10
+ filter?: boolean;
11
11
  id: string;
12
12
  label: string;
13
13
  onClose: () => void;
@@ -179,8 +179,7 @@ exports.TagOverflow = /*#__PURE__*/React.forwardRef(function (props, ref) {
179
179
  }, [visibleItems]);
180
180
  return /*#__PURE__*/React__default["default"].createElement("div", _rollupPluginBabelHelpers["extends"]({}, rest, {
181
181
  className: cx__default["default"](blockClass, className, "".concat(blockClass, "--align-").concat(align), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "--multiline"), multiline)),
182
- ref: containerRef,
183
- role: "main"
182
+ ref: containerRef
184
183
  }, devtools.getDevtoolsProps(componentName)), (visibleItems === null || visibleItems === void 0 ? void 0 : visibleItems.length) > 0 && visibleItems.map(function (item, index) {
185
184
  // Render custom components
186
185
  if (tagComponent) {
@@ -13,11 +13,11 @@ export interface TagSetProps extends PropsWithChildren {
13
13
  */
14
14
  align?: Align;
15
15
  /**
16
- * label text for the show all search. **Note: Required if more than 10 tags**
16
+ * label text for the show all search.
17
17
  */
18
18
  allTagsModalSearchLabel?: string;
19
19
  /**
20
- * placeholder text for the show all search. **Note: Required if more than 10 tags**
20
+ * placeholder text for the show all search.
21
21
  */
22
22
  allTagsModalSearchPlaceholderText?: string;
23
23
  /**
@@ -25,7 +25,7 @@ export interface TagSetProps extends PropsWithChildren {
25
25
  */
26
26
  allTagsModalTarget?: ReactNode;
27
27
  /**
28
- * title for the show all modal. **Note: Required if more than 10 tags**
28
+ * title for the show all modal.
29
29
  */
30
30
  allTagsModalTitle?: string;
31
31
  /**
@@ -58,6 +58,10 @@ export interface TagSetProps extends PropsWithChildren {
58
58
  * overflowAlign from the standard tooltip. Default center.
59
59
  */
60
60
  overflowAlign?: OverflowAlign;
61
+ /**
62
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
63
+ */
64
+ overflowAutoAlign?: boolean;
61
65
  /**
62
66
  * overflowClassName for the tooltip popup
63
67
  */
@@ -68,10 +72,8 @@ export interface TagSetProps extends PropsWithChildren {
68
72
  overflowType?: OverflowType;
69
73
  /**
70
74
  * label for the overflow show all tags link.
71
- *
72
- * **Note:** Required if more than 10 tags
73
75
  */
74
- showAllTagsLabel: string;
76
+ showAllTagsLabel?: string;
75
77
  /**
76
78
  * The tags to be shown in the TagSet. Each tag is specified as an object
77
79
  * with properties: **label**\* (required) to supply the tag content, and
@@ -26,7 +26,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
26
26
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
27
27
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
28
28
 
29
- var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAlign", "overflowClassName", "overflowType", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags", "containingElementRef", "measurementOffset", "onOverflowTagChange"],
29
+ var _excluded = ["align", "allTagsModalTarget", "className", "maxVisible", "multiline", "overflowAutoAlign", "overflowAlign", "overflowClassName", "overflowType", "allTagsModalTitle", "allTagsModalSearchLabel", "allTagsModalSearchPlaceholderText", "showAllTagsLabel", "tags", "containingElementRef", "measurementOffset", "onOverflowTagChange"],
30
30
  _excluded2 = ["label", "id"],
31
31
  _excluded3 = ["label", "onClose"];
32
32
  var componentName = 'TagSet';
@@ -41,14 +41,6 @@ var defaults = {
41
41
  overflowType: 'default',
42
42
  onOverflowTagChange: function onOverflowTagChange() {}
43
43
  };
44
-
45
- // interface TagType extends TagBaseProps
46
- // {
47
- // label: string;
48
- // // we duplicate this prop to improve the DocGen
49
- // type?: typeof tagTypes[number];
50
- // }
51
-
52
44
  exports.TagSet = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
53
45
  var _ref$align = _ref.align,
54
46
  align = _ref$align === void 0 ? 'start' : _ref$align,
@@ -56,15 +48,20 @@ exports.TagSet = /*#__PURE__*/React__default["default"].forwardRef(function (_re
56
48
  className = _ref.className,
57
49
  maxVisible = _ref.maxVisible,
58
50
  multiline = _ref.multiline,
51
+ overflowAutoAlign = _ref.overflowAutoAlign,
59
52
  _ref$overflowAlign = _ref.overflowAlign,
60
53
  overflowAlign = _ref$overflowAlign === void 0 ? 'bottom' : _ref$overflowAlign,
61
54
  overflowClassName = _ref.overflowClassName,
62
55
  _ref$overflowType = _ref.overflowType,
63
56
  overflowType = _ref$overflowType === void 0 ? 'default' : _ref$overflowType,
64
- allTagsModalTitle = _ref.allTagsModalTitle,
65
- allTagsModalSearchLabel = _ref.allTagsModalSearchLabel,
66
- allTagsModalSearchPlaceholderText = _ref.allTagsModalSearchPlaceholderText,
67
- showAllTagsLabel = _ref.showAllTagsLabel,
57
+ _ref$allTagsModalTitl = _ref.allTagsModalTitle,
58
+ allTagsModalTitle = _ref$allTagsModalTitl === void 0 ? 'All tags' : _ref$allTagsModalTitl,
59
+ _ref$allTagsModalSear = _ref.allTagsModalSearchLabel,
60
+ allTagsModalSearchLabel = _ref$allTagsModalSear === void 0 ? 'Search all tags' : _ref$allTagsModalSear,
61
+ _ref$allTagsModalSear2 = _ref.allTagsModalSearchPlaceholderText,
62
+ allTagsModalSearchPlaceholderText = _ref$allTagsModalSear2 === void 0 ? 'Search all tags' : _ref$allTagsModalSear2,
63
+ _ref$showAllTagsLabel = _ref.showAllTagsLabel,
64
+ showAllTagsLabel = _ref$showAllTagsLabel === void 0 ? 'View all tags' : _ref$showAllTagsLabel,
68
65
  tags = _ref.tags,
69
66
  containingElementRef = _ref.containingElementRef,
70
67
  _ref$measurementOffse = _ref.measurementOffset,
@@ -97,13 +94,21 @@ exports.TagSet = /*#__PURE__*/React__default["default"].forwardRef(function (_re
97
94
  sizingTags = _useState10[0],
98
95
  setSizingTags = _useState10[1];
99
96
  var overflowTag = React.useRef(null);
100
- var _useState11 = React.useState(false),
97
+ var _useState11 = React.useState(0),
101
98
  _useState12 = _rollupPluginBabelHelpers.slicedToArray(_useState11, 2),
102
- popoverOpen = _useState12[0],
103
- setPopoverOpen = _useState12[1];
99
+ maxVisibleCount = _useState12[0],
100
+ setMaxVisibleCount = _useState12[1];
101
+ var _useState13 = React.useState(false),
102
+ _useState14 = _rollupPluginBabelHelpers.slicedToArray(_useState13, 2),
103
+ popoverOpen = _useState14[0],
104
+ setPopoverOpen = _useState14[1];
104
105
  var handleShowAllClick = function handleShowAllClick() {
105
106
  setShowAllModalOpen(true);
106
107
  };
108
+ React.useEffect(function () {
109
+ var maxCount = maxVisible || (tags === null || tags === void 0 ? void 0 : tags.length) || 0;
110
+ setMaxVisibleCount(maxCount);
111
+ }, [maxVisible, tags]);
107
112
  React.useEffect(function () {
108
113
  var newSizingTags = [];
109
114
  // create sizing tags
@@ -158,6 +163,7 @@ exports.TagSet = /*#__PURE__*/React__default["default"].forwardRef(function (_re
158
163
  });
159
164
  newDisplayedTags.push( /*#__PURE__*/React__default["default"].createElement(TagSetOverflow.TagSetOverflow, {
160
165
  allTagsModalSearchThreshold: allTagsModalSearchThreshold,
166
+ overflowAutoAlign: overflowAutoAlign,
161
167
  className: overflowClassName,
162
168
  onShowAllClick: handleShowAllClick,
163
169
  overflowTags: newOverflowTags,
@@ -171,10 +177,10 @@ exports.TagSet = /*#__PURE__*/React__default["default"].forwardRef(function (_re
171
177
  }));
172
178
  onOverflowTagChange === null || onOverflowTagChange === void 0 || onOverflowTagChange(newOverflowTags);
173
179
  setDisplayedTags(newDisplayedTags);
174
- }, [displayCount, overflowAlign, overflowClassName, overflowType, showAllTagsLabel, tags, onOverflowTagChange, popoverOpen, handleTagOnClose]);
180
+ }, [displayCount, overflowAlign, overflowClassName, overflowType, showAllTagsLabel, tags, onOverflowTagChange, popoverOpen, handleTagOnClose, overflowAutoAlign]);
175
181
  var checkFullyVisibleTags = React.useCallback(function () {
176
182
  if (multiline) {
177
- return setDisplayCount(maxVisible || 3);
183
+ return setDisplayCount(maxVisibleCount);
178
184
  }
179
185
 
180
186
  // how many will fit?
@@ -204,12 +210,12 @@ exports.TagSet = /*#__PURE__*/React__default["default"].forwardRef(function (_re
204
210
  if (willFit < 1) {
205
211
  setDisplayCount(0);
206
212
  } else {
207
- setDisplayCount(maxVisible ? Math.min(willFit, maxVisible) : willFit);
213
+ setDisplayCount(maxVisibleCount ? Math.min(willFit, maxVisibleCount) : willFit);
208
214
  }
209
- }, [maxVisible, multiline, sizingTags, tagSetRef, measurementOffset, containingElementRef]);
215
+ }, [maxVisibleCount, multiline, sizingTags, tagSetRef, measurementOffset, containingElementRef]);
210
216
  React.useEffect(function () {
211
217
  checkFullyVisibleTags();
212
- }, [checkFullyVisibleTags, maxVisible, multiline, sizingTags]);
218
+ }, [checkFullyVisibleTags, maxVisibleCount, multiline, sizingTags]);
213
219
 
214
220
  /* don't know how to test resize */
215
221
  /* istanbul ignore next */
@@ -288,21 +294,21 @@ exports.TagSet.propTypes = {
288
294
  */
289
295
  align: index["default"].oneOf(['start', 'center', 'end']),
290
296
  /**
291
- * label text for the show all search. **Note: Required if more than 10 tags**
297
+ * label text for the show all search.
292
298
  */
293
- allTagsModalSearchLabel: string_required_if_more_than_10_tags,
299
+ allTagsModalSearchLabel: index["default"].string,
294
300
  /**
295
- * placeholder text for the show all search. **Note: Required if more than 10 tags**
301
+ * placeholder text for the show all search.
296
302
  */
297
- allTagsModalSearchPlaceholderText: string_required_if_more_than_10_tags,
303
+ allTagsModalSearchPlaceholderText: index["default"].string,
298
304
  /**
299
305
  * portal target for the all tags modal
300
306
  */
301
307
  allTagsModalTarget: index["default"].node,
302
308
  /**
303
- * title for the show all modal. **Note: Required if more than 10 tags**
309
+ * title for the show all modal.
304
310
  */
305
- allTagsModalTitle: string_required_if_more_than_10_tags,
311
+ allTagsModalTitle: index["default"].string,
306
312
  /**
307
313
  * className
308
314
  */
@@ -334,6 +340,10 @@ exports.TagSet.propTypes = {
334
340
  * overflowAlign from the standard tooltip. Default center.
335
341
  */
336
342
  overflowAlign: index["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top']),
343
+ /**
344
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
345
+ */
346
+ overflowAutoAlign: index["default"].bool,
337
347
  /**
338
348
  * overflowClassName for the tooltip popup
339
349
  */
@@ -344,10 +354,8 @@ exports.TagSet.propTypes = {
344
354
  overflowType: index["default"].oneOf(['default', 'tag']),
345
355
  /**
346
356
  * label for the overflow show all tags link.
347
- *
348
- * **Note:** Required if more than 10 tags
349
357
  */
350
- showAllTagsLabel: string_required_if_more_than_10_tags,
358
+ showAllTagsLabel: index["default"].string,
351
359
  /**
352
360
  * The tags to be shown in the TagSet. Each tag is specified as an object
353
361
  * with properties: **label**\* (required) to supply the tag content, and
@@ -26,6 +26,10 @@ interface TagSetOverflowProps {
26
26
  * Type of rendering displayed inside of the tag overflow component
27
27
  */
28
28
  overflowType?: OverflowType;
29
+ /**
30
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
31
+ */
32
+ overflowAutoAlign?: boolean;
29
33
  /**
30
34
  * Open state of the popover
31
35
  */
@@ -22,7 +22,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
22
22
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
23
  var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
24
24
 
25
- var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"];
25
+ var _excluded = ["allTagsModalSearchThreshold", "className", "onShowAllClick", "overflowAlign", "overflowAutoAlign", "overflowTags", "overflowType", "showAllTagsLabel", "popoverOpen", "setPopoverOpen"];
26
26
  var componentName = 'TagSetOverflow';
27
27
  var blockClass = "".concat(settings.pkg.prefix, "--tag-set-overflow");
28
28
 
@@ -37,6 +37,7 @@ var TagSetOverflow = /*#__PURE__*/React__default["default"].forwardRef(function
37
37
  onShowAllClick = _ref.onShowAllClick,
38
38
  _ref$overflowAlign = _ref.overflowAlign,
39
39
  overflowAlign = _ref$overflowAlign === void 0 ? 'bottom' : _ref$overflowAlign,
40
+ overflowAutoAlign = _ref.overflowAutoAlign,
40
41
  overflowTags = _ref.overflowTags,
41
42
  overflowType = _ref.overflowType,
42
43
  showAllTagsLabel = _ref.showAllTagsLabel,
@@ -72,7 +73,8 @@ var TagSetOverflow = /*#__PURE__*/React__default["default"].forwardRef(function
72
73
  dropShadow: true,
73
74
  highContrast: true,
74
75
  onKeyDown: handleEscKeyPress,
75
- open: popoverOpen
76
+ open: popoverOpen,
77
+ autoAlign: overflowAutoAlign
76
78
  }, /*#__PURE__*/React__default["default"].createElement(react.Tag, {
77
79
  onClick: function onClick() {
78
80
  return setPopoverOpen === null || setPopoverOpen === void 0 ? void 0 : setPopoverOpen(!popoverOpen);
@@ -124,6 +126,10 @@ TagSetOverflow.propTypes = {
124
126
  * overflowAlign from the standard tooltip
125
127
  */
126
128
  overflowAlign: index["default"].oneOf(['top', 'top-left', 'top-right', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-bottom', 'left-top', 'right', 'right-bottom', 'right-top']),
129
+ /**
130
+ * Will auto-align the popover on first render if it is not visible. This prop is currently experimental and is subject to future changes.
131
+ */
132
+ overflowAutoAlign: index["default"].bool,
127
133
  /**
128
134
  * tags shown in overflow
129
135
  */
@@ -35,7 +35,7 @@ export interface TearsheetProps extends PropsWithChildren {
35
35
  *
36
36
  * See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
37
37
  */
38
- actions: ButtonProps<'button'>[];
38
+ actions?: ButtonProps<'button'>[];
39
39
  /**
40
40
  * The aria-label for the tearsheet, which is optional.
41
41
  * if it is not passed, the title will be used as the aria-label.
@@ -23,7 +23,7 @@ interface TearsheetNarrowBaseProps extends PropsWithChildren {
23
23
  *
24
24
  * See https://react.carbondesignsystem.com/?path=/docs/components-button--default#component-api
25
25
  */
26
- actions?: ButtonProps[];
26
+ actions?: ButtonProps<'button'>[];
27
27
  /**
28
28
  * The aria-label for the tearsheet, which is optional.
29
29
  * if it is not passed, the title will be used as the aria-label.
@@ -9,7 +9,7 @@ import React, { PropsWithChildren, ReactNode, RefObject } from 'react';
9
9
  import PropTypes from 'prop-types';
10
10
  import { type ButtonProps } from '@carbon/react';
11
11
  interface TearsheetShellProps extends PropsWithChildren {
12
- actions?: ButtonProps<any>[];
12
+ actions?: ButtonProps<'button'>[];
13
13
  ariaLabel?: string;
14
14
  /**
15
15
  * An optional class or classes to be added to the outermost element.
@@ -310,7 +310,8 @@ var TearsheetShell = /*#__PURE__*/React__default["default"].forwardRef(function
310
310
  alwaysRender: includeActions
311
311
  }, /*#__PURE__*/React__default["default"].createElement(Wrap.Wrap, {
312
312
  className: "".concat(bc, "__content"),
313
- alwaysRender: !!(influencer && influencerPosition === 'right')
313
+ alwaysRender: !!(influencer && influencerPosition === 'right'),
314
+ tabIndex: -1
314
315
  }, children), /*#__PURE__*/React__default["default"].createElement(Wrap.Wrap, {
315
316
  className: cx__default["default"](_rollupPluginBabelHelpers.defineProperty(_rollupPluginBabelHelpers.defineProperty({}, "".concat(bc, "__influencer"), true), "".concat(bc, "__influencer--wide"), influencerWidth === 'wide')),
316
317
  neverRender: influencerPosition !== 'right'
@@ -1,4 +1,4 @@
1
- export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedStep, stepData, onPrevious, onNext, isSubmitDisabled, setCurrentStep, setIsSubmitting, setLoadingPrevious, loadingPrevious, onClose, onRequestSubmit, componentName, currentStep, backButtonText, cancelButtonText, submitButtonText, nextButtonText, isSubmitting, componentBlockClass, setCreateComponentActions, setModalIsOpen, }: {
1
+ export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedStep, stepData, onPrevious, onNext, isSubmitDisabled, setCurrentStep, setIsSubmitting, setLoadingPrevious, loadingPrevious, onClose, onRequestSubmit, componentName, currentStep, backButtonText, cancelButtonText, submitButtonText, nextButtonText, isSubmitting, componentBlockClass, setCreateComponentActions, setModalIsOpen, experimentalSecondarySubmit, experimentalSecondarySubmitText, }: {
2
2
  firstIncludedStep: any;
3
3
  lastIncludedStep: any;
4
4
  stepData: any;
@@ -21,4 +21,6 @@ export function useCreateComponentStepChange({ firstIncludedStep, lastIncludedSt
21
21
  componentBlockClass: any;
22
22
  setCreateComponentActions: any;
23
23
  setModalIsOpen: any;
24
+ experimentalSecondarySubmit: any;
25
+ experimentalSecondarySubmitText: any;
24
26
  }): void;
@@ -36,7 +36,9 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
36
36
  isSubmitting = _ref.isSubmitting,
37
37
  componentBlockClass = _ref.componentBlockClass,
38
38
  setCreateComponentActions = _ref.setCreateComponentActions,
39
- setModalIsOpen = _ref.setModalIsOpen;
39
+ setModalIsOpen = _ref.setModalIsOpen,
40
+ experimentalSecondarySubmit = _ref.experimentalSecondarySubmit,
41
+ experimentalSecondarySubmitText = _ref.experimentalSecondarySubmitText;
40
42
  var continueToNextStep = React.useCallback(function () {
41
43
  setIsSubmitting(false);
42
44
  setCurrentStep(function (prev) {
@@ -216,6 +218,11 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
216
218
  return _ref5.apply(this, arguments);
217
219
  };
218
220
  }();
221
+ var handleExperimentalSecondarySubmit = function handleExperimentalSecondarySubmit() {
222
+ if (typeof (experimentalSecondarySubmit === null || experimentalSecondarySubmit === void 0 ? void 0 : experimentalSecondarySubmit.onClick) === 'function') {
223
+ experimentalSecondarySubmit.onClick();
224
+ }
225
+ };
219
226
  if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 0) {
220
227
  var buttons = [];
221
228
  if ((stepData === null || stepData === void 0 ? void 0 : stepData.length) > 1) {
@@ -236,6 +243,15 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
236
243
  } : onUnmount,
237
244
  kind: 'ghost'
238
245
  });
246
+ if (experimentalSecondarySubmitText && !(experimentalSecondarySubmit !== null && experimentalSecondarySubmit !== void 0 && experimentalSecondarySubmit.hideSecondarySubmit)) {
247
+ buttons.push({
248
+ key: 'create-action-button-experimentalSecondarySubmit',
249
+ label: experimentalSecondarySubmitText,
250
+ onClick: handleExperimentalSecondarySubmit,
251
+ kind: 'secondary',
252
+ disabled: experimentalSecondarySubmit === null || experimentalSecondarySubmit === void 0 ? void 0 : experimentalSecondarySubmit.disabled
253
+ });
254
+ }
239
255
  buttons.push({
240
256
  key: 'create-action-button-submit',
241
257
  label: currentStep < lastIncludedStep ? nextButtonText : submitButtonText,
@@ -247,7 +263,7 @@ var useCreateComponentStepChange = function useCreateComponentStepChange(_ref) {
247
263
  });
248
264
  setCreateComponentActions(buttons);
249
265
  }
250
- }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setModalIsOpen, moveToPreviousStep, onPrevious, setLoadingPrevious, loadingPrevious]);
266
+ }, [firstIncludedStep, lastIncludedStep, stepData, onNext, isSubmitDisabled, backButtonText, cancelButtonText, currentStep, onClose, nextButtonText, submitButtonText, onRequestSubmit, isSubmitting, componentBlockClass, componentName, continueToNextStep, setCurrentStep, setCreateComponentActions, setIsSubmitting, setModalIsOpen, moveToPreviousStep, onPrevious, setLoadingPrevious, loadingPrevious, experimentalSecondarySubmit, experimentalSecondarySubmitText]);
251
267
  };
252
268
 
253
269
  exports.useCreateComponentStepChange = useCreateComponentStepChange;
@@ -26,6 +26,10 @@ interface WrapProps extends PropsWithChildren {
26
26
  */
27
27
  neverRender?: boolean;
28
28
  className?: string;
29
+ /**
30
+ * Tab index for the wrapper div
31
+ */
32
+ tabIndex?: number;
29
33
  }
30
34
  /**
31
35
  * A simple conditional wrapper that encloses its children in a <div> (or other