@sproutsocial/seeds-react-menu 1.6.0 → 1.6.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.
- package/.turbo/turbo-build.log +10 -10
- package/CHANGELOG.md +6 -0
- package/dist/esm/index.js +18 -18
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/ActionMenu/ActionMenu.stories.tsx +20 -1
- package/src/MenuGroup/__tests__/MenuGroup.test.tsx +33 -0
- package/src/MenuGroup/__tests__/MenuGroup.typetest.tsx +5 -0
- package/src/hooks/useMenuChildren.tsx +23 -22
- package/src/types.ts +2 -4
package/dist/index.d.mts
CHANGED
|
@@ -280,7 +280,7 @@ type TypeChildrenOrItems<I extends TypeMenuItemProps = TypeMenuItemProps> = Type
|
|
|
280
280
|
menuItems: I[];
|
|
281
281
|
MenuItemComponent?: React.ComponentType<I>;
|
|
282
282
|
});
|
|
283
|
-
type TypeNotEmptyChildren = React.
|
|
283
|
+
type TypeNotEmptyChildren = Exclude<React.ReactNode, null | undefined>;
|
|
284
284
|
type TypeInputEventListeners = "onKeyDown" | "onChange" | "onInput" | "onBlur" | "onClick" | "refKey";
|
|
285
285
|
type TypeDownshiftMergedInputProps<B> = Pick<UseComboboxGetInputPropsOptions, TypeInputEventListeners> & Omit<Partial<B>, TypeInputEventListeners>;
|
|
286
286
|
|
|
@@ -662,7 +662,7 @@ declare const useMenuChildren: <I extends TypeMenuItemProps = TypeMenuItemProps>
|
|
|
662
662
|
menuItemsMap: {
|
|
663
663
|
[key: string]: TypeInternalItemProps<TypeMenuItemProps>;
|
|
664
664
|
};
|
|
665
|
-
children:
|
|
665
|
+
children: string | number | true | React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | React__default.ReactPortal;
|
|
666
666
|
};
|
|
667
667
|
|
|
668
668
|
declare const useSelectStateReducer: Required<UseSelectProps<TypeInternalItemProps>>["stateReducer"];
|
package/dist/index.d.ts
CHANGED
|
@@ -280,7 +280,7 @@ type TypeChildrenOrItems<I extends TypeMenuItemProps = TypeMenuItemProps> = Type
|
|
|
280
280
|
menuItems: I[];
|
|
281
281
|
MenuItemComponent?: React.ComponentType<I>;
|
|
282
282
|
});
|
|
283
|
-
type TypeNotEmptyChildren = React.
|
|
283
|
+
type TypeNotEmptyChildren = Exclude<React.ReactNode, null | undefined>;
|
|
284
284
|
type TypeInputEventListeners = "onKeyDown" | "onChange" | "onInput" | "onBlur" | "onClick" | "refKey";
|
|
285
285
|
type TypeDownshiftMergedInputProps<B> = Pick<UseComboboxGetInputPropsOptions, TypeInputEventListeners> & Omit<Partial<B>, TypeInputEventListeners>;
|
|
286
286
|
|
|
@@ -662,7 +662,7 @@ declare const useMenuChildren: <I extends TypeMenuItemProps = TypeMenuItemProps>
|
|
|
662
662
|
menuItemsMap: {
|
|
663
663
|
[key: string]: TypeInternalItemProps<TypeMenuItemProps>;
|
|
664
664
|
};
|
|
665
|
-
children:
|
|
665
|
+
children: string | number | true | React__default.ReactElement<any, string | React__default.JSXElementConstructor<any>> | Iterable<React__default.ReactNode> | React__default.ReactPortal;
|
|
666
666
|
};
|
|
667
667
|
|
|
668
668
|
declare const useSelectStateReducer: Required<UseSelectProps<TypeInternalItemProps>>["stateReducer"];
|
package/dist/index.js
CHANGED
|
@@ -2203,10 +2203,11 @@ var walkAllChildren = (children, callback) => {
|
|
|
2203
2203
|
if (element === null || element === void 0) return;
|
|
2204
2204
|
callback(element, parents2);
|
|
2205
2205
|
const newParents = [...parents2, element];
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2206
|
+
if (import_react4.default.isValidElement(element) && element.props?.children) {
|
|
2207
|
+
import_react4.default.Children.toArray(element.props.children).forEach((child) => {
|
|
2208
|
+
walk(child, newParents);
|
|
2209
|
+
});
|
|
2210
|
+
}
|
|
2210
2211
|
};
|
|
2211
2212
|
const parents = [];
|
|
2212
2213
|
import_react4.default.Children.toArray(children).forEach((child) => {
|
|
@@ -2250,21 +2251,20 @@ var addItemsFromGroup = ({
|
|
|
2250
2251
|
});
|
|
2251
2252
|
});
|
|
2252
2253
|
} else if (menuGroup.props.children) {
|
|
2253
|
-
|
|
2254
|
-
if (!Array.isArray(children)) {
|
|
2255
|
-
children = [children];
|
|
2256
|
-
}
|
|
2254
|
+
const children = import_react4.default.Children.toArray(menuGroup.props.children);
|
|
2257
2255
|
children.forEach((menuItem) => {
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2256
|
+
if (import_react4.default.isValidElement(menuItem)) {
|
|
2257
|
+
addMenuItem({
|
|
2258
|
+
itemProps: {
|
|
2259
|
+
id: menuItem.props.id,
|
|
2260
|
+
disabled: menuItem.props.disabled,
|
|
2261
|
+
menuItemProps: menuItem.props,
|
|
2262
|
+
menuGroupProps: menuGroup.props
|
|
2263
|
+
},
|
|
2264
|
+
allMenuItems,
|
|
2265
|
+
menuItemsMap
|
|
2266
|
+
});
|
|
2267
|
+
}
|
|
2268
2268
|
});
|
|
2269
2269
|
}
|
|
2270
2270
|
};
|