@muraldevkit/ui-toolkit 4.76.1-dev-aD33.1 → 4.76.1
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/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.js +5 -2
- package/dist/cjs/components/file-upload/MrlFileUpload/MrlFileUpload.js.map +1 -1
- package/dist/cjs/components/grid/MrlCol/MrlCol.js +55 -58
- package/dist/cjs/components/grid/MrlCol/MrlCol.js.map +1 -1
- package/dist/cjs/components/grid/MrlGrid/MrlGrid.js +6 -4
- package/dist/cjs/components/grid/MrlGrid/MrlGrid.js.map +1 -1
- package/dist/cjs/components/grid/MrlRow/MrlRow.js +8 -10
- package/dist/cjs/components/grid/MrlRow/MrlRow.js.map +1 -1
- package/dist/cjs/components/grid/constants.js +9 -47
- package/dist/cjs/components/grid/constants.js.map +1 -1
- package/dist/cjs/components/menu/MrlMenu/MrlMenu.js.map +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/version.js.map +1 -1
- package/dist/components/grid/MrlCol/MrlCol.d.ts +6 -4
- package/dist/components/grid/MrlCol/index.d.ts +1 -1
- package/dist/components/grid/MrlGrid/MrlGrid.d.ts +5 -5
- package/dist/components/grid/MrlGrid/index.d.ts +1 -1
- package/dist/components/grid/MrlRow/MrlRow.d.ts +7 -7
- package/dist/components/grid/MrlRow/index.d.ts +1 -1
- package/dist/components/grid/constants.d.ts +12 -52
- package/dist/components/grid/index.d.ts +0 -1
- package/dist/components/menu/MrlMenu/MrlMenu.d.ts +10 -3
- package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.js +5 -2
- package/dist/esm/components/file-upload/MrlFileUpload/MrlFileUpload.js.map +1 -1
- package/dist/esm/components/grid/MrlCol/MrlCol.js +56 -59
- package/dist/esm/components/grid/MrlCol/MrlCol.js.map +1 -1
- package/dist/esm/components/grid/MrlGrid/MrlGrid.js +6 -4
- package/dist/esm/components/grid/MrlGrid/MrlGrid.js.map +1 -1
- package/dist/esm/components/grid/MrlRow/MrlRow.js +8 -10
- package/dist/esm/components/grid/MrlRow/MrlRow.js.map +1 -1
- package/dist/esm/components/grid/constants.js +9 -46
- package/dist/esm/components/grid/constants.js.map +1 -1
- package/dist/esm/components/menu/MrlMenu/MrlMenu.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/styles/MrlSidebar/module.scss +2 -2
- package/dist/styles/grid/global.scss +2 -97
- package/dist/styles/grid/variables.scss +26 -0
- package/dist/styles.css +7 -1
- package/dist/types/components/grid/MrlCol/MrlCol.d.ts +6 -4
- package/dist/types/components/grid/MrlCol/index.d.ts +1 -1
- package/dist/types/components/grid/MrlGrid/MrlGrid.d.ts +5 -5
- package/dist/types/components/grid/MrlGrid/index.d.ts +1 -1
- package/dist/types/components/grid/MrlRow/MrlRow.d.ts +7 -7
- package/dist/types/components/grid/MrlRow/index.d.ts +1 -1
- package/dist/types/components/grid/constants.d.ts +12 -52
- package/dist/types/components/grid/index.d.ts +0 -1
- package/dist/types/components/menu/MrlMenu/MrlMenu.d.ts +10 -3
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MrlMenu.js","sources":["../../../../../src/components/menu/MrlMenu/MrlMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { MrlPortal, PortalProps } from '../../portal/MrlPortal';\nimport { useTriggerPosition } from '../../../hooks/useTriggerPosition';\nimport { useClickOutside } from '../../../hooks/useClickOutside';\nimport { useSubMenuElementPosition } from '../hooks/useSubMenuElementPosition';\nimport {\n\tMenuPosition,\n\tMenuAlignment,\n\tActionState,\n\tActionType,\n\tCustomMenuPosition\n} from '../constants';\nimport { PORTAL_LAYERS } from '../../../utils/layers';\nimport {\n\tfindAdjacentInteractiveElement,\n\tpreventDefault,\n\tisElementAriaDisabled\n} from '../../../utils';\nimport classnames from 'classnames';\nimport { MrlMenuContext } from '../context/MrlMenuContext';\nimport styles from './MrlMenu.module.scss';\nimport itemStyles from '../MrlMenuItem/MrlMenuItem.module.scss';\nimport { useTransition, animated } from '@react-spring/web';\nimport { isTouchDevice } from '../../../utils/isTouch';\nimport { getScrollableParent } from '../utilities/get-scrollable-parent';\nimport { useMenuScroll } from '../hooks/useMenuScroll';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nexport interface MrlMenuProps {\n\t/** Custom position for the menu */\n\tcustomPosition?: CustomMenuPosition;\n\n\t/** Children to be rendered within the menu component*/\n\tchildren: React.ReactNode;\n\n\t/** Event to close the menu */\n\tclickOutsideEvent?: 'mousedown' | 'mouseup' | 'click';\n\n\t/**\n\t * Enables closing the menu when scrolling. Default is false.\n\t *\n\t */\n\tcloseOnScroll?: boolean;\n\n\t/**\n\t * Private closeParent prop for use with MrlMenuItem\n\t *\n\t * !!! Please do not use this prop directly, it is only used internally by MrlMenuItem !!!\n\t * @private\n\t */\n\tcloseParent?: () => void;\n\n\t/**\n\t * Disable arrows from opening the menu\n\t * - This is useful when you want to disable the default browser behavior of opening a menu on arrow down.\n\t *\n\t * Example usage: the menu is within a vertical toolbar and you want to use the arrow keys to navigate the toolbar.\n\t * By using this prop you can disable the arrow key open/close so that navigating the toolbar does not conflict\n\t * with opening/closing the menu.\n\t */\n\tdisableArrowOpen?: boolean;\n\n\t/**\n\t * Disable flipping of the menu when it goes off the screen\n\t * @default false\n\t */\n\tdisableFlipping?: boolean;\n\n\t/** Unique identifier for the menu */\n\tid?: string;\n\n\t/**\n\t * Use when the menu is embedded within another component\n\t * Removes the following styles:\n\t * - padding on the menu\n\t * - drop shadow and border\n\t * @default false\n\t */\n\tisInternal?: boolean;\n\n\t/**\n\t * Private isSubMenu prop for use with MrlMenuItem\n\t *\n\t * !!! Please do not use this prop directly, it is only used internally by MrlMenuItem !!!\n\t * @private\n\t */\n\tisSubMenu?: boolean;\n\n\t/**\n\t * spacing of menu\n\t * - compact has less padding\n\t * @default 'default'\n\t */\n\tspacing?: 'default' | 'compact';\n\n\t/**\n\t * Offset of the menu from the trigger element in pixels\n\t * @default 10px\n\t */\n\tmenuOffset?: number;\n\n\t/**\n\t * Configuration for the portal component\n\t */\n\tportalProps?: Omit<PortalProps, 'children'>;\n\n\t/**\n\t * Horizontal and vertical alignment of the menu relative to the trigger element\n\t * - position 'left', 'right', 'top', 'bottom' position relative to the trigger\n\t * - position 'static' renders the menu in place, not using the portal\n\t * - position 'ignore' will not position the menu, allowing you to use the customPosition prop to position the element\n\t * @default 'bottom'\n\t */\n\tposition?: MenuPosition;\n\n\t/**\n\t * Set initial state of menu\n\t * @default { actionType: null, isOpen: false }\n\t */\n\tactionState?: ActionState;\n\n\t/**\n\t * Reference to the DOM element that triggers this menu.\n\t */\n\ttriggerRef?: React.RefObject<HTMLButtonElement>;\n\n\t/**\n\t * Trigger stop propagation on click\n\t *\n\t * In some instances we may want the trigger element to stop propogation to the\n\t * rest of the DOM. Use this flag to enable and disable it.\n\t * @default false\n\t */\n\ttriggerStopPropagation?: boolean;\n\n\t/**\n\t * Vertical and horizontal alignment of the menu relative to the position of the menu with the trigger\n\t * - 'left' and 'right' work with position 'top' and 'bottom'\n\t * - 'top' and 'bottom' work with position 'left' and 'right'\n\t * - 'center' works with all positions\n\t *\n\t * This does not impact submenus\n\t */\n\talignment?: MenuAlignment;\n\n\t/**\n\t * Callback to be called when the menu is closed\n\t * @param type - type of close event\n\t */\n\tonClose?: (type?: string) => void;\n\n\t/**\n\t * Enables interaction tracking for this menu. Provide a stable, non-PII id\n\t * (e.g. 'mural-context-menu'). When omitted, the menu emits no analytics.\n\t */\n\teventId?: string;\n}\n\nconst MENU_ITEM_SELECTOR = '[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]';\n\n/**\n * MrlMenu component\n *\n * Renders a menu component with alignment relative to a trigger element\n * @param {MrlMenuProps} props - The props for the MrlMenu component\n * @returns {Element} - rendered MrlMenu component\n */\nexport function MrlMenu({\n\tactionState = { actionType: null, isOpen: false },\n\talignment = 'center',\n\tchildren,\n\tcloseOnScroll = false,\n\tcloseParent,\n\tcustomPosition,\n\tclickOutsideEvent = 'mouseup',\n\tdisableArrowOpen,\n\tdisableFlipping = false,\n\tid,\n\tisInternal = false,\n\tisSubMenu = false,\n\tspacing = 'default',\n\tmenuOffset = 10,\n\tportalProps = { id: PORTAL_LAYERS.MENU.name },\n\tposition = 'bottom',\n\ttriggerStopPropagation = false,\n\tonClose,\n\teventId,\n\ttriggerRef,\n\t...remainingProps\n}: MrlMenuProps): JSX.Element {\n\tconst defaultOpenState = position === 'static' || false;\n\n\tconst [state, setState] = React.useState({\n\t\tactionType: null,\n\t\tisOpen: defaultOpenState\n\t} as ActionState);\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlMenu', eventId);\n\t// the menu opens and closes from several paths (click, keyboard, hover, click outside),\n\t// so open/close is emitted from the resulting state rather than each individual handler.\n\tconst wasOpenRef = React.useRef(defaultOpenState);\n\n\tReact.useEffect(() => {\n\t\tif (wasOpenRef.current === state.isOpen) return;\n\n\t\twasOpenRef.current = state.isOpen;\n\n\t\ttrackInteraction({\n\t\t\taction: state.isOpen ? 'open' : 'close',\n\t\t\tmetadata: { isSubMenu, trigger: state.actionType ?? 'unknown' },\n\t\t\tvariant: position\n\t\t});\n\t}, [state.isOpen, state.actionType, isSubMenu, position, trackInteraction]);\n\n\tconst menuRef = React.useRef<HTMLDivElement>(null);\n\tconst listRef = React.useRef<HTMLUListElement>(null);\n\tconst [menuItems, setMenuItems] = React.useState<HTMLButtonElement[]>([]);\n\tconst [menuRect, setMenuRect] = React.useState<DOMRect | null>(null);\n\n\t/**\n\t * Checks if the trigger element is disabled\n\t * @returns {boolean} - true if the trigger element is disabled, false otherwise\n\t */\n\tconst isTriggerDisabled = React.useCallback((): boolean => {\n\t\treturn isElementAriaDisabled(triggerRef?.current);\n\t}, [triggerRef]);\n\n\t/**\n\t * Sets up trigger event listeners to open and close the menu\n\t * @param e - mouse event\n\t */\n\tconst toggleMenuTrigger = React.useCallback(\n\t\t(e: MouseEvent) => {\n\t\t\tif (isTriggerDisabled()) return;\n\n\t\t\tif (triggerStopPropagation) {\n\t\t\t\tpreventDefault(e);\n\t\t\t}\n\n\t\t\tsetState((prevState) => ({ actionType: 'click', isOpen: !prevState.isOpen }));\n\t\t},\n\t\t[triggerStopPropagation, isTriggerDisabled]\n\t);\n\n\t/**\n\t * Used to display the menu when hovering over a menu item that has a submenu\n\t */\n\tconst showMenuHover = React.useCallback(() => {\n\t\tsetState({ actionType: 'click', isOpen: true });\n\t}, []);\n\n\tconst showMenuTap = React.useCallback(() => {\n\t\tsetState((prevState) => ({ actionType: 'click', isOpen: !prevState.isOpen }));\n\t}, []);\n\n\tconst hideMenuHover = React.useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tconst relatedTarget = event.relatedTarget as Node;\n\n\t\t\t// If the related target is not a child of the menu, close the menu\n\t\t\t// This prevents the menu from closing when hovering over a submenu item or trigger\n\t\t\tif (\n\t\t\t\ttriggerRef &&\n\t\t\t\tmenuRef.current &&\n\t\t\t\t!menuRef.current.contains(relatedTarget) &&\n\t\t\t\ttriggerRef.current &&\n\t\t\t\t!triggerRef.current.contains(relatedTarget)\n\t\t\t) {\n\t\t\t\tsetState({ actionType: null, isOpen: false });\n\t\t\t}\n\t\t},\n\t\t[triggerRef]\n\t);\n\n\t/**\n\t * Sets up trigger event listeners to open and close the menu with a keyboard\n\t */\n\tconst toggleMenuKey = React.useCallback(\n\t\t(e: KeyboardEvent) => {\n\t\t\tconst openMenu = () => {\n\t\t\t\tif (isTriggerDisabled()) return;\n\t\t\t\tsetState({ actionType: e.key as ActionType, isOpen: true });\n\t\t\t};\n\n\t\t\tif (!state.isOpen) {\n\t\t\t\tif (isSubMenu) {\n\t\t\t\t\tswitch (e.key) {\n\t\t\t\t\t\tcase 'ArrowRight':\n\t\t\t\t\t\tcase 'Enter':\n\t\t\t\t\t\tcase ' ':\n\t\t\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\t\t\topenMenu();\n\t\t\t\t\t}\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tswitch (e.key) {\n\t\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\t\tif (!disableArrowOpen && !isTriggerDisabled()) {\n\t\t\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\t\t\topenMenu();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Enter':\n\t\t\t\t\tcase ' ':\n\t\t\t\t\t\tif (isTriggerDisabled()) return;\n\t\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\t\topenMenu();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[state.isOpen, isTriggerDisabled, disableArrowOpen, isSubMenu]\n\t);\n\n\tconst closeMenu = React.useCallback(\n\t\t(shouldCloseParent = true) => {\n\t\t\tif (position === 'static') return;\n\n\t\t\t/**\n\t\t\t * What is closeParent?\n\t\t\t *\n\t\t\t * It is passed from the context provider to the MenuItem (which helps render our submenus)\n\t\t\t * When we render the submenu, we pass the closeMenu function as \"closeParent\" to the submenu.\n\t\t\t * This allows us to trigger closing the parent menu when the submenu is closed. And that's\n\t\t\t * what this call is for.\n\t\t\t */\n\t\t\tif (shouldCloseParent && closeParent) closeParent();\n\n\t\t\tsetState({ actionType: null, isOpen: false });\n\t\t\tonClose?.();\n\t\t},\n\t\t[position, closeParent, onClose]\n\t);\n\n\t/**\n\t * Click outside to dismiss the menu\n\t * @param e\n\t */\n\tconst disableClickOutside = !state.isOpen || position === 'static';\n\tuseClickOutside(menuRef, triggerRef, clickOutsideEvent, closeMenu, disableClickOutside);\n\n\tconst handleMenuKeyUp = (e: React.KeyboardEvent) => {\n\t\tconst actions: ActionType[] = ['ArrowUp', 'ArrowDown', 'ArrowRight', 'Enter', 'Escape', ' '];\n\n\t\tif (actions.includes(e.key as ActionType)) {\n\t\t\tpreventDefault(e);\n\t\t}\n\t};\n\n\t/**\n\t * Focus management when someone is using a keyboard to navigate the menu\n\t * @param e - keyboard event\n\t */\n\tconst handleMenuKey = (e: React.KeyboardEvent) => {\n\t\tconst currentIndex = menuItems.findIndex((item) => document.activeElement === item);\n\t\tlet nextIndex: number;\n\n\t\tif (state.isOpen) {\n\t\t\tswitch (e.key) {\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\tnextIndex = currentIndex < menuItems.length - 1 ? currentIndex + 1 : currentIndex;\n\t\t\t\t\tmenuItems[nextIndex]?.focus();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\tnextIndex = currentIndex > 0 ? currentIndex - 1 : 0;\n\t\t\t\t\tmenuItems[nextIndex]?.focus();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowRight':\n\t\t\t\tcase 'ArrowLeft':\n\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\ttriggerRef?.current?.focus();\n\t\t\t\t\tcloseMenu(false);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Tab':\n\t\t\t\t\tif (!isSubMenu && position !== 'static') {\n\t\t\t\t\t\tif (e.shiftKey) {\n\t\t\t\t\t\t\t// Handle shift + tab: move focus to the previous item\n\t\t\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\t\t\tif (triggerRef) {\n\t\t\t\t\t\t\t\tconst prevElement = findAdjacentInteractiveElement(triggerRef, 'previous');\n\t\t\t\t\t\t\t\tprevElement?.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Regular tab: close the menu or move to the next item\n\t\t\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\t\t\tif (triggerRef) {\n\t\t\t\t\t\t\t\tconst nextElement = findAdjacentInteractiveElement(triggerRef);\n\t\t\t\t\t\t\t\tnextElement?.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcloseMenu();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * useEffect hooks to handle menu state changes\n\t */\n\n\tReact.useEffect(() => {\n\t\tif (triggerRef?.current) {\n\t\t\ttriggerRef.current.setAttribute('aria-haspopup', 'menu');\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\tReact.useEffect(() => {\n\t\tif (position === 'static') {\n\t\t\tsetState({ actionType: 'click', isOpen: true });\n\t\t}\n\t}, [position]);\n\n\tReact.useEffect(() => {\n\t\ttriggerRef?.current?.setAttribute('aria-expanded', state.isOpen.toString());\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [state.isOpen]);\n\n\tReact.useEffect(() => {\n\t\tif (!isSubMenu && position !== 'static')\n\t\t\tsetState({ actionType: actionState.actionType, isOpen: actionState.isOpen });\n\t}, [actionState.isOpen, actionState.actionType, isSubMenu, position]);\n\n\t// setup event handlers for mouse, keyboard, and scroll interactions\n\tReact.useEffect(() => {\n\t\tconst triggerElement = triggerRef?.current;\n\t\tconst menuElement = menuRef?.current;\n\t\tconst menuItems = menuElement?.querySelectorAll(MENU_ITEM_SELECTOR);\n\n\t\tlet scrollableParent: HTMLElement | Window;\n\n\t\tif (triggerElement) {\n\t\t\ttriggerElement.addEventListener('mousedown', preventDefault);\n\t\t\tif (!isSubMenu) triggerElement.addEventListener('click', toggleMenuTrigger);\n\t\t\ttriggerElement.addEventListener('keydown', toggleMenuKey);\n\n\t\t\t// Setup event listeners for when the menu is a submenu\n\t\t\tif (isSubMenu) {\n\t\t\t\ttriggerElement.addEventListener('mouseover', showMenuHover);\n\t\t\t\ttriggerElement.addEventListener('mouseout', hideMenuHover);\n\n\t\t\t\tif (isTouchDevice()) {\n\t\t\t\t\ttriggerElement.addEventListener('touchend', showMenuTap);\n\t\t\t\t}\n\n\t\t\t\tif (menuElement) {\n\t\t\t\t\tmenuElement.addEventListener('mouseover', showMenuHover);\n\t\t\t\t\tmenuElement.addEventListener('mouseout', hideMenuHover);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (closeOnScroll) {\n\t\t\t\tscrollableParent = getScrollableParent(triggerElement);\n\t\t\t\tif (scrollableParent) {\n\t\t\t\t\tscrollableParent.addEventListener('scroll', () => closeMenu(), {\n\t\t\t\t\t\tcapture: true,\n\t\t\t\t\t\tpassive: true\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\ttriggerElement.removeEventListener('mousedown', preventDefault);\n\t\t\t\tif (!isSubMenu) triggerElement.removeEventListener('click', toggleMenuTrigger);\n\t\t\t\ttriggerElement.removeEventListener('keydown', toggleMenuKey);\n\n\t\t\t\tif (menuItems) {\n\t\t\t\t\tmenuItems.forEach((item: Element) => {\n\t\t\t\t\t\tif (!item.getAttribute('aria-haspopup')) {\n\t\t\t\t\t\t\titem.removeEventListener('mousedown', () => closeMenu());\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (isSubMenu) {\n\t\t\t\t\ttriggerElement.removeEventListener('mouseover', showMenuHover);\n\t\t\t\t\ttriggerElement.removeEventListener('mouseout', hideMenuHover);\n\n\t\t\t\t\tif (isTouchDevice()) {\n\t\t\t\t\t\ttriggerElement.removeEventListener('touchstart', showMenuHover);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (menuElement) {\n\t\t\t\t\t\tmenuElement.removeEventListener('mouseover', showMenuHover);\n\t\t\t\t\t\tmenuElement.removeEventListener('mouseout', hideMenuHover);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (closeOnScroll && scrollableParent) {\n\t\t\t\t\tscrollableParent.removeEventListener('scroll', () => closeMenu());\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}, [\n\t\tcloseOnScroll,\n\t\tisSubMenu,\n\t\ttriggerRef,\n\t\ttoggleMenuTrigger,\n\t\ttoggleMenuKey,\n\t\tshowMenuHover,\n\t\thideMenuHover,\n\t\tcloseMenu,\n\t\tshowMenuTap\n\t]);\n\n\t// This use effect handles a few things when we open the menu:\n\t// - making sure that the menu component is aware of it's menu items\n\t// - adding a class to the trigger element when the submenu is open for styling\n\t// - storing the menu rect in state for positioning calculations\n\tReact.useEffect(() => {\n\t\tif (state.isOpen) {\n\t\t\tconst foundMenuItems = Array.from(\n\t\t\t\tmenuRef.current?.querySelectorAll(MENU_ITEM_SELECTOR) || []\n\t\t\t) as HTMLButtonElement[];\n\n\t\t\tsetMenuItems(foundMenuItems);\n\t\t}\n\n\t\tif (state.isOpen && isSubMenu) {\n\t\t\ttriggerRef?.current?.classList.add(itemStyles['MrlMenuItem--item--submenuOpen']);\n\t\t} else if (!state.isOpen && isSubMenu) {\n\t\t\ttriggerRef?.current?.classList.remove(itemStyles['MrlMenuItem--item--submenuOpen']);\n\t\t}\n\n\t\t// For consistent submenu calculations, we are storing the menu rect in state\n\t\t// Anytime we need to use the menu rect, we want to make sure the values are based\n\t\t// on the original state of the menu for proper transformations\n\t\tif (!menuRect && menuRef.current) {\n\t\t\tconst newRect = menuRef.current?.getBoundingClientRect();\n\t\t\tsetMenuRect(newRect || null);\n\t\t}\n\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [state.isOpen, menuRect, isSubMenu]);\n\n\t/**\n\t * Focus management for when the menu is opening or closing\n\t */\n\tReact.useEffect(() => {\n\t\tif (menuItems.length > 0) {\n\t\t\tlet menuItemToFocus;\n\n\t\t\tswitch (state.actionType) {\n\t\t\t\tcase 'Enter':\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\tcase ' ':\n\t\t\t\t\tmenuItemToFocus = menuItems[0];\n\t\t\t\t\tmenuItemToFocus?.focus();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tmenuItemToFocus = menuItems[menuItems.length - 1];\n\t\t\t\t\tmenuItemToFocus?.focus();\n\n\t\t\t\t\t// Scroll to the bottom of the menu when the last item is focused\n\t\t\t\t\t// setTimeout is required to ensure the element has been rendered\n\t\t\t\t\t// and the scrollHeight is accurate prior to scrolling\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (listRef.current) {\n\t\t\t\t\t\t\tlistRef.current.scrollTo(0, listRef.current.scrollHeight);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 20);\n\t\t\t}\n\n\t\t\tif (isSubMenu && state.actionType === 'ArrowRight') {\n\t\t\t\tmenuItemToFocus = menuItems[0];\n\t\t\t\tmenuItemToFocus?.focus();\n\t\t\t}\n\t\t}\n\t}, [isSubMenu, menuItems, state.actionType]);\n\n\t/**\n\t * Menu scroll behavior\n\t *\n\t * When the menu cannot fit in the preferred or flipped position,\n\t * this hook constrains the menu height and enables internal scrolling.\n\t * Called before useTriggerPosition so that isScrolling can disable flipping,\n\t * preventing the positioning hook from fighting the scroll constraint.\n\t */\n\tconst disableMenuScroll =\n\t\tisSubMenu || !state.isOpen || position === 'static' || position === 'ignore';\n\n\t/**\n\t * Sets overflow (scrolling) on menu when there is no space to display\n\t * the menu in the preferred or flipped position.\n\t */\n\tconst menuScroll = useMenuScroll(\n\t\ttriggerRef,\n\t\tlistRef,\n\t\tposition,\n\t\tmenuOffset,\n\t\tstate.isOpen,\n\t\tdisableMenuScroll\n\t);\n\n\t/**\n\t * Primary menu positioning, alignment, and transition styling\n\t *\n\t * This hook is only enabled if isSubMenu is FALSE\n\t */\n\tconst disableTriggerPosition = isSubMenu || !state.isOpen || position === 'static';\n\tconst menuPositionStyles = useTriggerPosition(\n\t\ttriggerRef,\n\t\tmenuRef,\n\t\t{\n\t\t\talign: alignment,\n\t\t\tcustomPosition: customPosition,\n\t\t\tposition: position\n\t\t},\n\t\tstate.isOpen,\n\t\tmenuOffset,\n\t\tdisableTriggerPosition,\n\t\tdisableFlipping || menuScroll.isScrolling\n\t);\n\n\t/**\n\t * Submenu positioning and alignment\n\t *\n\t * This hook is only enabled if isSubMenu is TRUE\n\t */\n\tconst subMenuPosition = useSubMenuElementPosition(\n\t\ttriggerRef,\n\t\tmenuRef,\n\t\tisSubMenu,\n\t\tstate.isOpen,\n\t\tmenuRect,\n\t\t// disable the subelement positioning if it's not a submenu\n\t\t!isSubMenu\n\t);\n\n\tconst inlineStyles = {\n\t\tmenu: {\n\t\t\tleft: menuPositionStyles.left,\n\t\t\tposition: 'fixed' as const,\n\t\t\ttop: menuPositionStyles.top\n\t\t},\n\t\tsubmenu: {\n\t\t\tleft: subMenuPosition.left,\n\t\t\ttop: subMenuPosition.top\n\t\t}\n\t};\n\n\t/**\n\t * React Spring transitions for the menu\n\t */\n\tconst transitionConfig = {\n\t\tconfig: { duration: state.isOpen ? 300 : 150 },\n\t\tenter: { opacity: 1, transform: 'translateY(0)' },\n\t\tfrom: { opacity: 0, transform: 'translateY(4px)' },\n\t\tleave: { opacity: 0, transform: 'translateY(4px)' }\n\t};\n\n\tconst transitionStatic = {\n\t\tconfig: { duration: 0 },\n\t\tenter: { opacity: 1, transform: 'translateY(0)' }\n\t};\n\n\tconst transitions = useTransition(\n\t\tstate.isOpen,\n\t\tposition === 'static' ? transitionStatic : transitionConfig\n\t);\n\n\tconst menuClasses = classnames(styles['MrlMenu'], 'MrlMenu', {\n\t\t[styles['MrlMenu--submenu']]: isSubMenu,\n\t\t[styles.open]: state.isOpen,\n\t\t[styles['MrlMenu--compact']]: spacing === 'compact',\n\t\t[styles['MrlMenu--static']]: position === 'static',\n\t\t[styles['MrlMenu--internal']]: isInternal,\n\t\t[styles['MrlMenu--scrolling']]: menuScroll.isScrolling,\n\t\t[styles['MrlMenu--ignore']]: position === 'ignore'\n\t});\n\n\tconst positionStyles = isSubMenu\n\t\t? inlineStyles.submenu\n\t\t: position !== 'static'\n\t\t\t? inlineStyles.menu\n\t\t\t: {};\n\n\tconst menuScrollStyles =\n\t\t(menuScroll.maxHeight !== undefined && { maxHeight: menuScroll.maxHeight }) || undefined;\n\n\tconst renderMenu = () => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{transitions(\n\t\t\t\t\t(style, item) =>\n\t\t\t\t\t\titem && (\n\t\t\t\t\t\t\t<animated.div\n\t\t\t\t\t\t\t\tclassName={menuClasses}\n\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t\tstyle={{ ...positionStyles, ...style }}\n\t\t\t\t\t\t\t\tonKeyUp={handleMenuKeyUp}\n\t\t\t\t\t\t\t\tonKeyDown={handleMenuKey}\n\t\t\t\t\t\t\t\tref={menuRef}\n\t\t\t\t\t\t\t\trole=\"none\"\n\t\t\t\t\t\t\t\t{...remainingProps}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ul ref={listRef} role=\"menu\" style={menuScrollStyles}>\n\t\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</animated.div>\n\t\t\t\t\t\t)\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n\n\t// For managing and restoring focus to the original menu trigger\n\t// Ensures the triggerRef in context is always the parent triggerRef\n\tconst parentContext = React.useContext(MrlMenuContext);\n\tconst contextTriggerRef = isSubMenu ? parentContext?.triggerRef : triggerRef;\n\n\treturn (\n\t\t<MrlMenuContext.Provider\n\t\t\tvalue={{\n\t\t\t\tcloseMenu,\n\t\t\t\tcloseParent: !isSubMenu ? closeMenu : undefined,\n\t\t\t\ttriggerRef: contextTriggerRef\n\t\t\t}}\n\t\t>\n\t\t\t{isSubMenu || position === 'static' ? (\n\t\t\t\trenderMenu()\n\t\t\t) : (\n\t\t\t\t<MrlPortal layer={portalProps.layer || PORTAL_LAYERS.MENU} {...portalProps}>\n\t\t\t\t\t{renderMenu()}\n\t\t\t\t</MrlPortal>\n\t\t\t)}\n\t\t</MrlMenuContext.Provider>\n\t);\n\t/* eslint-enable */\n}\n\nMrlMenu.componentType = 'Menu';\n"],"names":["MENU_ITEM_SELECTOR","MrlMenu","_ref","_ref$actionState","actionState","actionType","isOpen","_ref$alignment","alignment","children","_ref$closeOnScroll","closeOnScroll","closeParent","customPosition","_ref$clickOutsideEven","clickOutsideEvent","disableArrowOpen","_ref$disableFlipping","disableFlipping","id","_ref$isInternal","isInternal","_ref$isSubMenu","isSubMenu","_ref$spacing","spacing","_ref$menuOffset","menuOffset","_ref$portalProps","portalProps","PORTAL_LAYERS","MENU","name","_ref$position","position","_ref$triggerStopPropa","triggerStopPropagation","onClose","eventId","triggerRef","remainingProps","_objectWithoutProperties","_excluded","defaultOpenState","_React$useState","React","useState","_React$useState2","_slicedToArray","state","setState","trackInteraction","useMrlTrackInteraction","wasOpenRef","useRef","useEffect","_state$actionType","current","action","metadata","trigger","variant","menuRef","listRef","_React$useState3","_React$useState4","menuItems","setMenuItems","_React$useState5","_React$useState6","menuRect","setMenuRect","isTriggerDisabled","useCallback","isElementAriaDisabled","toggleMenuTrigger","e","preventDefault","prevState","showMenuHover","showMenuTap","hideMenuHover","event","relatedTarget","contains","toggleMenuKey","openMenu","key","closeMenu","shouldCloseParent","arguments","length","undefined","disableClickOutside","useClickOutside","handleMenuKeyUp","actions","includes","handleMenuKey","_menuItems$nextIndex","_menuItems$nextIndex2","_triggerRef$current","currentIndex","findIndex","item","document","activeElement","nextIndex","focus","shiftKey","prevElement","findAdjacentInteractiveElement","nextElement","setAttribute","_triggerRef$current2","toString","triggerElement","menuElement","querySelectorAll","scrollableParent","addEventListener","isTouchDevice","getScrollableParent","capture","passive","removeEventListener","forEach","getAttribute","_menuRef$current","foundMenuItems","Array","from","_triggerRef$current3","classList","add","itemStyles","_triggerRef$current4","remove","_menuRef$current2","newRect","getBoundingClientRect","_menuItemToFocus","_menuItemToFocus2","menuItemToFocus","setTimeout","scrollTo","scrollHeight","_menuItemToFocus3","disableMenuScroll","menuScroll","useMenuScroll","disableTriggerPosition","menuPositionStyles","useTriggerPosition","align","isScrolling","subMenuPosition","useSubMenuElementPosition","inlineStyles","menu","left","top","submenu","transitionConfig","config","duration","enter","opacity","transform","leave","transitionStatic","transitions","useTransition","menuClasses","classnames","styles","open","positionStyles","menuScrollStyles","maxHeight","renderMenu","createElement","Fragment","style","animated","div","_extends","className","_objectSpread","onKeyUp","onKeyDown","ref","role","parentContext","useContext","MrlMenuContext","contextTriggerRef","Provider","value","MrlPortal","layer","componentType"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8JA,IAAMA,kBAAkB,GAAG,sEAAsE;;AAEjG;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,OAAOA,CAAAC,IAAA,EAsBO;AAAA,EAAA,IAAAC,gBAAA,GAAAD,IAAA,CArB7BE,WAAW;IAAXA,WAAW,GAAAD,gBAAA,KAAA,MAAA,GAAG;AAAEE,MAAAA,UAAU,EAAE,IAAI;AAAEC,MAAAA,MAAM,EAAE;AAAM,KAAC,GAAAH,gBAAA;IAAAI,cAAA,GAAAL,IAAA,CACjDM,SAAS;AAATA,IAAAA,SAAS,GAAAD,cAAA,KAAA,MAAA,GAAG,QAAQ,GAAAA,cAAA;IACpBE,QAAQ,GAAAP,IAAA,CAARO,QAAQ;IAAAC,kBAAA,GAAAR,IAAA,CACRS,aAAa;AAAbA,IAAAA,aAAa,GAAAD,kBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,kBAAA;IACrBE,WAAW,GAAAV,IAAA,CAAXU,WAAW;IACXC,cAAc,GAAAX,IAAA,CAAdW,cAAc;IAAAC,qBAAA,GAAAZ,IAAA,CACda,iBAAiB;AAAjBA,IAAAA,iBAAiB,GAAAD,qBAAA,KAAA,MAAA,GAAG,SAAS,GAAAA,qBAAA;IAC7BE,gBAAgB,GAAAd,IAAA,CAAhBc,gBAAgB;IAAAC,oBAAA,GAAAf,IAAA,CAChBgB,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,oBAAA;IACvBE,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CAAAwI,aAAA,CAACkB,mBAAS,EAAAb,iCAAA,CAAA;AAACc,IAAAA,KAAK,EAAE3K,WAAW,CAAC2K,KAAK,IAAI1K,mBAAa,CAACC;AAAK,GAAA,EAAKF,WAAW,CAAA,EACxEuJ,UAAU,EACD,CAEY,CAAC;AAE3B;AACD;AAEAnL,OAAO,CAACwM,aAAa,GAAG,MAAM;;;;"}
|
|
1
|
+
{"version":3,"file":"MrlMenu.js","sources":["../../../../../src/components/menu/MrlMenu/MrlMenu.tsx"],"sourcesContent":["import * as React from 'react';\nimport { MrlPortal, PortalProps } from '../../portal/MrlPortal';\nimport { useTriggerPosition } from '../../../hooks/useTriggerPosition';\nimport { useClickOutside } from '../../../hooks/useClickOutside';\nimport { useSubMenuElementPosition } from '../hooks/useSubMenuElementPosition';\nimport {\n\tMenuPosition,\n\tMenuAlignment,\n\tActionState,\n\tActionType,\n\tCustomMenuPosition\n} from '../constants';\nimport { PORTAL_LAYERS } from '../../../utils/layers';\nimport {\n\tfindAdjacentInteractiveElement,\n\tpreventDefault,\n\tisElementAriaDisabled\n} from '../../../utils';\nimport classnames from 'classnames';\nimport { MrlMenuContext } from '../context/MrlMenuContext';\nimport styles from './MrlMenu.module.scss';\nimport itemStyles from '../MrlMenuItem/MrlMenuItem.module.scss';\nimport { useTransition, animated } from '@react-spring/web';\nimport { isTouchDevice } from '../../../utils/isTouch';\nimport { getScrollableParent } from '../utilities/get-scrollable-parent';\nimport { useMenuScroll } from '../hooks/useMenuScroll';\nimport { useMrlTrackInteraction } from '../../../hooks/useMrlAnalytics';\n\nexport interface MrlMenuProps {\n\t/** Custom position for the menu */\n\tcustomPosition?: CustomMenuPosition;\n\n\t/** Children to be rendered within the menu component*/\n\tchildren: React.ReactNode;\n\n\t/** Event to close the menu */\n\tclickOutsideEvent?: 'mousedown' | 'mouseup' | 'click';\n\n\t/**\n\t * Enables closing the menu when scrolling. Default is false.\n\t *\n\t */\n\tcloseOnScroll?: boolean;\n\n\t/**\n\t * Private closeParent prop for use with MrlMenuItem\n\t *\n\t * !!! Please do not use this prop directly, it is only used internally by MrlMenuItem !!!\n\t * @private\n\t */\n\tcloseParent?: () => void;\n\n\t/**\n\t * Disable arrows from opening the menu\n\t * - This is useful when you want to disable the default browser behavior of opening a menu on arrow down.\n\t *\n\t * Example usage: the menu is within a vertical toolbar and you want to use the arrow keys to navigate the toolbar.\n\t * By using this prop you can disable the arrow key open/close so that navigating the toolbar does not conflict\n\t * with opening/closing the menu.\n\t */\n\tdisableArrowOpen?: boolean;\n\n\t/**\n\t * Disable flipping of the menu when it goes off the screen\n\t * @default false\n\t */\n\tdisableFlipping?: boolean;\n\n\t/** Unique identifier for the menu */\n\tid?: string;\n\n\t/**\n\t * Use when the menu is embedded within another component\n\t * Removes the following styles:\n\t * - padding on the menu\n\t * - drop shadow and border\n\t * @default false\n\t */\n\tisInternal?: boolean;\n\n\t/**\n\t * Private isSubMenu prop for use with MrlMenuItem\n\t *\n\t * !!! Please do not use this prop directly, it is only used internally by MrlMenuItem !!!\n\t * @private\n\t */\n\tisSubMenu?: boolean;\n\n\t/**\n\t * spacing of menu\n\t * - compact has less padding\n\t * @default 'default'\n\t */\n\tspacing?: 'default' | 'compact';\n\n\t/**\n\t * Offset of the menu from the trigger element in pixels\n\t * @default 10px\n\t */\n\tmenuOffset?: number;\n\n\t/**\n\t * Configuration for the portal component\n\t */\n\tportalProps?: Omit<PortalProps, 'children'>;\n\n\t/**\n\t * Horizontal and vertical alignment of the menu relative to the trigger element\n\t * - position 'left', 'right', 'top', 'bottom' position relative to the trigger\n\t * - position 'static' renders the menu in place, not using the portal\n\t * - position 'ignore' will not position the menu, allowing you to use the customPosition prop to position the element\n\t * @default 'bottom'\n\t */\n\tposition?: MenuPosition;\n\n\t/**\n\t * Opens or closes the menu from outside. Not just an initial value: whenever\n\t * `isOpen` or `actionType` changes, the menu syncs its internal state to it.\n\t * The menu can still close itself (item select, click outside, Escape, Tab),\n\t * so pair this with `onClose` to reset your state. Prefer `triggerRef` when\n\t * there is a trigger element. Ignored for submenus and `position=\"static\"`.\n\t * @default { actionType: null, isOpen: false }\n\t */\n\tactionState?: ActionState;\n\n\t/**\n\t * Reference to the DOM element that triggers this menu. This alone wires up\n\t * click and keyboard open/close and the trigger's ARIA attributes; no\n\t * `actionState` or `onClick` toggle is needed.\n\t */\n\ttriggerRef?: React.RefObject<HTMLButtonElement>;\n\n\t/**\n\t * Trigger stop propagation on click\n\t *\n\t * In some instances we may want the trigger element to stop propogation to the\n\t * rest of the DOM. Use this flag to enable and disable it.\n\t * @default false\n\t */\n\ttriggerStopPropagation?: boolean;\n\n\t/**\n\t * Vertical and horizontal alignment of the menu relative to the position of the menu with the trigger\n\t * - 'left' and 'right' work with position 'top' and 'bottom'\n\t * - 'top' and 'bottom' work with position 'left' and 'right'\n\t * - 'center' works with all positions\n\t *\n\t * This does not impact submenus\n\t */\n\talignment?: MenuAlignment;\n\n\t/**\n\t * Called when the menu closes itself: item select, click outside, Escape, Tab,\n\t * or scroll with `closeOnScroll`. Not called when a trigger click toggles it closed.\n\t * @param type - type of close event\n\t */\n\tonClose?: (type?: string) => void;\n\n\t/**\n\t * Enables interaction tracking for this menu. Provide a stable, non-PII id\n\t * (e.g. 'mural-context-menu'). When omitted, the menu emits no analytics.\n\t */\n\teventId?: string;\n}\n\nconst MENU_ITEM_SELECTOR = '[role=\"menuitem\"], [role=\"menuitemcheckbox\"], [role=\"menuitemradio\"]';\n\n/**\n * MrlMenu component\n *\n * Renders a menu component with alignment relative to a trigger element\n * @param {MrlMenuProps} props - The props for the MrlMenu component\n * @returns {Element} - rendered MrlMenu component\n */\nexport function MrlMenu({\n\tactionState = { actionType: null, isOpen: false },\n\talignment = 'center',\n\tchildren,\n\tcloseOnScroll = false,\n\tcloseParent,\n\tcustomPosition,\n\tclickOutsideEvent = 'mouseup',\n\tdisableArrowOpen,\n\tdisableFlipping = false,\n\tid,\n\tisInternal = false,\n\tisSubMenu = false,\n\tspacing = 'default',\n\tmenuOffset = 10,\n\tportalProps = { id: PORTAL_LAYERS.MENU.name },\n\tposition = 'bottom',\n\ttriggerStopPropagation = false,\n\tonClose,\n\teventId,\n\ttriggerRef,\n\t...remainingProps\n}: MrlMenuProps): JSX.Element {\n\tconst defaultOpenState = position === 'static' || false;\n\n\tconst [state, setState] = React.useState({\n\t\tactionType: null,\n\t\tisOpen: defaultOpenState\n\t} as ActionState);\n\n\tconst trackInteraction = useMrlTrackInteraction('MrlMenu', eventId);\n\t// the menu opens and closes from several paths (click, keyboard, hover, click outside),\n\t// so open/close is emitted from the resulting state rather than each individual handler.\n\tconst wasOpenRef = React.useRef(defaultOpenState);\n\n\tReact.useEffect(() => {\n\t\tif (wasOpenRef.current === state.isOpen) return;\n\n\t\twasOpenRef.current = state.isOpen;\n\n\t\ttrackInteraction({\n\t\t\taction: state.isOpen ? 'open' : 'close',\n\t\t\tmetadata: { isSubMenu, trigger: state.actionType ?? 'unknown' },\n\t\t\tvariant: position\n\t\t});\n\t}, [state.isOpen, state.actionType, isSubMenu, position, trackInteraction]);\n\n\tconst menuRef = React.useRef<HTMLDivElement>(null);\n\tconst listRef = React.useRef<HTMLUListElement>(null);\n\tconst [menuItems, setMenuItems] = React.useState<HTMLButtonElement[]>([]);\n\tconst [menuRect, setMenuRect] = React.useState<DOMRect | null>(null);\n\n\t/**\n\t * Checks if the trigger element is disabled\n\t * @returns {boolean} - true if the trigger element is disabled, false otherwise\n\t */\n\tconst isTriggerDisabled = React.useCallback((): boolean => {\n\t\treturn isElementAriaDisabled(triggerRef?.current);\n\t}, [triggerRef]);\n\n\t/**\n\t * Sets up trigger event listeners to open and close the menu\n\t * @param e - mouse event\n\t */\n\tconst toggleMenuTrigger = React.useCallback(\n\t\t(e: MouseEvent) => {\n\t\t\tif (isTriggerDisabled()) return;\n\n\t\t\tif (triggerStopPropagation) {\n\t\t\t\tpreventDefault(e);\n\t\t\t}\n\n\t\t\tsetState((prevState) => ({ actionType: 'click', isOpen: !prevState.isOpen }));\n\t\t},\n\t\t[triggerStopPropagation, isTriggerDisabled]\n\t);\n\n\t/**\n\t * Used to display the menu when hovering over a menu item that has a submenu\n\t */\n\tconst showMenuHover = React.useCallback(() => {\n\t\tsetState({ actionType: 'click', isOpen: true });\n\t}, []);\n\n\tconst showMenuTap = React.useCallback(() => {\n\t\tsetState((prevState) => ({ actionType: 'click', isOpen: !prevState.isOpen }));\n\t}, []);\n\n\tconst hideMenuHover = React.useCallback(\n\t\t(event: MouseEvent) => {\n\t\t\tconst relatedTarget = event.relatedTarget as Node;\n\n\t\t\t// If the related target is not a child of the menu, close the menu\n\t\t\t// This prevents the menu from closing when hovering over a submenu item or trigger\n\t\t\tif (\n\t\t\t\ttriggerRef &&\n\t\t\t\tmenuRef.current &&\n\t\t\t\t!menuRef.current.contains(relatedTarget) &&\n\t\t\t\ttriggerRef.current &&\n\t\t\t\t!triggerRef.current.contains(relatedTarget)\n\t\t\t) {\n\t\t\t\tsetState({ actionType: null, isOpen: false });\n\t\t\t}\n\t\t},\n\t\t[triggerRef]\n\t);\n\n\t/**\n\t * Sets up trigger event listeners to open and close the menu with a keyboard\n\t */\n\tconst toggleMenuKey = React.useCallback(\n\t\t(e: KeyboardEvent) => {\n\t\t\tconst openMenu = () => {\n\t\t\t\tif (isTriggerDisabled()) return;\n\t\t\t\tsetState({ actionType: e.key as ActionType, isOpen: true });\n\t\t\t};\n\n\t\t\tif (!state.isOpen) {\n\t\t\t\tif (isSubMenu) {\n\t\t\t\t\tswitch (e.key) {\n\t\t\t\t\t\tcase 'ArrowRight':\n\t\t\t\t\t\tcase 'Enter':\n\t\t\t\t\t\tcase ' ':\n\t\t\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\t\t\topenMenu();\n\t\t\t\t\t}\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tswitch (e.key) {\n\t\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\t\tif (!disableArrowOpen && !isTriggerDisabled()) {\n\t\t\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\t\t\topenMenu();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 'Enter':\n\t\t\t\t\tcase ' ':\n\t\t\t\t\t\tif (isTriggerDisabled()) return;\n\t\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\t\topenMenu();\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t[state.isOpen, isTriggerDisabled, disableArrowOpen, isSubMenu]\n\t);\n\n\tconst closeMenu = React.useCallback(\n\t\t(shouldCloseParent = true) => {\n\t\t\tif (position === 'static') return;\n\n\t\t\t/**\n\t\t\t * What is closeParent?\n\t\t\t *\n\t\t\t * It is passed from the context provider to the MenuItem (which helps render our submenus)\n\t\t\t * When we render the submenu, we pass the closeMenu function as \"closeParent\" to the submenu.\n\t\t\t * This allows us to trigger closing the parent menu when the submenu is closed. And that's\n\t\t\t * what this call is for.\n\t\t\t */\n\t\t\tif (shouldCloseParent && closeParent) closeParent();\n\n\t\t\tsetState({ actionType: null, isOpen: false });\n\t\t\tonClose?.();\n\t\t},\n\t\t[position, closeParent, onClose]\n\t);\n\n\t/**\n\t * Click outside to dismiss the menu\n\t * @param e\n\t */\n\tconst disableClickOutside = !state.isOpen || position === 'static';\n\tuseClickOutside(menuRef, triggerRef, clickOutsideEvent, closeMenu, disableClickOutside);\n\n\tconst handleMenuKeyUp = (e: React.KeyboardEvent) => {\n\t\tconst actions: ActionType[] = ['ArrowUp', 'ArrowDown', 'ArrowRight', 'Enter', 'Escape', ' '];\n\n\t\tif (actions.includes(e.key as ActionType)) {\n\t\t\tpreventDefault(e);\n\t\t}\n\t};\n\n\t/**\n\t * Focus management when someone is using a keyboard to navigate the menu\n\t * @param e - keyboard event\n\t */\n\tconst handleMenuKey = (e: React.KeyboardEvent) => {\n\t\tconst currentIndex = menuItems.findIndex((item) => document.activeElement === item);\n\t\tlet nextIndex: number;\n\n\t\tif (state.isOpen) {\n\t\t\tswitch (e.key) {\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\tnextIndex = currentIndex < menuItems.length - 1 ? currentIndex + 1 : currentIndex;\n\t\t\t\t\tmenuItems[nextIndex]?.focus();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\tnextIndex = currentIndex > 0 ? currentIndex - 1 : 0;\n\t\t\t\t\tmenuItems[nextIndex]?.focus();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowRight':\n\t\t\t\tcase 'ArrowLeft':\n\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Escape':\n\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\ttriggerRef?.current?.focus();\n\t\t\t\t\tcloseMenu(false);\n\t\t\t\t\tbreak;\n\n\t\t\t\tcase 'Tab':\n\t\t\t\t\tif (!isSubMenu && position !== 'static') {\n\t\t\t\t\t\tif (e.shiftKey) {\n\t\t\t\t\t\t\t// Handle shift + tab: move focus to the previous item\n\t\t\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\t\t\tif (triggerRef) {\n\t\t\t\t\t\t\t\tconst prevElement = findAdjacentInteractiveElement(triggerRef, 'previous');\n\t\t\t\t\t\t\t\tprevElement?.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Regular tab: close the menu or move to the next item\n\t\t\t\t\t\t\tpreventDefault(e);\n\t\t\t\t\t\t\tif (triggerRef) {\n\t\t\t\t\t\t\t\tconst nextElement = findAdjacentInteractiveElement(triggerRef);\n\t\t\t\t\t\t\t\tnextElement?.focus();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcloseMenu();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * useEffect hooks to handle menu state changes\n\t */\n\n\tReact.useEffect(() => {\n\t\tif (triggerRef?.current) {\n\t\t\ttriggerRef.current.setAttribute('aria-haspopup', 'menu');\n\t\t}\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, []);\n\n\tReact.useEffect(() => {\n\t\tif (position === 'static') {\n\t\t\tsetState({ actionType: 'click', isOpen: true });\n\t\t}\n\t}, [position]);\n\n\tReact.useEffect(() => {\n\t\ttriggerRef?.current?.setAttribute('aria-expanded', state.isOpen.toString());\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [state.isOpen]);\n\n\tReact.useEffect(() => {\n\t\tif (!isSubMenu && position !== 'static')\n\t\t\tsetState({ actionType: actionState.actionType, isOpen: actionState.isOpen });\n\t}, [actionState.isOpen, actionState.actionType, isSubMenu, position]);\n\n\t// setup event handlers for mouse, keyboard, and scroll interactions\n\tReact.useEffect(() => {\n\t\tconst triggerElement = triggerRef?.current;\n\t\tconst menuElement = menuRef?.current;\n\t\tconst menuItems = menuElement?.querySelectorAll(MENU_ITEM_SELECTOR);\n\n\t\tlet scrollableParent: HTMLElement | Window;\n\n\t\tif (triggerElement) {\n\t\t\ttriggerElement.addEventListener('mousedown', preventDefault);\n\t\t\tif (!isSubMenu) triggerElement.addEventListener('click', toggleMenuTrigger);\n\t\t\ttriggerElement.addEventListener('keydown', toggleMenuKey);\n\n\t\t\t// Setup event listeners for when the menu is a submenu\n\t\t\tif (isSubMenu) {\n\t\t\t\ttriggerElement.addEventListener('mouseover', showMenuHover);\n\t\t\t\ttriggerElement.addEventListener('mouseout', hideMenuHover);\n\n\t\t\t\tif (isTouchDevice()) {\n\t\t\t\t\ttriggerElement.addEventListener('touchend', showMenuTap);\n\t\t\t\t}\n\n\t\t\t\tif (menuElement) {\n\t\t\t\t\tmenuElement.addEventListener('mouseover', showMenuHover);\n\t\t\t\t\tmenuElement.addEventListener('mouseout', hideMenuHover);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (closeOnScroll) {\n\t\t\t\tscrollableParent = getScrollableParent(triggerElement);\n\t\t\t\tif (scrollableParent) {\n\t\t\t\t\tscrollableParent.addEventListener('scroll', () => closeMenu(), {\n\t\t\t\t\t\tcapture: true,\n\t\t\t\t\t\tpassive: true\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn () => {\n\t\t\t\ttriggerElement.removeEventListener('mousedown', preventDefault);\n\t\t\t\tif (!isSubMenu) triggerElement.removeEventListener('click', toggleMenuTrigger);\n\t\t\t\ttriggerElement.removeEventListener('keydown', toggleMenuKey);\n\n\t\t\t\tif (menuItems) {\n\t\t\t\t\tmenuItems.forEach((item: Element) => {\n\t\t\t\t\t\tif (!item.getAttribute('aria-haspopup')) {\n\t\t\t\t\t\t\titem.removeEventListener('mousedown', () => closeMenu());\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tif (isSubMenu) {\n\t\t\t\t\ttriggerElement.removeEventListener('mouseover', showMenuHover);\n\t\t\t\t\ttriggerElement.removeEventListener('mouseout', hideMenuHover);\n\n\t\t\t\t\tif (isTouchDevice()) {\n\t\t\t\t\t\ttriggerElement.removeEventListener('touchstart', showMenuHover);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (menuElement) {\n\t\t\t\t\t\tmenuElement.removeEventListener('mouseover', showMenuHover);\n\t\t\t\t\t\tmenuElement.removeEventListener('mouseout', hideMenuHover);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (closeOnScroll && scrollableParent) {\n\t\t\t\t\tscrollableParent.removeEventListener('scroll', () => closeMenu());\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\t}, [\n\t\tcloseOnScroll,\n\t\tisSubMenu,\n\t\ttriggerRef,\n\t\ttoggleMenuTrigger,\n\t\ttoggleMenuKey,\n\t\tshowMenuHover,\n\t\thideMenuHover,\n\t\tcloseMenu,\n\t\tshowMenuTap\n\t]);\n\n\t// This use effect handles a few things when we open the menu:\n\t// - making sure that the menu component is aware of it's menu items\n\t// - adding a class to the trigger element when the submenu is open for styling\n\t// - storing the menu rect in state for positioning calculations\n\tReact.useEffect(() => {\n\t\tif (state.isOpen) {\n\t\t\tconst foundMenuItems = Array.from(\n\t\t\t\tmenuRef.current?.querySelectorAll(MENU_ITEM_SELECTOR) || []\n\t\t\t) as HTMLButtonElement[];\n\n\t\t\tsetMenuItems(foundMenuItems);\n\t\t}\n\n\t\tif (state.isOpen && isSubMenu) {\n\t\t\ttriggerRef?.current?.classList.add(itemStyles['MrlMenuItem--item--submenuOpen']);\n\t\t} else if (!state.isOpen && isSubMenu) {\n\t\t\ttriggerRef?.current?.classList.remove(itemStyles['MrlMenuItem--item--submenuOpen']);\n\t\t}\n\n\t\t// For consistent submenu calculations, we are storing the menu rect in state\n\t\t// Anytime we need to use the menu rect, we want to make sure the values are based\n\t\t// on the original state of the menu for proper transformations\n\t\tif (!menuRect && menuRef.current) {\n\t\t\tconst newRect = menuRef.current?.getBoundingClientRect();\n\t\t\tsetMenuRect(newRect || null);\n\t\t}\n\n\t\t// eslint-disable-next-line react-hooks/exhaustive-deps\n\t}, [state.isOpen, menuRect, isSubMenu]);\n\n\t/**\n\t * Focus management for when the menu is opening or closing\n\t */\n\tReact.useEffect(() => {\n\t\tif (menuItems.length > 0) {\n\t\t\tlet menuItemToFocus;\n\n\t\t\tswitch (state.actionType) {\n\t\t\t\tcase 'Enter':\n\t\t\t\tcase 'ArrowDown':\n\t\t\t\tcase ' ':\n\t\t\t\t\tmenuItemToFocus = menuItems[0];\n\t\t\t\t\tmenuItemToFocus?.focus();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'ArrowUp':\n\t\t\t\t\tmenuItemToFocus = menuItems[menuItems.length - 1];\n\t\t\t\t\tmenuItemToFocus?.focus();\n\n\t\t\t\t\t// Scroll to the bottom of the menu when the last item is focused\n\t\t\t\t\t// setTimeout is required to ensure the element has been rendered\n\t\t\t\t\t// and the scrollHeight is accurate prior to scrolling\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (listRef.current) {\n\t\t\t\t\t\t\tlistRef.current.scrollTo(0, listRef.current.scrollHeight);\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 20);\n\t\t\t}\n\n\t\t\tif (isSubMenu && state.actionType === 'ArrowRight') {\n\t\t\t\tmenuItemToFocus = menuItems[0];\n\t\t\t\tmenuItemToFocus?.focus();\n\t\t\t}\n\t\t}\n\t}, [isSubMenu, menuItems, state.actionType]);\n\n\t/**\n\t * Menu scroll behavior\n\t *\n\t * When the menu cannot fit in the preferred or flipped position,\n\t * this hook constrains the menu height and enables internal scrolling.\n\t * Called before useTriggerPosition so that isScrolling can disable flipping,\n\t * preventing the positioning hook from fighting the scroll constraint.\n\t */\n\tconst disableMenuScroll =\n\t\tisSubMenu || !state.isOpen || position === 'static' || position === 'ignore';\n\n\t/**\n\t * Sets overflow (scrolling) on menu when there is no space to display\n\t * the menu in the preferred or flipped position.\n\t */\n\tconst menuScroll = useMenuScroll(\n\t\ttriggerRef,\n\t\tlistRef,\n\t\tposition,\n\t\tmenuOffset,\n\t\tstate.isOpen,\n\t\tdisableMenuScroll\n\t);\n\n\t/**\n\t * Primary menu positioning, alignment, and transition styling\n\t *\n\t * This hook is only enabled if isSubMenu is FALSE\n\t */\n\tconst disableTriggerPosition = isSubMenu || !state.isOpen || position === 'static';\n\tconst menuPositionStyles = useTriggerPosition(\n\t\ttriggerRef,\n\t\tmenuRef,\n\t\t{\n\t\t\talign: alignment,\n\t\t\tcustomPosition: customPosition,\n\t\t\tposition: position\n\t\t},\n\t\tstate.isOpen,\n\t\tmenuOffset,\n\t\tdisableTriggerPosition,\n\t\tdisableFlipping || menuScroll.isScrolling\n\t);\n\n\t/**\n\t * Submenu positioning and alignment\n\t *\n\t * This hook is only enabled if isSubMenu is TRUE\n\t */\n\tconst subMenuPosition = useSubMenuElementPosition(\n\t\ttriggerRef,\n\t\tmenuRef,\n\t\tisSubMenu,\n\t\tstate.isOpen,\n\t\tmenuRect,\n\t\t// disable the subelement positioning if it's not a submenu\n\t\t!isSubMenu\n\t);\n\n\tconst inlineStyles = {\n\t\tmenu: {\n\t\t\tleft: menuPositionStyles.left,\n\t\t\tposition: 'fixed' as const,\n\t\t\ttop: menuPositionStyles.top\n\t\t},\n\t\tsubmenu: {\n\t\t\tleft: subMenuPosition.left,\n\t\t\ttop: subMenuPosition.top\n\t\t}\n\t};\n\n\t/**\n\t * React Spring transitions for the menu\n\t */\n\tconst transitionConfig = {\n\t\tconfig: { duration: state.isOpen ? 300 : 150 },\n\t\tenter: { opacity: 1, transform: 'translateY(0)' },\n\t\tfrom: { opacity: 0, transform: 'translateY(4px)' },\n\t\tleave: { opacity: 0, transform: 'translateY(4px)' }\n\t};\n\n\tconst transitionStatic = {\n\t\tconfig: { duration: 0 },\n\t\tenter: { opacity: 1, transform: 'translateY(0)' }\n\t};\n\n\tconst transitions = useTransition(\n\t\tstate.isOpen,\n\t\tposition === 'static' ? transitionStatic : transitionConfig\n\t);\n\n\tconst menuClasses = classnames(styles['MrlMenu'], 'MrlMenu', {\n\t\t[styles['MrlMenu--submenu']]: isSubMenu,\n\t\t[styles.open]: state.isOpen,\n\t\t[styles['MrlMenu--compact']]: spacing === 'compact',\n\t\t[styles['MrlMenu--static']]: position === 'static',\n\t\t[styles['MrlMenu--internal']]: isInternal,\n\t\t[styles['MrlMenu--scrolling']]: menuScroll.isScrolling,\n\t\t[styles['MrlMenu--ignore']]: position === 'ignore'\n\t});\n\n\tconst positionStyles = isSubMenu\n\t\t? inlineStyles.submenu\n\t\t: position !== 'static'\n\t\t\t? inlineStyles.menu\n\t\t\t: {};\n\n\tconst menuScrollStyles =\n\t\t(menuScroll.maxHeight !== undefined && { maxHeight: menuScroll.maxHeight }) || undefined;\n\n\tconst renderMenu = () => {\n\t\treturn (\n\t\t\t<>\n\t\t\t\t{transitions(\n\t\t\t\t\t(style, item) =>\n\t\t\t\t\t\titem && (\n\t\t\t\t\t\t\t<animated.div\n\t\t\t\t\t\t\t\tclassName={menuClasses}\n\t\t\t\t\t\t\t\tid={id}\n\t\t\t\t\t\t\t\tstyle={{ ...positionStyles, ...style }}\n\t\t\t\t\t\t\t\tonKeyUp={handleMenuKeyUp}\n\t\t\t\t\t\t\t\tonKeyDown={handleMenuKey}\n\t\t\t\t\t\t\t\tref={menuRef}\n\t\t\t\t\t\t\t\trole=\"none\"\n\t\t\t\t\t\t\t\t{...remainingProps}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<ul ref={listRef} role=\"menu\" style={menuScrollStyles}>\n\t\t\t\t\t\t\t\t\t{children}\n\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t</animated.div>\n\t\t\t\t\t\t)\n\t\t\t\t)}\n\t\t\t</>\n\t\t);\n\t};\n\n\t// For managing and restoring focus to the original menu trigger\n\t// Ensures the triggerRef in context is always the parent triggerRef\n\tconst parentContext = React.useContext(MrlMenuContext);\n\tconst contextTriggerRef = isSubMenu ? parentContext?.triggerRef : triggerRef;\n\n\treturn (\n\t\t<MrlMenuContext.Provider\n\t\t\tvalue={{\n\t\t\t\tcloseMenu,\n\t\t\t\tcloseParent: !isSubMenu ? closeMenu : undefined,\n\t\t\t\ttriggerRef: contextTriggerRef\n\t\t\t}}\n\t\t>\n\t\t\t{isSubMenu || position === 'static' ? (\n\t\t\t\trenderMenu()\n\t\t\t) : (\n\t\t\t\t<MrlPortal layer={portalProps.layer || PORTAL_LAYERS.MENU} {...portalProps}>\n\t\t\t\t\t{renderMenu()}\n\t\t\t\t</MrlPortal>\n\t\t\t)}\n\t\t</MrlMenuContext.Provider>\n\t);\n\t/* eslint-enable */\n}\n\nMrlMenu.componentType = 'Menu';\n"],"names":["MENU_ITEM_SELECTOR","MrlMenu","_ref","_ref$actionState","actionState","actionType","isOpen","_ref$alignment","alignment","children","_ref$closeOnScroll","closeOnScroll","closeParent","customPosition","_ref$clickOutsideEven","clickOutsideEvent","disableArrowOpen","_ref$disableFlipping","disableFlipping","id","_ref$isInternal","isInternal","_ref$isSubMenu","isSubMenu","_ref$spacing","spacing","_ref$menuOffset","menuOffset","_ref$portalProps","portalProps","PORTAL_LAYERS","MENU","name","_ref$position","position","_ref$triggerStopPropa","triggerStopPropagation","onClose","eventId","triggerRef","remainingProps","_objectWithoutProperties","_excluded","defaultOpenState","_React$useState","React","useState","_React$useState2","_slicedToArray","state","setState","trackInteraction","useMrlTrackInteraction","wasOpenRef","useRef","useEffect","_state$actionType","current","action","metadata","trigger","variant","menuRef","listRef","_React$useState3","_React$useState4","menuItems","setMenuItems","_React$useState5","_React$useState6","menuRect","setMenuRect","isTriggerDisabled","useCallback","isElementAriaDisabled","toggleMenuTrigger","e","preventDefault","prevState","showMenuHover","showMenuTap","hideMenuHover","event","relatedTarget","contains","toggleMenuKey","openMenu","key","closeMenu","shouldCloseParent","arguments","length","undefined","disableClickOutside","useClickOutside","handleMenuKeyUp","actions","includes","handleMenuKey","_menuItems$nextIndex","_menuItems$nextIndex2","_triggerRef$current","currentIndex","findIndex","item","document","activeElement","nextIndex","focus","shiftKey","prevElement","findAdjacentInteractiveElement","nextElement","setAttribute","_triggerRef$current2","toString","triggerElement","menuElement","querySelectorAll","scrollableParent","addEventListener","isTouchDevice","getScrollableParent","capture","passive","removeEventListener","forEach","getAttribute","_menuRef$current","foundMenuItems","Array","from","_triggerRef$current3","classList","add","itemStyles","_triggerRef$current4","remove","_menuRef$current2","newRect","getBoundingClientRect","_menuItemToFocus","_menuItemToFocus2","menuItemToFocus","setTimeout","scrollTo","scrollHeight","_menuItemToFocus3","disableMenuScroll","menuScroll","useMenuScroll","disableTriggerPosition","menuPositionStyles","useTriggerPosition","align","isScrolling","subMenuPosition","useSubMenuElementPosition","inlineStyles","menu","left","top","submenu","transitionConfig","config","duration","enter","opacity","transform","leave","transitionStatic","transitions","useTransition","menuClasses","classnames","styles","open","positionStyles","menuScrollStyles","maxHeight","renderMenu","createElement","Fragment","style","animated","div","_extends","className","_objectSpread","onKeyUp","onKeyDown","ref","role","parentContext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B;AACD;AAEAnL,OAAO,CAACwM,aAAa,GAAG,MAAM;;;;"}
|
package/dist/cjs/version.js
CHANGED
package/dist/cjs/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sources":["../../src/version.ts"],"sourcesContent":["export const TOOLKIT_VERSION = \"4.76.1
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../../src/version.ts"],"sourcesContent":["export const TOOLKIT_VERSION = \"4.76.1\";"],"names":["TOOLKIT_VERSION"],"mappings":";;AAAO,IAAMA,eAAe,GAAG;;;;"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { LayoutComponent } from '../../layout/constants';
|
|
2
|
+
import { GridColumns } from '../constants';
|
|
3
|
+
type MrlCol = LayoutComponent & GridColumns;
|
|
3
4
|
/**
|
|
4
|
-
* MrlCol React component.
|
|
5
|
+
* MrlCol React component.
|
|
5
6
|
* @param props - component props
|
|
6
7
|
* @returns a MrlCol React component.
|
|
7
8
|
*/
|
|
8
|
-
export declare function MrlCol(
|
|
9
|
+
export declare function MrlCol(props: MrlCol): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { MrlCol } from './MrlCol';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LayoutComponent } from '../../layout/constants';
|
|
2
|
+
import '../grid.variables.scss';
|
|
2
3
|
import '../grid.global.scss';
|
|
3
|
-
export type MrlGridProps = GridBaseProps;
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* MrlCol React component.
|
|
6
6
|
* @param props - component props
|
|
7
|
-
* @returns a
|
|
7
|
+
* @returns a MrlCol React component.
|
|
8
8
|
*/
|
|
9
|
-
export declare function MrlGrid({ children, className, ...rest }:
|
|
9
|
+
export declare function MrlGrid({ children, className, ...rest }: LayoutComponent): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { MrlGrid } from './MrlGrid';
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { LayoutComponent } from '../../layout/constants';
|
|
2
|
+
import { AlignOptions, GutterSizes, JustifyOptions } from '../constants';
|
|
3
|
+
interface MrlRow extends LayoutComponent {
|
|
3
4
|
/**
|
|
4
5
|
* Flex alignment of the children within the component.
|
|
5
6
|
*/
|
|
6
7
|
align?: AlignOptions;
|
|
7
8
|
/**
|
|
8
|
-
* Gutter size for columns within the row
|
|
9
|
-
*
|
|
10
|
-
* @default 1
|
|
9
|
+
* Gutter size for columns within the row
|
|
11
10
|
*/
|
|
12
11
|
gutter?: GutterSizes;
|
|
13
12
|
/**
|
|
@@ -16,8 +15,9 @@ export interface MrlRowProps extends GridBaseProps {
|
|
|
16
15
|
justify?: JustifyOptions;
|
|
17
16
|
}
|
|
18
17
|
/**
|
|
19
|
-
* MrlRow React component.
|
|
18
|
+
* MrlRow React component.
|
|
20
19
|
* @param props - component props
|
|
21
20
|
* @returns a MrlRow React component.
|
|
22
21
|
*/
|
|
23
|
-
export declare function MrlRow({ align, children, className,
|
|
22
|
+
export declare function MrlRow({ align, children, className, justify, ...rest }: MrlRow): JSX.Element;
|
|
23
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { MrlRow } from './MrlRow';
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import { DataQa } from '../../utils/dataQa';
|
|
2
1
|
/**
|
|
3
2
|
* Alignment & justification options for grid containers
|
|
4
3
|
*/
|
|
5
4
|
export type AlignOptions = 'start' | 'center' | 'end';
|
|
6
5
|
export type JustifyOptions = 'start' | 'center' | 'end' | 'between' | 'around';
|
|
7
6
|
/**
|
|
8
|
-
*
|
|
9
|
-
* always occupies at least one of the twelve tracks.
|
|
7
|
+
* Available grid sizes
|
|
10
8
|
*/
|
|
11
|
-
export
|
|
9
|
+
export declare const GridSizes: string[];
|
|
12
10
|
/**
|
|
13
|
-
* Number of columns
|
|
14
|
-
* larger breakpoint cancels an offset inherited from a smaller one.
|
|
11
|
+
* Number of columns that will be span on the grid.
|
|
15
12
|
*/
|
|
16
|
-
export type
|
|
13
|
+
export type NumCols = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
17
14
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* The type of classes that can be configured based on the bootstrap API.
|
|
16
|
+
* Current supported:
|
|
17
|
+
* - columns "col-<size>-<number>"
|
|
18
|
+
* - offsets "offset-<size>-<number>""
|
|
20
19
|
*/
|
|
21
|
-
|
|
20
|
+
type GridClass = 'col' | 'offset';
|
|
22
21
|
/**
|
|
23
|
-
* Interface of available class selectors
|
|
22
|
+
* Interface of available class selectors based on GridClass
|
|
24
23
|
*
|
|
25
24
|
* Example interface:
|
|
26
25
|
* {
|
|
@@ -29,13 +28,12 @@ export type NumCols = 0 | ColSpan;
|
|
|
29
28
|
* }
|
|
30
29
|
*/
|
|
31
30
|
type GridClassConfig = {
|
|
32
|
-
|
|
33
|
-
offset?: OffsetSpan;
|
|
31
|
+
[key in GridClass]?: NumCols;
|
|
34
32
|
};
|
|
35
33
|
/**
|
|
36
34
|
* Options to configure the number of columns to span on different screen sizes.
|
|
37
35
|
*/
|
|
38
|
-
type ColumnConfig =
|
|
36
|
+
type ColumnConfig = NumCols | 'auto' | GridClassConfig | undefined;
|
|
39
37
|
export interface GridColumns {
|
|
40
38
|
col?: ColumnConfig;
|
|
41
39
|
xs?: ColumnConfig;
|
|
@@ -45,46 +43,8 @@ export interface GridColumns {
|
|
|
45
43
|
xl?: ColumnConfig;
|
|
46
44
|
xxl?: ColumnConfig;
|
|
47
45
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Breakpoint keys in ascending order. Drives both class generation and the
|
|
50
|
-
* filtering that keeps grid props from reaching the DOM.
|
|
51
|
-
*/
|
|
52
|
-
export declare const GRID_SIZE_KEYS: readonly ["col", "xs", "sm", "md", "lg", "xl", "xxl"];
|
|
53
46
|
/**
|
|
54
47
|
* Available gutter sizes for customizing the grid
|
|
55
48
|
*/
|
|
56
49
|
export type GutterSizes = 0 | 1 | 2;
|
|
57
|
-
/**
|
|
58
|
-
* Gutter size to modifier class. `1` is the default declared on `.row`, so it
|
|
59
|
-
* needs no class.
|
|
60
|
-
*/
|
|
61
|
-
export declare const GUTTER_CLASS: Record<GutterSizes, string | undefined>;
|
|
62
|
-
/**
|
|
63
|
-
* Roles a generic layout wrapper may safely carry.
|
|
64
|
-
*
|
|
65
|
-
* Composite widget roles (`grid`, `row`, `gridcell`, `listbox`, `tablist`, …)
|
|
66
|
-
* are deliberately excluded: they promise an APG keyboard contract — roving
|
|
67
|
-
* tabindex or `aria-activedescendant`, arrow-key navigation, selection state —
|
|
68
|
-
* that these divs do not implement. The roles below are structural only and
|
|
69
|
-
* carry no interaction contract, so they are safe to forward.
|
|
70
|
-
*
|
|
71
|
-
* `list`/`listitem` in particular is how a row of columns is announced as
|
|
72
|
-
* "list, N items", and is the standard workaround for Safari/VoiceOver
|
|
73
|
-
* dropping implicit list semantics. `region` needs an accessible name to be
|
|
74
|
-
* exposed as a landmark; the type cannot enforce that.
|
|
75
|
-
*
|
|
76
|
-
* Page landmarks belong to the layout components (MrlMain, MrlPage).
|
|
77
|
-
*/
|
|
78
|
-
export type SafeLayoutRole = 'group' | 'list' | 'listitem' | 'none' | 'presentation' | 'region';
|
|
79
|
-
/**
|
|
80
|
-
* Shared props for the grid components: every `div` attribute, with `role`
|
|
81
|
-
* narrowed to {@link SafeLayoutRole}.
|
|
82
|
-
*/
|
|
83
|
-
export type GridBaseProps = Omit<React.ComponentPropsWithoutRef<'div'>, 'role'> & DataQa & {
|
|
84
|
-
/**
|
|
85
|
-
* Structural role for the wrapper. Composite widget roles are not
|
|
86
|
-
* accepted — see {@link SafeLayoutRole}.
|
|
87
|
-
*/
|
|
88
|
-
role?: SafeLayoutRole;
|
|
89
|
-
};
|
|
90
50
|
export {};
|
|
@@ -75,12 +75,18 @@ export interface MrlMenuProps {
|
|
|
75
75
|
*/
|
|
76
76
|
position?: MenuPosition;
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* Opens or closes the menu from outside. Not just an initial value: whenever
|
|
79
|
+
* `isOpen` or `actionType` changes, the menu syncs its internal state to it.
|
|
80
|
+
* The menu can still close itself (item select, click outside, Escape, Tab),
|
|
81
|
+
* so pair this with `onClose` to reset your state. Prefer `triggerRef` when
|
|
82
|
+
* there is a trigger element. Ignored for submenus and `position="static"`.
|
|
79
83
|
* @default { actionType: null, isOpen: false }
|
|
80
84
|
*/
|
|
81
85
|
actionState?: ActionState;
|
|
82
86
|
/**
|
|
83
|
-
* Reference to the DOM element that triggers this menu.
|
|
87
|
+
* Reference to the DOM element that triggers this menu. This alone wires up
|
|
88
|
+
* click and keyboard open/close and the trigger's ARIA attributes; no
|
|
89
|
+
* `actionState` or `onClick` toggle is needed.
|
|
84
90
|
*/
|
|
85
91
|
triggerRef?: React.RefObject<HTMLButtonElement>;
|
|
86
92
|
/**
|
|
@@ -101,7 +107,8 @@ export interface MrlMenuProps {
|
|
|
101
107
|
*/
|
|
102
108
|
alignment?: MenuAlignment;
|
|
103
109
|
/**
|
|
104
|
-
*
|
|
110
|
+
* Called when the menu closes itself: item select, click outside, Escape, Tab,
|
|
111
|
+
* or scroll with `closeOnScroll`. Not called when a trigger click toggles it closed.
|
|
105
112
|
* @param type - type of close event
|
|
106
113
|
*/
|
|
107
114
|
onClose?: (type?: string) => void;
|
|
@@ -47,7 +47,7 @@ var _excluded = ["accept", "className", "errorMessage", "eventId", "fileName", "
|
|
|
47
47
|
* @returns The MrlFileUpload component.
|
|
48
48
|
*/
|
|
49
49
|
function MrlFileUpload(props) {
|
|
50
|
-
var _ref
|
|
50
|
+
var _ref;
|
|
51
51
|
var _props$accept = props.accept,
|
|
52
52
|
accept = _props$accept === void 0 ? fileUploadDefaults.accept : _props$accept,
|
|
53
53
|
className = props.className,
|
|
@@ -103,7 +103,10 @@ function MrlFileUpload(props) {
|
|
|
103
103
|
// A disabled zone outranks both — it cannot have accepted a file.
|
|
104
104
|
var effectiveState = isDisabled ? 'disabled' : validationError ? 'error' : state;
|
|
105
105
|
var displayName = (_ref = fileName !== null && fileName !== void 0 ? fileName : selectedName) !== null && _ref !== void 0 ? _ref : '';
|
|
106
|
-
|
|
106
|
+
// `||` rather than `??`: an empty message is as good as no message, and has
|
|
107
|
+
// to fall through — to the consumer's `errorMessage`, and then to the
|
|
108
|
+
// default below — or an errored zone renders with no text at all.
|
|
109
|
+
var displayError = validationError || errorMessage || null;
|
|
107
110
|
// An errored zone always carries text. The types forbid reporting 'error'
|
|
108
111
|
// without a message, but a JavaScript consumer can still reach it, and colour
|
|
109
112
|
// alone reaches neither assistive technology nor anyone who cannot see the hue.
|