@sproutsocial/seeds-react-menu 1.10.7 → 1.10.9
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.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +22 -0
- package/dist/esm/index.js +47 -24
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +37 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/MenuGroup/MenuGroup.tsx +16 -3
- package/src/MenuGroup/__tests__/MenuGroup.test.tsx +19 -0
- package/src/MenuItem/MenuItem.tsx +21 -10
- package/src/MenuItem/__tests__/MenuItem.test.tsx +19 -0
- package/src/MenuSearchInput/MenuSearchInput.tsx +2 -0
- package/src/MenuSearchInput/__tests__/MenuSearchInput.test.tsx +23 -0
package/dist/index.d.mts
CHANGED
|
@@ -430,7 +430,7 @@ interface TypeMenuSearchInputProps extends TypeInputProps {
|
|
|
430
430
|
* @see {@link https://seeds.sproutsocial.com/components/seeds-react-menu/#menuheader MenuHeader}
|
|
431
431
|
* @see {@link https://seeds.sproutsocial.com/components/seeds-react-menu/#menusearchtokeninput MenuSearchTokenInput}
|
|
432
432
|
*/
|
|
433
|
-
declare const MenuSearchInput: ({ getIsItemVisible, inputProps, ...restInputProps }: TypeMenuSearchInputProps) => react_jsx_runtime.JSX.Element;
|
|
433
|
+
declare const MenuSearchInput: ({ getIsItemVisible, inputProps, onChange, ...restInputProps }: TypeMenuSearchInputProps) => react_jsx_runtime.JSX.Element;
|
|
434
434
|
|
|
435
435
|
interface TypeMenuTokenInputProps extends TypeTokenInputProps {
|
|
436
436
|
/** A function that can be passed to override the default token props */
|
package/dist/index.d.ts
CHANGED
|
@@ -430,7 +430,7 @@ interface TypeMenuSearchInputProps extends TypeInputProps {
|
|
|
430
430
|
* @see {@link https://seeds.sproutsocial.com/components/seeds-react-menu/#menuheader MenuHeader}
|
|
431
431
|
* @see {@link https://seeds.sproutsocial.com/components/seeds-react-menu/#menusearchtokeninput MenuSearchTokenInput}
|
|
432
432
|
*/
|
|
433
|
-
declare const MenuSearchInput: ({ getIsItemVisible, inputProps, ...restInputProps }: TypeMenuSearchInputProps) => react_jsx_runtime.JSX.Element;
|
|
433
|
+
declare const MenuSearchInput: ({ getIsItemVisible, inputProps, onChange, ...restInputProps }: TypeMenuSearchInputProps) => react_jsx_runtime.JSX.Element;
|
|
434
434
|
|
|
435
435
|
interface TypeMenuTokenInputProps extends TypeTokenInputProps {
|
|
436
436
|
/** A function that can be passed to override the default token props */
|
package/dist/index.js
CHANGED
|
@@ -475,22 +475,26 @@ var MenuItem = ({
|
|
|
475
475
|
});
|
|
476
476
|
const item = itemsMap[id] || { index: 0, id };
|
|
477
477
|
const highlighted = highlightedIndex === item?.index;
|
|
478
|
+
const downshiftItemProps = getItemProps?.({
|
|
479
|
+
...isListbox ? {} : { role: "menuitem" },
|
|
480
|
+
item,
|
|
481
|
+
index: item.index,
|
|
482
|
+
// The disabled prop no longer supported in downshift. Use isItemDisabled instead.
|
|
483
|
+
// disabled,
|
|
484
|
+
onClick,
|
|
485
|
+
onKeyDown,
|
|
486
|
+
ref: innerRef
|
|
487
|
+
}) ?? {};
|
|
488
|
+
if (!isListbox && "aria-selected" in downshiftItemProps) {
|
|
489
|
+
delete downshiftItemProps["aria-selected"];
|
|
490
|
+
}
|
|
478
491
|
return hiddenItemsMap[item.id] ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, {}) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(MenuItemContainer, { role: "none", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
479
492
|
StyledMenuItem,
|
|
480
493
|
{
|
|
481
494
|
id,
|
|
482
495
|
$highlighted: highlighted,
|
|
483
496
|
$active: active,
|
|
484
|
-
...
|
|
485
|
-
...isListbox ? {} : { role: "menuitem" },
|
|
486
|
-
item,
|
|
487
|
-
index: item.index,
|
|
488
|
-
// The disabled prop no longer supported in downshift. Use isItemDisabled instead.
|
|
489
|
-
// disabled,
|
|
490
|
-
onClick,
|
|
491
|
-
onKeyDown,
|
|
492
|
-
ref: innerRef
|
|
493
|
-
}),
|
|
497
|
+
...downshiftItemProps,
|
|
494
498
|
as: isListbox ? void 0 : href ? "a" : "button",
|
|
495
499
|
type: href ? void 0 : "button",
|
|
496
500
|
href,
|
|
@@ -919,7 +923,18 @@ var StyledMenuGroupUl = import_styled_components7.default.ul`
|
|
|
919
923
|
`;
|
|
920
924
|
|
|
921
925
|
// src/MenuGroup/MenuGroup.tsx
|
|
922
|
-
var import_jsx_runtime9 =
|
|
926
|
+
var import_jsx_runtime9 = (
|
|
927
|
+
// role="none" on the outer <li>: this wrapper is purely visual (it exists
|
|
928
|
+
// for the border-bottom divider between groups in the parent menu <ul>).
|
|
929
|
+
// The ARIA group semantics live on the inner <ul> below — axe rejects
|
|
930
|
+
// role="group" on <li>, and a native <ul> here would trigger the `list`
|
|
931
|
+
// rule because its children are <li role="none"> menuitem wrappers.
|
|
932
|
+
//
|
|
933
|
+
// TODO(DS-4273): drop the list-based DOM entirely (MenuContent/MenuGroup
|
|
934
|
+
// as <div>, no <ul>/<li>, no role="none" wrappers). This is the followup
|
|
935
|
+
// to DS-4271's minimal ARIA patch.
|
|
936
|
+
require("react/jsx-runtime")
|
|
937
|
+
);
|
|
923
938
|
var MenuGroup = ({
|
|
924
939
|
titleAs = "h3",
|
|
925
940
|
children: childrenProp,
|
|
@@ -939,15 +954,21 @@ var MenuGroup = ({
|
|
|
939
954
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
940
955
|
StyledMenuGroup,
|
|
941
956
|
{
|
|
942
|
-
role: "
|
|
957
|
+
role: "none",
|
|
943
958
|
id,
|
|
944
959
|
isSingleSelect,
|
|
945
|
-
"aria-labelledby": title ? titleId : void 0,
|
|
946
960
|
color: color5,
|
|
947
961
|
...rest,
|
|
948
962
|
children: [
|
|
949
963
|
title && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StyledTitle, { role: "heading", as: titleAs, id: titleId, children: title }),
|
|
950
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
964
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
965
|
+
StyledMenuGroupUl,
|
|
966
|
+
{
|
|
967
|
+
role: "group",
|
|
968
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
969
|
+
children
|
|
970
|
+
}
|
|
971
|
+
)
|
|
951
972
|
]
|
|
952
973
|
}
|
|
953
974
|
);
|
|
@@ -1221,6 +1242,7 @@ var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
|
1221
1242
|
var MenuSearchInput = ({
|
|
1222
1243
|
getIsItemVisible,
|
|
1223
1244
|
inputProps,
|
|
1245
|
+
onChange,
|
|
1224
1246
|
...restInputProps
|
|
1225
1247
|
}) => {
|
|
1226
1248
|
const {
|
|
@@ -1252,6 +1274,7 @@ var MenuSearchInput = ({
|
|
|
1252
1274
|
{
|
|
1253
1275
|
onChange: (e, value) => {
|
|
1254
1276
|
updateFilteredItems({ inputValue: value });
|
|
1277
|
+
onChange?.(e, value);
|
|
1255
1278
|
},
|
|
1256
1279
|
onKeyDown: handleKeyDown,
|
|
1257
1280
|
autoComplete: false,
|