@sproutsocial/seeds-react-menu 1.3.1 → 1.4.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
- CJS dist/index.js 142.61 KB
88
- CJS dist/index.js.map 368.34 KB
89
- CJS ⚡️ Build success in 596ms
90
- ESM dist/esm/index.js 132.96 KB
91
- ESM dist/esm/index.js.map 367.06 KB
92
- ESM ⚡️ Build success in 595ms
87
+ CJS dist/index.js 143.00 KB
88
+ CJS dist/index.js.map 369.68 KB
89
+ CJS ⚡️ Build success in 664ms
90
+ ESM dist/esm/index.js 133.33 KB
91
+ ESM dist/esm/index.js.map 368.41 KB
92
+ ESM ⚡️ Build success in 664ms
93
93
  DTS Build start
94
- DTS ⚡️ Build success in 16013ms
95
- DTS dist/index.d.ts 37.08 KB
96
- DTS dist/index.d.mts 37.08 KB
97
- Done in 19.00s.
94
+ DTS ⚡️ Build success in 11407ms
95
+ DTS dist/index.d.ts 37.42 KB
96
+ DTS dist/index.d.mts 37.42 KB
97
+ Done in 15.16s.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @sproutsocial/seeds-react-menu
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 37915da: Add system props to the `MenuContent` component
8
+
9
+ ### Patch Changes
10
+
11
+ - cc72db4: Smooths Menu animations when the height changes [[DS-3495)](https://sprout.atlassian.net/browse/DS-3495)]
12
+ - Updated dependencies [37915da]
13
+ - @sproutsocial/seeds-react-popout@2.3.0
14
+
15
+ ## 1.3.2
16
+
17
+ ### Patch Changes
18
+
19
+ - a67b345: Users can now add event listeners like onClick, onBlur, and onKeyDown to MenuToggleButton.
20
+
3
21
  ## 1.3.1
4
22
 
5
23
  ### Patch Changes
package/dist/esm/index.js CHANGED
@@ -239,58 +239,46 @@ import styled, { css as css4 } from "styled-components";
239
239
 
240
240
  // ../../node_modules/@babel/runtime/helpers/esm/extends.js
241
241
  function _extends() {
242
- _extends = Object.assign ? Object.assign.bind() : function(target) {
243
- for (var i = 1; i < arguments.length; i++) {
244
- var source = arguments[i];
245
- for (var key in source) {
246
- if (Object.prototype.hasOwnProperty.call(source, key)) {
247
- target[key] = source[key];
248
- }
249
- }
242
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
243
+ for (var e = 1; e < arguments.length; e++) {
244
+ var t = arguments[e];
245
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
250
246
  }
251
- return target;
252
- };
253
- return _extends.apply(this, arguments);
247
+ return n;
248
+ }, _extends.apply(null, arguments);
254
249
  }
255
250
 
256
251
  // ../../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
257
- function _assertThisInitialized(self) {
258
- if (self === void 0) {
259
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
260
- }
261
- return self;
252
+ function _assertThisInitialized(e) {
253
+ if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
254
+ return e;
262
255
  }
263
256
 
264
257
  // ../../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
265
- function _setPrototypeOf(o, p) {
266
- _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
267
- o2.__proto__ = p2;
268
- return o2;
269
- };
270
- return _setPrototypeOf(o, p);
258
+ function _setPrototypeOf(t, e) {
259
+ return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(t2, e2) {
260
+ return t2.__proto__ = e2, t2;
261
+ }, _setPrototypeOf(t, e);
271
262
  }
272
263
 
273
264
  // ../../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
274
- function _inheritsLoose(subClass, superClass) {
275
- subClass.prototype = Object.create(superClass.prototype);
276
- subClass.prototype.constructor = subClass;
277
- _setPrototypeOf(subClass, superClass);
265
+ function _inheritsLoose(t, o) {
266
+ t.prototype = Object.create(o.prototype), t.prototype.constructor = t, _setPrototypeOf(t, o);
278
267
  }
279
268
 
280
269
  // ../../node_modules/@babel/runtime/helpers/esm/getPrototypeOf.js
281
- function _getPrototypeOf(o) {
282
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
283
- return o2.__proto__ || Object.getPrototypeOf(o2);
284
- };
285
- return _getPrototypeOf(o);
270
+ function _getPrototypeOf(t) {
271
+ return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(t2) {
272
+ return t2.__proto__ || Object.getPrototypeOf(t2);
273
+ }, _getPrototypeOf(t);
286
274
  }
287
275
 
288
276
  // ../../node_modules/@babel/runtime/helpers/esm/isNativeFunction.js
289
- function _isNativeFunction(fn) {
277
+ function _isNativeFunction(t) {
290
278
  try {
291
- return Function.toString.call(fn).indexOf("[native code]") !== -1;
292
- } catch (e) {
293
- return typeof fn === "function";
279
+ return -1 !== Function.toString.call(t).indexOf("[native code]");
280
+ } catch (n) {
281
+ return "function" == typeof t;
294
282
  }
295
283
  }
296
284
 
@@ -316,31 +304,27 @@ function _construct(t, e, r) {
316
304
  }
317
305
 
318
306
  // ../../node_modules/@babel/runtime/helpers/esm/wrapNativeSuper.js
319
- function _wrapNativeSuper(Class) {
320
- var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
321
- _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
322
- if (Class2 === null || !_isNativeFunction(Class2)) return Class2;
323
- if (typeof Class2 !== "function") {
324
- throw new TypeError("Super expression must either be null or a function");
325
- }
326
- if (typeof _cache !== "undefined") {
327
- if (_cache.has(Class2)) return _cache.get(Class2);
328
- _cache.set(Class2, Wrapper);
307
+ function _wrapNativeSuper(t) {
308
+ var r = "function" == typeof Map ? /* @__PURE__ */ new Map() : void 0;
309
+ return _wrapNativeSuper = function _wrapNativeSuper2(t2) {
310
+ if (null === t2 || !_isNativeFunction(t2)) return t2;
311
+ if ("function" != typeof t2) throw new TypeError("Super expression must either be null or a function");
312
+ if (void 0 !== r) {
313
+ if (r.has(t2)) return r.get(t2);
314
+ r.set(t2, Wrapper);
329
315
  }
330
316
  function Wrapper() {
331
- return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
317
+ return _construct(t2, arguments, _getPrototypeOf(this).constructor);
332
318
  }
333
- Wrapper.prototype = Object.create(Class2.prototype, {
319
+ return Wrapper.prototype = Object.create(t2.prototype, {
334
320
  constructor: {
335
321
  value: Wrapper,
336
322
  enumerable: false,
337
323
  writable: true,
338
324
  configurable: true
339
325
  }
340
- });
341
- return _setPrototypeOf(Wrapper, Class2);
342
- };
343
- return _wrapNativeSuper(Class);
326
+ }), _setPrototypeOf(Wrapper, t2);
327
+ }, _wrapNativeSuper(t);
344
328
  }
345
329
 
346
330
  // ../../node_modules/polished/dist/polished.esm.js
@@ -2131,11 +2115,20 @@ import styled3 from "styled-components";
2131
2115
  var StyledMenuContent = styled3.ul`
2132
2116
  margin: 0;
2133
2117
  padding: 0;
2118
+ overflow: auto;
2134
2119
 
2135
2120
  &:focus {
2136
2121
  outline: none;
2137
2122
  box-shadow: none;
2138
2123
  }
2124
+
2125
+ ${border}
2126
+ ${color}
2127
+ ${flexbox}
2128
+ ${grid}
2129
+ ${layout}
2130
+ ${space}
2131
+ ${position}
2139
2132
  `;
2140
2133
 
2141
2134
  // src/hooks/useMenuChildren.tsx
@@ -2602,8 +2595,10 @@ var CustomPopoutContent = styled8(Popout.Content)`
2602
2595
  padding: 0;
2603
2596
  margin-left: 0;
2604
2597
  margin-right: 0;
2598
+ overflow: hidden;
2605
2599
  `;
2606
2600
  var menuAnimationConfig = {
2601
+ layout: true,
2607
2602
  initial: {
2608
2603
  scale: 0,
2609
2604
  opacity: 0,
@@ -2758,20 +2753,29 @@ import { Button } from "@sproutsocial/seeds-react-button";
2758
2753
  import { jsx as jsx13 } from "react/jsx-runtime";
2759
2754
  var MenuToggleButton = (props) => {
2760
2755
  const { getToggleButtonProps, isListbox, getDropdownProps, ref, ariaProps } = useMenuToggleContext();
2761
- return /* @__PURE__ */ jsx13(
2762
- Button,
2763
- {
2764
- appearance: "secondary",
2765
- ...getToggleButtonProps?.({
2766
- // Decide if we want the preventKeyAction stuff. Maybe create a prop to allow for this to be overriden.
2767
- ...getDropdownProps?.({ ref, preventKeyAction: true }) || { ref },
2768
- refKey: "innerRef",
2769
- ...ariaProps,
2770
- ...isListbox ? {} : { role: "button", "aria-haspopup": "menu" }
2771
- }),
2772
- ...props
2773
- }
2774
- );
2756
+ const {
2757
+ onClick: userOnClick,
2758
+ onKeyDown: userOnKeyDown,
2759
+ onBlur: userOnBlur,
2760
+ ...restProps
2761
+ } = props;
2762
+ const defaultDropdownProps = {
2763
+ ref,
2764
+ onClick: userOnClick,
2765
+ onKeyDown: userOnKeyDown,
2766
+ onBlur: userOnBlur
2767
+ };
2768
+ const dropdownProps = getDropdownProps?.({
2769
+ ...defaultDropdownProps,
2770
+ preventKeyAction: true
2771
+ }) ?? defaultDropdownProps;
2772
+ const toggleButtonProps = getToggleButtonProps?.({
2773
+ ...dropdownProps,
2774
+ refKey: "innerRef",
2775
+ ...ariaProps,
2776
+ ...isListbox ? {} : { role: "button", "aria-haspopup": "menu" }
2777
+ });
2778
+ return /* @__PURE__ */ jsx13(Button, { appearance: "secondary", ...toggleButtonProps, ...restProps });
2775
2779
  };
2776
2780
 
2777
2781
  // src/MenuSearchInput/MenuSearchInput.tsx
@@ -4186,19 +4190,23 @@ var NestedMenuPopout = ({
4186
4190
  content,
4187
4191
  menuToggleElement,
4188
4192
  width: width2,
4193
+ onClose,
4189
4194
  ...popoutProps
4190
4195
  }) => {
4191
4196
  const { activeMenuContext, rootMenuContextProps, resetSelectedMenuPath } = useNestedMenuContext();
4192
4197
  return /* @__PURE__ */ jsx33(
4193
4198
  MenuPopout,
4194
4199
  {
4195
- ...popoutProps,
4196
- onClose: () => setTimeout(() => resetSelectedMenuPath?.(), 100),
4200
+ onClose: () => {
4201
+ onClose?.();
4202
+ setTimeout(() => resetSelectedMenuPath?.(), 100);
4203
+ },
4197
4204
  isOpen: !!rootMenuContextProps.isOpen,
4198
4205
  openMenu: rootMenuContextProps.openMenu,
4199
4206
  closeMenu: rootMenuContextProps.closeMenu,
4200
4207
  width: width2,
4201
4208
  content: (props) => /* @__PURE__ */ jsx33(StyledDiv, { layout: "position", children: typeof content === "function" ? content(props) : content }),
4209
+ ...popoutProps,
4202
4210
  children: (toggleProps) => /* @__PURE__ */ jsx33(
4203
4211
  MenuToggleProvider,
4204
4212
  {
@@ -4222,7 +4230,10 @@ var NestedMenu = ({
4222
4230
  onBackButtonClick,
4223
4231
  backArrowLabel,
4224
4232
  menuToggleElement,
4225
- popoutProps = {},
4233
+ popoutProps: {
4234
+ scheduleUpdateRef: externalPopoutUpdateRef,
4235
+ ...restPopoutProps
4236
+ } = {},
4226
4237
  width: width2 = "300px",
4227
4238
  stateReducer: rootExternalStateReducer,
4228
4239
  id: externalNestedMenuId,
@@ -4271,6 +4282,7 @@ var NestedMenu = ({
4271
4282
  const [activeMenuContext, setActiveMenuContext] = useState(defaultMenuContext);
4272
4283
  const [currentMenuId, setCurrentMenuId] = useState(initialMenuId);
4273
4284
  const [isAdding, setIsAdding] = useState(false);
4285
+ const [popoutUpdateRef, setPopoutUpdateRef] = useState();
4274
4286
  const setSelectedMenuId = (id) => {
4275
4287
  setIsAdding(true);
4276
4288
  setSelectedMenuPath((currentPath) => [...currentPath, id]);
@@ -4279,6 +4291,7 @@ var NestedMenu = ({
4279
4291
  if (selectedMenuPath.length > 0) {
4280
4292
  const newMenuId = selectedMenuPath[selectedMenuPath.length - 1];
4281
4293
  setCurrentMenuId(newMenuId);
4294
+ popoutUpdateRef?.();
4282
4295
  }
4283
4296
  }, [selectedMenuPath.join("-")]);
4284
4297
  const resetSelectedMenuPath = () => {
@@ -4432,7 +4445,11 @@ var NestedMenu = ({
4432
4445
  ) }),
4433
4446
  menuToggleElement,
4434
4447
  width: width2,
4435
- ...popoutProps
4448
+ scheduleUpdateRef: (callback) => {
4449
+ setPopoutUpdateRef(callback);
4450
+ externalPopoutUpdateRef?.(callback);
4451
+ },
4452
+ ...restPopoutProps
4436
4453
  }
4437
4454
  )
4438
4455
  }