@launchpad-ui/menu 0.2.5 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/Menu.d.ts CHANGED
@@ -1,5 +1,5 @@
1
+ import type { FocusManager } from '@react-aria/focus';
1
2
  import type { ReactElement } from 'react';
2
- import { FocusManager } from '@react-aria/focus';
3
3
  declare type ControlledMenuProps<T> = {
4
4
  children: React.ReactNode;
5
5
  onSelect?: (item: T) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../src/Menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,YAAY,EAAE,MAAM,OAAO,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAmB,MAAM,mBAAmB,CAAC;AAmBlE,aAAK,mBAAmB,CAAC,CAAC,IAAI;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IAC7B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;IAC1D;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,aAAK,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAEnE,QAAA,MAAM,IAAI,iEA6HT,CAAC;AAEF,aAAK,oBAAoB,CAAC,CAAC,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG;IACxE,KAAK,EAAE,YAAY,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KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IAC1C,YAAY,EAAE,YAAY,CAAC;CAC5B,CAAC;AAEF,QAAA,MAAM,eAAe,4EAoNpB,CAAC;AAEF,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;AACjC,YAAY,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { SeparatorProps } from '@react-aria/separator';
2
+ import type { SeparatorProps } from '@react-aria/separator';
3
3
  import './styles/Menu.css';
4
4
  declare type MenuDividerProps = SeparatorProps & {
5
5
  innerRef?: React.RefObject<HTMLDivElement>;
@@ -1 +1 @@
1
- {"version":3,"file":"MenuDivider.d.ts","sourceRoot":"","sources":["../src/MenuDivider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAgB,MAAM,uBAAuB,CAAC;AAErE,OAAO,mBAAmB,CAAC;AAE3B,aAAK,gBAAgB,GAAG,cAAc,GAAG;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;CAC5C,CAAC;AAEF,QAAA,MAAM,WAAW,2CAAoD,gBAAgB,gBAOpF,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
1
+ {"version":3,"file":"MenuDivider.d.ts","sourceRoot":"","sources":["../src/MenuDivider.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,mBAAmB,CAAC;AAE3B,aAAK,gBAAgB,GAAG,cAAc,GAAG;IACvC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;CAC5C,CAAC;AAEF,QAAA,MAAM,WAAW,2CAAoD,gBAAgB,gBAOpF,CAAC;AAEF,OAAO,EAAE,WAAW,EAAE,CAAC;AACvB,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
+ import type { Icon } from '@launchpad-ui/icons';
2
3
  import type { PopoverPlacement } from '@launchpad-ui/popover';
3
- import { Icon } from '@launchpad-ui/icons';
4
4
  import { Tooltip } from '@launchpad-ui/tooltip';
5
5
  import { Link } from 'react-router-dom';
6
6
  import './styles/Menu.css';
@@ -1 +1 @@
1
- {"version":3,"file":"MenuItem.d.ts","sourceRoot":"","sources":["../src/MenuItem.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,IAAI,EAAY,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGhD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC,OAAO,mBAAmB,CAAC;AAG3B,aAAK,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC;AAExC,aAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,CAAC,GAAG;IAAE,SAAS,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC;AAEhF,aAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,CAClE,CAAC,SAAS,MAAM,GAAG,CAAC,iBAAiB,GACjC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,GAC5C,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAClC,kBAAkB,CAAC,CAAC,EAAE,CAAC,CAAC,CACzB,CAAC;AAEF,aAAK,gBAAgB,GAAG;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,IAAI,CAAC,EAAE,OAAO,IAAI,GAAG,IAAI,CAAC;IAC1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AAE,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC;IACtC,cAAc,CAAC,EAAE,OAAO,OAAO,CAAC;IAChC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,CAAC;AAEF,QAAA,MAAM,cAAc,WAAW,CAAC;AAEhC,aAAK,aAAa,CAChB,CAAC,EACD,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,OAAO,cAAc,IACjD,uBAAuB,CACvB,CAAC,gBAAgB,GAAG;IAClB,IAAI,EAAE,CAAC,CAAC;CACT,CAAC,GACF,CAAC,gBAAgB,GAAG;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC,EACJ,CAAC,CACF,CAAC;AAEF,QAAA,MAAM,QAAQ,8GAkEb,CAAC;AAEF,aAAK,oBAAoB,GAAG;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,aAAK,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,OAAO,IAAI,IAC/D,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAAC,EAAE,oBAAoB,CAAC,GAC1E,CACI;IACE,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,GACD;IACE,IAAI,EAAE,CAAC,CAAC;CACT,CACJ,CAAC;AAIR,QAAA,MAAM,YAAY;WATC,SAAS;;;kBA8B3B,CAAC;AAEF,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAClC,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC"}
package/dist/index.es.js CHANGED
@@ -45,7 +45,7 @@ var MenuItem = ({
45
45
  component,
46
46
  children,
47
47
  isHighlighted,
48
- icon: Icon2,
48
+ icon: Icon,
49
49
  nested,
50
50
  groupHeader,
51
51
  item,
@@ -67,12 +67,12 @@ var MenuItem = ({
67
67
  ref: innerRef,
68
68
  disabled,
69
69
  "aria-disabled": disabled ? disabled : void 0,
70
- className: cx2("Menu-item", className, { "is-highlighted": isHighlighted }, { "Menu-item--nested": nested }, { "u-fw-medium": groupHeader }),
70
+ className: cx2("Menu-item", className, { "is-highlighted": isHighlighted }, { "Menu-item--nested": nested }, { "Menu-item--header": groupHeader }),
71
71
  role,
72
72
  onKeyDown
73
- }, Icon2 && /* @__PURE__ */ React.createElement("span", {
73
+ }, Icon && /* @__PURE__ */ React.createElement("span", {
74
74
  className: "Menu-item-icon"
75
- }, /* @__PURE__ */ React.createElement(Icon2, {
75
+ }, /* @__PURE__ */ React.createElement(Icon, {
76
76
  size: IconSize.SMALL
77
77
  })), children));
78
78
  if (tooltip) {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../scripts/react-shim.js", "../src/MenuBase.tsx", "../src/MenuDivider.tsx", "../src/MenuItem.tsx", "../src/MenuItemList.tsx", "../src/MenuSearch.tsx", "../src/Menu.tsx", "../src/utils.ts"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import cx from 'clsx';\nimport { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuBaseProps = React.ComponentPropsWithRef<'div'>;\n\n// This is the pure presentational component that contains menu items\nconst MenuBase = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ children, ...props }, ref) => {\n const className = cx('Menu', props.className);\n return (\n <div {...props} className={className} ref={ref}>\n {children}\n </div>\n );\n }\n);\n\nMenuBase.displayName = 'MenuBase';\n\nexport { MenuBase };\nexport type { MenuBaseProps };\n", "import { SeparatorProps, useSeparator } from '@react-aria/separator';\n\nimport './styles/Menu.css';\n\ntype MenuDividerProps = SeparatorProps & {\n innerRef?: React.RefObject<HTMLDivElement>;\n};\n\nconst MenuDivider = ({ elementType = 'div', orientation, innerRef }: MenuDividerProps) => {\n const { separatorProps } = useSeparator({\n orientation,\n elementType,\n });\n\n return <div {...separatorProps} ref={innerRef} className=\"Menu-divider\" />;\n};\n\nexport { MenuDivider };\nexport type { MenuDividerProps };\n", "import type { PopoverPlacement } from '@launchpad-ui/popover';\n\nimport { Icon, IconSize } from '@launchpad-ui/icons';\nimport { Tooltip } from '@launchpad-ui/tooltip';\nimport { FocusRing } from '@react-aria/focus';\nimport cx from 'clsx';\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 React.ElementType> = P & { component?: T };\n\ntype PolymorphicPropsWithRef<P, T extends React.ElementType> = Merge<\n T extends keyof JSX.IntrinsicElements\n ? React.PropsWithRef<JSX.IntrinsicElements[T]>\n : React.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 innerRef?: React.RefObject<HTMLDivElement>;\n tooltip?: string | React.ReactElement;\n tooltipOptions?: typeof Tooltip;\n tooltipPlacement?: PopoverPlacement;\n};\n\nconst defaultElement = 'button';\n\ntype MenuItemProps<\n P,\n T extends React.ElementType = typeof defaultElement\n> = 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 React.ElementType = typeof defaultElement>({\n ...props\n}: MenuItemProps<P, T>) => {\n const {\n component,\n children,\n isHighlighted,\n icon: Icon,\n nested,\n groupHeader,\n item,\n disabled,\n className,\n innerRef,\n tooltip,\n role = 'menuitem',\n tooltipPlacement,\n onKeyDown,\n tooltipOptions,\n ...rest\n } = props;\n\n const Component: React.ElementType = component || defaultElement;\n\n const renderedItem = (\n <FocusRing focusRingClass=\"has-focus\">\n <Component\n {...rest}\n ref={innerRef}\n disabled={disabled}\n aria-disabled={disabled ? disabled : undefined}\n className={cx(\n 'Menu-item',\n className,\n { 'is-highlighted': isHighlighted },\n { 'Menu-item--nested': nested },\n { 'u-fw-medium': groupHeader }\n )}\n role={role}\n onKeyDown={onKeyDown}\n >\n {Icon && (\n <span className=\"Menu-item-icon\">\n <Icon size={IconSize.SMALL} />\n </span>\n )}\n {children}\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 React.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\nconst MenuItemLink = <P, T extends React.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 { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuItemListProps = Omit<React.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 { 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};\n\nconst MenuSearch = forwardRef<HTMLInputElement, MenuSearchProps>((props, ref) => {\n const { ariaLabel, placeholder, ...finalProps } = props;\n\n return (\n <div className=\"Menu-search\">\n <input\n {...finalProps}\n ref={ref}\n className=\"Menu-search-input FormInput FormInput--tiny\"\n type=\"search\"\n autoComplete=\"off\"\n placeholder={placeholder}\n aria-label={ariaLabel || 'Search'}\n />\n <div\n className=\"Menu-search-hidden-placeholder Menu-search-input FormInput FormInput--tiny\"\n aria-hidden=\"true\"\n >\n {placeholder}\n </div>\n </div>\n );\n});\n\nMenuSearch.displayName = 'MenuSearch';\n\nexport { MenuSearch };\nexport type { MenuSearchProps };\n", "import type { KeyboardEvent, ReactElement } from 'react';\n\nimport { FocusManager, useFocusManager } from '@react-aria/focus';\nimport cx from 'clsx';\nimport { isNil, noop } from 'lodash-es';\nimport { Children, cloneElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useVirtual } from 'react-virtual';\nimport { v4 } from 'uuid';\n\nimport { MenuBase } from './MenuBase';\nimport { MenuDivider } from './MenuDivider';\nimport { MenuItem, MenuItemLink, MenuItemProps } 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: React.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 menuWidth?: 'tiny' | 'small' | 'med' | 'large' | 'xLarge';\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};\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 menuWidth,\n overscan = 1,\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: noop,\n onKeyDown: noop,\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 const menuClassName = cx(\n { 'Menu--isVirtual': enableVirtualization },\n { [`MenuSize--${menuWidth}`]: menuWidth }\n );\n\n if (enableVirtualization) {\n return (\n <MenuBase role=\"menu\" className={menuClassName}>\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 role=\"menu\" className={menuClassName}>\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?: React.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-${v4()}`);\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 (isNil(focusedItemIndex.current)) {\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 ? noop\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 ? noop\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", "import type { KeyboardEvent } from 'react';\n\nimport { isFunction } from 'lodash-es';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any[]) => any;\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: React.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<AnyFunction | undefined>) =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (event: any) => {\n handlers.forEach((h) => isFunction(h) && h(event));\n };\n\nexport { createItemId, getNodeForIndex, hand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AAa,MAAM,WAAW,KAAK,CAAC,CAC1D;AAAA,EAEJ,CAAC,GACH,CAAC,eAAe,cAAc,OAAO,YAAY,CACnD;AAEA,SACE,0DACG,cACD,oCAAC;AAAA,IAAa,KAAK;AAAA,IAAW,MAAK;AAAA,KACjC,oCAAC;AAAA,IACC,MAAK;AAAA,IACL,WAAU;AAAA,IACV,OAAO;AAAA,MACL,QAAQ,GAAG,eAAe;AAAA,IAC5B;AAAA,KAEC,WACH,CACF,CACF;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import cx from 'clsx';\nimport { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuBaseProps = React.ComponentPropsWithRef<'div'>;\n\n// This is the pure presentational component that contains menu items\nconst MenuBase = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ children, ...props }, ref) => {\n const className = cx('Menu', props.className);\n return (\n <div {...props} className={className} 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';\n\nimport { useSeparator } from '@react-aria/separator';\n\nimport './styles/Menu.css';\n\ntype MenuDividerProps = SeparatorProps & {\n innerRef?: React.RefObject<HTMLDivElement>;\n};\n\nconst MenuDivider = ({ elementType = 'div', orientation, innerRef }: MenuDividerProps) => {\n const { separatorProps } = useSeparator({\n orientation,\n elementType,\n });\n\n return <div {...separatorProps} 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';\n\nimport { IconSize } from '@launchpad-ui/icons';\nimport { Tooltip } from '@launchpad-ui/tooltip';\nimport { FocusRing } from '@react-aria/focus';\nimport cx from 'clsx';\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 React.ElementType> = P & { component?: T };\n\ntype PolymorphicPropsWithRef<P, T extends React.ElementType> = Merge<\n T extends keyof JSX.IntrinsicElements\n ? React.PropsWithRef<JSX.IntrinsicElements[T]>\n : React.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 innerRef?: React.RefObject<HTMLDivElement>;\n tooltip?: string | React.ReactElement;\n tooltipOptions?: typeof Tooltip;\n tooltipPlacement?: PopoverPlacement;\n};\n\nconst defaultElement = 'button';\n\ntype MenuItemProps<\n P,\n T extends React.ElementType = typeof defaultElement\n> = 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 React.ElementType = typeof defaultElement>({\n ...props\n}: MenuItemProps<P, T>) => {\n const {\n component,\n children,\n isHighlighted,\n icon: Icon,\n nested,\n groupHeader,\n item,\n disabled,\n className,\n innerRef,\n tooltip,\n role = 'menuitem',\n tooltipPlacement,\n onKeyDown,\n tooltipOptions,\n ...rest\n } = props;\n\n const Component: React.ElementType = component || defaultElement;\n\n const renderedItem = (\n <FocusRing focusRingClass=\"has-focus\">\n <Component\n {...rest}\n ref={innerRef}\n disabled={disabled}\n aria-disabled={disabled ? disabled : undefined}\n className={cx(\n 'Menu-item',\n className,\n { 'is-highlighted': isHighlighted },\n { 'Menu-item--nested': nested },\n { 'Menu-item--header': groupHeader }\n )}\n role={role}\n onKeyDown={onKeyDown}\n >\n {Icon && (\n <span className=\"Menu-item-icon\">\n <Icon size={IconSize.SMALL} />\n </span>\n )}\n {children}\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 React.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\nconst MenuItemLink = <P, T extends React.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 { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuItemListProps = Omit<React.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 { 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};\n\nconst MenuSearch = forwardRef<HTMLInputElement, MenuSearchProps>((props, ref) => {\n const { ariaLabel, placeholder, ...finalProps } = props;\n\n return (\n <div className=\"Menu-search\">\n <input\n {...finalProps}\n ref={ref}\n className=\"Menu-search-input FormInput FormInput--tiny\"\n type=\"search\"\n autoComplete=\"off\"\n placeholder={placeholder}\n aria-label={ariaLabel || 'Search'}\n />\n <div\n className=\"Menu-search-hidden-placeholder Menu-search-input FormInput FormInput--tiny\"\n aria-hidden=\"true\"\n >\n {placeholder}\n </div>\n </div>\n );\n});\n\nMenuSearch.displayName = 'MenuSearch';\n\nexport { MenuSearch };\nexport type { MenuSearchProps };\n", "import type { MenuItemProps } from './MenuItem';\nimport type { FocusManager } from '@react-aria/focus';\nimport type { KeyboardEvent, ReactElement } from 'react';\n\nimport { useFocusManager } from '@react-aria/focus';\nimport cx from 'clsx';\nimport { isNil, noop } from 'lodash-es';\nimport { Children, cloneElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useVirtual } from 'react-virtual';\nimport { v4 } from 'uuid';\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: React.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 menuWidth?: 'tiny' | 'small' | 'med' | 'large' | 'xLarge';\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};\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 menuWidth,\n overscan = 1,\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: noop,\n onKeyDown: noop,\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 const menuClassName = cx(\n { 'Menu--isVirtual': enableVirtualization },\n { [`MenuSize--${menuWidth}`]: menuWidth }\n );\n\n if (enableVirtualization) {\n return (\n <MenuBase role=\"menu\" className={menuClassName}>\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 role=\"menu\" className={menuClassName}>\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?: React.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-${v4()}`);\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 (isNil(focusedItemIndex.current)) {\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 ? noop\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 ? noop\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", "import type { KeyboardEvent } from 'react';\n\nimport { isFunction } from 'lodash-es';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any[]) => any;\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: React.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<AnyFunction | undefined>) =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (event: any) => {\n handlers.forEach((h) => isFunction(h) && h(event));\n };\n\nexport { createItemId, getNodeForIndex, handleKeyboardInteractions, chainEventHandlers };\n"],
5
+ "mappings": ";AAAA;;;ACAA;AACA;AAEA;AAKA,IAAM,WAAW,WACf,CAAC,EAAE,aAAa,SAAS,QAAQ;AAC/B,QAAM,YAAY,GAAG,QAAQ,MAAM,SAAS;AAC5C,SACE,oCAAC;AAAA,IAAK,GAAG;AAAA,IAAO;AAAA,IAAsB;AAAA,KACnC,QACH;AAEJ,CACF;AAEA,SAAS,cAAc;;;ACjBvB;AAEA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,CACF,CACF;AAEJ;",
6
6
  "names": []
7
7
  }
package/dist/index.js CHANGED
@@ -80,7 +80,7 @@ var MenuItem = ({
80
80
  component,
81
81
  children,
82
82
  isHighlighted,
83
- icon: Icon2,
83
+ icon: Icon,
84
84
  nested,
85
85
  groupHeader,
86
86
  item,
@@ -102,12 +102,12 @@ var MenuItem = ({
102
102
  ref: innerRef,
103
103
  disabled,
104
104
  "aria-disabled": disabled ? disabled : void 0,
105
- className: (0, import_clsx2.default)("Menu-item", className, { "is-highlighted": isHighlighted }, { "Menu-item--nested": nested }, { "u-fw-medium": groupHeader }),
105
+ className: (0, import_clsx2.default)("Menu-item", className, { "is-highlighted": isHighlighted }, { "Menu-item--nested": nested }, { "Menu-item--header": groupHeader }),
106
106
  role,
107
107
  onKeyDown
108
- }, Icon2 && /* @__PURE__ */ React.createElement("span", {
108
+ }, Icon && /* @__PURE__ */ React.createElement("span", {
109
109
  className: "Menu-item-icon"
110
- }, /* @__PURE__ */ React.createElement(Icon2, {
110
+ }, /* @__PURE__ */ React.createElement(Icon, {
111
111
  size: import_icons.IconSize.SMALL
112
112
  })), children));
113
113
  if (tooltip) {
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts", "../../../scripts/react-shim.js", "../src/MenuBase.tsx", "../src/MenuDivider.tsx", "../src/MenuItem.tsx", "../src/MenuItemList.tsx", "../src/MenuSearch.tsx", "../src/Menu.tsx", "../src/utils.ts"],
4
- "sourcesContent": ["export type { MenuBaseProps } from './MenuBase';\nexport type { MenuDividerProps } from './MenuDivider';\nexport type { MenuItemProps, MenuItemLinkProps } from './MenuItem';\nexport type { MenuItemListProps } from './MenuItemList';\nexport type { MenuSearchProps } from './MenuSearch';\nexport type { MenuProps } from './Menu';\nexport { MenuBase } from './MenuBase';\nexport { MenuDivider } from './MenuDivider';\nexport { MenuItem, MenuItemLink } from './MenuItem';\nexport { MenuItemList } from './MenuItemList';\nexport { MenuSearch } from './MenuSearch';\nexport { Menu } from './Menu';\n", "import * as React from 'react';\nexport { React };\n", "import cx from 'clsx';\nimport { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuBaseProps = React.ComponentPropsWithRef<'div'>;\n\n// This is the pure presentational component that contains menu items\nconst MenuBase = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ children, ...props }, ref) => {\n const className = cx('Menu', props.className);\n return (\n <div {...props} className={className} ref={ref}>\n {children}\n </div>\n );\n }\n);\n\nMenuBase.displayName = 'MenuBase';\n\nexport { MenuBase };\nexport type { MenuBaseProps };\n", "import { SeparatorProps, useSeparator } from '@react-aria/separator';\n\nimport './styles/Menu.css';\n\ntype MenuDividerProps = SeparatorProps & {\n innerRef?: React.RefObject<HTMLDivElement>;\n};\n\nconst MenuDivider = ({ elementType = 'div', orientation, innerRef }: MenuDividerProps) => {\n const { separatorProps } = useSeparator({\n orientation,\n elementType,\n });\n\n return <div {...separatorProps} ref={innerRef} className=\"Menu-divider\" />;\n};\n\nexport { MenuDivider };\nexport type { MenuDividerProps };\n", "import type { PopoverPlacement } from '@launchpad-ui/popover';\n\nimport { Icon, IconSize } from '@launchpad-ui/icons';\nimport { Tooltip } from '@launchpad-ui/tooltip';\nimport { FocusRing } from '@react-aria/focus';\nimport cx from 'clsx';\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 React.ElementType> = P & { component?: T };\n\ntype PolymorphicPropsWithRef<P, T extends React.ElementType> = Merge<\n T extends keyof JSX.IntrinsicElements\n ? React.PropsWithRef<JSX.IntrinsicElements[T]>\n : React.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 innerRef?: React.RefObject<HTMLDivElement>;\n tooltip?: string | React.ReactElement;\n tooltipOptions?: typeof Tooltip;\n tooltipPlacement?: PopoverPlacement;\n};\n\nconst defaultElement = 'button';\n\ntype MenuItemProps<\n P,\n T extends React.ElementType = typeof defaultElement\n> = 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 React.ElementType = typeof defaultElement>({\n ...props\n}: MenuItemProps<P, T>) => {\n const {\n component,\n children,\n isHighlighted,\n icon: Icon,\n nested,\n groupHeader,\n item,\n disabled,\n className,\n innerRef,\n tooltip,\n role = 'menuitem',\n tooltipPlacement,\n onKeyDown,\n tooltipOptions,\n ...rest\n } = props;\n\n const Component: React.ElementType = component || defaultElement;\n\n const renderedItem = (\n <FocusRing focusRingClass=\"has-focus\">\n <Component\n {...rest}\n ref={innerRef}\n disabled={disabled}\n aria-disabled={disabled ? disabled : undefined}\n className={cx(\n 'Menu-item',\n className,\n { 'is-highlighted': isHighlighted },\n { 'Menu-item--nested': nested },\n { 'u-fw-medium': groupHeader }\n )}\n role={role}\n onKeyDown={onKeyDown}\n >\n {Icon && (\n <span className=\"Menu-item-icon\">\n <Icon size={IconSize.SMALL} />\n </span>\n )}\n {children}\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 React.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\nconst MenuItemLink = <P, T extends React.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 { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuItemListProps = Omit<React.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 { 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};\n\nconst MenuSearch = forwardRef<HTMLInputElement, MenuSearchProps>((props, ref) => {\n const { ariaLabel, placeholder, ...finalProps } = props;\n\n return (\n <div className=\"Menu-search\">\n <input\n {...finalProps}\n ref={ref}\n className=\"Menu-search-input FormInput FormInput--tiny\"\n type=\"search\"\n autoComplete=\"off\"\n placeholder={placeholder}\n aria-label={ariaLabel || 'Search'}\n />\n <div\n className=\"Menu-search-hidden-placeholder Menu-search-input FormInput FormInput--tiny\"\n aria-hidden=\"true\"\n >\n {placeholder}\n </div>\n </div>\n );\n});\n\nMenuSearch.displayName = 'MenuSearch';\n\nexport { MenuSearch };\nexport type { MenuSearchProps };\n", "import type { KeyboardEvent, ReactElement } from 'react';\n\nimport { FocusManager, useFocusManager } from '@react-aria/focus';\nimport cx from 'clsx';\nimport { isNil, noop } from 'lodash-es';\nimport { Children, cloneElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useVirtual } from 'react-virtual';\nimport { v4 } from 'uuid';\n\nimport { MenuBase } from './MenuBase';\nimport { MenuDivider } from './MenuDivider';\nimport { MenuItem, MenuItemLink, MenuItemProps } 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: React.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 menuWidth?: 'tiny' | 'small' | 'med' | 'large' | 'xLarge';\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};\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 menuWidth,\n overscan = 1,\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: noop,\n onKeyDown: noop,\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 const menuClassName = cx(\n { 'Menu--isVirtual': enableVirtualization },\n { [`MenuSize--${menuWidth}`]: menuWidth }\n );\n\n if (enableVirtualization) {\n return (\n <MenuBase role=\"menu\" className={menuClassName}>\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 role=\"menu\" className={menuClassName}>\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?: React.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-${v4()}`);\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 (isNil(focusedItemIndex.current)) {\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 ? noop\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 ? noop\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", "import type { KeyboardEvent } from 'react';\n\nimport { isFunction } from 'lodash-es';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any[]) => any;\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: React.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<AnyFunction | undefined>) =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (event: any) => {\n handlers.forEach((h) => isFunction(h) && h(event));\n };\n\nexport { createItemId, getNodeForIndex, handleKeyboardInteractions, chainEventHandlers };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;;;ACAvB,kBAAe;AACf,mBAA2B;AAE3B,kBAAO;AAKP,IAAM,WAAW,6BACf,CAAC,EAAE,aAAa,SAAS,QAAQ;AAC/B,QAAM,YAAY,yBAAG,QAAQ,MAAM,SAAS;AAC5C,SACE,oCAAC;AAAA,IAAK,GAAG;AAAA,IAAO;AAAA,IAAsB;AAAA,KACnC,QACH;AAEJ,CACF;AAEA,SAAS,cAAc;;;ACnBvB,uBAA6C;AAE7C,mBAAO;AAMP,IAAM,cAAc,CAAC,EAAE,cAAc,OAAO,aAAa,eAAiC;AACxF,QAAM,EAAE,mBAAmB,mCAAa;AAAA,IACtC;AAAA,IACA;AAAA,EACF,CAAC;AAED,SAAO,oCAAC;AAAA,IAAK,GAAG;AAAA,IAAgB,KAAK;AAAA,IAAU,WAAU;AAAA,GAAe;AAC1E;;;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+ "sourcesContent": ["export type { MenuBaseProps } from './MenuBase';\nexport type { MenuDividerProps } from './MenuDivider';\nexport type { MenuItemProps, MenuItemLinkProps } from './MenuItem';\nexport type { MenuItemListProps } from './MenuItemList';\nexport type { MenuSearchProps } from './MenuSearch';\nexport type { MenuProps } from './Menu';\nexport { MenuBase } from './MenuBase';\nexport { MenuDivider } from './MenuDivider';\nexport { MenuItem, MenuItemLink } from './MenuItem';\nexport { MenuItemList } from './MenuItemList';\nexport { MenuSearch } from './MenuSearch';\nexport { Menu } from './Menu';\n", "import * as React from 'react';\nexport { React };\n", "import cx from 'clsx';\nimport { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuBaseProps = React.ComponentPropsWithRef<'div'>;\n\n// This is the pure presentational component that contains menu items\nconst MenuBase = forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(\n ({ children, ...props }, ref) => {\n const className = cx('Menu', props.className);\n return (\n <div {...props} className={className} 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';\n\nimport { useSeparator } from '@react-aria/separator';\n\nimport './styles/Menu.css';\n\ntype MenuDividerProps = SeparatorProps & {\n innerRef?: React.RefObject<HTMLDivElement>;\n};\n\nconst MenuDivider = ({ elementType = 'div', orientation, innerRef }: MenuDividerProps) => {\n const { separatorProps } = useSeparator({\n orientation,\n elementType,\n });\n\n return <div {...separatorProps} 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';\n\nimport { IconSize } from '@launchpad-ui/icons';\nimport { Tooltip } from '@launchpad-ui/tooltip';\nimport { FocusRing } from '@react-aria/focus';\nimport cx from 'clsx';\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 React.ElementType> = P & { component?: T };\n\ntype PolymorphicPropsWithRef<P, T extends React.ElementType> = Merge<\n T extends keyof JSX.IntrinsicElements\n ? React.PropsWithRef<JSX.IntrinsicElements[T]>\n : React.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 innerRef?: React.RefObject<HTMLDivElement>;\n tooltip?: string | React.ReactElement;\n tooltipOptions?: typeof Tooltip;\n tooltipPlacement?: PopoverPlacement;\n};\n\nconst defaultElement = 'button';\n\ntype MenuItemProps<\n P,\n T extends React.ElementType = typeof defaultElement\n> = 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 React.ElementType = typeof defaultElement>({\n ...props\n}: MenuItemProps<P, T>) => {\n const {\n component,\n children,\n isHighlighted,\n icon: Icon,\n nested,\n groupHeader,\n item,\n disabled,\n className,\n innerRef,\n tooltip,\n role = 'menuitem',\n tooltipPlacement,\n onKeyDown,\n tooltipOptions,\n ...rest\n } = props;\n\n const Component: React.ElementType = component || defaultElement;\n\n const renderedItem = (\n <FocusRing focusRingClass=\"has-focus\">\n <Component\n {...rest}\n ref={innerRef}\n disabled={disabled}\n aria-disabled={disabled ? disabled : undefined}\n className={cx(\n 'Menu-item',\n className,\n { 'is-highlighted': isHighlighted },\n { 'Menu-item--nested': nested },\n { 'Menu-item--header': groupHeader }\n )}\n role={role}\n onKeyDown={onKeyDown}\n >\n {Icon && (\n <span className=\"Menu-item-icon\">\n <Icon size={IconSize.SMALL} />\n </span>\n )}\n {children}\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 React.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\nconst MenuItemLink = <P, T extends React.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 { forwardRef } from 'react';\n\nimport './styles/Menu.css';\n\ntype MenuItemListProps = Omit<React.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 { 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};\n\nconst MenuSearch = forwardRef<HTMLInputElement, MenuSearchProps>((props, ref) => {\n const { ariaLabel, placeholder, ...finalProps } = props;\n\n return (\n <div className=\"Menu-search\">\n <input\n {...finalProps}\n ref={ref}\n className=\"Menu-search-input FormInput FormInput--tiny\"\n type=\"search\"\n autoComplete=\"off\"\n placeholder={placeholder}\n aria-label={ariaLabel || 'Search'}\n />\n <div\n className=\"Menu-search-hidden-placeholder Menu-search-input FormInput FormInput--tiny\"\n aria-hidden=\"true\"\n >\n {placeholder}\n </div>\n </div>\n );\n});\n\nMenuSearch.displayName = 'MenuSearch';\n\nexport { MenuSearch };\nexport type { MenuSearchProps };\n", "import type { MenuItemProps } from './MenuItem';\nimport type { FocusManager } from '@react-aria/focus';\nimport type { KeyboardEvent, ReactElement } from 'react';\n\nimport { useFocusManager } from '@react-aria/focus';\nimport cx from 'clsx';\nimport { isNil, noop } from 'lodash-es';\nimport { Children, cloneElement, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport { useVirtual } from 'react-virtual';\nimport { v4 } from 'uuid';\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: React.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 menuWidth?: 'tiny' | 'small' | 'med' | 'large' | 'xLarge';\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};\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 menuWidth,\n overscan = 1,\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: noop,\n onKeyDown: noop,\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 const menuClassName = cx(\n { 'Menu--isVirtual': enableVirtualization },\n { [`MenuSize--${menuWidth}`]: menuWidth }\n );\n\n if (enableVirtualization) {\n return (\n <MenuBase role=\"menu\" className={menuClassName}>\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 role=\"menu\" className={menuClassName}>\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?: React.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-${v4()}`);\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 (isNil(focusedItemIndex.current)) {\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 ? noop\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 ? noop\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", "import type { KeyboardEvent } from 'react';\n\nimport { isFunction } from 'lodash-es';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyFunction = (...args: any[]) => any;\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: React.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<AnyFunction | undefined>) =>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (event: any) => {\n handlers.forEach((h) => isFunction(h) && h(event));\n };\n\nexport { createItemId, getNodeForIndex, handleKeyboardInteractions, chainEventHandlers };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;;;ACAvB,kBAAe;AACf,mBAA2B;AAE3B,kBAAO;AAKP,IAAM,WAAW,6BACf,CAAC,EAAE,aAAa,SAAS,QAAQ;AAC/B,QAAM,YAAY,yBAAG,Q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AAO;AAAA,QACL,WAAW,cAAc,WAAW;AAAA,MACtC;AAAA,OAEC,gCAAa,MAAM,aAAa,MAAM,WAAW,KAAK,CAAC,CAC1D;AAAA,EAEJ,CAAC,GACH,CAAC,eAAe,cAAc,OAAO,YAAY,CACnD;AAEA,SACE,0DACG,cACD,oCAAC;AAAA,IAAa,KAAK;AAAA,IAAW,MAAK;AAAA,KACjC,oCAAC;AAAA,IACC,MAAK;AAAA,IACL,WAAU;AAAA,IACV,OAAO;AAAA,MACL,QAAQ,GAAG,eAAe;AAAA,IAC5B;AAAA,KAEC,WACH,CACF,CACF;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -1,2 +1,2 @@
1
- .Menu:focus{outline:none}:is(.Menu [hidden]:first-child+.Menu .Menu-item-list,.Menu .Menu-item-list:first-child)>.Menu-item:first-child,:is(.Menu [hidden]:first-child+.Menu .Menu-item-list,.Menu .Menu-item-list:first-child)>.VirtualMenu-item-list .VirtualMenu-item:first-child .Menu-item{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.Menu-item-list{min-width:12rem;max-height:55vh;overflow:auto}.Menu-item-list>.Menu-item:last-child,.Menu-item-list>.VirtualMenu-item-list .VirtualMenu-item:last-child .Menu-item{border-bottom-left-radius:var(--border-radius);border-bottom-right-radius:var(--border-radius)}.Menu-item-list:first-child{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.Menu-item-list:last-child{border-bottom-left-radius:var(--border-radius);border-bottom-right-radius:var(--border-radius)}.Menu-item{color:var(--color-text);background:var(--color-background);cursor:pointer;text-align:left;text-overflow:ellipsis;white-space:nowrap;-webkit-user-select:none;user-select:none;font-size:1.3rem;line-height:inherit;width:100%;border-width:0;outline:none;padding:.6rem 2.5rem;text-decoration:none;display:block;position:relative;overflow:hidden}.Menu .Menu-item:not([disabled],[aria-disabled]):hover:not(:active,.has-focus){background-color:var(--color-background-hover);box-shadow:inset 0 0 0 1px var(--color-gray-600)}.Menu .Menu-item:not([disabled],[aria-disabled]).has-focus{background-color:var(--color-background-hover);box-shadow:inset 0 0 0 2px var(--color-focus)}.Menu .Menu-item:not([disabled],[aria-disabled]):active{box-shadow:none;background-color:var(--color-blue-200);color:var(--color-blue-600);text-decoration:none}.Menu a.Menu-item:focus:not(:hover,.has-focus){box-shadow:none;text-decoration:none}.Menu a.Menu-item:active[disabled],.Menu a.Menu-item:active[aria-disabled]{color:var(--color-text-subtle-primary);text-decoration:none}.Menu-item--nested{padding-left:4rem}.Menu-item .Gravatar{margin-right:.5rem}.Menu-item.is-highlighted{background-color:var(--color-background-hover);box-shadow:inset 0 0 0 1px var(--color-gray-600)}.Menu-item.is-highlighted:active{background-color:var(--color-blue-200);color:var(--color-blue-600);box-shadow:none}.Menu-item[aria-disabled],.Menu-item[disabled]{color:var(--color-text-subtle-primary);cursor:default}.Menu-item-icon{position:absolute;top:50%;left:.5rem;transform:translateY(-50%)}.Menu-divider{border-top:1px solid var(--color-border)}.Menu-search{border-bottom:1px solid var(--color-border);padding:1rem;font-size:1.3rem}.Menu-search:first-child{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.Menu-clear.Button{color:var(--color-system-red-600);font-size:1.3rem;font-weight:var(--font-weight-medium);width:100%;border-bottom:1px solid var(--color-border);padding:1rem;text-decoration:none}.Menu-clear.Button:active,.Menu-clear.Button:focus,.Menu-clear.Button:hover{box-shadow:unset;color:var(--color-system-red-600);border-bottom-color:var(--color-border);background-color:var(--color-background-hover);outline:none}.Popover-content .Menu-search{width:100%}.Popover-content .Menu-search .Menu-search-hidden-placeholder{height:0;visibility:hidden;border:none;padding-top:0;padding-bottom:0}.Menu--isVirtual{flex-direction:column;align-items:stretch;display:flex}.MenuSize--xLarge{width:32rem}.MenuSize--large{width:24rem}.MenuSize--med{width:16rem}.MenuSize--small{width:12rem}.VirtualMenu-item-list{width:100%;position:relative}.VirtualMenu-item{width:100%;position:absolute;top:0;left:0}
1
+ .Menu-item{color:var(--color-text);background:var(--color-background);cursor:pointer;text-align:left;text-overflow:ellipsis;white-space:nowrap;-webkit-user-select:none;user-select:none;font-size:1.3rem;line-height:inherit;width:100%;border-width:0;outline:none;padding:.6rem 2.5rem;text-decoration:none;display:block;position:relative;overflow:hidden}.Menu-item:first-child{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.Menu-item:last-child{border-bottom-left-radius:var(--border-radius);border-bottom-right-radius:var(--border-radius)}.Menu-item-list{min-width:12rem;max-height:55vh;overflow:auto}.Menu-item-list>.Menu-item:last-child{border-bottom-left-radius:var(--border-radius);border-bottom-right-radius:var(--border-radius)}.Menu .Menu-item:not([disabled],[aria-disabled]):active{box-shadow:none;background-color:var(--color-blue-200);color:var(--color-blue-600);text-decoration:none}.Menu .Menu-item:not([disabled],[aria-disabled]):hover:not(:active,.has-focus){background-color:var(--color-background-hover);box-shadow:inset 0 0 0 1px var(--color-gray-600)}.Menu .Menu-item:not([disabled],[aria-disabled]).has-focus{background-color:var(--color-background-hover);box-shadow:inset 0 0 0 2px var(--color-focus)}.Menu-item-list>.VirtualMenu-item-list .VirtualMenu-item:last-child .Menu-item{border-bottom-left-radius:var(--border-radius);border-bottom-right-radius:var(--border-radius)}.Menu:focus{outline:none}.Menu a.Menu-item:focus:not(:hover,.has-focus){box-shadow:none;text-decoration:none}.Menu a.Menu-item:active[disabled],.Menu a.Menu-item:active[aria-disabled]{color:var(--color-text-subtle-primary);text-decoration:none}:is(.Menu .Menu-item-list:first-child,.Menu [hidden]:first-child+.Menu .Menu-item-list)>.Menu-item:first-child,:is(.Menu .Menu-item-list:first-child,.Menu [hidden]:first-child+.Menu .Menu-item-list)>.VirtualMenu-item-list .VirtualMenu-item:first-child .Menu-item{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.Menu-item--nested{padding-left:4rem}.Menu-item--header{font-weight:var(--font-weight-medium)}.Menu-item .Gravatar{margin-right:.5rem}.Menu-item.is-highlighted{background-color:var(--color-background-hover);box-shadow:inset 0 0 0 1px var(--color-gray-600)}.Menu-item.is-highlighted:active{background-color:var(--color-blue-200);color:var(--color-blue-600);box-shadow:none}.Menu-item[aria-disabled],.Menu-item[disabled]{color:var(--color-text-subtle-primary);cursor:default}.Menu-item-icon{position:absolute;top:50%;left:.5rem;transform:translateY(-50%)}.Menu-divider{border-top:1px solid var(--color-border)}.Menu-search{border-bottom:1px solid var(--color-border);padding:1rem;font-size:1.3rem}.Menu-search:first-child{border-top-left-radius:var(--border-radius);border-top-right-radius:var(--border-radius)}.Menu-clear.Button{color:var(--color-system-red-600);font-size:1.3rem;font-weight:var(--font-weight-medium);width:100%;border-bottom:1px solid var(--color-border);padding:1rem;text-decoration:none}.Menu-clear.Button:active,.Menu-clear.Button:focus,.Menu-clear.Button:hover{box-shadow:unset;color:var(--color-system-red-600);border-bottom-color:var(--color-border);background-color:var(--color-background-hover);outline:none}.Popover-content .Menu-search{width:100%}.Popover-content .Menu-search .Menu-search-hidden-placeholder{height:0;visibility:hidden;border:none;padding-top:0;padding-bottom:0}.Menu--isVirtual{flex-direction:column;align-items:stretch;display:flex}.MenuSize--xLarge{width:32rem}.MenuSize--large{width:24rem}.MenuSize--med{width:16rem}.MenuSize--small{width:12rem}.VirtualMenu-item-list{width:100%;position:relative}.VirtualMenu-item{width:100%;position:absolute;top:0;left:0}
2
2
  /*# sourceMappingURL=Menu.css.map */
@@ -1 +1 @@
1
- {"version":3,"sourceRoot":null,"mappings":"AAEE,yBAME,gWAYJ,8DAME,oNAWF,qHAKA,0HAKA,+VAuBI,+KAKA,wJAKA,gKAUA,oFAMA,uIAQJ,qCAIA,wCAIA,0HAIE,oHAOF,qGAMA,gFAOA,uDAIA,uFAMA,kHAKA,qMAUA,mOAUA,yCAIE,oIASF,wEAMA,8BAIA,6BAIA,2BAIA,6BAIA,oDAKA","sources":["src/styles/Menu.css"],"sourcesContent":["/* stylelint-disable no-descending-specificity */\n.Menu {\n &:focus {\n outline: none;\n }\n\n & [hidden]:first-child + & .Menu-item-list,\n & .Menu-item-list:first-child {\n & > .Menu-item:first-child {\n border-top-left-radius: var(--border-radius);\n border-top-right-radius: var(--border-radius);\n }\n\n & > .VirtualMenu-item-list .VirtualMenu-item:first-child .Menu-item {\n border-top-left-radius: var(--border-radius);\n border-top-right-radius: var(--border-radius);\n }\n }\n}\n\n.Menu-item-list {\n min-width: 12rem;\n overflow: auto;\n max-height: 55vh;\n\n /* use the child selector due to MenuItems being nested in divs for virtualization */\n & > .Menu-item:last-child {\n border-bottom-left-radius: var(--border-radius);\n border-bottom-right-radius: var(--border-radius);\n }\n\n & > .VirtualMenu-item-list .VirtualMenu-item:last-child .Menu-item {\n border-bottom-left-radius: var(--border-radius);\n border-bottom-right-radius: var(--border-radius);\n }\n}\n\n.Menu-item-list:first-child {\n border-top-left-radius: var(--border-radius);\n border-top-right-radius: var(--border-radius);\n}\n\n.Menu-item-list:last-child {\n border-bottom-left-radius: var(--border-radius);\n border-bottom-right-radius: var(--border-radius);\n}\n\n.Menu-item {\n display: block;\n position: relative;\n color: var(--color-text);\n background: var(--color-background);\n text-decoration: none;\n cursor: pointer;\n outline: none;\n padding: 0.6rem 2.5rem;\n text-align: left;\n font-size: 1.3rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: none;\n line-height: inherit;\n border-width: 0;\n width: 100%;\n}\n\n/* stylelint-disable-next-line no-duplicate-selectors */\n.Menu {\n & .Menu-item:not([disabled], [aria-disabled]) {\n &:hover:not(:active, .has-focus) {\n background-color: var(--color-background-hover);\n box-shadow: inset 0 0 0 1px var(--color-gray-600);\n }\n\n &.has-focus {\n background-color: var(--color-background-hover);\n box-shadow: inset 0 0 0 2px var(--color-focus);\n }\n\n &:active {\n text-decoration: none;\n box-shadow: none;\n background-color: var(--color-blue-200);\n color: var(--color-blue-600);\n }\n }\n\n /* Override our link styles for MenuItemLink component */\n & a.Menu-item {\n &:focus:not(:hover, .has-focus) {\n text-decoration: none;\n box-shadow: none;\n }\n\n /* Ensures that links that are disabled don't show active styles */\n &:active[disabled],\n &:active[aria-disabled] {\n text-decoration: none;\n color: var(--color-text-subtle-primary);\n }\n }\n}\n\n.Menu-item--nested {\n padding-left: 4rem;\n}\n\n.Menu-item .Gravatar {\n margin-right: 0.5rem;\n}\n\n.Menu-item.is-highlighted {\n background-color: var(--color-background-hover);\n box-shadow: inset 0 0 0 1px var(--color-gray-600);\n\n &:active {\n background-color: var(--color-blue-200);\n color: var(--color-blue-600);\n box-shadow: none;\n }\n}\n\n.Menu-item[aria-disabled],\n.Menu-item[disabled] {\n color: var(--color-text-subtle-primary);\n cursor: default;\n}\n\n.Menu-item-icon {\n position: absolute;\n left: 0.5rem;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.Menu-divider {\n border-top: 1px solid var(--color-border);\n}\n\n.Menu-search {\n padding: 1rem;\n font-size: 1.3rem;\n border-bottom: 1px solid var(--color-border);\n}\n\n.Menu-search:first-child {\n border-top-left-radius: var(--border-radius);\n border-top-right-radius: var(--border-radius);\n}\n\n.Menu-clear.Button {\n text-decoration: none;\n color: var(--color-system-red-600);\n font-size: 1.3rem;\n font-weight: var(--font-weight-medium);\n padding: 1rem;\n width: 100%;\n border-bottom: 1px solid var(--color-border);\n}\n\n.Menu-clear.Button:active,\n.Menu-clear.Button:focus,\n.Menu-clear.Button:hover {\n outline: none;\n box-shadow: unset;\n color: var(--color-system-red-600);\n border-bottom-color: var(--color-border);\n background-color: var(--color-background-hover);\n}\n\n.Popover-content .Menu-search {\n width: 100%;\n\n /* Removing anything that could give it some height */\n & .Menu-search-hidden-placeholder {\n padding-top: 0;\n padding-bottom: 0;\n height: 0;\n border: none;\n visibility: hidden;\n }\n}\n\n.Menu--isVirtual {\n display: flex;\n align-items: stretch;\n flex-direction: column;\n}\n\n.MenuSize--xLarge {\n width: 32rem;\n}\n\n.MenuSize--large {\n width: 24rem;\n}\n\n.MenuSize--med {\n width: 16rem;\n}\n\n.MenuSize--small {\n width: 12rem;\n}\n\n.VirtualMenu-item-list {\n width: 100%;\n position: relative;\n}\n\n.VirtualMenu-item {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n}\n"],"names":[]}
1
+ {"version":3,"sourceRoot":null,"mappings":"AAAA,+VAmBE,gHAKA,qHAMF,8DAMA,qIAME,gKAOA,+KAKA,wJAMF,8KAME,yBAME,oFAMA,uIASA,gWAYJ,qCAIA,yDAIA,wCAIA,0HAIE,oHAOF,qGAMA,gFAOA,uDAIA,uFAMA,kHAKA,qMAUA,mOAUA,yCAIE,oIASF,wEAMA,8BAIA,6BAIA,2BAIA,6BAIA,oDAKA","sources":["src/styles/Menu.css"],"sourcesContent":[".Menu-item {\n display: block;\n position: relative;\n color: var(--color-text);\n background: var(--color-background);\n text-decoration: none;\n cursor: pointer;\n outline: none;\n padding: 0.6rem 2.5rem;\n text-align: left;\n font-size: 1.3rem;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: none;\n line-height: inherit;\n border-width: 0;\n width: 100%;\n\n &:first-child {\n border-top-left-radius: var(--border-radius);\n border-top-right-radius: var(--border-radius);\n }\n\n &:last-child {\n border-bottom-left-radius: var(--border-radius);\n border-bottom-right-radius: var(--border-radius);\n }\n}\n\n.Menu-item-list {\n min-width: 12rem;\n overflow: auto;\n max-height: 55vh;\n}\n\n.Menu-item-list > .Menu-item:last-child {\n border-bottom-left-radius: var(--border-radius);\n border-bottom-right-radius: var(--border-radius);\n}\n\n.Menu .Menu-item:not([disabled], [aria-disabled]) {\n &:active {\n text-decoration: none;\n box-shadow: none;\n background-color: var(--color-blue-200);\n color: var(--color-blue-600);\n }\n\n &:hover:not(:active, .has-focus) {\n background-color: var(--color-background-hover);\n box-shadow: inset 0 0 0 1px var(--color-gray-600);\n }\n\n &.has-focus {\n background-color: var(--color-background-hover);\n box-shadow: inset 0 0 0 2px var(--color-focus);\n }\n}\n\n.Menu-item-list > .VirtualMenu-item-list .VirtualMenu-item:last-child .Menu-item {\n border-bottom-left-radius: var(--border-radius);\n border-bottom-right-radius: var(--border-radius);\n}\n\n.Menu {\n &:focus {\n outline: none;\n }\n\n /* Override our link styles for MenuItemLink component */\n & a.Menu-item {\n &:focus:not(:hover, .has-focus) {\n text-decoration: none;\n box-shadow: none;\n }\n\n /* Ensures that links that are disabled don't show active styles */\n &:active[disabled],\n &:active[aria-disabled] {\n text-decoration: none;\n color: var(--color-text-subtle-primary);\n }\n }\n\n & .Menu-item-list:first-child,\n & [hidden]:first-child + & .Menu-item-list {\n & > .Menu-item:first-child {\n border-top-left-radius: var(--border-radius);\n border-top-right-radius: var(--border-radius);\n }\n\n & > .VirtualMenu-item-list .VirtualMenu-item:first-child .Menu-item {\n border-top-left-radius: var(--border-radius);\n border-top-right-radius: var(--border-radius);\n }\n }\n}\n\n.Menu-item--nested {\n padding-left: 4rem;\n}\n\n.Menu-item--header {\n font-weight: var(--font-weight-medium);\n}\n\n.Menu-item .Gravatar {\n margin-right: 0.5rem;\n}\n\n.Menu-item.is-highlighted {\n background-color: var(--color-background-hover);\n box-shadow: inset 0 0 0 1px var(--color-gray-600);\n\n &:active {\n background-color: var(--color-blue-200);\n color: var(--color-blue-600);\n box-shadow: none;\n }\n}\n\n.Menu-item[aria-disabled],\n.Menu-item[disabled] {\n color: var(--color-text-subtle-primary);\n cursor: default;\n}\n\n.Menu-item-icon {\n position: absolute;\n left: 0.5rem;\n top: 50%;\n transform: translateY(-50%);\n}\n\n.Menu-divider {\n border-top: 1px solid var(--color-border);\n}\n\n.Menu-search {\n padding: 1rem;\n font-size: 1.3rem;\n border-bottom: 1px solid var(--color-border);\n}\n\n.Menu-search:first-child {\n border-top-left-radius: var(--border-radius);\n border-top-right-radius: var(--border-radius);\n}\n\n.Menu-clear.Button {\n text-decoration: none;\n color: var(--color-system-red-600);\n font-size: 1.3rem;\n font-weight: var(--font-weight-medium);\n padding: 1rem;\n width: 100%;\n border-bottom: 1px solid var(--color-border);\n}\n\n.Menu-clear.Button:active,\n.Menu-clear.Button:focus,\n.Menu-clear.Button:hover {\n outline: none;\n box-shadow: unset;\n color: var(--color-system-red-600);\n border-bottom-color: var(--color-border);\n background-color: var(--color-background-hover);\n}\n\n.Popover-content .Menu-search {\n width: 100%;\n\n /* Removing anything that could give it some height */\n & .Menu-search-hidden-placeholder {\n padding-top: 0;\n padding-bottom: 0;\n height: 0;\n border: none;\n visibility: hidden;\n }\n}\n\n.Menu--isVirtual {\n display: flex;\n align-items: stretch;\n flex-direction: column;\n}\n\n.MenuSize--xLarge {\n width: 32rem;\n}\n\n.MenuSize--large {\n width: 24rem;\n}\n\n.MenuSize--med {\n width: 16rem;\n}\n\n.MenuSize--small {\n width: 12rem;\n}\n\n.VirtualMenu-item-list {\n width: 100%;\n position: relative;\n}\n\n.VirtualMenu-item {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n}\n"],"names":[]}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@launchpad-ui/menu",
3
- "version": "0.2.5",
3
+ "version": "0.2.8",
4
+ "status": "beta",
4
5
  "publishConfig": {
5
6
  "access": "public"
6
7
  },
@@ -25,10 +26,10 @@
25
26
  },
26
27
  "source": "src/index.ts",
27
28
  "dependencies": {
28
- "@launchpad-ui/icons": "~0.2.1",
29
- "@launchpad-ui/popover": "~0.3.1",
29
+ "@launchpad-ui/icons": "~0.2.2",
30
+ "@launchpad-ui/popover": "~0.4.1",
30
31
  "@launchpad-ui/tokens": "~0.1.5",
31
- "@launchpad-ui/tooltip": "~0.2.5",
32
+ "@launchpad-ui/tooltip": "~0.3.1",
32
33
  "@react-aria/focus": "^3.6.0",
33
34
  "@react-aria/separator": "^3.2.0",
34
35
  "clsx": "^1.2.0",
@@ -48,9 +49,9 @@
48
49
  "react-dom": "^18.2.0"
49
50
  },
50
51
  "scripts": {
51
- "build": "tsc --project tsconfig.build.json && node build.js",
52
+ "build": "tsc --project tsconfig.build.json && node ../../scripts/build.js",
52
53
  "clean": "rm -rf dist",
53
- "e2e": "exit 0",
54
+ "e2e": "playwright test --config=../../playwright.config.ct.ts",
54
55
  "lint": "eslint '**/*.{ts,tsx,js}' && stylelint '**/*.css' --ignore-path ../../.stylelintignore",
55
56
  "test": "vitest run --coverage"
56
57
  }