@carbon/react 1.107.0 → 1.107.1
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.
|
@@ -12,15 +12,13 @@ import { setupGetInstanceId } from "../../tools/setupGetInstanceId.js";
|
|
|
12
12
|
import { noopFn } from "../../internal/noopFn.js";
|
|
13
13
|
import { deprecate } from "../../prop-types/deprecate.js";
|
|
14
14
|
import { deprecateValuesWithin } from "../../prop-types/deprecateValuesWithin.js";
|
|
15
|
-
import { isComponentElement } from "../../internal/utils.js";
|
|
16
15
|
import { mapPopoverAlign } from "../../tools/mapPopoverAlign.js";
|
|
17
16
|
import { IconButton } from "../IconButton/index.js";
|
|
18
17
|
import { mergeRefs } from "../../tools/mergeRefs.js";
|
|
19
|
-
import OverflowMenuItem from "../OverflowMenuItem/OverflowMenuItem.js";
|
|
20
18
|
import { DIRECTION_BOTTOM, FloatingMenu } from "../../internal/FloatingMenu.js";
|
|
21
19
|
import { useOutsideClick } from "../../internal/useOutsideClick.js";
|
|
22
20
|
import classNames from "classnames";
|
|
23
|
-
import React, { Children, cloneElement, forwardRef, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
21
|
+
import React, { Children, cloneElement, forwardRef, isValidElement, useCallback, useContext, useEffect, useRef, useState } from "react";
|
|
24
22
|
import PropTypes from "prop-types";
|
|
25
23
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
26
24
|
import { OverflowMenuVertical } from "@carbon/icons-react";
|
|
@@ -224,14 +222,17 @@ const OverflowMenu = forwardRef(({ align, ["aria-label"]: ariaLabel = null, aria
|
|
|
224
222
|
});
|
|
225
223
|
const overflowMenuIconClasses = classNames(`${prefix}--overflow-menu__icon`, iconClass);
|
|
226
224
|
const childrenWithProps = Children.toArray(children).map((child, index) => {
|
|
227
|
-
if (
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
225
|
+
if (isValidElement(child)) {
|
|
226
|
+
const childElement = child;
|
|
227
|
+
return cloneElement(childElement, {
|
|
228
|
+
closeMenu: childElement.props.closeMenu || closeMenuAndFocus,
|
|
229
|
+
handleOverflowMenuItemFocus,
|
|
230
|
+
ref: (el) => {
|
|
231
|
+
menuItemRefs.current[index] = el;
|
|
232
|
+
},
|
|
233
|
+
index
|
|
234
|
+
});
|
|
235
|
+
}
|
|
235
236
|
return null;
|
|
236
237
|
});
|
|
237
238
|
const wrappedMenuBody = /* @__PURE__ */ jsx(FloatingMenu, {
|
|
@@ -13,11 +13,9 @@ const require_setupGetInstanceId = require("../../tools/setupGetInstanceId.js");
|
|
|
13
13
|
const require_noopFn = require("../../internal/noopFn.js");
|
|
14
14
|
const require_deprecate = require("../../prop-types/deprecate.js");
|
|
15
15
|
const require_deprecateValuesWithin = require("../../prop-types/deprecateValuesWithin.js");
|
|
16
|
-
const require_utils = require("../../internal/utils.js");
|
|
17
16
|
const require_mapPopoverAlign = require("../../tools/mapPopoverAlign.js");
|
|
18
17
|
const require_index = require("../IconButton/index.js");
|
|
19
18
|
const require_mergeRefs = require("../../tools/mergeRefs.js");
|
|
20
|
-
const require_OverflowMenuItem = require("../OverflowMenuItem/OverflowMenuItem.js");
|
|
21
19
|
const require_FloatingMenu = require("../../internal/FloatingMenu.js");
|
|
22
20
|
const require_useOutsideClick = require("../../internal/useOutsideClick.js");
|
|
23
21
|
let classnames = require("classnames");
|
|
@@ -229,14 +227,17 @@ const OverflowMenu = (0, react.forwardRef)(({ align, ["aria-label"]: ariaLabel =
|
|
|
229
227
|
});
|
|
230
228
|
const overflowMenuIconClasses = (0, classnames.default)(`${prefix}--overflow-menu__icon`, iconClass);
|
|
231
229
|
const childrenWithProps = react.Children.toArray(children).map((child, index) => {
|
|
232
|
-
if (
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
230
|
+
if ((0, react.isValidElement)(child)) {
|
|
231
|
+
const childElement = child;
|
|
232
|
+
return (0, react.cloneElement)(childElement, {
|
|
233
|
+
closeMenu: childElement.props.closeMenu || closeMenuAndFocus,
|
|
234
|
+
handleOverflowMenuItemFocus,
|
|
235
|
+
ref: (el) => {
|
|
236
|
+
menuItemRefs.current[index] = el;
|
|
237
|
+
},
|
|
238
|
+
index
|
|
239
|
+
});
|
|
240
|
+
}
|
|
240
241
|
return null;
|
|
241
242
|
});
|
|
242
243
|
const wrappedMenuBody = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_FloatingMenu.FloatingMenu, {
|
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.107.
|
|
4
|
+
"version": "1.107.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|
|
@@ -125,5 +125,5 @@
|
|
|
125
125
|
"**/*.scss",
|
|
126
126
|
"**/*.css"
|
|
127
127
|
],
|
|
128
|
-
"gitHead": "
|
|
128
|
+
"gitHead": "80f5039e553e19f4b540f914c35b8c3eaa8e41d3"
|
|
129
129
|
}
|