@sproutsocial/seeds-react-menu 1.3.0 → 1.3.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.
@@ -46,9 +46,6 @@ ESM Build start
46
46
  ╵ ~~~~~~~~~
47
47
 
48
48
 
49
- ESM dist/esm/index.js 132.88 KB
50
- ESM dist/esm/index.js.map 367.00 KB
51
- ESM ⚡️ Build success in 645ms
52
49
  [warn] ▲ [WARNING] The condition "types" here will never be used as it comes after both "import" and "require" [package.json]
53
50
 
54
51
  ../../seeds-design-tokens/seeds-motion/package.json:12:6:
@@ -87,11 +84,14 @@ ESM ⚡️ Build success in 645ms
87
84
  ╵ ~~~~~~~~~
88
85
 
89
86
 
90
- CJS dist/index.js 142.53 KB
91
- CJS dist/index.js.map 368.28 KB
92
- CJS ⚡️ Build success in 713ms
87
+ CJS dist/index.js 142.82 KB
88
+ CJS dist/index.js.map 368.80 KB
89
+ CJS ⚡️ Build success in 602ms
90
+ ESM dist/esm/index.js 133.17 KB
91
+ ESM dist/esm/index.js.map 367.52 KB
92
+ ESM ⚡️ Build success in 605ms
93
93
  DTS Build start
94
- DTS ⚡️ Build success in 15562ms
95
- DTS dist/index.d.ts 37.05 KB
96
- DTS dist/index.d.mts 37.05 KB
97
- Done in 19.23s.
94
+ DTS ⚡️ Build success in 12162ms
95
+ DTS dist/index.d.ts 37.08 KB
96
+ DTS dist/index.d.mts 37.08 KB
97
+ Done in 15.79s.
package/CHANGELOG.md CHANGED
@@ -1,14 +1,26 @@
1
1
  # @sproutsocial/seeds-react-menu
2
2
 
3
+ ## 1.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - a67b345: Users can now add event listeners like onClick, onBlur, and onKeyDown to MenuToggleButton.
8
+
9
+ ## 1.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 8d18309: MenuContent no longer shows empty state outside of a context provider.
14
+
3
15
  ## 1.3.0
4
16
 
5
17
  ### Minor Changes
6
18
 
7
- - e27ab2e: This update introduces a `DefaultMenuEmptyState` for filter menus and an `emptyStateElement` prop on `MenuContent` to allow for custom empty states to be passed in to the `seeds-react-menu` package.
19
+ - 7fe0b84: This update introduces a `DefaultMenuEmptyState` for filter menus and an `emptyStateElement` prop on `MenuContent` to allow for custom empty states to be passed in to the `seeds-react-menu` package.
8
20
 
9
21
  ### Patch Changes
10
22
 
11
- - e27ab2e: This update fixes a bug that prevented developers from passing custom popoutProps.
23
+ - e60ec1d: This update fixes a bug that prevented developers from passing custom popoutProps.
12
24
 
13
25
  ## 1.2.3
14
26
 
package/dist/esm/index.js CHANGED
@@ -102,7 +102,8 @@ var defaultMenuContext = {
102
102
  itemsMap: {},
103
103
  isItemSelected: () => false,
104
104
  getInputComponentProps: () => ({}),
105
- hasVisibleItems: false
105
+ hasVisibleItems: false,
106
+ isInitialized: false
106
107
  };
107
108
  var getSelectedItemIds = (selectedItems) => selectedItems?.reduce(
108
109
  (selected, item) => ({ ...selected, [item.id]: true }),
@@ -196,6 +197,7 @@ var useMenu = ({
196
197
  contentRef,
197
198
  hasVisibleItems,
198
199
  autoCloseOnEmpty,
200
+ isInitialized: true,
199
201
  ...menuProps
200
202
  };
201
203
  };
@@ -2341,11 +2343,12 @@ var MenuContent = ({
2341
2343
  getMenuProps,
2342
2344
  isListbox,
2343
2345
  hasVisibleItems,
2344
- autoCloseOnEmpty
2346
+ autoCloseOnEmpty,
2347
+ isInitialized
2345
2348
  } = useMenuContentContext();
2346
2349
  const toggleButtonProps = getToggleButtonProps?.();
2347
2350
  const children = childrenProp || !menuItems || !menuItems.length ? childrenProp : mapMenuItems({ menuItems, MenuItemComponent });
2348
- if (!hasVisibleItems && !autoCloseOnEmpty) {
2351
+ if (isInitialized && !hasVisibleItems && !autoCloseOnEmpty) {
2349
2352
  return emptyStateElement ?? /* @__PURE__ */ jsx7(DefaultMenuEmptyState, {});
2350
2353
  }
2351
2354
  if (!children) {
@@ -2755,20 +2758,29 @@ import { Button } from "@sproutsocial/seeds-react-button";
2755
2758
  import { jsx as jsx13 } from "react/jsx-runtime";
2756
2759
  var MenuToggleButton = (props) => {
2757
2760
  const { getToggleButtonProps, isListbox, getDropdownProps, ref, ariaProps } = useMenuToggleContext();
2758
- return /* @__PURE__ */ jsx13(
2759
- Button,
2760
- {
2761
- appearance: "secondary",
2762
- ...getToggleButtonProps?.({
2763
- // Decide if we want the preventKeyAction stuff. Maybe create a prop to allow for this to be overriden.
2764
- ...getDropdownProps?.({ ref, preventKeyAction: true }) || { ref },
2765
- refKey: "innerRef",
2766
- ...ariaProps,
2767
- ...isListbox ? {} : { role: "button", "aria-haspopup": "menu" }
2768
- }),
2769
- ...props
2770
- }
2771
- );
2761
+ const {
2762
+ onClick: userOnClick,
2763
+ onKeyDown: userOnKeyDown,
2764
+ onBlur: userOnBlur,
2765
+ ...restProps
2766
+ } = props;
2767
+ const defaultDropdownProps = {
2768
+ ref,
2769
+ onClick: userOnClick,
2770
+ onKeyDown: userOnKeyDown,
2771
+ onBlur: userOnBlur
2772
+ };
2773
+ const dropdownProps = getDropdownProps?.({
2774
+ ...defaultDropdownProps,
2775
+ preventKeyAction: true
2776
+ }) ?? defaultDropdownProps;
2777
+ const toggleButtonProps = getToggleButtonProps?.({
2778
+ ...dropdownProps,
2779
+ refKey: "innerRef",
2780
+ ...ariaProps,
2781
+ ...isListbox ? {} : { role: "button", "aria-haspopup": "menu" }
2782
+ });
2783
+ return /* @__PURE__ */ jsx13(Button, { appearance: "secondary", ...toggleButtonProps, ...restProps });
2772
2784
  };
2773
2785
 
2774
2786
  // src/MenuSearchInput/MenuSearchInput.tsx