@carbon/react 1.41.2 → 1.42.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 (53) hide show
  1. package/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json +682 -614
  2. package/es/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +25 -0
  3. package/es/components/Breadcrumb/Breadcrumb.d.ts +24 -0
  4. package/es/components/Breadcrumb/Breadcrumb.js +1 -2
  5. package/es/components/Breadcrumb/BreadcrumbItem.d.ts +25 -0
  6. package/es/components/Breadcrumb/BreadcrumbItem.js +8 -7
  7. package/es/components/ComboBox/ComboBox.d.ts +7 -1
  8. package/es/components/ComboBox/ComboBox.js +30 -2
  9. package/es/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
  10. package/es/components/DataTable/TableBatchAction.d.ts +46 -0
  11. package/es/components/DataTable/TableBatchAction.js +1 -2
  12. package/es/components/DataTable/TableExpandRow.d.ts +2 -46
  13. package/es/components/DataTable/TableExpandRow.js +6 -2
  14. package/es/components/Dropdown/Dropdown.d.ts +1 -1
  15. package/es/components/Tabs/Tabs.js +1 -2
  16. package/es/components/TreeView/TreeNode.js +7 -4
  17. package/es/components/UIShell/HeaderMenu.js +2 -2
  18. package/es/components/UIShell/SideNav.d.ts +1 -1
  19. package/es/components/UIShell/SideNavFooter.d.ts +52 -0
  20. package/es/components/UIShell/SideNavFooter.js +0 -1
  21. package/es/components/UIShell/SideNavItem.d.ts +24 -0
  22. package/es/components/UIShell/SideNavItem.js +2 -2
  23. package/es/components/UIShell/SideNavMenu.js +4 -5
  24. package/es/components/UIShell/SideNavMenuItem.d.ts +25 -0
  25. package/es/components/UIShell/SideNavMenuItem.js +1 -2
  26. package/es/index.js +1 -1
  27. package/icons/index.d.ts +7 -0
  28. package/lib/components/Breadcrumb/Breadcrumb.Skeleton.d.ts +25 -0
  29. package/lib/components/Breadcrumb/Breadcrumb.d.ts +24 -0
  30. package/lib/components/Breadcrumb/Breadcrumb.js +1 -2
  31. package/lib/components/Breadcrumb/BreadcrumbItem.d.ts +25 -0
  32. package/lib/components/Breadcrumb/BreadcrumbItem.js +8 -7
  33. package/lib/components/ComboBox/ComboBox.d.ts +7 -1
  34. package/lib/components/ComboBox/ComboBox.js +30 -2
  35. package/lib/components/ContentSwitcher/ContentSwitcher.d.ts +1 -1
  36. package/lib/components/DataTable/TableBatchAction.d.ts +46 -0
  37. package/lib/components/DataTable/TableBatchAction.js +1 -2
  38. package/lib/components/DataTable/TableExpandRow.d.ts +2 -46
  39. package/lib/components/DataTable/TableExpandRow.js +6 -2
  40. package/lib/components/Dropdown/Dropdown.d.ts +1 -1
  41. package/lib/components/Tabs/Tabs.js +1 -2
  42. package/lib/components/TreeView/TreeNode.js +7 -4
  43. package/lib/components/UIShell/HeaderMenu.js +2 -2
  44. package/lib/components/UIShell/SideNav.d.ts +1 -1
  45. package/lib/components/UIShell/SideNavFooter.d.ts +52 -0
  46. package/lib/components/UIShell/SideNavFooter.js +0 -1
  47. package/lib/components/UIShell/SideNavItem.d.ts +24 -0
  48. package/lib/components/UIShell/SideNavItem.js +2 -2
  49. package/lib/components/UIShell/SideNavMenu.js +4 -5
  50. package/lib/components/UIShell/SideNavMenuItem.d.ts +25 -0
  51. package/lib/components/UIShell/SideNavMenuItem.js +1 -2
  52. package/lib/index.js +2 -2
  53. package/package.json +8 -7
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
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 from 'react';
8
+ interface SideNavItemProps {
9
+ /**
10
+ * Provide a single icon as the child to `SideNavItem` to render in the
11
+ * container
12
+ */
13
+ children: React.ReactNode;
14
+ /**
15
+ * Provide an optional class to be applied to the containing node
16
+ */
17
+ className?: string;
18
+ /**
19
+ * Specify if this is a large variation of the SideNavItem
20
+ */
21
+ large?: boolean;
22
+ }
23
+ declare const SideNavItem: React.FC<SideNavItemProps>;
24
+ export default SideNavItem;
@@ -20,7 +20,7 @@ var cx__default = /*#__PURE__*/_interopDefaultLegacy(cx);
20
20
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
21
21
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
22
22
 
23
- function SideNavItem(_ref) {
23
+ const SideNavItem = _ref => {
24
24
  let {
25
25
  className: customClassName,
26
26
  children,
@@ -35,7 +35,7 @@ function SideNavItem(_ref) {
35
35
  return /*#__PURE__*/React__default["default"].createElement("li", {
36
36
  className: className
37
37
  }, children);
38
- }
38
+ };
39
39
  SideNavItem.propTypes = {
40
40
  /**
41
41
  * Provide a single icon as the child to `SideNavItem` to render in the
@@ -44,7 +44,7 @@ const SideNavMenu = /*#__PURE__*/React__default["default"].forwardRef(function S
44
44
  const [prevExpanded, setPrevExpanded] = React.useState(defaultExpanded);
45
45
  const className = cx__default["default"]({
46
46
  [`${prefix}--side-nav__item`]: true,
47
- [`${prefix}--side-nav__item--active`]: isActive || hasActiveChild(children) && !isExpanded,
47
+ [`${prefix}--side-nav__item--active`]: isActive || hasActiveDescendant(children) && !isExpanded,
48
48
  [`${prefix}--side-nav__item--icon`]: IconElement,
49
49
  [`${prefix}--side-nav__item--large`]: large,
50
50
  [customClassName]: !!customClassName
@@ -76,8 +76,7 @@ const SideNavMenu = /*#__PURE__*/React__default["default"].forwardRef(function S
76
76
  type: "button",
77
77
  tabIndex: tabIndex === undefined ? !isSideNavExpanded && !isRail ? -1 : 0 : tabIndex
78
78
  }, IconElement && /*#__PURE__*/React__default["default"].createElement(SideNavIcon["default"], null, /*#__PURE__*/React__default["default"].createElement(IconElement, null)), /*#__PURE__*/React__default["default"].createElement("span", {
79
- className: `${prefix}--side-nav__submenu-title`,
80
- title: title
79
+ className: `${prefix}--side-nav__submenu-title`
81
80
  }, title), /*#__PURE__*/React__default["default"].createElement(SideNavIcon["default"], {
82
81
  className: `${prefix}--side-nav__submenu-chevron`,
83
82
  small: true
@@ -137,7 +136,7 @@ SideNavMenu.propTypes = {
137
136
  Defining the children parameter with the type ReactNode | ReactNode[]. This allows for various possibilities:
138
137
  a single element, an array of elements, or null or undefined.
139
138
  **/
140
- function hasActiveChild(children) {
139
+ function hasActiveDescendant(children) {
141
140
  if (Array.isArray(children)) {
142
141
  return children.some(child => {
143
142
  if (! /*#__PURE__*/React__default["default"].isValidElement(child)) {
@@ -148,7 +147,7 @@ function hasActiveChild(children) {
148
147
  safety when accessing their props.
149
148
  **/
150
149
  const props = child.props;
151
- if (props.isActive === true || props['aria-current']) {
150
+ if (props.isActive === true || props['aria-current'] || props.children instanceof Array && hasActiveDescendant(props.children)) {
152
151
  return true;
153
152
  }
154
153
  return false;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright IBM Corp. 2016, 2023
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, { HTMLAttributes } from 'react';
8
+ interface SideNavMenuItemProps extends HTMLAttributes<HTMLElement> {
9
+ /**
10
+ * Specify the children to be rendered inside of the `SideNavMenuItem`
11
+ */
12
+ children?: React.ReactNode;
13
+ /**
14
+ * Provide an optional class to be applied to the containing node
15
+ */
16
+ className?: string;
17
+ /**
18
+ * Optionally specify whether the link is "active". An active link is one that
19
+ * has an href that is the same as the current page. Can also pass in
20
+ * `aria-current="page"`, as well.
21
+ */
22
+ isActive?: boolean;
23
+ }
24
+ declare const SideNavMenuItem: React.ForwardRefExoticComponent<SideNavMenuItemProps & React.RefAttributes<HTMLElement>>;
25
+ export default SideNavMenuItem;
@@ -60,6 +60,5 @@ SideNavMenuItem.propTypes = {
60
60
  */
61
61
  isActive: PropTypes__default["default"].bool
62
62
  };
63
- var SideNavMenuItem$1 = SideNavMenuItem;
64
63
 
65
- exports["default"] = SideNavMenuItem$1;
64
+ exports["default"] = SideNavMenuItem;
package/lib/index.js CHANGED
@@ -165,7 +165,6 @@ var ModalWrapper = require('./components/ModalWrapper/ModalWrapper.js');
165
165
  var ProgressIndicator_Skeleton = require('./components/ProgressIndicator/ProgressIndicator.Skeleton.js');
166
166
  var TextInput_Skeleton = require('./components/TextInput/TextInput.Skeleton.js');
167
167
  var TextInput = require('./components/TextInput/TextInput.js');
168
- var TreeNode = require('./components/TreeView/TreeNode.js');
169
168
  var TreeView = require('./components/TreeView/TreeView.js');
170
169
  var ProgressBar = require('./components/ProgressBar/ProgressBar.js');
171
170
  var FluidComboBox = require('./components/FluidComboBox/FluidComboBox.js');
@@ -223,6 +222,7 @@ var SkeletonIcon = require('./components/SkeletonIcon/SkeletonIcon.js');
223
222
  var Slider_Skeleton = require('./components/Slider/Slider.Skeleton.js');
224
223
  var Switch = require('./components/Switch/Switch.js');
225
224
  var IconSwitch = require('./components/Switch/IconSwitch.js');
225
+ var TreeNode = require('./components/TreeView/TreeNode.js');
226
226
  var Stack = require('./components/Stack/Stack.js');
227
227
 
228
228
 
@@ -418,7 +418,6 @@ exports.ModalWrapper = ModalWrapper["default"];
418
418
  exports.ProgressIndicatorSkeleton = ProgressIndicator_Skeleton["default"];
419
419
  exports.TextInputSkeleton = TextInput_Skeleton["default"];
420
420
  exports.TextInput = TextInput["default"];
421
- exports.TreeNode = TreeNode["default"];
422
421
  exports.TreeView = TreeView["default"];
423
422
  exports.ProgressBar = ProgressBar["default"];
424
423
  exports.unstable__FluidComboBox = FluidComboBox["default"];
@@ -481,4 +480,5 @@ exports.SkeletonIcon = SkeletonIcon["default"];
481
480
  exports.SliderSkeleton = Slider_Skeleton["default"];
482
481
  exports.Switch = Switch["default"];
483
482
  exports.IconSwitch = IconSwitch["default"];
483
+ exports.TreeNode = TreeNode["default"];
484
484
  exports.Stack = Stack.Stack;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/react",
3
3
  "description": "React components for the Carbon Design System",
4
- "version": "1.41.2",
4
+ "version": "1.42.0-rc.0",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -18,6 +18,7 @@
18
18
  "index.scss",
19
19
  "icons/index.js",
20
20
  "icons/index.esm.js",
21
+ "icons/index.d.ts",
21
22
  "icons/package.json",
22
23
  ".playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json"
23
24
  ],
@@ -47,9 +48,9 @@
47
48
  "dependencies": {
48
49
  "@babel/runtime": "^7.18.3",
49
50
  "@carbon/feature-flags": "^0.16.0",
50
- "@carbon/icons-react": "^11.29.2",
51
- "@carbon/layout": "^11.20.1",
52
- "@carbon/styles": "^1.41.2",
51
+ "@carbon/icons-react": "^11.30.0-rc.0",
52
+ "@carbon/layout": "^11.20.0",
53
+ "@carbon/styles": "^1.42.0-rc.0",
53
54
  "@carbon/telemetry": "0.1.0",
54
55
  "classnames": "2.3.2",
55
56
  "copy-to-clipboard": "^3.3.1",
@@ -77,7 +78,7 @@
77
78
  "@babel/preset-react": "^7.22.3",
78
79
  "@babel/preset-typescript": "^7.21.5",
79
80
  "@carbon/test-utils": "^10.30.0",
80
- "@carbon/themes": "^11.26.1",
81
+ "@carbon/themes": "^11.26.0",
81
82
  "@rollup/plugin-babel": "^6.0.0",
82
83
  "@rollup/plugin-commonjs": "^25.0.0",
83
84
  "@rollup/plugin-node-resolve": "^15.0.0",
@@ -124,7 +125,7 @@
124
125
  "storybook-readme": "^5.0.9",
125
126
  "stream-browserify": "^3.0.0",
126
127
  "style-loader": "^3.3.1",
127
- "typescript-config-carbon": "^0.2.1",
128
+ "typescript-config-carbon": "^0.2.0",
128
129
  "webpack": "^5.65.0",
129
130
  "webpack-dev-server": "^4.7.4"
130
131
  },
@@ -139,5 +140,5 @@
139
140
  "**/*.scss",
140
141
  "**/*.css"
141
142
  ],
142
- "gitHead": "a4709f9f15fd713e910528118e5192faf5a48985"
143
+ "gitHead": "5f47b0432b76b562cb152b481fe82d21e74da6d9"
143
144
  }