@carbon/ibm-products 2.32.0 → 2.33.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. package/css/index-full-carbon.css +56 -0
  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.css +56 -0
  6. package/css/index-without-carbon.css.map +1 -1
  7. package/css/index-without-carbon.min.css +1 -1
  8. package/css/index-without-carbon.min.css.map +1 -1
  9. package/css/index.css +56 -0
  10. package/css/index.css.map +1 -1
  11. package/css/index.min.css +1 -1
  12. package/css/index.min.css.map +1 -1
  13. package/es/components/ActionBar/ActionBar.js +8 -1
  14. package/es/components/CreateTearsheet/CreateTearsheetDivider.d.ts +12 -1
  15. package/es/components/CreateTearsheet/CreateTearsheetDivider.js +1 -1
  16. package/es/components/DataSpreadsheet/DataSpreadsheet.js +36 -30
  17. package/es/components/DataSpreadsheet/DataSpreadsheetBody.js +49 -2
  18. package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.d.ts +3 -1
  19. package/es/components/DataSpreadsheet/hooks/useMoveActiveCell.js +10 -3
  20. package/es/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +5 -5
  21. package/es/components/Datagrid/useRowSize.js +4 -2
  22. package/es/components/DescriptionList/DescriptionList.d.ts +0 -37
  23. package/es/components/DescriptionList/DescriptionList.js +7 -12
  24. package/es/components/DescriptionList/DescriptionListBody.d.ts +2 -0
  25. package/es/components/DescriptionList/DescriptionListBody.js +39 -0
  26. package/es/components/DescriptionList/DescriptionListCell.d.ts +2 -0
  27. package/es/components/DescriptionList/DescriptionListCell.js +39 -0
  28. package/es/components/DescriptionList/DescriptionListRow.d.ts +2 -0
  29. package/es/components/DescriptionList/DescriptionListRow.js +41 -0
  30. package/es/components/DescriptionList/index.d.ts +4 -1
  31. package/es/components/FilterPanel/FilterPanel.d.ts +5 -0
  32. package/es/components/FilterPanel/FilterPanel.js +55 -0
  33. package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
  34. package/es/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +78 -0
  35. package/es/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.d.ts +5 -0
  36. package/es/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +63 -0
  37. package/es/components/FilterPanel/FilterPanelLabel/index.d.ts +1 -0
  38. package/es/components/FilterPanel/index.d.ts +3 -0
  39. package/es/components/SidePanel/SidePanel.js +35 -68
  40. package/es/components/Tearsheet/TearsheetShell.js +9 -1
  41. package/es/components/Toolbar/ToolbarGroup.d.ts +17 -2
  42. package/es/components/Toolbar/ToolbarGroup.js +0 -1
  43. package/es/components/index.d.ts +3 -1
  44. package/es/global/js/hooks/useFocus.js +9 -2
  45. package/es/global/js/package-settings.d.ts +7 -0
  46. package/es/global/js/package-settings.js +7 -0
  47. package/es/index.js +7 -0
  48. package/es/settings.d.ts +7 -0
  49. package/lib/components/ActionBar/ActionBar.js +11 -6
  50. package/lib/components/CreateTearsheet/CreateTearsheetDivider.d.ts +12 -1
  51. package/lib/components/CreateTearsheet/CreateTearsheetDivider.js +1 -1
  52. package/lib/components/DataSpreadsheet/DataSpreadsheet.js +36 -30
  53. package/lib/components/DataSpreadsheet/DataSpreadsheetBody.js +49 -2
  54. package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.d.ts +3 -1
  55. package/lib/components/DataSpreadsheet/hooks/useMoveActiveCell.js +9 -2
  56. package/lib/components/Datagrid/Datagrid/addons/RowSize/RowSizeRadioGroup.js +5 -5
  57. package/lib/components/Datagrid/useRowSize.js +4 -2
  58. package/lib/components/DescriptionList/DescriptionList.d.ts +0 -37
  59. package/lib/components/DescriptionList/DescriptionList.js +6 -11
  60. package/lib/components/DescriptionList/DescriptionListBody.d.ts +2 -0
  61. package/lib/components/DescriptionList/DescriptionListBody.js +46 -0
  62. package/lib/components/DescriptionList/DescriptionListCell.d.ts +2 -0
  63. package/lib/components/DescriptionList/DescriptionListCell.js +46 -0
  64. package/lib/components/DescriptionList/DescriptionListRow.d.ts +2 -0
  65. package/lib/components/DescriptionList/DescriptionListRow.js +48 -0
  66. package/lib/components/DescriptionList/index.d.ts +4 -1
  67. package/lib/components/FilterPanel/FilterPanel.d.ts +5 -0
  68. package/lib/components/FilterPanel/FilterPanel.js +62 -0
  69. package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.d.ts +5 -0
  70. package/lib/components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js +85 -0
  71. package/lib/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.d.ts +5 -0
  72. package/lib/components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js +70 -0
  73. package/lib/components/FilterPanel/FilterPanelLabel/index.d.ts +1 -0
  74. package/lib/components/FilterPanel/index.d.ts +3 -0
  75. package/lib/components/SidePanel/SidePanel.js +35 -68
  76. package/lib/components/Tearsheet/TearsheetShell.js +9 -1
  77. package/lib/components/Toolbar/ToolbarGroup.d.ts +17 -2
  78. package/lib/components/Toolbar/ToolbarGroup.js +0 -1
  79. package/lib/components/index.d.ts +3 -1
  80. package/lib/global/js/hooks/useFocus.js +9 -2
  81. package/lib/global/js/package-settings.d.ts +7 -0
  82. package/lib/global/js/package-settings.js +7 -0
  83. package/lib/index.js +35 -0
  84. package/lib/settings.d.ts +7 -0
  85. package/package.json +3 -3
  86. package/scss/components/FilterPanel/_carbon-imports.scss +9 -0
  87. package/scss/components/FilterPanel/_filter-panel-checkbox.scss +32 -0
  88. package/scss/components/FilterPanel/_filter-panel-label.scss +47 -0
  89. package/scss/components/FilterPanel/_filter-panel.scss +29 -0
  90. package/scss/components/FilterPanel/_index-with-carbon.scss +11 -0
  91. package/scss/components/FilterPanel/_index.scss +10 -0
  92. package/scss/components/_index-with-carbon.scss +1 -0
  93. package/scss/components/_index.scss +1 -0
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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.
6
+ */
7
+
8
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import PropTypes from '../../node_modules/prop-types/index.js';
11
+ import cx from 'classnames';
12
+ import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
13
+ import { pkg } from '../../settings.js';
14
+
15
+ var _excluded = ["children", "className", "title"];
16
+
17
+ // The block part of our conventional BEM class names (blockClass__E--M).
18
+ var blockClass = "".concat(pkg.prefix, "--filter-panel");
19
+ var componentName = 'FilterPanel';
20
+
21
+ /**
22
+ * The container for filter panel subcomponents.
23
+ */
24
+ var FilterPanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
25
+ var children = _ref.children,
26
+ className = _ref.className,
27
+ title = _ref.title,
28
+ rest = _objectWithoutProperties(_ref, _excluded);
29
+ return /*#__PURE__*/React__default.createElement("section", _extends({}, rest, {
30
+ className: cx(blockClass, className),
31
+ ref: ref
32
+ }, getDevtoolsProps(componentName)), title && /*#__PURE__*/React__default.createElement("h1", {
33
+ className: "".concat(blockClass, "__title")
34
+ }, title), children);
35
+ });
36
+
37
+ // Return a placeholder if not released and not enabled by feature flag
38
+ FilterPanel = pkg.checkComponentEnabled(FilterPanel, componentName);
39
+ FilterPanel.displayName = componentName;
40
+ FilterPanel.propTypes = {
41
+ /**
42
+ * Provide the contents of the FilterPanel.
43
+ */
44
+ children: PropTypes.node,
45
+ /**
46
+ * Provide an optional class to be applied to the containing node.
47
+ */
48
+ className: PropTypes.string,
49
+ /**
50
+ * Title text for the filter panel.
51
+ */
52
+ title: PropTypes.node
53
+ };
54
+
55
+ export { FilterPanel };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Provides a checkbox, label, and count.
3
+ */
4
+ export let FilterPanelCheckbox: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
+ import React from 'react';
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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.
6
+ */
7
+
8
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import PropTypes from '../../../node_modules/prop-types/index.js';
11
+ import cx from 'classnames';
12
+ import { Checkbox } from '@carbon/react';
13
+ import { getDevtoolsProps } from '../../../global/js/utils/devtools.js';
14
+ import { pkg } from '../../../settings.js';
15
+ import { FilterPanelLabel } from '../FilterPanelLabel/FilterPanelLabel.js';
16
+
17
+ var _excluded = ["className", "count", "labelText", "title"];
18
+
19
+ // The block part of our conventional BEM class names (blockClass__E--M).
20
+ var blockClass = "".concat(pkg.prefix, "--filter-panel-checkbox");
21
+ var componentName = 'FilterPanelCheckbox';
22
+
23
+ /**
24
+ * Provides a checkbox, label, and count.
25
+ */
26
+ var FilterPanelCheckbox = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
27
+ var className = _ref.className,
28
+ count = _ref.count,
29
+ labelText = _ref.labelText,
30
+ title = _ref.title,
31
+ rest = _objectWithoutProperties(_ref, _excluded);
32
+ return /*#__PURE__*/React__default.createElement(Checkbox, _extends({}, rest, {
33
+ className: cx(blockClass, className),
34
+ labelText: /*#__PURE__*/React__default.createElement(FilterPanelLabel, {
35
+ count: count,
36
+ labelText: labelText,
37
+ title: title
38
+ }),
39
+ ref: ref
40
+ }, getDevtoolsProps(componentName)));
41
+ });
42
+
43
+ // Return a placeholder if not released and not enabled by feature flag
44
+ FilterPanelCheckbox = pkg.checkComponentEnabled(FilterPanelCheckbox, componentName);
45
+ FilterPanelCheckbox.displayName = componentName;
46
+ FilterPanelCheckbox.propTypes = {
47
+ /**
48
+ * IMPORTANT NOTE
49
+ *
50
+ * This component is returning Carbon's Checkbox.
51
+ *
52
+ * All of Carbon Checkbox's props are directly available
53
+ * through "...rest", including id, onClick, etc.
54
+ */
55
+
56
+ /**
57
+ * Optional class to be applied to the containing node.
58
+ */
59
+ className: PropTypes.string,
60
+ /**
61
+ * Number to be displayed with the checkbox.
62
+ */
63
+ count: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
64
+ /**
65
+ * Unique identifier.
66
+ */
67
+ id: PropTypes.string.isRequired,
68
+ /**
69
+ * Label to be displayed with the checkbox.
70
+ */
71
+ labelText: PropTypes.node.isRequired,
72
+ /**
73
+ * Optional title attribute for the label.
74
+ */
75
+ title: PropTypes.string
76
+ };
77
+
78
+ export { FilterPanelCheckbox };
@@ -0,0 +1,5 @@
1
+ /**
2
+ * A container with a label and optional count.
3
+ */
4
+ export let FilterPanelLabel: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
5
+ import React from 'react';
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Copyright IBM Corp. 2020, 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.
6
+ */
7
+
8
+ import { objectWithoutProperties as _objectWithoutProperties, extends as _extends } from '../../../_virtual/_rollupPluginBabelHelpers.js';
9
+ import React__default from 'react';
10
+ import PropTypes from '../../../node_modules/prop-types/index.js';
11
+ import cx from 'classnames';
12
+ import { getDevtoolsProps } from '../../../global/js/utils/devtools.js';
13
+ import { pkg } from '../../../settings.js';
14
+
15
+ var _excluded = ["className", "count", "labelText", "title"];
16
+
17
+ // The block part of our conventional BEM class names (blockClass__E--M).
18
+ var blockClass = "".concat(pkg.prefix, "--filter-panel-label");
19
+ var componentName = 'FilterPanelLabel';
20
+
21
+ /**
22
+ * A container with a label and optional count.
23
+ */
24
+ var FilterPanelLabel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
25
+ var className = _ref.className,
26
+ count = _ref.count,
27
+ labelText = _ref.labelText,
28
+ title = _ref.title,
29
+ rest = _objectWithoutProperties(_ref, _excluded);
30
+ return /*#__PURE__*/React__default.createElement("span", _extends({}, rest, {
31
+ className: cx(blockClass, className),
32
+ ref: ref
33
+ }, getDevtoolsProps(componentName)), /*#__PURE__*/React__default.createElement("span", {
34
+ className: "".concat(blockClass, "__text"),
35
+ title: title
36
+ }, labelText), /*#__PURE__*/React__default.createElement("span", {
37
+ className: "".concat(blockClass, "__count")
38
+ }, count));
39
+ });
40
+
41
+ // Return a placeholder if not released and not enabled by feature flag
42
+ FilterPanelLabel = pkg.checkComponentEnabled(FilterPanelLabel, componentName);
43
+ FilterPanelLabel.displayName = componentName;
44
+ FilterPanelLabel.propTypes = {
45
+ /**
46
+ * Optional class to be applied to the containing node.
47
+ */
48
+ className: PropTypes.string,
49
+ /**
50
+ * Number to be displayed with the label.
51
+ */
52
+ count: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
53
+ /**
54
+ * The label for the component.
55
+ */
56
+ labelText: PropTypes.node.isRequired,
57
+ /**
58
+ * Optional title attribute for the label.
59
+ */
60
+ title: PropTypes.string
61
+ };
62
+
63
+ export { FilterPanelLabel };
@@ -0,0 +1 @@
1
+ export { FilterPanelLabel } from "./FilterPanelLabel";
@@ -0,0 +1,3 @@
1
+ export { FilterPanel } from "./FilterPanel";
2
+ export { FilterPanelCheckbox } from "./FilterPanelCheckbox/FilterPanelCheckbox";
3
+ export { FilterPanelLabel } from "./FilterPanelLabel/FilterPanelLabel";
@@ -14,7 +14,6 @@ import { useResizeObserver } from '../../global/js/hooks/useResizeObserver.js';
14
14
  import { moderate02 } from '@carbon/motion';
15
15
  import { getDevtoolsProps } from '../../global/js/utils/devtools.js';
16
16
  import { allPropTypes } from '../../global/js/utils/props-helper.js';
17
- import wrapFocus from '../../global/js/utils/wrapFocus.js';
18
17
  import { pkg } from '../../settings.js';
19
18
  import { SIDE_PANEL_SIZES } from './constants.js';
20
19
  import { Button } from '@carbon/react';
@@ -23,6 +22,7 @@ import { actionSetVariants, overlayVariants, panelVariants } from './motion/vari
23
22
  import pconsole from '../../global/js/utils/pconsole.js';
24
23
  import { ActionSet } from '../ActionSet/ActionSet.js';
25
24
  import { usePreviousValue } from '../../global/js/hooks/usePreviousValue.js';
25
+ import { useFocus } from '../../global/js/hooks/useFocus.js';
26
26
 
27
27
  var _excluded = ["actionToolbarButtons", "actions", "animateTitle", "children", "className", "closeIconDescription", "condensedActions", "currentStep", "id", "includeOverlay", "labelText", "navigationBackIconDescription", "onNavigationBack", "onRequestClose", "onUnmount", "open", "placement", "preventCloseOnClickOutside", "selectorPageContent", "selectorPrimaryFocus", "size", "slideIn", "slug", "subtitle", "title"],
28
28
  _excluded2 = ["label", "kind", "icon", "tooltipPosition", "tooltipAlignment", "leading", "disabled", "className", "onClick"];
@@ -87,8 +87,6 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
87
87
  var localRef = useRef();
88
88
  var sidePanelRef = ref || localRef;
89
89
  var overlayRef = useRef();
90
- var startTrapRef = useRef();
91
- var endTrapRef = useRef();
92
90
  var innerContentRef = useRef();
93
91
  var closeRef = useRef();
94
92
  var animatedScrollRef = useRef();
@@ -108,6 +106,9 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
108
106
  _useState6 = _slicedToArray(_useState5, 2),
109
107
  doAnimateTitle = _useState6[0],
110
108
  setDoAnimateTitle = _useState6[1];
109
+ var _useFocus = useFocus(sidePanelRef),
110
+ firstElement = _useFocus.firstElement,
111
+ keyDownListener = _useFocus.keyDownListener;
111
112
  var shouldReduceMotion = useReducedMotion();
112
113
  useEffect(function () {
113
114
  setDoAnimateTitle(animateTitle);
@@ -135,26 +136,6 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
135
136
  }
136
137
  }, [currentStep, sidePanelRef, size, previousState === null || previousState === void 0 ? void 0 : previousState.size, id]);
137
138
 
138
- // set initial focus when side panel opens
139
- useEffect(function () {
140
- var initialFocus = function initialFocus(focusContainerElement) {
141
- var containerElement = focusContainerElement;
142
- var primaryFocusElement = containerElement && containerElement.querySelector(selectorPrimaryFocus);
143
- if (primaryFocusElement) {
144
- return primaryFocusElement;
145
- } else {
146
- return closeRef && closeRef.current;
147
- }
148
- };
149
- var focusButton = function focusButton(focusContainerElement) {
150
- var target = initialFocus(focusContainerElement);
151
- target === null || target === void 0 || target.focus();
152
- };
153
- if (open && animationComplete) {
154
- focusButton(innerContentRef.current);
155
- }
156
- }, [selectorPrimaryFocus, open, animationComplete]);
157
-
158
139
  // Add console warning if labelText is provided without a title.
159
140
  // This combination is not allowed.
160
141
  useEffect(function () {
@@ -301,23 +282,19 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
301
282
  }
302
283
  }
303
284
  }, [slideIn, selectorPageContent, placement, size, reducedMotion.matches, open]);
304
-
305
- // adds focus trap functionality
306
- /* istanbul ignore next */
307
- var handleBlur = function handleBlur(_ref2) {
308
- var oldActiveNode = _ref2.target,
309
- currentActiveNode = _ref2.relatedTarget;
310
- // focus trap should only be set if the side panel is a `slideOver` type
311
- if (open && innerContentRef && !slideIn) {
312
- wrapFocus({
313
- bodyNode: innerContentRef.current,
314
- startTrapRef: startTrapRef,
315
- endTrapRef: endTrapRef,
316
- currentActiveNode: currentActiveNode,
317
- oldActiveNode: oldActiveNode
318
- });
285
+ useEffect(function () {
286
+ if (open) {
287
+ setTimeout(function () {
288
+ var _document;
289
+ var primeFocusEl = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(selectorPrimaryFocus);
290
+ if (selectorPrimaryFocus && primeFocusEl) {
291
+ primeFocusEl.focus();
292
+ } else {
293
+ firstElement === null || firstElement === void 0 || firstElement.focus();
294
+ }
295
+ }, 0);
319
296
  }
320
- };
297
+ }, [animationComplete, firstElement, open, selectorPrimaryFocus]);
321
298
  var primaryActionContainerClassNames = cx(["".concat(blockClass, "__actions-container"), _defineProperty({}, "".concat(blockClass, "__actions-container--condensed"), condensedActions)]);
322
299
  var mainPanelClassNames = cx([blockClass, className, "".concat(blockClass), "".concat(blockClass, "--").concat(size), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_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, "--animated-title"), doAnimateTitle), "".concat(blockClass, "--has-overlay"), includeOverlay)]);
323
300
  var renderTitle = function renderTitle() {
@@ -383,17 +360,17 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
383
360
  ref: subtitleRef
384
361
  }, subtitle), actionToolbarButtons && actionToolbarButtons.length && /*#__PURE__*/React__default.createElement("div", {
385
362
  className: "".concat(blockClass, "__action-toolbar")
386
- }, actionToolbarButtons.map(function (_ref5) {
387
- var label = _ref5.label,
388
- kind = _ref5.kind,
389
- icon = _ref5.icon,
390
- tooltipPosition = _ref5.tooltipPosition,
391
- tooltipAlignment = _ref5.tooltipAlignment,
392
- leading = _ref5.leading,
393
- disabled = _ref5.disabled,
394
- className = _ref5.className,
395
- onClick = _ref5.onClick,
396
- rest = _objectWithoutProperties(_ref5, _excluded2);
363
+ }, actionToolbarButtons.map(function (_ref4) {
364
+ var label = _ref4.label,
365
+ kind = _ref4.kind,
366
+ icon = _ref4.icon,
367
+ tooltipPosition = _ref4.tooltipPosition,
368
+ tooltipAlignment = _ref4.tooltipAlignment,
369
+ leading = _ref4.leading,
370
+ disabled = _ref4.disabled,
371
+ className = _ref4.className,
372
+ onClick = _ref4.onClick,
373
+ rest = _objectWithoutProperties(_ref4, _excluded2);
397
374
  return /*#__PURE__*/React__default.createElement(Button, _extends({}, rest, {
398
375
  key: label,
399
376
  kind: kind || 'ghost',
@@ -419,7 +396,6 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
419
396
  return /*#__PURE__*/React__default.createElement(AnimatePresence, null, open && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(motion.div, _extends({}, getDevtoolsProps(componentName), rest, {
420
397
  id: id,
421
398
  className: mainPanelClassNames,
422
- onBlur: handleBlur,
423
399
  ref: sidePanelRef,
424
400
  role: "complementary",
425
401
  "aria-label": title,
@@ -434,13 +410,9 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
434
410
  custom: {
435
411
  placement: placement,
436
412
  shouldReduceMotion: shouldReduceMotion
437
- }
438
- }), /*#__PURE__*/React__default.createElement("span", {
439
- ref: startTrapRef,
440
- tabIndex: "0",
441
- role: "link",
442
- className: "".concat(blockClass, "__visually-hidden")
443
- }, "Focus sentinel"), doAnimateTitle ? /*#__PURE__*/React__default.createElement("div", {
413
+ },
414
+ onKeyDown: keyDownListener
415
+ }), doAnimateTitle ? /*#__PURE__*/React__default.createElement("div", {
444
416
  ref: animatedScrollRef,
445
417
  className: "".concat(blockClass, "__animated-scroll-wrapper ").concat(blockClass, "--scrolls")
446
418
  }, renderHeader(), renderMain()) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, renderHeader(), renderMain()), /*#__PURE__*/React__default.createElement(MotionActionSet, {
@@ -449,12 +421,7 @@ var SidePanel = /*#__PURE__*/React__default.forwardRef(function (_ref, ref) {
449
421
  size: size === 'xs' ? 'sm' : size,
450
422
  custom: shouldReduceMotion,
451
423
  variants: actionSetVariants
452
- }), /*#__PURE__*/React__default.createElement("span", {
453
- ref: endTrapRef,
454
- tabIndex: "0",
455
- role: "link",
456
- className: "".concat(blockClass, "__visually-hidden")
457
- }, "Focus sentinel")), /*#__PURE__*/React__default.createElement(AnimatePresence, null, includeOverlay && /*#__PURE__*/React__default.createElement(motion.div, {
424
+ })), /*#__PURE__*/React__default.createElement(AnimatePresence, null, includeOverlay && /*#__PURE__*/React__default.createElement(motion.div, {
458
425
  variants: overlayVariants,
459
426
  initial: "hidden",
460
427
  animate: "visible",
@@ -574,8 +541,8 @@ SidePanel.propTypes = {
574
541
  * This is the selector to the element that contains all of the page content that will shrink if the panel is a slide in.
575
542
  * This prop is required when using the `slideIn` variant of the side panel.
576
543
  */
577
- selectorPageContent: PropTypes.string.isRequired.if(function (_ref7) {
578
- var slideIn = _ref7.slideIn;
544
+ selectorPageContent: PropTypes.string.isRequired.if(function (_ref6) {
545
+ var slideIn = _ref6.slideIn;
579
546
  return slideIn;
580
547
  }),
581
548
  /**
@@ -602,8 +569,8 @@ SidePanel.propTypes = {
602
569
  /**
603
570
  * Sets the title text
604
571
  */
605
- title: PropTypes.string.isRequired.if(function (_ref8) {
606
- var labelText = _ref8.labelText;
572
+ title: PropTypes.string.isRequired.if(function (_ref7) {
573
+ var labelText = _ref7.labelText;
607
574
  return labelText;
608
575
  })
609
576
  };
@@ -140,7 +140,15 @@ var TearsheetShell = /*#__PURE__*/React__default.forwardRef(function (_ref, ref)
140
140
  firstElement === null || firstElement === void 0 || firstElement.focus();
141
141
  }, 0);
142
142
  }
143
- }, [open, firstElement]);
143
+ // eslint-disable-next-line react-hooks/exhaustive-deps
144
+ }, [open]);
145
+ useEffect(function () {
146
+ if (open && position !== depth) {
147
+ setTimeout(function () {
148
+ firstElement === null || firstElement === void 0 || firstElement.focus();
149
+ }, 0);
150
+ }
151
+ }, [position, depth, firstElement, open]);
144
152
  useEffect(function () {
145
153
  var notify = function notify() {
146
154
  return stack.all.forEach(function (handler) {
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Copyright IBM Corp. 2021, 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.
6
+ */
7
+ import React, { ReactNode } from 'react';
8
+ interface ToolbarGroupProps {
9
+ /** Provide the content of the `ToolbarGroup` */
10
+ children?: ReactNode;
11
+ /** Provide an optional class to be applied to the containing node */
12
+ className?: string;
13
+ }
1
14
  /** Toolbar groups organize the commands within a toolbar into related groups. */
2
- export let ToolbarGroup: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
3
- import React from 'react';
15
+ export declare let ToolbarGroup: React.ForwardRefExoticComponent<ToolbarGroupProps & {
16
+ children?: React.ReactNode;
17
+ } & React.RefAttributes<HTMLDivElement>>;
18
+ export {};
@@ -13,7 +13,6 @@ import { pkg } from '../../settings.js';
13
13
  import { blockClass } from './Toolbar.js';
14
14
 
15
15
  var _excluded = ["className", "children"];
16
-
17
16
  /** Toolbar groups organize the commands within a toolbar into related groups. */
18
17
  var ToolbarGroup = /*#__PURE__*/forwardRef(function (_ref, ref) {
19
18
  var className = _ref.className,
@@ -44,13 +44,13 @@ export { Decorator } from "./Decorator";
44
44
  export { DecoratorLink } from "./DecoratorLink";
45
45
  export { DecoratorSingleButton } from "./DecoratorSingleButton";
46
46
  export { DecoratorDualButton } from "./DecoratorDualButton";
47
- export { DescriptionList } from "./DescriptionList";
48
47
  export { FullPageError } from "./FullPageError";
49
48
  export { SearchBar } from "./SearchBar";
50
49
  export { Nav } from "./Nav";
51
50
  export { StringFormatter } from "./StringFormatter";
52
51
  export { UserAvatar } from "./UserAvatar";
53
52
  export { StatusIndicator } from "./StatusIndicator";
53
+ export { ActionBar } from "./ActionBar";
54
54
  export { ComboButton, ComboButtonItem } from "./ComboButton";
55
55
  export { CreateFullPage, CreateFullPageStep } from "./CreateFullPage";
56
56
  export { CreateTearsheet, CreateTearsheetStep, CreateTearsheetDivider } from "./CreateTearsheet";
@@ -63,3 +63,5 @@ export { Datagrid, useDatagrid, useInfiniteScroll, useNestedRows, useSelectRows,
63
63
  export { EditTearsheet, EditTearsheetForm } from "./EditTearsheet";
64
64
  export { Guidebanner, GuidebannerElement, GuidebannerElementButton, GuidebannerElementLink } from "./Guidebanner";
65
65
  export { InlineTip, InlineTipButton, InlineTipLink } from "./InlineTip";
66
+ export { DescriptionList, DescriptionListBody, DescriptionListCell, DescriptionListRow } from "./DescriptionList";
67
+ export { FilterPanel, FilterPanelCheckbox, FilterPanelLabel } from "./FilterPanel";
@@ -27,10 +27,17 @@ var useFocus = function useFocus(modalRef) {
27
27
  var query = "".concat(queryButton, ",").concat(queryLink, ",").concat(queryInput, ",").concat(querySelect, ",").concat(queryTextarea, ", ").concat(queryTabIndex);
28
28
  var modalEl = modalRef === null || modalRef === void 0 ? void 0 : modalRef.current;
29
29
  var getFocusable = useCallback(function () {
30
+ var _focusableElements, _focusableElements2, _focusableElements3, _focusableElements4;
30
31
  // Selecting all focusable elements based on the above conditions
31
32
  var focusableElements = modalEl === null || modalEl === void 0 ? void 0 : modalEl.querySelectorAll("".concat(query));
32
- var first = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements[0];
33
- var last = focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements[(focusableElements === null || focusableElements === void 0 ? void 0 : focusableElements.length) - 1];
33
+ if ((_focusableElements = focusableElements) !== null && _focusableElements !== void 0 && _focusableElements.length) {
34
+ focusableElements = Array.prototype.filter.call(focusableElements, function (el) {
35
+ var _window;
36
+ return ((_window = window) === null || _window === void 0 || (_window = _window.getComputedStyle(el)) === null || _window === void 0 ? void 0 : _window.display) !== 'none';
37
+ });
38
+ }
39
+ var first = (_focusableElements2 = focusableElements) === null || _focusableElements2 === void 0 ? void 0 : _focusableElements2[0];
40
+ var last = (_focusableElements3 = focusableElements) === null || _focusableElements3 === void 0 ? void 0 : _focusableElements3[((_focusableElements4 = focusableElements) === null || _focusableElements4 === void 0 ? void 0 : _focusableElements4.length) - 1];
34
41
  var all = focusableElements;
35
42
  return {
36
43
  first: first,
@@ -83,6 +83,10 @@ declare namespace defaults {
83
83
  let StringFormatter: boolean;
84
84
  let StatusIndicator: boolean;
85
85
  let StatusIndicatorStep: boolean;
86
+ let ActionBar: boolean;
87
+ let FilterPanel: boolean;
88
+ let FilterPanelCheckbox: boolean;
89
+ let FilterPanelLabel: boolean;
86
90
  let Coachmark: boolean;
87
91
  let CoachmarkBeacon: boolean;
88
92
  let CoachmarkButton: boolean;
@@ -95,6 +99,9 @@ declare namespace defaults {
95
99
  let DecoratorSingleButton: boolean;
96
100
  let DecoratorDualButton: boolean;
97
101
  let DescriptionList: boolean;
102
+ let DescriptionListBody: boolean;
103
+ let DescriptionListCell: boolean;
104
+ let DescriptionListRow: boolean;
98
105
  let SearchBar: boolean;
99
106
  let UserAvatar: boolean;
100
107
  let Checklist: boolean;
@@ -82,6 +82,10 @@ var defaults = {
82
82
  StringFormatter: false,
83
83
  StatusIndicator: false,
84
84
  StatusIndicatorStep: false,
85
+ ActionBar: false,
86
+ FilterPanel: false,
87
+ FilterPanelCheckbox: false,
88
+ FilterPanelLabel: false,
85
89
  /* new component flags here - comment used by generate CLI */
86
90
 
87
91
  // Novice to pro components not yet reviewed and released:
@@ -97,6 +101,9 @@ var defaults = {
97
101
  DecoratorSingleButton: false,
98
102
  DecoratorDualButton: false,
99
103
  DescriptionList: false,
104
+ DescriptionListBody: false,
105
+ DescriptionListCell: false,
106
+ DescriptionListRow: false,
100
107
  SearchBar: false,
101
108
  UserAvatar: false,
102
109
  /* new component flags here - comment used by generate CLI */
package/es/index.js CHANGED
@@ -110,9 +110,16 @@ export { DecoratorLink } from './components/DecoratorLink/DecoratorLink.js';
110
110
  export { DecoratorSingleButton } from './components/DecoratorSingleButton/DecoratorSingleButton.js';
111
111
  export { DecoratorDualButton } from './components/DecoratorDualButton/DecoratorDualButton.js';
112
112
  export { DescriptionList } from './components/DescriptionList/DescriptionList.js';
113
+ export { DescriptionListBody } from './components/DescriptionList/DescriptionListBody.js';
114
+ export { DescriptionListCell } from './components/DescriptionList/DescriptionListCell.js';
115
+ export { DescriptionListRow } from './components/DescriptionList/DescriptionListRow.js';
113
116
  export { FullPageError } from './components/FullPageError/FullPageError.js';
114
117
  export { SearchBar } from './components/SearchBar/SearchBar.js';
115
118
  export { Nav } from './components/Nav/Nav.js';
116
119
  export { StringFormatter } from './components/StringFormatter/StringFormatter.js';
117
120
  export { UserAvatar } from './components/UserAvatar/UserAvatar.js';
118
121
  export { StatusIndicator } from './components/StatusIndicator/StatusIndicator.js';
122
+ export { ActionBar } from './components/ActionBar/ActionBar.js';
123
+ export { FilterPanel } from './components/FilterPanel/FilterPanel.js';
124
+ export { FilterPanelCheckbox } from './components/FilterPanel/FilterPanelCheckbox/FilterPanelCheckbox.js';
125
+ export { FilterPanelLabel } from './components/FilterPanel/FilterPanelLabel/FilterPanelLabel.js';
package/es/settings.d.ts CHANGED
@@ -69,6 +69,10 @@ export const pkg: {
69
69
  StringFormatter: boolean;
70
70
  StatusIndicator: boolean;
71
71
  StatusIndicatorStep: boolean;
72
+ ActionBar: boolean;
73
+ FilterPanel: boolean;
74
+ FilterPanelCheckbox: boolean;
75
+ FilterPanelLabel: boolean;
72
76
  Coachmark: boolean;
73
77
  CoachmarkBeacon: boolean;
74
78
  CoachmarkButton: boolean;
@@ -81,6 +85,9 @@ export const pkg: {
81
85
  DecoratorSingleButton: boolean;
82
86
  DecoratorDualButton: boolean;
83
87
  DescriptionList: boolean;
88
+ DescriptionListBody: boolean;
89
+ DescriptionListCell: boolean;
90
+ DescriptionListRow: boolean;
84
91
  SearchBar: boolean;
85
92
  UserAvatar: boolean;
86
93
  Checklist: boolean;
@@ -34,13 +34,19 @@ var _excluded = ["actions", "className", "maxVisible", "menuOptionsClass", "onWi
34
34
  var blockClass = "".concat(settings.pkg.prefix, "--action-bar");
35
35
  var componentName = 'ActionBar';
36
36
 
37
+ // Default values for props
38
+ var defaults = {
39
+ actions: Object.freeze([])
40
+ };
41
+
37
42
  // NOTE: the component SCSS is not imported here: it is rolled up separately.
38
43
 
39
44
  /**
40
45
  * The ActionBar is used internally by the PageHeader to wrap ActionBarItems.
41
46
  */
42
- var ActionBar = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
43
- var actions = _ref.actions,
47
+ exports.ActionBar = /*#__PURE__*/React__default["default"].forwardRef(function (_ref, ref) {
48
+ var _ref$actions = _ref.actions,
49
+ actions = _ref$actions === void 0 ? defaults.actions : _ref$actions,
44
50
  className = _ref.className,
45
51
  maxVisible = _ref.maxVisible,
46
52
  menuOptionsClass = _ref.menuOptionsClass,
@@ -197,8 +203,9 @@ var ActionBar = /*#__PURE__*/React__default["default"].forwardRef(function (_ref
197
203
  className: cx__default["default"](["".concat(blockClass, "__displayed-items"), _rollupPluginBabelHelpers.defineProperty({}, "".concat(blockClass, "__displayed-items--right"), rightAlign)])
198
204
  }, displayedItems));
199
205
  });
200
- ActionBar.displayName = componentName;
201
- ActionBar.propTypes = {
206
+ exports.ActionBar = settings.pkg.checkComponentEnabled(exports.ActionBar, componentName);
207
+ exports.ActionBar.displayName = componentName;
208
+ exports.ActionBar.propTypes = {
202
209
  /**
203
210
  * Specifies the action bar items. Each item is specified as an object
204
211
  * with required fields: key for array rendering, renderIcon, iconDescription and
@@ -252,5 +259,3 @@ ActionBar.propTypes = {
252
259
  */
253
260
  rightAlign: index["default"].bool
254
261
  };
255
-
256
- exports.ActionBar = ActionBar;
@@ -1,2 +1,13 @@
1
- export let CreateTearsheetDivider: React.ForwardRefExoticComponent<React.RefAttributes<any>>;
1
+ /**
2
+ * Copyright IBM Corp. 2021, 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.
6
+ */
2
7
  import React from 'react';
8
+ interface CreateTearsheetDividerProps {
9
+ /** Specifies an optional className to be added to the tearsheet divider */
10
+ className?: string;
11
+ }
12
+ export declare let CreateTearsheetDivider: React.FC<CreateTearsheetDividerProps>;
13
+ export {};
@@ -36,7 +36,7 @@ exports.CreateTearsheetDivider = /*#__PURE__*/React.forwardRef(function (_ref, r
36
36
  exports.CreateTearsheetDivider = settings.pkg.checkComponentEnabled(exports.CreateTearsheetDivider, componentName);
37
37
  exports.CreateTearsheetDivider.propTypes = {
38
38
  /**
39
- * Sets an optional className to be added to the tearsheet step
39
+ * Sets an optional className to be added to the tearsheet divider
40
40
  */
41
41
  className: index["default"].string
42
42
  };