@sproutsocial/seeds-react-menu 1.1.1 → 1.2.0

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.
@@ -84,14 +84,14 @@ ESM Build start
84
84
  ╵ ~~~~~~~~~
85
85
 
86
86
 
87
- ESM dist/esm/index.js 129.91 KB
88
- ESM dist/esm/index.js.map 358.55 KB
89
- ESM ⚡️ Build success in 657ms
90
- CJS dist/index.js 139.19 KB
91
- CJS dist/index.js.map 359.73 KB
92
- CJS ⚡️ Build success in 673ms
87
+ CJS dist/index.js 140.15 KB
88
+ CJS dist/index.js.map 361.00 KB
89
+ CJS ⚡️ Build success in 717ms
90
+ ESM dist/esm/index.js 130.58 KB
91
+ ESM dist/esm/index.js.map 359.70 KB
92
+ ESM ⚡️ Build success in 717ms
93
93
  DTS Build start
94
- DTS ⚡️ Build success in 11751ms
95
- DTS dist/index.d.ts 32.38 KB
96
- DTS dist/index.d.mts 32.38 KB
97
- Done in 15.25s.
94
+ DTS ⚡️ Build success in 15500ms
95
+ DTS dist/index.d.ts 32.50 KB
96
+ DTS dist/index.d.mts 32.50 KB
97
+ Done in 18.95s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @sproutsocial/seeds-react-menu
2
2
 
3
+ ## 1.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 34ef27e: Added an `AutocompleteSelect` component that combines autocomplete behavior with the appearance of a `Select`.
8
+
9
+ ### Patch Changes
10
+
11
+ - 9fdb2f8: Supports onClick prop on a NestedMenuItem without a childMenuId
12
+ - Fixes a bug where the onClick prop on a NestedMenuItem would not be triggered unless the item had a childMenuId
13
+ - 64c536e: Adjust focus styling due to a bug where focus appeared on MenuContent when focus is applied at global level
14
+
3
15
  ## 1.1.1
4
16
 
5
17
  ### Patch Changes
package/dist/esm/index.js CHANGED
@@ -2121,7 +2121,11 @@ import styled3 from "styled-components";
2121
2121
  var StyledMenuContent = styled3.ul`
2122
2122
  margin: 0;
2123
2123
  padding: 0;
2124
- outline: none;
2124
+
2125
+ &:focus {
2126
+ outline: none;
2127
+ box-shadow: none;
2128
+ }
2125
2129
  `;
2126
2130
 
2127
2131
  // src/hooks/useMenuChildren.tsx
@@ -3872,8 +3876,29 @@ var AutocompleteTokenInput = ({
3872
3876
  );
3873
3877
  };
3874
3878
 
3879
+ // src/Autocomplete/AutocompleteSelect.tsx
3880
+ import Icon4 from "@sproutsocial/seeds-react-icon";
3881
+ import "react";
3882
+ import styled10 from "styled-components";
3883
+ import { Accessory } from "@sproutsocial/seeds-react-input";
3884
+ import { jsx as jsx26 } from "react/jsx-runtime";
3885
+ var StyledAutocompleteInput = styled10(AutocompleteInput)`
3886
+ ${Accessory} {
3887
+ pointer-events: none;
3888
+ }
3889
+ `;
3890
+ var AutocompleteSelect = (props) => {
3891
+ return /* @__PURE__ */ jsx26(
3892
+ StyledAutocompleteInput,
3893
+ {
3894
+ elemAfter: /* @__PURE__ */ jsx26(Icon4, { name: "chevron-down" }),
3895
+ ...props
3896
+ }
3897
+ );
3898
+ };
3899
+
3875
3900
  // src/NestedMenu/NestedMenu.tsx
3876
- import { useId, useEffect as useEffect4, useState } from "react";
3901
+ import { useId, useEffect as useEffect5, useState } from "react";
3877
3902
  import { AnimatePresence as AnimatePresence2, motion as motion3 } from "motion/react";
3878
3903
  import { useSelect as useSelect6 } from "downshift";
3879
3904
 
@@ -3903,7 +3928,7 @@ var nestedMenuStateReducer = (_state, actionAndChanges) => {
3903
3928
 
3904
3929
  // src/NestedMenu/NestedMenuContext.tsx
3905
3930
  import { createContext as createContext2, useContext as useContext5 } from "react";
3906
- import { jsx as jsx26 } from "react/jsx-runtime";
3931
+ import { jsx as jsx27 } from "react/jsx-runtime";
3907
3932
  var defaultNestedMenuContext = {
3908
3933
  selectedMenuPath: [],
3909
3934
  setSelectedMenuId: () => {
@@ -3927,7 +3952,7 @@ var NestedMenuProvider = ({
3927
3952
  children,
3928
3953
  ...nestedMenuProps
3929
3954
  }) => {
3930
- return /* @__PURE__ */ jsx26(NestedMenuContext.Provider, { value: nestedMenuProps, children });
3955
+ return /* @__PURE__ */ jsx27(NestedMenuContext.Provider, { value: nestedMenuProps, children });
3931
3956
  };
3932
3957
  var useNestedMenuContext = () => {
3933
3958
  const nestedMenuContextValue = useContext5(NestedMenuContext);
@@ -3940,13 +3965,13 @@ var useNestedMenuContext = () => {
3940
3965
  };
3941
3966
 
3942
3967
  // src/NestedMenu/NestedMenuContent.tsx
3943
- import { useEffect as useEffect3, useRef } from "react";
3968
+ import { useEffect as useEffect4, useRef } from "react";
3944
3969
  import { mergeRefs as mergeRefs2 } from "@sproutsocial/seeds-react-utilities";
3945
3970
 
3946
3971
  // src/NestedMenu/NestedMenuItem.tsx
3947
- import { Icon as Icon4 } from "@sproutsocial/seeds-react-icon";
3972
+ import { Icon as Icon5 } from "@sproutsocial/seeds-react-icon";
3948
3973
  import { Box as Box4 } from "@sproutsocial/seeds-react-box";
3949
- import { jsx as jsx27, jsxs as jsxs6 } from "react/jsx-runtime";
3974
+ import { jsx as jsx28, jsxs as jsxs6 } from "react/jsx-runtime";
3950
3975
  var NestedMenuItem = ({
3951
3976
  children,
3952
3977
  childMenuId,
@@ -3954,21 +3979,23 @@ var NestedMenuItem = ({
3954
3979
  ...rest
3955
3980
  }) => {
3956
3981
  const { setSelectedMenuId } = useNestedMenuContext();
3957
- const onClickProps = childMenuId ? {
3982
+ const onClickProps = childMenuId || onClickProp ? {
3958
3983
  onClick: (e) => {
3959
3984
  onClickProp?.(e);
3960
- setSelectedMenuId?.(childMenuId);
3985
+ if (childMenuId) {
3986
+ setSelectedMenuId?.(childMenuId);
3987
+ }
3961
3988
  }
3962
3989
  } : {};
3963
- return /* @__PURE__ */ jsx27(MenuItem, { ...onClickProps, ...rest, children: /* @__PURE__ */ jsxs6(Box4, { display: "flex", justifyContent: "space-between", children: [
3990
+ return /* @__PURE__ */ jsx28(MenuItem, { ...onClickProps, ...rest, children: /* @__PURE__ */ jsxs6(Box4, { display: "flex", justifyContent: "space-between", children: [
3964
3991
  children,
3965
- childMenuId && /* @__PURE__ */ jsx27(MenuItemActionRight, { children: /* @__PURE__ */ jsx27(Icon4, { name: "arrow-right-outline" }) })
3992
+ childMenuId && /* @__PURE__ */ jsx28(MenuItemActionRight, { children: /* @__PURE__ */ jsx28(Icon5, { name: "arrow-right-outline" }) })
3966
3993
  ] }) });
3967
3994
  };
3968
3995
  NestedMenuItem.__MENU_PRIMITIVE_TYPE = "MenuItem";
3969
3996
 
3970
3997
  // src/NestedMenu/NestedMenuContent.tsx
3971
- import { jsx as jsx28 } from "react/jsx-runtime";
3998
+ import { jsx as jsx29 } from "react/jsx-runtime";
3972
3999
  var NestedMenuContent = ({
3973
4000
  innerRef: innerRefProp = null,
3974
4001
  onKeyDown: onKeyDownProp,
@@ -3982,7 +4009,7 @@ var NestedMenuContent = ({
3982
4009
  const internalRef = useRef(null);
3983
4010
  const innerRef = mergeRefs2(internalRef, innerRefProp);
3984
4011
  const contentProps = children ? { children } : { menuItems, MenuItemComponent };
3985
- useEffect3(() => {
4012
+ useEffect4(() => {
3986
4013
  internalRef?.current?.focus();
3987
4014
  }, []);
3988
4015
  const onKeyDown = (e) => {
@@ -4005,7 +4032,7 @@ var NestedMenuContent = ({
4005
4032
  break;
4006
4033
  }
4007
4034
  };
4008
- return /* @__PURE__ */ jsx28(
4035
+ return /* @__PURE__ */ jsx29(
4009
4036
  MenuContent,
4010
4037
  {
4011
4038
  onKeyDown,
@@ -4019,19 +4046,19 @@ NestedMenuContent.__MENU_PRIMITIVE_TYPE = "MenuContent";
4019
4046
 
4020
4047
  // src/NestedMenu/NestedMenuHeader.tsx
4021
4048
  import { Button as Button2 } from "@sproutsocial/seeds-react-button";
4022
- import { Icon as Icon5 } from "@sproutsocial/seeds-react-icon";
4049
+ import { Icon as Icon6 } from "@sproutsocial/seeds-react-icon";
4023
4050
  import { AnimatePresence, motion } from "motion/react";
4024
- import { jsx as jsx29 } from "react/jsx-runtime";
4051
+ import { jsx as jsx30 } from "react/jsx-runtime";
4025
4052
  var NestedMenuHeader = ({
4026
4053
  backArrowLabel,
4027
4054
  ...props
4028
4055
  }) => {
4029
4056
  const { goBack, selectedMenuPath, animationSpeed } = useNestedMenuContext();
4030
4057
  const showBackArrow = selectedMenuPath.length > 1;
4031
- return /* @__PURE__ */ jsx29(
4058
+ return /* @__PURE__ */ jsx30(
4032
4059
  MenuHeader,
4033
4060
  {
4034
- leftAction: /* @__PURE__ */ jsx29(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx29(
4061
+ leftAction: /* @__PURE__ */ jsx30(AnimatePresence, { mode: "wait", children: /* @__PURE__ */ jsx30(
4035
4062
  motion.div,
4036
4063
  {
4037
4064
  initial: { opacity: 0 },
@@ -4040,7 +4067,7 @@ var NestedMenuHeader = ({
4040
4067
  opacity: 0,
4041
4068
  transition: { duration: animationSpeed }
4042
4069
  },
4043
- children: showBackArrow ? /* @__PURE__ */ jsx29(Button2, { onClick: goBack, ariaLabel: backArrowLabel, children: /* @__PURE__ */ jsx29(Icon5, { name: "arrow-left" }) }) : void 0
4070
+ children: showBackArrow ? /* @__PURE__ */ jsx30(Button2, { onClick: goBack, ariaLabel: backArrowLabel, children: /* @__PURE__ */ jsx30(Icon6, { name: "arrow-left" }) }) : void 0
4044
4071
  },
4045
4072
  `${selectedMenuPath}-header--button`
4046
4073
  ) }),
@@ -4050,8 +4077,8 @@ var NestedMenuHeader = ({
4050
4077
  };
4051
4078
 
4052
4079
  // src/NestedMenu/NestedMenuRoot.tsx
4053
- import React24 from "react";
4054
- import { jsx as jsx30 } from "react/jsx-runtime";
4080
+ import React25 from "react";
4081
+ import { jsx as jsx31 } from "react/jsx-runtime";
4055
4082
  var NestedMenuRoot = ({
4056
4083
  children,
4057
4084
  menuToggleElement,
@@ -4059,21 +4086,21 @@ var NestedMenuRoot = ({
4059
4086
  }) => {
4060
4087
  const menuContext = useMenu(contextProps);
4061
4088
  const { setActiveMenuContext, selectedMenuPath } = useNestedMenuContext();
4062
- React24.useEffect(() => {
4089
+ React25.useEffect(() => {
4063
4090
  setActiveMenuContext(menuContext);
4064
4091
  }, [
4065
4092
  selectedMenuPath[selectedMenuPath.length - 1],
4066
4093
  menuContext.selectedItem,
4067
4094
  menuContext.selectedItems?.length
4068
4095
  ]);
4069
- return /* @__PURE__ */ jsx30(MenuContentProvider, { menuContext, children });
4096
+ return /* @__PURE__ */ jsx31(MenuContentProvider, { menuContext, children });
4070
4097
  };
4071
4098
 
4072
4099
  // src/NestedMenu/NestedMenuPopout.tsx
4073
4100
  import { motion as motion2 } from "motion/react";
4074
- import styled10 from "styled-components";
4075
- import { jsx as jsx31 } from "react/jsx-runtime";
4076
- var StyledDiv = styled10(motion2.div)`
4101
+ import styled11 from "styled-components";
4102
+ import { jsx as jsx32 } from "react/jsx-runtime";
4103
+ var StyledDiv = styled11(motion2.div)`
4077
4104
  overflow: hidden;
4078
4105
  `;
4079
4106
  var NestedMenuPopout = ({
@@ -4083,7 +4110,7 @@ var NestedMenuPopout = ({
4083
4110
  ...popoutProps
4084
4111
  }) => {
4085
4112
  const { activeMenuContext, rootMenuContextProps, resetSelectedMenuPath } = useNestedMenuContext();
4086
- return /* @__PURE__ */ jsx31(
4113
+ return /* @__PURE__ */ jsx32(
4087
4114
  MenuPopout,
4088
4115
  {
4089
4116
  ...popoutProps,
@@ -4092,8 +4119,8 @@ var NestedMenuPopout = ({
4092
4119
  openMenu: rootMenuContextProps.openMenu,
4093
4120
  closeMenu: rootMenuContextProps.closeMenu,
4094
4121
  width: width2,
4095
- content: (props) => /* @__PURE__ */ jsx31(StyledDiv, { layout: "position", children: typeof content === "function" ? content(props) : content }),
4096
- children: (toggleProps) => /* @__PURE__ */ jsx31(
4122
+ content: (props) => /* @__PURE__ */ jsx32(StyledDiv, { layout: "position", children: typeof content === "function" ? content(props) : content }),
4123
+ children: (toggleProps) => /* @__PURE__ */ jsx32(
4097
4124
  MenuToggleProvider,
4098
4125
  {
4099
4126
  menuContext: {
@@ -4109,7 +4136,7 @@ var NestedMenuPopout = ({
4109
4136
  };
4110
4137
 
4111
4138
  // src/NestedMenu/NestedMenu.tsx
4112
- import { jsx as jsx32, jsxs as jsxs7 } from "react/jsx-runtime";
4139
+ import { jsx as jsx33, jsxs as jsxs7 } from "react/jsx-runtime";
4113
4140
  var NestedMenu = ({
4114
4141
  initialMenuId,
4115
4142
  menus,
@@ -4143,7 +4170,7 @@ var NestedMenu = ({
4143
4170
  ...useSelectReturnProps,
4144
4171
  ...restDefaults
4145
4172
  };
4146
- useEffect4(() => {
4173
+ useEffect5(() => {
4147
4174
  if (!useSelectReturnProps.isOpen) {
4148
4175
  setHasLoadedOnce(false);
4149
4176
  } else {
@@ -4168,7 +4195,7 @@ var NestedMenu = ({
4168
4195
  setIsAdding(true);
4169
4196
  setSelectedMenuPath((currentPath) => [...currentPath, id]);
4170
4197
  };
4171
- useEffect4(() => {
4198
+ useEffect5(() => {
4172
4199
  if (selectedMenuPath.length > 0) {
4173
4200
  const newMenuId = selectedMenuPath[selectedMenuPath.length - 1];
4174
4201
  setCurrentMenuId(newMenuId);
@@ -4262,7 +4289,7 @@ var NestedMenu = ({
4262
4289
  initialIsOpen: true,
4263
4290
  children: (
4264
4291
  // Handles the smooth animating of the content
4265
- /* @__PURE__ */ jsx32(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsxs7(
4292
+ /* @__PURE__ */ jsx33(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsxs7(
4266
4293
  motion3.div,
4267
4294
  {
4268
4295
  variants: contentVariants,
@@ -4271,7 +4298,7 @@ var NestedMenu = ({
4271
4298
  exit: "leave",
4272
4299
  custom: { isAdding, hasLoadedOnce },
4273
4300
  children: [
4274
- MenuHeaderComponent && /* @__PURE__ */ jsx32(
4301
+ MenuHeaderComponent && /* @__PURE__ */ jsx33(
4275
4302
  MenuHeaderComponent,
4276
4303
  {
4277
4304
  backArrowLabel,
@@ -4279,7 +4306,7 @@ var NestedMenu = ({
4279
4306
  }
4280
4307
  ),
4281
4308
  children && children,
4282
- menuItems && !children && /* @__PURE__ */ jsx32(
4309
+ menuItems && !children && /* @__PURE__ */ jsx33(
4283
4310
  NestedMenuContent,
4284
4311
  {
4285
4312
  menuItems,
@@ -4293,7 +4320,7 @@ var NestedMenu = ({
4293
4320
  ),
4294
4321
  ...restMenuProps
4295
4322
  };
4296
- return /* @__PURE__ */ jsx32(
4323
+ return /* @__PURE__ */ jsx33(
4297
4324
  NestedMenuProvider,
4298
4325
  {
4299
4326
  ...{
@@ -4307,11 +4334,11 @@ var NestedMenu = ({
4307
4334
  setActiveMenuContext,
4308
4335
  animationSpeed
4309
4336
  },
4310
- children: /* @__PURE__ */ jsx32(
4337
+ children: /* @__PURE__ */ jsx33(
4311
4338
  NestedMenuPopout,
4312
4339
  {
4313
4340
  content: MenuComponent && // Handles the rerender of the component
4314
- /* @__PURE__ */ jsx32(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsx32(
4341
+ /* @__PURE__ */ jsx33(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsx33(
4315
4342
  motion3.div,
4316
4343
  {
4317
4344
  variants: menuVariants,
@@ -4319,7 +4346,7 @@ var NestedMenu = ({
4319
4346
  animate: "enter",
4320
4347
  exit: "leave",
4321
4348
  custom: { isAdding, hasLoadedOnce },
4322
- children: /* @__PURE__ */ jsx32(MenuComponent, { ...nestedMenuProps })
4349
+ children: /* @__PURE__ */ jsx33(MenuComponent, { ...nestedMenuProps })
4323
4350
  },
4324
4351
  `${currentMenuId}-content`
4325
4352
  ) }),
@@ -4335,6 +4362,7 @@ export {
4335
4362
  ActionMenu,
4336
4363
  Autocomplete,
4337
4364
  AutocompleteInput,
4365
+ AutocompleteSelect,
4338
4366
  AutocompleteTokenInput,
4339
4367
  CustomPopoutContent,
4340
4368
  INPUT_TYPES,