@sproutsocial/seeds-react-menu 0.2.1 → 0.2.2

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/dist/index.d.mts CHANGED
@@ -22,14 +22,11 @@ declare const MENU_ITEM_ROLES: {
22
22
  };
23
23
  type TypeMenuItemRoles = (typeof MENU_ITEM_ROLES)[keyof typeof MENU_ITEM_ROLES];
24
24
 
25
- interface TypeItemElements {
26
- element: React.ReactElement<TypeMenuItemProps>;
27
- parents: readonly React.ReactNode[];
28
- }
29
- interface TypeDefaultItemProps extends Partial<TypeItemElements> {
25
+ interface TypeDefaultItemProps {
30
26
  id: string;
31
27
  index: number;
32
28
  disabled?: boolean;
29
+ menuItemProps?: TypeMenuItemProps;
33
30
  }
34
31
  type TypeNotEmptyChildren = React.ReactChild | React.ReactFragment | React.ReactPortal;
35
32
 
@@ -247,6 +244,10 @@ declare const MultiSelectMenu: ({ children, stateReducer: externalStateReducer,
247
244
  interface TypeUseItemsFromChildrenProps {
248
245
  children: ReactNode;
249
246
  }
247
+ interface TypeItemElements {
248
+ element: React__default.ReactElement<TypeMenuItemProps>;
249
+ parents: readonly React__default.ReactNode[];
250
+ }
250
251
  declare const useItemsFromChildren: ({ children, }: TypeUseItemsFromChildrenProps) => {
251
252
  allMenuItems: TypeDefaultItemProps[];
252
253
  menuItemsMap: {
@@ -260,4 +261,4 @@ declare const defaultUseSelectProps: {
260
261
  isItemDisabled: (item: any) => boolean;
261
262
  };
262
263
 
263
- export { ActionMenu, INPUT_TYPES, type InputType, MenuContent, MenuContext, MenuFooter, MenuGroup, MenuHeader, MenuItem, MenuItemAction, MenuItemContainer, MenuItemRow, MenuItemText, MenuLabel, MenuProvider, MenuRoot, MenuToggleButton, MultiSelectMenu, SingleSelectMenu, StyledMenuGroup, StyledMenuGroupUl, StyledMenuItem, StyledTitle, type TypeActionMenuProps, type TypeDownshiftMultiSelectProps, type TypeMenuContentProps, type TypeMenuContext, type TypeMenuContextProps, type TypeMenuGroupProps, type TypeMenuGroupStyledProps, type TypeMenuHeaderProps, type TypeMenuItemProps, type TypeMenuItemStyledProps, type TypeMenuProviderProps, type TypeMenuRootOwnProps, type TypeMenuRootProps, type TypeMenuToggleButtonProps, type TypeSingleSelectMenuProps, type TypeUseItemsFromChildrenProps, defaultUseSelectProps, useItemsFromChildren, useMenu, useMenuContext, useSelectStateReducer };
264
+ export { ActionMenu, INPUT_TYPES, type InputType, MenuContent, MenuContext, MenuFooter, MenuGroup, MenuHeader, MenuItem, MenuItemAction, MenuItemContainer, MenuItemRow, MenuItemText, MenuLabel, MenuProvider, MenuRoot, MenuToggleButton, MultiSelectMenu, SingleSelectMenu, StyledMenuGroup, StyledMenuGroupUl, StyledMenuItem, StyledTitle, type TypeActionMenuProps, type TypeDefaultItemProps, type TypeDownshiftMultiSelectProps, type TypeItemElements, type TypeMenuContentProps, type TypeMenuContext, type TypeMenuContextProps, type TypeMenuGroupProps, type TypeMenuGroupStyledProps, type TypeMenuHeaderProps, type TypeMenuItemProps, type TypeMenuItemStyledProps, type TypeMenuProviderProps, type TypeMenuRootOwnProps, type TypeMenuRootProps, type TypeMenuToggleButtonProps, type TypeNotEmptyChildren, type TypeSingleSelectMenuProps, type TypeUseItemsFromChildrenProps, defaultUseSelectProps, useItemsFromChildren, useMenu, useMenuContext, useSelectStateReducer };
package/dist/index.d.ts CHANGED
@@ -22,14 +22,11 @@ declare const MENU_ITEM_ROLES: {
22
22
  };
23
23
  type TypeMenuItemRoles = (typeof MENU_ITEM_ROLES)[keyof typeof MENU_ITEM_ROLES];
24
24
 
25
- interface TypeItemElements {
26
- element: React.ReactElement<TypeMenuItemProps>;
27
- parents: readonly React.ReactNode[];
28
- }
29
- interface TypeDefaultItemProps extends Partial<TypeItemElements> {
25
+ interface TypeDefaultItemProps {
30
26
  id: string;
31
27
  index: number;
32
28
  disabled?: boolean;
29
+ menuItemProps?: TypeMenuItemProps;
33
30
  }
34
31
  type TypeNotEmptyChildren = React.ReactChild | React.ReactFragment | React.ReactPortal;
35
32
 
@@ -247,6 +244,10 @@ declare const MultiSelectMenu: ({ children, stateReducer: externalStateReducer,
247
244
  interface TypeUseItemsFromChildrenProps {
248
245
  children: ReactNode;
249
246
  }
247
+ interface TypeItemElements {
248
+ element: React__default.ReactElement<TypeMenuItemProps>;
249
+ parents: readonly React__default.ReactNode[];
250
+ }
250
251
  declare const useItemsFromChildren: ({ children, }: TypeUseItemsFromChildrenProps) => {
251
252
  allMenuItems: TypeDefaultItemProps[];
252
253
  menuItemsMap: {
@@ -260,4 +261,4 @@ declare const defaultUseSelectProps: {
260
261
  isItemDisabled: (item: any) => boolean;
261
262
  };
262
263
 
263
- export { ActionMenu, INPUT_TYPES, type InputType, MenuContent, MenuContext, MenuFooter, MenuGroup, MenuHeader, MenuItem, MenuItemAction, MenuItemContainer, MenuItemRow, MenuItemText, MenuLabel, MenuProvider, MenuRoot, MenuToggleButton, MultiSelectMenu, SingleSelectMenu, StyledMenuGroup, StyledMenuGroupUl, StyledMenuItem, StyledTitle, type TypeActionMenuProps, type TypeDownshiftMultiSelectProps, type TypeMenuContentProps, type TypeMenuContext, type TypeMenuContextProps, type TypeMenuGroupProps, type TypeMenuGroupStyledProps, type TypeMenuHeaderProps, type TypeMenuItemProps, type TypeMenuItemStyledProps, type TypeMenuProviderProps, type TypeMenuRootOwnProps, type TypeMenuRootProps, type TypeMenuToggleButtonProps, type TypeSingleSelectMenuProps, type TypeUseItemsFromChildrenProps, defaultUseSelectProps, useItemsFromChildren, useMenu, useMenuContext, useSelectStateReducer };
264
+ export { ActionMenu, INPUT_TYPES, type InputType, MenuContent, MenuContext, MenuFooter, MenuGroup, MenuHeader, MenuItem, MenuItemAction, MenuItemContainer, MenuItemRow, MenuItemText, MenuLabel, MenuProvider, MenuRoot, MenuToggleButton, MultiSelectMenu, SingleSelectMenu, StyledMenuGroup, StyledMenuGroupUl, StyledMenuItem, StyledTitle, type TypeActionMenuProps, type TypeDefaultItemProps, type TypeDownshiftMultiSelectProps, type TypeItemElements, type TypeMenuContentProps, type TypeMenuContext, type TypeMenuContextProps, type TypeMenuGroupProps, type TypeMenuGroupStyledProps, type TypeMenuHeaderProps, type TypeMenuItemProps, type TypeMenuItemStyledProps, type TypeMenuProviderProps, type TypeMenuRootOwnProps, type TypeMenuRootProps, type TypeMenuToggleButtonProps, type TypeNotEmptyChildren, type TypeSingleSelectMenuProps, type TypeUseItemsFromChildrenProps, defaultUseSelectProps, useItemsFromChildren, useMenu, useMenuContext, useSelectStateReducer };
package/dist/index.js CHANGED
@@ -1737,7 +1737,6 @@ var MenuItemContainer = import_styled_components2.default.li`
1737
1737
  list-style-type: none;
1738
1738
  margin-left: ${({ theme: theme2 }) => theme2.space[300]};
1739
1739
  margin-right: ${({ theme: theme2 }) => theme2.space[300]};
1740
- transition: all ${({ theme: theme2 }) => theme2.duration["fast"]};
1741
1740
 
1742
1741
  &:first-child {
1743
1742
  margin-top: ${({ theme: theme2 }) => theme2.space[300]};
@@ -1762,6 +1761,7 @@ var StyledMenuItem = import_styled_components2.default.div`
1762
1761
  padding: ${({ theme: theme2 }) => theme2.space[300]};
1763
1762
  outline: 0;
1764
1763
  ${({ theme: theme2 }) => theme2.typography[200]};
1764
+ transition: all ${({ theme: theme2 }) => theme2.duration["fast"]};
1765
1765
 
1766
1766
  /* Highlighted */
1767
1767
  ${({ $highlighted }) => $highlighted && highlightedStyles}
@@ -1892,7 +1892,6 @@ var useOptionProps = ({
1892
1892
  const { selectedItem, selectedItems, isListbox } = (0, import_react2.useContext)(MenuContext);
1893
1893
  const selected = (0, import_react2.useMemo)(
1894
1894
  () => selectedItem?.id === id || !!selectedItems?.find((item) => item?.id === id),
1895
- // eslint-disable-next-line react-hooks/exhaustive-deps
1896
1895
  [selectedItem, selectedItems]
1897
1896
  );
1898
1897
  const label = inputLabelId || `menu-item-child-${id}`;
@@ -1922,12 +1921,9 @@ var MenuItem = ({
1922
1921
  children,
1923
1922
  onClick,
1924
1923
  onKeyDown,
1925
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1926
1924
  disabled: disabled2 = false,
1927
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1928
1925
  ref,
1929
1926
  href,
1930
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
1931
1927
  color: color2,
1932
1928
  ...props
1933
1929
  }) => {
@@ -2296,6 +2292,7 @@ var MenuRoot = ({
2296
2292
  return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MenuProvider, { ...contextProps, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2297
2293
  import_seeds_react_popout.Popout,
2298
2294
  {
2295
+ menuPopout: true,
2299
2296
  isOpen: !!isOpen,
2300
2297
  setIsOpen,
2301
2298
  content: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CustomPopoutContent, { width: width2, children }),
@@ -2388,13 +2385,12 @@ var useItemsFromChildren = ({
2388
2385
  const allMenuItemElements = getAllMenuItems(children);
2389
2386
  const menuItemsMap2 = {};
2390
2387
  const allMenuItems2 = allMenuItemElements.map(
2391
- ({ element, parents }, index) => {
2388
+ ({ element }, index) => {
2392
2389
  const item = {
2393
2390
  id: element.props.id,
2394
2391
  disabled: element.props.disabled,
2395
2392
  index,
2396
- element,
2397
- parents
2393
+ menuItemProps: element.props
2398
2394
  };
2399
2395
  menuItemsMap2[`${item.id}`] = item;
2400
2396
  return item;
@@ -2439,11 +2435,11 @@ var handleStateChange = (changes, currentSelectedItem) => {
2439
2435
  const selectedItem = changes.selectedItem || currentSelectedItem;
2440
2436
  if (!selectedItem)
2441
2437
  return;
2442
- if (selectedItem.element?.props?.disabled) {
2438
+ if (selectedItem.disabled) {
2443
2439
  return;
2444
2440
  }
2445
2441
  const isEnterKeyDown = changes.type === import_downshift2.useSelect.stateChangeTypes.ToggleButtonKeyDownEnter;
2446
- const selectedItemProps = selectedItem.element?.props;
2442
+ const selectedItemProps = selectedItem.menuItemProps;
2447
2443
  if (selectedItemProps?.onClick) {
2448
2444
  const syntheticKeyboardEvent = new KeyboardEvent("keydown", {
2449
2445
  key: isEnterKeyDown ? "Enter" : " ",