@launchpad-ui/menu 0.6.5 → 0.6.6-alpha.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.
- package/package.json +5 -6
- package/dist/Menu.d.ts +0 -43
- package/dist/Menu.d.ts.map +0 -1
- package/dist/MenuBase.d.ts +0 -11
- package/dist/MenuBase.d.ts.map +0 -1
- package/dist/MenuDivider.d.ts +0 -11
- package/dist/MenuDivider.d.ts.map +0 -1
- package/dist/MenuItem.d.ts +0 -48
- package/dist/MenuItem.d.ts.map +0 -1
- package/dist/MenuItemList.d.ts +0 -7
- package/dist/MenuItemList.d.ts.map +0 -1
- package/dist/MenuSearch.d.ts +0 -13
- package/dist/MenuSearch.d.ts.map +0 -1
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.es.js +0 -452
- package/dist/index.es.js.map +0 -1
- package/dist/index.js +0 -452
- package/dist/index.js.map +0 -1
- package/dist/style.css +0 -222
- package/dist/utils.d.ts +0 -7
- package/dist/utils.d.ts.map +0 -1
    
        package/dist/index.es.js
    DELETED
    
    | @@ -1,452 +0,0 @@ | |
| 1 | 
            -
            import './style.css';
         | 
| 2 | 
            -
            import { cx } from "classix";
         | 
| 3 | 
            -
            import { forwardRef, useCallback, useMemo, Children, cloneElement, useRef, useId, useState, useEffect } from "react";
         | 
| 4 | 
            -
            import { jsx, jsxs, Fragment } from "react/jsx-runtime";
         | 
| 5 | 
            -
            import { useSeparator } from "@react-aria/separator";
         | 
| 6 | 
            -
            import { Tooltip } from "@launchpad-ui/tooltip";
         | 
| 7 | 
            -
            import { Slot } from "@radix-ui/react-slot";
         | 
| 8 | 
            -
            import { FocusRing, useFocusManager } from "@react-aria/focus";
         | 
| 9 | 
            -
            import { Link } from "react-router-dom";
         | 
| 10 | 
            -
            import { TextField } from "@launchpad-ui/form";
         | 
| 11 | 
            -
            import { useVirtual } from "react-virtual";
         | 
| 12 | 
            -
            const Menu$1 = "";
         | 
| 13 | 
            -
            const MenuBase = forwardRef(({
         | 
| 14 | 
            -
              children,
         | 
| 15 | 
            -
              size,
         | 
| 16 | 
            -
              isVirtual,
         | 
| 17 | 
            -
              ...props
         | 
| 18 | 
            -
            }, ref) => {
         | 
| 19 | 
            -
              const classes = cx("Menu", isVirtual && "Menu--isVirtual", size && `MenuSize--${size}`);
         | 
| 20 | 
            -
              return /* @__PURE__ */ jsx("div", {
         | 
| 21 | 
            -
                ...props,
         | 
| 22 | 
            -
                role: "menu",
         | 
| 23 | 
            -
                className: classes,
         | 
| 24 | 
            -
                ref,
         | 
| 25 | 
            -
                children
         | 
| 26 | 
            -
              });
         | 
| 27 | 
            -
            });
         | 
| 28 | 
            -
            MenuBase.displayName = "MenuBase";
         | 
| 29 | 
            -
            const MenuDivider = ({
         | 
| 30 | 
            -
              elementType = "div",
         | 
| 31 | 
            -
              orientation,
         | 
| 32 | 
            -
              innerRef,
         | 
| 33 | 
            -
              "data-test-id": testId = "menu-divider"
         | 
| 34 | 
            -
            }) => {
         | 
| 35 | 
            -
              const {
         | 
| 36 | 
            -
                separatorProps
         | 
| 37 | 
            -
              } = useSeparator({
         | 
| 38 | 
            -
                orientation,
         | 
| 39 | 
            -
                elementType
         | 
| 40 | 
            -
              });
         | 
| 41 | 
            -
              return /* @__PURE__ */ jsx("div", {
         | 
| 42 | 
            -
                ...separatorProps,
         | 
| 43 | 
            -
                "data-test-id": testId,
         | 
| 44 | 
            -
                ref: innerRef,
         | 
| 45 | 
            -
                className: "Menu-divider"
         | 
| 46 | 
            -
              });
         | 
| 47 | 
            -
            };
         | 
| 48 | 
            -
            const defaultElement = "button";
         | 
| 49 | 
            -
            const MenuItem = ({
         | 
| 50 | 
            -
              ...props
         | 
| 51 | 
            -
            }) => {
         | 
| 52 | 
            -
              const {
         | 
| 53 | 
            -
                component,
         | 
| 54 | 
            -
                children,
         | 
| 55 | 
            -
                isHighlighted,
         | 
| 56 | 
            -
                icon: Icon,
         | 
| 57 | 
            -
                nested,
         | 
| 58 | 
            -
                groupHeader,
         | 
| 59 | 
            -
                item,
         | 
| 60 | 
            -
                disabled,
         | 
| 61 | 
            -
                className,
         | 
| 62 | 
            -
                tooltip,
         | 
| 63 | 
            -
                role = "menuitem",
         | 
| 64 | 
            -
                tooltipPlacement,
         | 
| 65 | 
            -
                onKeyDown,
         | 
| 66 | 
            -
                tooltipOptions,
         | 
| 67 | 
            -
                asChild,
         | 
| 68 | 
            -
                "data-test-id": testId = "menu-item",
         | 
| 69 | 
            -
                ...rest
         | 
| 70 | 
            -
              } = props;
         | 
| 71 | 
            -
              const Component = component || (asChild ? Slot : defaultElement);
         | 
| 72 | 
            -
              const renderedItem = /* @__PURE__ */ jsx(FocusRing, {
         | 
| 73 | 
            -
                focusRingClass: "has-focus",
         | 
| 74 | 
            -
                children: /* @__PURE__ */ jsx(Component, {
         | 
| 75 | 
            -
                  ...rest,
         | 
| 76 | 
            -
                  disabled,
         | 
| 77 | 
            -
                  "aria-disabled": disabled ? disabled : void 0,
         | 
| 78 | 
            -
                  className: cx("Menu-item", className, isHighlighted && "is-highlighted", nested && "Menu-item--nested", groupHeader && "Menu-item--header"),
         | 
| 79 | 
            -
                  "data-test-id": testId,
         | 
| 80 | 
            -
                  role,
         | 
| 81 | 
            -
                  onKeyDown,
         | 
| 82 | 
            -
                  children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, {
         | 
| 83 | 
            -
                    children: [Icon && /* @__PURE__ */ jsx("span", {
         | 
| 84 | 
            -
                      className: "Menu-item-icon",
         | 
| 85 | 
            -
                      children: /* @__PURE__ */ jsx(Icon, {
         | 
| 86 | 
            -
                        size: "small"
         | 
| 87 | 
            -
                      })
         | 
| 88 | 
            -
                    }), children]
         | 
| 89 | 
            -
                  })
         | 
| 90 | 
            -
                })
         | 
| 91 | 
            -
              });
         | 
| 92 | 
            -
              if (tooltip) {
         | 
| 93 | 
            -
                return /* @__PURE__ */ jsx(Tooltip, {
         | 
| 94 | 
            -
                  content: tooltip,
         | 
| 95 | 
            -
                  rootElementStyle: {
         | 
| 96 | 
            -
                    display: "block"
         | 
| 97 | 
            -
                  },
         | 
| 98 | 
            -
                  allowBoundaryElementOverflow: true,
         | 
| 99 | 
            -
                  placement: tooltipPlacement ? tooltipPlacement : "bottom",
         | 
| 100 | 
            -
                  ...tooltipOptions || {},
         | 
| 101 | 
            -
                  children: renderedItem
         | 
| 102 | 
            -
                });
         | 
| 103 | 
            -
              }
         | 
| 104 | 
            -
              return renderedItem;
         | 
| 105 | 
            -
            };
         | 
| 106 | 
            -
            const MenuItemLink = ({
         | 
| 107 | 
            -
              to,
         | 
| 108 | 
            -
              disabled = false,
         | 
| 109 | 
            -
              useHistory = true,
         | 
| 110 | 
            -
              newTab = false,
         | 
| 111 | 
            -
              children,
         | 
| 112 | 
            -
              ...props
         | 
| 113 | 
            -
            }) => {
         | 
| 114 | 
            -
              const finalProps = {
         | 
| 115 | 
            -
                ...props,
         | 
| 116 | 
            -
                disabled,
         | 
| 117 | 
            -
                component: useHistory ? Link : "a",
         | 
| 118 | 
            -
                [useHistory ? "to" : "href"]: disabled ? "" : to,
         | 
| 119 | 
            -
                rel: newTab ? "noopener noreferrer" : void 0,
         | 
| 120 | 
            -
                target: newTab ? "_blank" : void 0
         | 
| 121 | 
            -
              };
         | 
| 122 | 
            -
              return /* @__PURE__ */ jsx(MenuItem, {
         | 
| 123 | 
            -
                ...finalProps,
         | 
| 124 | 
            -
                children
         | 
| 125 | 
            -
              });
         | 
| 126 | 
            -
            };
         | 
| 127 | 
            -
            const MenuItemList = forwardRef(({
         | 
| 128 | 
            -
              children,
         | 
| 129 | 
            -
              ...rest
         | 
| 130 | 
            -
            }, ref) => /* @__PURE__ */ jsx("div", {
         | 
| 131 | 
            -
              ...rest,
         | 
| 132 | 
            -
              ref,
         | 
| 133 | 
            -
              "data-test-id": "menu-item-list",
         | 
| 134 | 
            -
              className: "Menu-item-list",
         | 
| 135 | 
            -
              children
         | 
| 136 | 
            -
            }));
         | 
| 137 | 
            -
            MenuItemList.displayName = "MenuItemList";
         | 
| 138 | 
            -
            const MenuSearch = forwardRef((props, ref) => {
         | 
| 139 | 
            -
              const {
         | 
| 140 | 
            -
                ariaLabel,
         | 
| 141 | 
            -
                placeholder,
         | 
| 142 | 
            -
                "data-test-id": testId = "menu-search",
         | 
| 143 | 
            -
                ...finalProps
         | 
| 144 | 
            -
              } = props;
         | 
| 145 | 
            -
              return /* @__PURE__ */ jsx("div", {
         | 
| 146 | 
            -
                className: "Menu-search",
         | 
| 147 | 
            -
                children: /* @__PURE__ */ jsx(TextField, {
         | 
| 148 | 
            -
                  ...finalProps,
         | 
| 149 | 
            -
                  ref,
         | 
| 150 | 
            -
                  className: "Menu-search-input",
         | 
| 151 | 
            -
                  tiny: true,
         | 
| 152 | 
            -
                  type: "search",
         | 
| 153 | 
            -
                  "data-test-id": testId,
         | 
| 154 | 
            -
                  autoComplete: "off",
         | 
| 155 | 
            -
                  placeholder,
         | 
| 156 | 
            -
                  "aria-label": ariaLabel || "Search"
         | 
| 157 | 
            -
                })
         | 
| 158 | 
            -
              });
         | 
| 159 | 
            -
            });
         | 
| 160 | 
            -
            MenuSearch.displayName = "MenuSearch";
         | 
| 161 | 
            -
            const createItemId = (index, id) => `${id}-item-${index}`;
         | 
| 162 | 
            -
            const getNodeForIndex = (index, menuId) => index === null ? index : document.getElementById(createItemId(index, menuId));
         | 
| 163 | 
            -
            const handleKeyboardInteractions = (event, keyHandlers) => {
         | 
| 164 | 
            -
              var _a;
         | 
| 165 | 
            -
              const ops = {
         | 
| 166 | 
            -
                ArrowUp: keyHandlers.handleUp,
         | 
| 167 | 
            -
                ArrowDown: keyHandlers.handleDown,
         | 
| 168 | 
            -
                Enter: keyHandlers.handleEnter
         | 
| 169 | 
            -
              };
         | 
| 170 | 
            -
              if (ops[event.key]) {
         | 
| 171 | 
            -
                event.preventDefault();
         | 
| 172 | 
            -
                (_a = ops[event.key]) == null ? void 0 : _a.call(globalThis, event);
         | 
| 173 | 
            -
              }
         | 
| 174 | 
            -
            };
         | 
| 175 | 
            -
            const chainEventHandlers = (...handlers) => (event) => {
         | 
| 176 | 
            -
              handlers.forEach((h) => typeof h === "function" && h(event));
         | 
| 177 | 
            -
            };
         | 
| 178 | 
            -
            const Menu = (props) => {
         | 
| 179 | 
            -
              const {
         | 
| 180 | 
            -
                children,
         | 
| 181 | 
            -
                menuItemClassName,
         | 
| 182 | 
            -
                onSelect,
         | 
| 183 | 
            -
                enableVirtualization,
         | 
| 184 | 
            -
                itemHeight,
         | 
| 185 | 
            -
                size,
         | 
| 186 | 
            -
                overscan = 1,
         | 
| 187 | 
            -
                "data-test-id": testId = "menu"
         | 
| 188 | 
            -
              } = props;
         | 
| 189 | 
            -
              const focusManager = useFocusManager();
         | 
| 190 | 
            -
              const handleArrowDown = useCallback(() => {
         | 
| 191 | 
            -
                focusManager.focusNext({
         | 
| 192 | 
            -
                  wrap: true
         | 
| 193 | 
            -
                });
         | 
| 194 | 
            -
              }, [focusManager]);
         | 
| 195 | 
            -
              const handleArrowUp = useCallback(() => {
         | 
| 196 | 
            -
                focusManager.focusPrevious({
         | 
| 197 | 
            -
                  wrap: true
         | 
| 198 | 
            -
                });
         | 
| 199 | 
            -
              }, [focusManager]);
         | 
| 200 | 
            -
              const reduceItems = useMemo(() => {
         | 
| 201 | 
            -
                const childrenProps = Children.toArray(children);
         | 
| 202 | 
            -
                if (enableVirtualization) {
         | 
| 203 | 
            -
                  let searchElem = null;
         | 
| 204 | 
            -
                  let elements = [];
         | 
| 205 | 
            -
                  childrenProps.forEach((child) => {
         | 
| 206 | 
            -
                    switch (child.type) {
         | 
| 207 | 
            -
                      case MenuSearch:
         | 
| 208 | 
            -
                        searchElem = child;
         | 
| 209 | 
            -
                        break;
         | 
| 210 | 
            -
                      case MenuItem:
         | 
| 211 | 
            -
                      case MenuItemLink:
         | 
| 212 | 
            -
                      case MenuDivider:
         | 
| 213 | 
            -
                        elements = elements.concat(child);
         | 
| 214 | 
            -
                        break;
         | 
| 215 | 
            -
                    }
         | 
| 216 | 
            -
                  });
         | 
| 217 | 
            -
                  return {
         | 
| 218 | 
            -
                    items: elements,
         | 
| 219 | 
            -
                    searchElement: searchElem
         | 
| 220 | 
            -
                  };
         | 
| 221 | 
            -
                }
         | 
| 222 | 
            -
                return childrenProps.reduce(({
         | 
| 223 | 
            -
                  items,
         | 
| 224 | 
            -
                  searchElement
         | 
| 225 | 
            -
                }, child) => {
         | 
| 226 | 
            -
                  var _a;
         | 
| 227 | 
            -
                  switch (child.type) {
         | 
| 228 | 
            -
                    case MenuSearch:
         | 
| 229 | 
            -
                      return {
         | 
| 230 | 
            -
                        items,
         | 
| 231 | 
            -
                        searchElement: cloneElement(child, {
         | 
| 232 | 
            -
                          onKeyDown: (e) => handleKeyboardInteractions(e, {
         | 
| 233 | 
            -
                            handleDown: handleArrowDown,
         | 
| 234 | 
            -
                            handleUp: handleArrowUp
         | 
| 235 | 
            -
                          })
         | 
| 236 | 
            -
                        })
         | 
| 237 | 
            -
                      };
         | 
| 238 | 
            -
                    case MenuItem:
         | 
| 239 | 
            -
                    case MenuItemLink:
         | 
| 240 | 
            -
                      return {
         | 
| 241 | 
            -
                        items: items.concat(child.props.disabled ? cloneElement(child, {
         | 
| 242 | 
            -
                          onClick: () => void 0,
         | 
| 243 | 
            -
                          onKeyDown: () => void 0,
         | 
| 244 | 
            -
                          tabIndex: -1,
         | 
| 245 | 
            -
                          disabled: true
         | 
| 246 | 
            -
                        }) : cloneElement(child, {
         | 
| 247 | 
            -
                          className: cx(child.props.className, menuItemClassName),
         | 
| 248 | 
            -
                          item: (_a = child.props.item) != null ? _a : items.length,
         | 
| 249 | 
            -
                          onClick: chainEventHandlers(child.props.onClick, () => {
         | 
| 250 | 
            -
                            var _a2;
         | 
| 251 | 
            -
                            onSelect == null ? void 0 : onSelect((_a2 = child.props.item) != null ? _a2 : items.length);
         | 
| 252 | 
            -
                          }),
         | 
| 253 | 
            -
                          onKeyDown: (e) => handleKeyboardInteractions(e, {
         | 
| 254 | 
            -
                            handleDown: handleArrowDown,
         | 
| 255 | 
            -
                            handleUp: handleArrowUp
         | 
| 256 | 
            -
                          })
         | 
| 257 | 
            -
                        })),
         | 
| 258 | 
            -
                        searchElement
         | 
| 259 | 
            -
                      };
         | 
| 260 | 
            -
                    case MenuDivider:
         | 
| 261 | 
            -
                      return {
         | 
| 262 | 
            -
                        items: items.concat(child),
         | 
| 263 | 
            -
                        searchElement
         | 
| 264 | 
            -
                      };
         | 
| 265 | 
            -
                    default:
         | 
| 266 | 
            -
                      return {
         | 
| 267 | 
            -
                        items,
         | 
| 268 | 
            -
                        searchElement
         | 
| 269 | 
            -
                      };
         | 
| 270 | 
            -
                  }
         | 
| 271 | 
            -
                }, {
         | 
| 272 | 
            -
                  items: [],
         | 
| 273 | 
            -
                  searchElement: null
         | 
| 274 | 
            -
                });
         | 
| 275 | 
            -
              }, [children, enableVirtualization, menuItemClassName, handleArrowDown, handleArrowUp, onSelect]);
         | 
| 276 | 
            -
              if (enableVirtualization) {
         | 
| 277 | 
            -
                return /* @__PURE__ */ jsx(MenuBase, {
         | 
| 278 | 
            -
                  "data-test-id": testId,
         | 
| 279 | 
            -
                  isVirtual: true,
         | 
| 280 | 
            -
                  size,
         | 
| 281 | 
            -
                  children: /* @__PURE__ */ jsx(ItemVirtualizer, {
         | 
| 282 | 
            -
                    items: Children.toArray(reduceItems.items),
         | 
| 283 | 
            -
                    searchElement: reduceItems.searchElement,
         | 
| 284 | 
            -
                    overscan,
         | 
| 285 | 
            -
                    menuItemClassName,
         | 
| 286 | 
            -
                    onSelect,
         | 
| 287 | 
            -
                    itemHeight,
         | 
| 288 | 
            -
                    focusManager
         | 
| 289 | 
            -
                  })
         | 
| 290 | 
            -
                });
         | 
| 291 | 
            -
              }
         | 
| 292 | 
            -
              return /* @__PURE__ */ jsxs(MenuBase, {
         | 
| 293 | 
            -
                "data-test-id": testId,
         | 
| 294 | 
            -
                size,
         | 
| 295 | 
            -
                children: [reduceItems.searchElement, /* @__PURE__ */ jsx(MenuItemList, {
         | 
| 296 | 
            -
                  role: "presentation",
         | 
| 297 | 
            -
                  children: reduceItems.items
         | 
| 298 | 
            -
                })]
         | 
| 299 | 
            -
              });
         | 
| 300 | 
            -
            };
         | 
| 301 | 
            -
            const ItemVirtualizer = (props) => {
         | 
| 302 | 
            -
              const {
         | 
| 303 | 
            -
                overscan,
         | 
| 304 | 
            -
                searchElement,
         | 
| 305 | 
            -
                itemHeight = 33,
         | 
| 306 | 
            -
                menuItemClassName,
         | 
| 307 | 
            -
                items,
         | 
| 308 | 
            -
                focusManager,
         | 
| 309 | 
            -
                onSelect
         | 
| 310 | 
            -
              } = props;
         | 
| 311 | 
            -
              const menuId = useRef(`menu-ctrl-${useId()}`);
         | 
| 312 | 
            -
              const focusedItemIndex = useRef(null);
         | 
| 313 | 
            -
              const parentRef = useRef(null);
         | 
| 314 | 
            -
              const searchRef = useRef();
         | 
| 315 | 
            -
              const [nextFocusValue, setNextFocusValue] = useState(null);
         | 
| 316 | 
            -
              const hasSearch = !!searchElement;
         | 
| 317 | 
            -
              const lastVirtualItemIndex = items ? items.length - 1 : 0;
         | 
| 318 | 
            -
              const rowVirtualizer = useVirtual({
         | 
| 319 | 
            -
                size: items !== null ? items.length : 0,
         | 
| 320 | 
            -
                parentRef,
         | 
| 321 | 
            -
                estimateSize: useCallback(() => itemHeight, [itemHeight]),
         | 
| 322 | 
            -
                overscan
         | 
| 323 | 
            -
              });
         | 
| 324 | 
            -
              const focusSearchBar = useCallback(() => {
         | 
| 325 | 
            -
                var _a, _b;
         | 
| 326 | 
            -
                rowVirtualizer.scrollToIndex(0);
         | 
| 327 | 
            -
                (_b = (_a = searchRef.current) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
         | 
| 328 | 
            -
              }, [rowVirtualizer]);
         | 
| 329 | 
            -
              const focusMenuItem = useCallback((index) => {
         | 
| 330 | 
            -
                rowVirtualizer.scrollToIndex(index);
         | 
| 331 | 
            -
                setNextFocusValue(index);
         | 
| 332 | 
            -
              }, [rowVirtualizer]);
         | 
| 333 | 
            -
              const handleKeyboardFocusInteraction = useCallback((direction) => {
         | 
| 334 | 
            -
                if (focusedItemIndex.current === null || focusedItemIndex.current === void 0) {
         | 
| 335 | 
            -
                  return;
         | 
| 336 | 
            -
                }
         | 
| 337 | 
            -
                const nextIndex = direction === "next" ? focusedItemIndex.current + 1 : focusedItemIndex.current - 1;
         | 
| 338 | 
            -
                const shouldWrap = direction === "next" && focusedItemIndex.current === lastVirtualItemIndex || direction === "previous" && focusedItemIndex.current === 0;
         | 
| 339 | 
            -
                if (shouldWrap) {
         | 
| 340 | 
            -
                  if (hasSearch) {
         | 
| 341 | 
            -
                    focusSearchBar();
         | 
| 342 | 
            -
                  } else {
         | 
| 343 | 
            -
                    focusMenuItem(direction === "next" ? 0 : lastVirtualItemIndex);
         | 
| 344 | 
            -
                  }
         | 
| 345 | 
            -
                  return;
         | 
| 346 | 
            -
                }
         | 
| 347 | 
            -
                switch (direction) {
         | 
| 348 | 
            -
                  case "next":
         | 
| 349 | 
            -
                    rowVirtualizer.scrollToIndex(nextIndex);
         | 
| 350 | 
            -
                    focusManager.focusNext();
         | 
| 351 | 
            -
                    break;
         | 
| 352 | 
            -
                  case "previous":
         | 
| 353 | 
            -
                    rowVirtualizer.scrollToIndex(nextIndex);
         | 
| 354 | 
            -
                    focusManager.focusPrevious();
         | 
| 355 | 
            -
                    break;
         | 
| 356 | 
            -
                }
         | 
| 357 | 
            -
              }, [focusManager, focusMenuItem, focusSearchBar, hasSearch, lastVirtualItemIndex, rowVirtualizer]);
         | 
| 358 | 
            -
              const getItemProps = useCallback((itemElem, index) => {
         | 
| 359 | 
            -
                const childProps = itemElem.props;
         | 
| 360 | 
            -
                switch (itemElem.type) {
         | 
| 361 | 
            -
                  case MenuItem:
         | 
| 362 | 
            -
                  case MenuItemLink:
         | 
| 363 | 
            -
                    return {
         | 
| 364 | 
            -
                      className: cx(childProps.className, menuItemClassName),
         | 
| 365 | 
            -
                      onKeyDown: childProps.disabled ? () => void 0 : (e) => handleKeyboardFocusKeydown(e, {
         | 
| 366 | 
            -
                        handleFocusBackward: handleKeyboardFocusInteraction,
         | 
| 367 | 
            -
                        handleFocusForward: handleKeyboardFocusInteraction
         | 
| 368 | 
            -
                      }),
         | 
| 369 | 
            -
                      onFocus: chainEventHandlers(childProps.onFocus, () => {
         | 
| 370 | 
            -
                        focusedItemIndex.current = index;
         | 
| 371 | 
            -
                      }),
         | 
| 372 | 
            -
                      id: createItemId(index, menuId.current),
         | 
| 373 | 
            -
                      onBlur: chainEventHandlers(childProps.onBlur, () => {
         | 
| 374 | 
            -
                        focusedItemIndex.current = null;
         | 
| 375 | 
            -
                      }),
         | 
| 376 | 
            -
                      onClick: childProps.disabled ? () => void 0 : chainEventHandlers(childProps.onClick, () => {
         | 
| 377 | 
            -
                        onSelect == null ? void 0 : onSelect(childProps.item);
         | 
| 378 | 
            -
                      })
         | 
| 379 | 
            -
                    };
         | 
| 380 | 
            -
                  default:
         | 
| 381 | 
            -
                    return {};
         | 
| 382 | 
            -
                }
         | 
| 383 | 
            -
              }, [handleKeyboardFocusInteraction, menuItemClassName, onSelect]);
         | 
| 384 | 
            -
              useEffect(() => {
         | 
| 385 | 
            -
                if (nextFocusValue !== null) {
         | 
| 386 | 
            -
                  requestAnimationFrame(() => {
         | 
| 387 | 
            -
                    const element = getNodeForIndex(nextFocusValue, menuId.current);
         | 
| 388 | 
            -
                    element == null ? void 0 : element.focus();
         | 
| 389 | 
            -
                  });
         | 
| 390 | 
            -
                  setNextFocusValue(null);
         | 
| 391 | 
            -
                }
         | 
| 392 | 
            -
              }, [nextFocusValue]);
         | 
| 393 | 
            -
              const handleKeyboardFocusKeydown = (e, callbacks) => {
         | 
| 394 | 
            -
                var _a, _b;
         | 
| 395 | 
            -
                const keyOps = ["Tab", "ArrowUp", "ArrowDown"];
         | 
| 396 | 
            -
                if (keyOps.includes(e.key)) {
         | 
| 397 | 
            -
                  e.preventDefault();
         | 
| 398 | 
            -
                  e.stopPropagation();
         | 
| 399 | 
            -
                  if (e.key === "Tab" && e.shiftKey || e.key === "ArrowUp") {
         | 
| 400 | 
            -
                    (_a = callbacks.handleFocusBackward) == null ? void 0 : _a.call(callbacks, "previous");
         | 
| 401 | 
            -
                  } else if (e.key === "ArrowDown" || e.key === "Tab") {
         | 
| 402 | 
            -
                    (_b = callbacks.handleFocusForward) == null ? void 0 : _b.call(callbacks, "next");
         | 
| 403 | 
            -
                  }
         | 
| 404 | 
            -
                }
         | 
| 405 | 
            -
              };
         | 
| 406 | 
            -
              const renderSearch = useMemo(() => searchElement ? cloneElement(searchElement, {
         | 
| 407 | 
            -
                onKeyDown: (e) => handleKeyboardFocusKeydown(e, {
         | 
| 408 | 
            -
                  handleFocusBackward: () => focusMenuItem(lastVirtualItemIndex),
         | 
| 409 | 
            -
                  handleFocusForward: () => focusMenuItem(0)
         | 
| 410 | 
            -
                }),
         | 
| 411 | 
            -
                ref: searchRef
         | 
| 412 | 
            -
              }) : null, [searchElement, lastVirtualItemIndex, focusMenuItem]);
         | 
| 413 | 
            -
              const renderItems = useMemo(() => rowVirtualizer.virtualItems.map((virtualRow) => {
         | 
| 414 | 
            -
                if (!items) {
         | 
| 415 | 
            -
                  return null;
         | 
| 416 | 
            -
                }
         | 
| 417 | 
            -
                const elem = items[virtualRow.index];
         | 
| 418 | 
            -
                return /* @__PURE__ */ jsx("div", {
         | 
| 419 | 
            -
                  ref: elem.type !== MenuItem || elem.type !== MenuItemLink ? virtualRow.measureRef : void 0,
         | 
| 420 | 
            -
                  role: "presentation",
         | 
| 421 | 
            -
                  className: cx("VirtualMenu-item"),
         | 
| 422 | 
            -
                  style: {
         | 
| 423 | 
            -
                    transform: `translateY(${virtualRow.start}px)`
         | 
| 424 | 
            -
                  },
         | 
| 425 | 
            -
                  children: cloneElement(elem, getItemProps(elem, virtualRow.index))
         | 
| 426 | 
            -
                }, virtualRow.index);
         | 
| 427 | 
            -
              }), [rowVirtualizer.virtualItems, items, getItemProps]);
         | 
| 428 | 
            -
              return /* @__PURE__ */ jsxs(Fragment, {
         | 
| 429 | 
            -
                children: [renderSearch, /* @__PURE__ */ jsx(MenuItemList, {
         | 
| 430 | 
            -
                  ref: parentRef,
         | 
| 431 | 
            -
                  role: "presentation",
         | 
| 432 | 
            -
                  children: /* @__PURE__ */ jsx("div", {
         | 
| 433 | 
            -
                    role: "presentation",
         | 
| 434 | 
            -
                    className: "VirtualMenu-item-list",
         | 
| 435 | 
            -
                    style: {
         | 
| 436 | 
            -
                      height: `${rowVirtualizer.totalSize}px`
         | 
| 437 | 
            -
                    },
         | 
| 438 | 
            -
                    children: renderItems
         | 
| 439 | 
            -
                  })
         | 
| 440 | 
            -
                })]
         | 
| 441 | 
            -
              });
         | 
| 442 | 
            -
            };
         | 
| 443 | 
            -
            export {
         | 
| 444 | 
            -
              Menu,
         | 
| 445 | 
            -
              MenuBase,
         | 
| 446 | 
            -
              MenuDivider,
         | 
| 447 | 
            -
              MenuItem,
         | 
| 448 | 
            -
              MenuItemLink,
         | 
| 449 | 
            -
              MenuItemList,
         | 
| 450 | 
            -
              MenuSearch
         | 
| 451 | 
            -
            };
         | 
| 452 | 
            -
            //# sourceMappingURL=index.es.js.map
         | 
    
        package/dist/index.es.js.map
    DELETED
    
    | @@ -1 +0,0 @@ | |
| 1 | 
            -
            {"version":3,"file":"index.es.js","sources":["../src/MenuBase.tsx","../src/MenuDivider.tsx","../src/MenuItem.tsx","../src/MenuItemList.tsx","../src/MenuSearch.tsx","../src/utils.ts","../src/Menu.tsx"],"sourcesContent":["import type { MenuProps } from './Menu';\nimport type { ComponentPropsWithRef } from 'react';\n\nimport { cx } from 'classix';\nimport { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuBaseProps = ComponentPropsWithRef<'div'> & {\n  isVirtual?: boolean;\n  size?: MenuProps<string>['size'];\n};\n\nconst MenuBase = forwardRef<HTMLDivElement, MenuBaseProps>(\n  ({ children, size, isVirtual, ...props }, ref) => {\n    const classes = cx('Menu', isVirtual && 'Menu--isVirtual', size && `MenuSize--${size}`);\n\n    return (\n      <div {...props} role=\"menu\" className={classes} ref={ref}>\n        {children}\n      </div>\n    );\n  }\n);\n\nMenuBase.displayName = 'MenuBase';\n\nexport { MenuBase };\nexport type { MenuBaseProps };\n","import type { SeparatorProps } from '@react-aria/separator';\nimport type { RefObject } from 'react';\n\nimport { useSeparator } from '@react-aria/separator';\n\nimport './styles/Menu.css';\n\ntype MenuDividerProps = SeparatorProps & {\n  innerRef?: RefObject<HTMLDivElement>;\n  'data-test-id'?: string;\n};\n\nconst MenuDivider = ({\n  elementType = 'div',\n  orientation,\n  innerRef,\n  'data-test-id': testId = 'menu-divider',\n}: MenuDividerProps) => {\n  const { separatorProps } = useSeparator({\n    orientation,\n    elementType,\n  });\n\n  return <div {...separatorProps} data-test-id={testId} ref={innerRef} className=\"Menu-divider\" />;\n};\n\nexport { MenuDivider };\nexport type { MenuDividerProps };\n","import type { Icon } from '@launchpad-ui/icons';\nimport type { PopoverPlacement } from '@launchpad-ui/popover';\nimport type { ComponentPropsWithRef, ElementType, PropsWithRef, ReactElement } from 'react';\n\nimport { Tooltip } from '@launchpad-ui/tooltip';\nimport { Slot } from '@radix-ui/react-slot';\nimport { FocusRing } from '@react-aria/focus';\nimport { cx } from 'classix';\nimport { Link } from 'react-router-dom';\n\nimport './styles/Menu.css';\n\n// Merge two types and get rid of overlapping definitions\ntype Merge<T, U> = Omit<T, keyof U> & U;\n\ntype PropsWithComponent<P, T extends ElementType> = P & { component?: T };\n\ntype PolymorphicPropsWithRef<P, T extends ElementType> = Merge<\n  T extends keyof JSX.IntrinsicElements\n    ? PropsWithRef<JSX.IntrinsicElements[T]>\n    : ComponentPropsWithRef<T>,\n  PropsWithComponent<P, T>\n>;\n\ntype MenuItemOwnProps = {\n  isHighlighted?: boolean;\n  icon?: typeof Icon | null;\n  disabled?: boolean;\n  nested?: boolean;\n  groupHeader?: boolean;\n  tooltip?: string | ReactElement;\n  tooltipOptions?: typeof Tooltip;\n  tooltipPlacement?: PopoverPlacement;\n  asChild?: boolean;\n  'data-test-id'?: string;\n};\n\nconst defaultElement = 'button';\n\ntype MenuItemProps<P, T extends ElementType = typeof defaultElement> = PolymorphicPropsWithRef<\n  | (MenuItemOwnProps & {\n      item: P; // Infer the type if it is included\n    })\n  | (MenuItemOwnProps & {\n      item?: undefined;\n    }),\n  T\n>;\n\nconst MenuItem = <P, T extends ElementType = typeof defaultElement>({\n  ...props\n}: MenuItemProps<P, T>) => {\n  const {\n    // TODO: remove component prop once we migrate over to asChild format\n    component,\n    children,\n    isHighlighted,\n    icon: Icon,\n    nested,\n    groupHeader,\n    item,\n    disabled,\n    className,\n    tooltip,\n    role = 'menuitem',\n    tooltipPlacement,\n    onKeyDown,\n    tooltipOptions,\n    asChild,\n    'data-test-id': testId = 'menu-item',\n    ...rest\n  } = props;\n\n  const Component: ElementType = component || (asChild ? Slot : defaultElement);\n\n  const renderedItem = (\n    <FocusRing focusRingClass=\"has-focus\">\n      <Component\n        {...rest}\n        disabled={disabled}\n        aria-disabled={disabled ? disabled : undefined}\n        className={cx(\n          'Menu-item',\n          className,\n          isHighlighted && 'is-highlighted',\n          nested && 'Menu-item--nested',\n          groupHeader && 'Menu-item--header'\n        )}\n        data-test-id={testId}\n        role={role}\n        onKeyDown={onKeyDown}\n      >\n        {asChild ? (\n          children\n        ) : (\n          <>\n            {Icon && (\n              <span className=\"Menu-item-icon\">\n                <Icon size=\"small\" />\n              </span>\n            )}\n            {children}\n          </>\n        )}\n      </Component>\n    </FocusRing>\n  );\n\n  if (tooltip) {\n    return (\n      <Tooltip\n        content={tooltip}\n        rootElementStyle={{ display: 'block' }}\n        allowBoundaryElementOverflow\n        placement={tooltipPlacement ? tooltipPlacement : 'bottom'}\n        {...(tooltipOptions || {})}\n      >\n        {renderedItem}\n      </Tooltip>\n    );\n  }\n\n  return renderedItem;\n};\n\ntype MenuItemLinkOwnProps = {\n  disabled?: boolean;\n  useHistory?: boolean;\n  newTab?: boolean;\n};\n\ntype MenuItemLinkProps<P, T extends ElementType = typeof Link> =\n  | Merge<Omit<MenuItemProps<P, T>, 'component' | 'item'>, MenuItemLinkOwnProps> &\n      (\n        | {\n            item?: undefined;\n          }\n        | {\n            item: P;\n          }\n      );\n\n// By default, this is a Link component whenever useHistory is\n// explicitly not false\n// TODO: deprecate this component\nconst MenuItemLink = <P, T extends ElementType = typeof Link>({\n  to,\n  disabled = false,\n  useHistory = true,\n  newTab = false,\n  children,\n  ...props\n}: MenuItemLinkProps<P, T>) => {\n  const finalProps = {\n    ...props,\n    disabled,\n    component: useHistory ? Link : ('a' as const),\n    [useHistory ? 'to' : 'href']: disabled ? '' : to,\n    rel: newTab ? 'noopener noreferrer' : undefined,\n    target: newTab ? '_blank' : undefined,\n  };\n\n  // Ideally if this item is disabled, it should be a button rather\n  // than a link https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/anchor-is-valid.md\n\n  return <MenuItem {...finalProps}>{children}</MenuItem>;\n};\n\nexport { MenuItem, MenuItemLink };\nexport type { MenuItemProps, MenuItemLinkProps };\n","import type { ComponentPropsWithRef } from 'react';\n\nimport { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuItemListProps = Omit<ComponentPropsWithRef<'div'>, 'className'>;\n\nconst MenuItemList = forwardRef<HTMLDivElement, MenuItemListProps>(({ children, ...rest }, ref) => (\n  <div {...rest} ref={ref} data-test-id=\"menu-item-list\" className=\"Menu-item-list\">\n    {children}\n  </div>\n));\n\nMenuItemList.displayName = 'MenuItemList';\n\nexport { MenuItemList };\nexport type { MenuItemListProps };\n","import type { ChangeEvent } from 'react';\n\nimport { TextField } from '@launchpad-ui/form';\nimport { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuSearchProps = {\n  ariaLabel?: string;\n  value?: string;\n  placeholder?: string;\n  onChange?(event: ChangeEvent<HTMLInputElement>): void;\n  'data-test-id'?: string;\n};\n\nconst MenuSearch = forwardRef<HTMLInputElement, MenuSearchProps>((props, ref) => {\n  const { ariaLabel, placeholder, 'data-test-id': testId = 'menu-search', ...finalProps } = props;\n\n  return (\n    <div className=\"Menu-search\">\n      <TextField\n        {...finalProps}\n        ref={ref}\n        className=\"Menu-search-input\"\n        tiny\n        type=\"search\"\n        data-test-id={testId}\n        autoComplete=\"off\"\n        placeholder={placeholder}\n        aria-label={ariaLabel || 'Search'}\n      />\n    </div>\n  );\n});\n\nMenuSearch.displayName = 'MenuSearch';\n\nexport { MenuSearch };\nexport type { MenuSearchProps };\n","import type { EventHandler, KeyboardEvent, SyntheticEvent } from 'react';\n\nconst createItemId = (index: number, id: string) => `${id}-item-${index}`;\n\nconst getNodeForIndex = (index: number | null, menuId: string) =>\n  index === null ? index : document.getElementById(createItemId(index, menuId));\n\nconst handleKeyboardInteractions = (\n  event: KeyboardEvent,\n  keyHandlers: Partial<\n    Record<'handleUp' | 'handleDown' | 'handleEnter', (e: KeyboardEvent) => void>\n  >\n) => {\n  const ops = {\n    ArrowUp: keyHandlers.handleUp,\n    ArrowDown: keyHandlers.handleDown,\n    Enter: keyHandlers.handleEnter,\n  } as Record<string, (e: KeyboardEvent) => void | undefined>;\n\n  if (ops[event.key]) {\n    event.preventDefault();\n    ops[event.key]?.call(globalThis, event);\n  }\n};\n\nconst chainEventHandlers =\n  (...handlers: Array<EventHandler<SyntheticEvent> | undefined>) =>\n  (event: SyntheticEvent) => {\n    handlers.forEach((h) => typeof h === 'function' && h(event));\n  };\n\nexport { createItemId, getNodeForIndex, handleKeyboardInteractions, chainEventHandlers };\n","import type { MenuItemProps } from './MenuItem';\nimport type { FocusManager } from '@react-aria/focus';\nimport type { KeyboardEvent, ReactElement, ReactNode } from 'react';\n\nimport { useFocusManager } from '@react-aria/focus';\nimport { cx } from 'classix';\nimport {\n  Children,\n  cloneElement,\n  useCallback,\n  useEffect,\n  useId,\n  useMemo,\n  useRef,\n  useState,\n} from 'react';\nimport { useVirtual } from 'react-virtual';\n\nimport { MenuBase } from './MenuBase';\nimport { MenuDivider } from './MenuDivider';\nimport { MenuItem, MenuItemLink } from './MenuItem';\nimport { MenuItemList } from './MenuItemList';\nimport { MenuSearch } from './MenuSearch';\nimport {\n  chainEventHandlers,\n  createItemId,\n  getNodeForIndex,\n  handleKeyboardInteractions,\n} from './utils';\n\ntype ControlledMenuProps<T> = {\n  children: ReactNode;\n  onSelect?: (item: T) => void;\n  /**\n   * Menus items are rendered using react-virtual for\n   * additional rendering performance.\n   */\n  enableVirtualization?: boolean;\n  /**\n   * Class name to be applied to all MenuItem and MenuItemLink components\n   * in the menu.\n   */\n  menuItemClassName?: string;\n  /**\n   * Sets the width of the menu. This is especially useful when using virtual items\n   * since the width cannot be automatically set by the widest element.\n   */\n  size?: 'sm' | 'md' | 'lg' | 'xl';\n  /**\n   * Sets the number out of elements rendered outside of the view window\n   * when using virtualization\n   */\n  overscan?: number;\n  /**\n   * Sets the height for each menu item when using virtualization.\n   *\n   */\n  itemHeight?: number;\n  'data-test-id'?: string;\n};\n\ntype MenuProps<T extends number | string> = ControlledMenuProps<T>;\n\nconst Menu = <T extends number | string>(props: MenuProps<T>) => {\n  const {\n    children,\n    menuItemClassName,\n    onSelect,\n    enableVirtualization,\n    itemHeight,\n    size,\n    overscan = 1,\n    'data-test-id': testId = 'menu',\n  } = props;\n\n  const focusManager = useFocusManager();\n\n  const handleArrowDown = useCallback(() => {\n    focusManager.focusNext({ wrap: true });\n  }, [focusManager]);\n\n  const handleArrowUp = useCallback(() => {\n    focusManager.focusPrevious({ wrap: true });\n  }, [focusManager]);\n\n  const reduceItems = useMemo(() => {\n    const childrenProps = Children.toArray(children);\n    if (enableVirtualization) {\n      // the virtualized menu has its own handlers and props\n      let searchElem = null;\n      let elements: ReactElement[] = [];\n      (childrenProps as ReactElement[]).forEach((child: ReactElement) => {\n        switch (child.type) {\n          case MenuSearch:\n            searchElem = child;\n            break;\n          case MenuItem:\n          case MenuItemLink:\n          case MenuDivider:\n            elements = elements.concat(child);\n            break;\n          default:\n            break;\n        }\n      });\n      return { items: elements, searchElement: searchElem };\n    }\n\n    return (childrenProps as ReactElement[]).reduce(\n      (\n        { items, searchElement }: { items: ReactElement[]; searchElement: null | ReactElement },\n        child\n      ) => {\n        switch (child.type) {\n          case MenuSearch:\n            return {\n              items,\n              searchElement: cloneElement(child, {\n                onKeyDown: (e: KeyboardEvent) =>\n                  handleKeyboardInteractions(e, {\n                    handleDown: handleArrowDown,\n                    handleUp: handleArrowUp,\n                  }),\n              }),\n            };\n          case MenuItem:\n          case MenuItemLink:\n            return {\n              items: items.concat(\n                child.props.disabled\n                  ? cloneElement(child, {\n                      onClick: () => undefined,\n                      onKeyDown: () => undefined,\n                      tabIndex: -1,\n                      disabled: true,\n                    })\n                  : cloneElement(child, {\n                      className: cx(child.props.className, menuItemClassName),\n                      item: child.props.item ?? items.length,\n                      // set focus on the first menu item if there is no search input, and set in the tab order\n                      onClick: chainEventHandlers(child.props.onClick, () => {\n                        onSelect?.(child.props.item ?? items.length);\n                      }),\n                      onKeyDown: (e: KeyboardEvent) =>\n                        handleKeyboardInteractions(e, {\n                          handleDown: handleArrowDown,\n                          handleUp: handleArrowUp,\n                        }),\n                    })\n              ),\n              searchElement,\n            };\n          case MenuDivider:\n            return { items: items.concat(child), searchElement };\n          default:\n            return { items, searchElement };\n        }\n      },\n      { items: [], searchElement: null }\n    );\n  }, [children, enableVirtualization, menuItemClassName, handleArrowDown, handleArrowUp, onSelect]);\n\n  if (enableVirtualization) {\n    return (\n      <MenuBase data-test-id={testId} isVirtual size={size}>\n        <ItemVirtualizer<T>\n          items={Children.toArray(reduceItems.items) as ReactElement[]}\n          searchElement={reduceItems.searchElement}\n          overscan={overscan}\n          menuItemClassName={menuItemClassName}\n          onSelect={onSelect}\n          itemHeight={itemHeight}\n          focusManager={focusManager}\n        />\n      </MenuBase>\n    );\n  }\n\n  return (\n    <MenuBase data-test-id={testId} size={size}>\n      {reduceItems.searchElement}\n      <MenuItemList role=\"presentation\">{reduceItems.items}</MenuItemList>\n    </MenuBase>\n  );\n};\n\ntype ItemVirtualizerProps<T> = Omit<ControlledMenuProps<T>, 'children'> & {\n  items: ReactElement[] | null;\n  searchElement?: ReactElement | null;\n  focusManager: FocusManager;\n};\n\nconst ItemVirtualizer = <T extends number | string>(props: ItemVirtualizerProps<T>) => {\n  const {\n    overscan,\n    searchElement,\n    itemHeight = 33,\n    menuItemClassName,\n    items: items,\n    focusManager,\n    onSelect,\n  } = props;\n\n  const menuId = useRef(`menu-ctrl-${useId()}`);\n\n  const focusedItemIndex = useRef<number | null>(null);\n  const parentRef = useRef<HTMLDivElement | null>(null);\n  const searchRef = useRef<HTMLInputElement>();\n\n  const [nextFocusValue, setNextFocusValue] = useState<number | null>(null);\n\n  const hasSearch = !!searchElement;\n\n  const lastVirtualItemIndex = items ? items.length - 1 : 0;\n\n  const rowVirtualizer = useVirtual({\n    size: items !== null ? items.length : 0,\n    parentRef,\n    estimateSize: useCallback(() => itemHeight, [itemHeight]),\n    overscan,\n  });\n\n  const focusSearchBar = useCallback(() => {\n    rowVirtualizer.scrollToIndex(0);\n    searchRef.current?.focus?.();\n  }, [rowVirtualizer]);\n\n  /**\n   * Scrolls to the menu item with the index provided and\n   * then manually focuses it using a side effect in useEffect\n   */\n  const focusMenuItem = useCallback(\n    (index: number) => {\n      rowVirtualizer.scrollToIndex(index);\n      setNextFocusValue(index);\n    },\n    [rowVirtualizer]\n  );\n\n  const handleKeyboardFocusInteraction = useCallback(\n    (direction: 'next' | 'previous') => {\n      if (focusedItemIndex.current === null || focusedItemIndex.current === undefined) {\n        return;\n      }\n      const nextIndex =\n        direction === 'next' ? focusedItemIndex.current + 1 : focusedItemIndex.current - 1;\n      const shouldWrap =\n        (direction === 'next' && focusedItemIndex.current === lastVirtualItemIndex) ||\n        (direction === 'previous' && focusedItemIndex.current === 0);\n      if (shouldWrap) {\n        // we are at the end of the list so we will\n        // scroll back to the beginning of the list\n        if (hasSearch) {\n          focusSearchBar();\n        } else {\n          // if at end, wrap to beginning, else focus last item\n          focusMenuItem(direction === 'next' ? 0 : lastVirtualItemIndex);\n        }\n        return;\n      }\n      switch (direction) {\n        case 'next':\n          rowVirtualizer.scrollToIndex(nextIndex);\n          focusManager.focusNext();\n          break;\n        case 'previous':\n          rowVirtualizer.scrollToIndex(nextIndex);\n          focusManager.focusPrevious();\n          break;\n        default:\n          break;\n      }\n    },\n    [focusManager, focusMenuItem, focusSearchBar, hasSearch, lastVirtualItemIndex, rowVirtualizer]\n  );\n\n  const getItemProps = useCallback(\n    (itemElem: ReactElement, index: number) => {\n      const childProps = itemElem.props as MenuItemProps<T>;\n      switch (itemElem.type) {\n        case MenuItem:\n        case MenuItemLink:\n          return {\n            className: cx(childProps.className, menuItemClassName),\n            // set focus on the first menu item if there is no search input, and set in the tab order\n            onKeyDown: childProps.disabled\n              ? () => undefined\n              : (e: KeyboardEvent) =>\n                  handleKeyboardFocusKeydown(e, {\n                    handleFocusBackward: handleKeyboardFocusInteraction,\n                    handleFocusForward: handleKeyboardFocusInteraction,\n                  }),\n            onFocus: chainEventHandlers(childProps.onFocus, () => {\n              focusedItemIndex.current = index;\n            }),\n            id: createItemId(index, menuId.current),\n            onBlur: chainEventHandlers(childProps.onBlur, () => {\n              focusedItemIndex.current = null;\n            }),\n            onClick: childProps.disabled\n              ? () => undefined\n              : chainEventHandlers(childProps.onClick, () => {\n                  onSelect?.(childProps.item as T);\n                }),\n          } as MenuItemProps<T>;\n        default:\n          return {};\n      }\n    },\n    [handleKeyboardFocusInteraction, menuItemClassName, onSelect]\n  );\n\n  useEffect(() => {\n    if (nextFocusValue !== null) {\n      requestAnimationFrame(() => {\n        const element = getNodeForIndex(nextFocusValue, menuId.current);\n        element?.focus();\n      });\n      setNextFocusValue(null);\n    }\n  }, [nextFocusValue]);\n\n  /**\n   * Calls handleFocusForward when the user is attempting to focus forward using\n   * tab or arrow keys. Calls handleFocusBackward when the users wants to move backward.\n   */\n  const handleKeyboardFocusKeydown = (\n    e: KeyboardEvent,\n    callbacks: Record<\n      'handleFocusForward' | 'handleFocusBackward',\n      (direction: 'next' | 'previous') => void\n    >\n  ) => {\n    const keyOps = ['Tab', 'ArrowUp', 'ArrowDown'];\n    if (keyOps.includes(e.key)) {\n      e.preventDefault();\n      e.stopPropagation();\n      if ((e.key === 'Tab' && e.shiftKey) || e.key === 'ArrowUp') {\n        callbacks.handleFocusBackward?.('previous');\n      } else if (e.key === 'ArrowDown' || e.key === 'Tab') {\n        callbacks.handleFocusForward?.('next');\n      }\n    }\n  };\n\n  const renderSearch = useMemo(\n    () =>\n      searchElement\n        ? cloneElement(searchElement, {\n            onKeyDown: (e: KeyboardEvent) =>\n              handleKeyboardFocusKeydown(e, {\n                handleFocusBackward: () => focusMenuItem(lastVirtualItemIndex),\n                handleFocusForward: () => focusMenuItem(0),\n              }),\n            ref: searchRef,\n          })\n        : null,\n    [searchElement, lastVirtualItemIndex, focusMenuItem]\n  );\n\n  const renderItems = useMemo(\n    () =>\n      rowVirtualizer.virtualItems.map((virtualRow) => {\n        if (!items) {\n          return null;\n        }\n        const elem = items[virtualRow.index];\n        return (\n          <div\n            key={virtualRow.index}\n            ref={\n              elem.type !== MenuItem || elem.type !== MenuItemLink\n                ? virtualRow.measureRef\n                : undefined\n            }\n            role=\"presentation\"\n            className={cx('VirtualMenu-item')}\n            style={{\n              transform: `translateY(${virtualRow.start}px)`,\n            }}\n          >\n            {cloneElement(elem, getItemProps(elem, virtualRow.index))}\n          </div>\n        );\n      }),\n    [rowVirtualizer.virtualItems, items, getItemProps]\n  );\n\n  return (\n    <>\n      {renderSearch}\n      <MenuItemList ref={parentRef} role=\"presentation\">\n        <div\n          role=\"presentation\"\n          className=\"VirtualMenu-item-list\"\n          style={{\n            height: `${rowVirtualizer.totalSize}px`,\n          }}\n        >\n          {renderItems}\n        </div>\n      </MenuItemList>\n    </>\n  );\n};\n\nexport { Menu, ItemVirtualizer };\nexport type { MenuProps, ItemVirtualizerProps };\n"],"names":["MenuBase","forwardRef","children","size","isVirtual","props","ref","classes","cx","displayName","MenuDivider","elementType","orientation","innerRef","testId","separatorProps","useSeparator","defaultElement","MenuItem","component","isHighlighted","icon","Icon","nested","groupHeader","item","disabled","className","tooltip","role","tooltipPlacement","onKeyDown","tooltipOptions","asChild","rest","Component","Slot","renderedItem","undefined","_jsxs","_Fragment","_jsx","display","MenuItemLink","to","useHistory","newTab","finalProps","Link","rel","target","MenuItemList","MenuSearch","ariaLabel","placeholder","Menu","menuItemClassName","onSelect","enableVirtualization","itemHeight","overscan","focusManager","useFocusManager","handleArrowDown","useCallback","focusNext","wrap","handleArrowUp","focusPrevious","reduceItems","useMemo","childrenProps","Children","toArray","searchElem","elements","forEach","child","type","concat","items","searchElement","reduce","cloneElement","e","handleKeyboardInteractions","handleDown","handleUp","onClick","tabIndex","length","chainEventHandlers","ItemVirtualizer","menuId","useRef","useId","focusedItemIndex","parentRef","searchRef","nextFocusValue","setNextFocusValue","useState","hasSearch","lastVirtualItemIndex","rowVirtualizer","useVirtual","estimateSize","focusSearchBar","scrollToIndex","current","focus","focusMenuItem","index","handleKeyboardFocusInteraction","direction","nextIndex","shouldWrap","getItemProps","itemElem","childProps","handleKeyboardFocusKeydown","handleFocusBackward","handleFocusForward","onFocus","id","createItemId","onBlur","useEffect","requestAnimationFrame","element","getNodeForIndex","callbacks","keyOps","includes","key","preventDefault","stopPropagation","shiftKey","renderSearch","renderItems","virtualItems","map","virtualRow","elem","measureRef","transform","start","height","totalSize"],"mappings":";;;;;;;;;;;AAaMA,MAAAA,WAAWC,WACf,CAAC;AAAA,EAAEC;AAAAA,EAAUC;AAAAA,EAAMC;AAAAA,KAAcC;AAAhC,GAAyCC,QAAQ;AAChD,QAAMC,UAAUC,GAAG,QAAQJ,aAAa,mBAAmBD,QAAS,aAAYA,MAA9D;AAElB;OACWE;AAAAA,IAAO,MAAK;AAAA,IAAO,WAAWE;AAAAA,IAAS;AAAA,IAAhD;AAAA,EAAA,CADF;AAKD,CATwB;AAY3BP,SAASS,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