1 line
37 KiB
JSON
1 line
37 KiB
JSON
{"ast":null,"code":"'use client';\n\n/* eslint-disable consistent-return, jsx-a11y/no-noninteractive-tabindex */\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { exactProp, elementAcceptingRef, unstable_useForkRef as useForkRef, unstable_ownerDocument as ownerDocument } from '@mui/utils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\n// Inspired by https://github.com/focus-trap/tabbable\nconst candidatesSelector = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable=\"false\"])'].join(',');\nfunction getTabIndex(node) {\n const tabindexAttr = parseInt(node.getAttribute('tabindex') || '', 10);\n if (!Number.isNaN(tabindexAttr)) {\n return tabindexAttr;\n }\n\n // Browsers do not return `tabIndex` correctly for contentEditable nodes;\n // https://bugs.chromium.org/p/chromium/issues/detail?id=661108&q=contenteditable%20tabindex&can=2\n // so if they don't have a tabindex attribute specifically set, assume it's 0.\n // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default\n // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,\n // yet they are still part of the regular tab order; in FF, they get a default\n // `tabIndex` of 0; since Chrome still puts those elements in the regular tab\n // order, consider their tab index to be 0.\n if (node.contentEditable === 'true' || (node.nodeName === 'AUDIO' || node.nodeName === 'VIDEO' || node.nodeName === 'DETAILS') && node.getAttribute('tabindex') === null) {\n return 0;\n }\n return node.tabIndex;\n}\nfunction isNonTabbableRadio(node) {\n if (node.tagName !== 'INPUT' || node.type !== 'radio') {\n return false;\n }\n if (!node.name) {\n return false;\n }\n const getRadio = selector => node.ownerDocument.querySelector(`input[type=\"radio\"]${selector}`);\n let roving = getRadio(`[name=\"${node.name}\"]:checked`);\n if (!roving) {\n roving = getRadio(`[name=\"${node.name}\"]`);\n }\n return roving !== node;\n}\nfunction isNodeMatchingSelectorFocusable(node) {\n if (node.disabled || node.tagName === 'INPUT' && node.type === 'hidden' || isNonTabbableRadio(node)) {\n return false;\n }\n return true;\n}\nfunction defaultGetTabbable(root) {\n const regularTabNodes = [];\n const orderedTabNodes = [];\n Array.from(root.querySelectorAll(candidatesSelector)).forEach((node, i) => {\n const nodeTabIndex = getTabIndex(node);\n if (nodeTabIndex === -1 || !isNodeMatchingSelectorFocusable(node)) {\n return;\n }\n if (nodeTabIndex === 0) {\n regularTabNodes.push(node);\n } else {\n orderedTabNodes.push({\n documentOrder: i,\n tabIndex: nodeTabIndex,\n node: node\n });\n }\n });\n return orderedTabNodes.sort((a, b) => a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex).map(a => a.node).concat(regularTabNodes);\n}\nfunction defaultIsEnabled() {\n return true;\n}\n\n/**\n * Utility component that locks focus inside the component.\n *\n * Demos:\n *\n * - [Focus Trap](https://mui.com/base-ui/react-focus-trap/)\n *\n * API:\n *\n * - [FocusTrap API](https://mui.com/base-ui/react-focus-trap/components-api/#focus-trap)\n */\nfunction FocusTrap(props) {\n const {\n children,\n disableAutoFocus = false,\n disableEnforceFocus = false,\n disableRestoreFocus = false,\n getTabbable = defaultGetTabbable,\n isEnabled = defaultIsEnabled,\n open\n } = props;\n const ignoreNextEnforceFocus = React.useRef(false);\n const sentinelStart = React.useRef(null);\n const sentinelEnd = React.useRef(null);\n const nodeToRestore = React.useRef(null);\n const reactFocusEventTarget = React.useRef(null);\n // This variable is useful when disableAutoFocus is true.\n // It waits for the active element to move into the component to activate.\n const activated = React.useRef(false);\n const rootRef = React.useRef(null);\n // @ts-expect-error TODO upstream fix\n const handleRef = useForkRef(children.ref, rootRef);\n const lastKeydown = React.useRef(null);\n React.useEffect(() => {\n // We might render an empty child.\n if (!open || !rootRef.current) {\n return;\n }\n activated.current = !disableAutoFocus;\n }, [disableAutoFocus, open]);\n React.useEffect(() => {\n // We might render an empty child.\n if (!open || !rootRef.current) {\n return;\n }\n const doc = ownerDocument(rootRef.current);\n if (!rootRef.current.contains(doc.activeElement)) {\n if (!rootRef.current.hasAttribute('tabIndex')) {\n if (process.env.NODE_ENV !== 'production') {\n console.error(['MUI: The modal content node does not accept focus.', 'For the benefit of assistive technologies, ' + 'the tabIndex of the node is being set to \"-1\".'].join('\\n'));\n }\n rootRef.current.setAttribute('tabIndex', '-1');\n }\n if (activated.current) {\n rootRef.current.focus();\n }\n }\n return () => {\n // restoreLastFocus()\n if (!disableRestoreFocus) {\n // In IE11 it is possible for document.activeElement to be null resulting\n // in nodeToRestore.current being null.\n // Not all elements in IE11 have a focus method.\n // Once IE11 support is dropped the focus() call can be unconditional.\n if (nodeToRestore.current && nodeToRestore.current.focus) {\n ignoreNextEnforceFocus.current = true;\n nodeToRestore.current.focus();\n }\n nodeToRestore.current = null;\n }\n };\n // Missing `disableRestoreFocus` which is fine.\n // We don't support changing that prop on an open FocusTrap\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n React.useEffect(() => {\n // We might render an empty child.\n if (!open || !rootRef.current) {\n return;\n }\n const doc = ownerDocument(rootRef.current);\n const loopFocus = nativeEvent => {\n lastKeydown.current = nativeEvent;\n if (disableEnforceFocus || !isEnabled() || nativeEvent.key !== 'Tab') {\n return;\n }\n\n // Make sure the next tab starts from the right place.\n // doc.activeElement refers to the origin.\n if (doc.activeElement === rootRef.current && nativeEvent.shiftKey) {\n // We need to ignore the next contain as\n // it will try to move the focus back to the rootRef element.\n ignoreNextEnforceFocus.current = true;\n if (sentinelEnd.current) {\n sentinelEnd.current.focus();\n }\n }\n };\n const contain = () => {\n const rootElement = rootRef.current;\n\n // Cleanup functions are executed lazily in React 17.\n // Contain can be called between the component being unmounted and its cleanup function being run.\n if (rootElement === null) {\n return;\n }\n if (!doc.hasFocus() || !isEnabled() || ignoreNextEnforceFocus.current) {\n ignoreNextEnforceFocus.current = false;\n return;\n }\n\n // The focus is already inside\n if (rootElement.contains(doc.activeElement)) {\n return;\n }\n\n // The disableEnforceFocus is set and the focus is outside of the focus trap (and sentinel nodes)\n if (disableEnforceFocus && doc.activeElement !== sentinelStart.current && doc.activeElement !== sentinelEnd.current) {\n return;\n }\n\n // if the focus event is not coming from inside the children's react tree, reset the refs\n if (doc.activeElement !== reactFocusEventTarget.current) {\n reactFocusEventTarget.current = null;\n } else if (reactFocusEventTarget.current !== null) {\n return;\n }\n if (!activated.current) {\n return;\n }\n let tabbable = [];\n if (doc.activeElement === sentinelStart.current || doc.activeElement === sentinelEnd.current) {\n tabbable = getTabbable(rootRef.current);\n }\n\n // one of the sentinel nodes was focused, so move the focus\n // to the first/last tabbable element inside the focus trap\n if (tabbable.length > 0) {\n var _lastKeydown$current, _lastKeydown$current2;\n const isShiftTab = Boolean(((_lastKeydown$current = lastKeydown.current) == null ? void 0 : _lastKeydown$current.shiftKey) && ((_lastKeydown$current2 = lastKeydown.current) == null ? void 0 : _lastKeydown$current2.key) === 'Tab');\n const focusNext = tabbable[0];\n const focusPrevious = tabbable[tabbable.length - 1];\n if (typeof focusNext !== 'string' && typeof focusPrevious !== 'string') {\n if (isShiftTab) {\n focusPrevious.focus();\n } else {\n focusNext.focus();\n }\n }\n // no tabbable elements in the trap focus or the focus was outside of the focus trap\n } else {\n rootElement.focus();\n }\n };\n doc.addEventListener('focusin', contain);\n doc.addEventListener('keydown', loopFocus, true);\n\n // With Edge, Safari and Firefox, no focus related events are fired when the focused area stops being a focused area.\n // for example https://bugzilla.mozilla.org/show_bug.cgi?id=559561.\n // Instead, we can look if the active element was restored on the BODY element.\n //\n // The whatwg spec defines how the browser should behave but does not explicitly mention any events:\n // https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule.\n const interval = setInterval(() => {\n if (doc.activeElement && doc.activeElement.tagName === 'BODY') {\n contain();\n }\n }, 50);\n return () => {\n clearInterval(interval);\n doc.removeEventListener('focusin', contain);\n doc.removeEventListener('keydown', loopFocus, true);\n };\n }, [disableAutoFocus, disableEnforceFocus, disableRestoreFocus, isEnabled, open, getTabbable]);\n const onFocus = event => {\n if (nodeToRestore.current === null) {\n nodeToRestore.current = event.relatedTarget;\n }\n activated.current = true;\n reactFocusEventTarget.current = event.target;\n const childrenPropsHandler = children.props.onFocus;\n if (childrenPropsHandler) {\n childrenPropsHandler(event);\n }\n };\n const handleFocusSentinel = event => {\n if (nodeToRestore.current === null) {\n nodeToRestore.current = event.relatedTarget;\n }\n activated.current = true;\n };\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [/*#__PURE__*/_jsx(\"div\", {\n tabIndex: open ? 0 : -1,\n onFocus: handleFocusSentinel,\n ref: sentinelStart,\n \"data-testid\": \"sentinelStart\"\n }), /*#__PURE__*/React.cloneElement(children, {\n ref: handleRef,\n onFocus\n }), /*#__PURE__*/_jsx(\"div\", {\n tabIndex: open ? 0 : -1,\n onFocus: handleFocusSentinel,\n ref: sentinelEnd,\n \"data-testid\": \"sentinelEnd\"\n })]\n });\n}\nprocess.env.NODE_ENV !== \"production\" ? FocusTrap.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * A single child content element.\n */\n children: elementAcceptingRef,\n /**\n * If `true`, the focus trap will not automatically shift focus to itself when it opens, and\n * replace it to the last focused element when it closes.\n * This also works correctly with any focus trap children that have the `disableAutoFocus` prop.\n *\n * Generally this should never be set to `true` as it makes the focus trap less\n * accessible to assistive technologies, like screen readers.\n * @default false\n */\n disableAutoFocus: PropTypes.bool,\n /**\n * If `true`, the focus trap will not prevent focus from leaving the focus trap while open.\n *\n * Generally this should never be set to `true` as it makes the focus trap less\n * accessible to assistive technologies, like screen readers.\n * @default false\n */\n disableEnforceFocus: PropTypes.bool,\n /**\n * If `true`, the focus trap will not restore focus to previously focused element once\n * focus trap is hidden or unmounted.\n * @default false\n */\n disableRestoreFocus: PropTypes.bool,\n /**\n * Returns an array of ordered tabbable nodes (i.e. in tab order) within the root.\n * For instance, you can provide the \"tabbable\" npm dependency.\n * @param {HTMLElement} root\n */\n getTabbable: PropTypes.func,\n /**\n * This prop extends the `open` prop.\n * It allows to toggle the open state without having to wait for a rerender when changing the `open` prop.\n * This prop should be memoized.\n * It can be used to support multiple focus trap mounted at the same time.\n * @default function defaultIsEnabled(): boolean {\n * return true;\n * }\n */\n isEnabled: PropTypes.func,\n /**\n * If `true`, focus is locked.\n */\n open: PropTypes.bool.isRequired\n} : void 0;\nif (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n FocusTrap['propTypes' + ''] = exactProp(FocusTrap.propTypes);\n}\nexport { FocusTrap };","map":{"version":3,"names":["React","PropTypes","exactProp","elementAcceptingRef","unstable_useForkRef","useForkRef","unstable_ownerDocument","ownerDocument","jsx","_jsx","jsxs","_jsxs","candidatesSelector","join","getTabIndex","node","tabindexAttr","parseInt","getAttribute","Number","isNaN","contentEditable","nodeName","tabIndex","isNonTabbableRadio","tagName","type","name","getRadio","selector","querySelector","roving","isNodeMatchingSelectorFocusable","disabled","defaultGetTabbable","root","regularTabNodes","orderedTabNodes","Array","from","querySelectorAll","forEach","i","nodeTabIndex","push","documentOrder","sort","a","b","map","concat","defaultIsEnabled","FocusTrap","props","children","disableAutoFocus","disableEnforceFocus","disableRestoreFocus","getTabbable","isEnabled","open","ignoreNextEnforceFocus","useRef","sentinelStart","sentinelEnd","nodeToRestore","reactFocusEventTarget","activated","rootRef","handleRef","ref","lastKeydown","useEffect","current","doc","contains","activeElement","hasAttribute","process","env","NODE_ENV","console","error","setAttribute","focus","loopFocus","nativeEvent","key","shiftKey","contain","rootElement","hasFocus","tabbable","length","_lastKeydown$current","_lastKeydown$current2","isShiftTab","Boolean","focusNext","focusPrevious","addEventListener","interval","setInterval","clearInterval","removeEventListener","onFocus","event","relatedTarget","target","childrenPropsHandler","handleFocusSentinel","Fragment","cloneElement","propTypes","bool","func","isRequired"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/base/FocusTrap/FocusTrap.js"],"sourcesContent":["'use client';\n\n/* eslint-disable consistent-return, jsx-a11y/no-noninteractive-tabindex */\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport { exactProp, elementAcceptingRef, unstable_useForkRef as useForkRef, unstable_ownerDocument as ownerDocument } from '@mui/utils';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nimport { jsxs as _jsxs } from \"react/jsx-runtime\";\n// Inspired by https://github.com/focus-trap/tabbable\nconst candidatesSelector = ['input', 'select', 'textarea', 'a[href]', 'button', '[tabindex]', 'audio[controls]', 'video[controls]', '[contenteditable]:not([contenteditable=\"false\"])'].join(',');\nfunction getTabIndex(node) {\n const tabindexAttr = parseInt(node.getAttribute('tabindex') || '', 10);\n if (!Number.isNaN(tabindexAttr)) {\n return tabindexAttr;\n }\n\n // Browsers do not return `tabIndex` correctly for contentEditable nodes;\n // https://bugs.chromium.org/p/chromium/issues/detail?id=661108&q=contenteditable%20tabindex&can=2\n // so if they don't have a tabindex attribute specifically set, assume it's 0.\n // in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default\n // `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,\n // yet they are still part of the regular tab order; in FF, they get a default\n // `tabIndex` of 0; since Chrome still puts those elements in the regular tab\n // order, consider their tab index to be 0.\n if (node.contentEditable === 'true' || (node.nodeName === 'AUDIO' || node.nodeName === 'VIDEO' || node.nodeName === 'DETAILS') && node.getAttribute('tabindex') === null) {\n return 0;\n }\n return node.tabIndex;\n}\nfunction isNonTabbableRadio(node) {\n if (node.tagName !== 'INPUT' || node.type !== 'radio') {\n return false;\n }\n if (!node.name) {\n return false;\n }\n const getRadio = selector => node.ownerDocument.querySelector(`input[type=\"radio\"]${selector}`);\n let roving = getRadio(`[name=\"${node.name}\"]:checked`);\n if (!roving) {\n roving = getRadio(`[name=\"${node.name}\"]`);\n }\n return roving !== node;\n}\nfunction isNodeMatchingSelectorFocusable(node) {\n if (node.disabled || node.tagName === 'INPUT' && node.type === 'hidden' || isNonTabbableRadio(node)) {\n return false;\n }\n return true;\n}\nfunction defaultGetTabbable(root) {\n const regularTabNodes = [];\n const orderedTabNodes = [];\n Array.from(root.querySelectorAll(candidatesSelector)).forEach((node, i) => {\n const nodeTabIndex = getTabIndex(node);\n if (nodeTabIndex === -1 || !isNodeMatchingSelectorFocusable(node)) {\n return;\n }\n if (nodeTabIndex === 0) {\n regularTabNodes.push(node);\n } else {\n orderedTabNodes.push({\n documentOrder: i,\n tabIndex: nodeTabIndex,\n node: node\n });\n }\n });\n return orderedTabNodes.sort((a, b) => a.tabIndex === b.tabIndex ? a.documentOrder - b.documentOrder : a.tabIndex - b.tabIndex).map(a => a.node).concat(regularTabNodes);\n}\nfunction defaultIsEnabled() {\n return true;\n}\n\n/**\n * Utility component that locks focus inside the component.\n *\n * Demos:\n *\n * - [Focus Trap](https://mui.com/base-ui/react-focus-trap/)\n *\n * API:\n *\n * - [FocusTrap API](https://mui.com/base-ui/react-focus-trap/components-api/#focus-trap)\n */\nfunction FocusTrap(props) {\n const {\n children,\n disableAutoFocus = false,\n disableEnforceFocus = false,\n disableRestoreFocus = false,\n getTabbable = defaultGetTabbable,\n isEnabled = defaultIsEnabled,\n open\n } = props;\n const ignoreNextEnforceFocus = React.useRef(false);\n const sentinelStart = React.useRef(null);\n const sentinelEnd = React.useRef(null);\n const nodeToRestore = React.useRef(null);\n const reactFocusEventTarget = React.useRef(null);\n // This variable is useful when disableAutoFocus is true.\n // It waits for the active element to move into the component to activate.\n const activated = React.useRef(false);\n const rootRef = React.useRef(null);\n // @ts-expect-error TODO upstream fix\n const handleRef = useForkRef(children.ref, rootRef);\n const lastKeydown = React.useRef(null);\n React.useEffect(() => {\n // We might render an empty child.\n if (!open || !rootRef.current) {\n return;\n }\n activated.current = !disableAutoFocus;\n }, [disableAutoFocus, open]);\n React.useEffect(() => {\n // We might render an empty child.\n if (!open || !rootRef.current) {\n return;\n }\n const doc = ownerDocument(rootRef.current);\n if (!rootRef.current.contains(doc.activeElement)) {\n if (!rootRef.current.hasAttribute('tabIndex')) {\n if (process.env.NODE_ENV !== 'production') {\n console.error(['MUI: The modal content node does not accept focus.', 'For the benefit of assistive technologies, ' + 'the tabIndex of the node is being set to \"-1\".'].join('\\n'));\n }\n rootRef.current.setAttribute('tabIndex', '-1');\n }\n if (activated.current) {\n rootRef.current.focus();\n }\n }\n return () => {\n // restoreLastFocus()\n if (!disableRestoreFocus) {\n // In IE11 it is possible for document.activeElement to be null resulting\n // in nodeToRestore.current being null.\n // Not all elements in IE11 have a focus method.\n // Once IE11 support is dropped the focus() call can be unconditional.\n if (nodeToRestore.current && nodeToRestore.current.focus) {\n ignoreNextEnforceFocus.current = true;\n nodeToRestore.current.focus();\n }\n nodeToRestore.current = null;\n }\n };\n // Missing `disableRestoreFocus` which is fine.\n // We don't support changing that prop on an open FocusTrap\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [open]);\n React.useEffect(() => {\n // We might render an empty child.\n if (!open || !rootRef.current) {\n return;\n }\n const doc = ownerDocument(rootRef.current);\n const loopFocus = nativeEvent => {\n lastKeydown.current = nativeEvent;\n if (disableEnforceFocus || !isEnabled() || nativeEvent.key !== 'Tab') {\n return;\n }\n\n // Make sure the next tab starts from the right place.\n // doc.activeElement refers to the origin.\n if (doc.activeElement === rootRef.current && nativeEvent.shiftKey) {\n // We need to ignore the next contain as\n // it will try to move the focus back to the rootRef element.\n ignoreNextEnforceFocus.current = true;\n if (sentinelEnd.current) {\n sentinelEnd.current.focus();\n }\n }\n };\n const contain = () => {\n const rootElement = rootRef.current;\n\n // Cleanup functions are executed lazily in React 17.\n // Contain can be called between the component being unmounted and its cleanup function being run.\n if (rootElement === null) {\n return;\n }\n if (!doc.hasFocus() || !isEnabled() || ignoreNextEnforceFocus.current) {\n ignoreNextEnforceFocus.current = false;\n return;\n }\n\n // The focus is already inside\n if (rootElement.contains(doc.activeElement)) {\n return;\n }\n\n // The disableEnforceFocus is set and the focus is outside of the focus trap (and sentinel nodes)\n if (disableEnforceFocus && doc.activeElement !== sentinelStart.current && doc.activeElement !== sentinelEnd.current) {\n return;\n }\n\n // if the focus event is not coming from inside the children's react tree, reset the refs\n if (doc.activeElement !== reactFocusEventTarget.current) {\n reactFocusEventTarget.current = null;\n } else if (reactFocusEventTarget.current !== null) {\n return;\n }\n if (!activated.current) {\n return;\n }\n let tabbable = [];\n if (doc.activeElement === sentinelStart.current || doc.activeElement === sentinelEnd.current) {\n tabbable = getTabbable(rootRef.current);\n }\n\n // one of the sentinel nodes was focused, so move the focus\n // to the first/last tabbable element inside the focus trap\n if (tabbable.length > 0) {\n var _lastKeydown$current, _lastKeydown$current2;\n const isShiftTab = Boolean(((_lastKeydown$current = lastKeydown.current) == null ? void 0 : _lastKeydown$current.shiftKey) && ((_lastKeydown$current2 = lastKeydown.current) == null ? void 0 : _lastKeydown$current2.key) === 'Tab');\n const focusNext = tabbable[0];\n const focusPrevious = tabbable[tabbable.length - 1];\n if (typeof focusNext !== 'string' && typeof focusPrevious !== 'string') {\n if (isShiftTab) {\n focusPrevious.focus();\n } else {\n focusNext.focus();\n }\n }\n // no tabbable elements in the trap focus or the focus was outside of the focus trap\n } else {\n rootElement.focus();\n }\n };\n doc.addEventListener('focusin', contain);\n doc.addEventListener('keydown', loopFocus, true);\n\n // With Edge, Safari and Firefox, no focus related events are fired when the focused area stops being a focused area.\n // for example https://bugzilla.mozilla.org/show_bug.cgi?id=559561.\n // Instead, we can look if the active element was restored on the BODY element.\n //\n // The whatwg spec defines how the browser should behave but does not explicitly mention any events:\n // https://html.spec.whatwg.org/multipage/interaction.html#focus-fixup-rule.\n const interval = setInterval(() => {\n if (doc.activeElement && doc.activeElement.tagName === 'BODY') {\n contain();\n }\n }, 50);\n return () => {\n clearInterval(interval);\n doc.removeEventListener('focusin', contain);\n doc.removeEventListener('keydown', loopFocus, true);\n };\n }, [disableAutoFocus, disableEnforceFocus, disableRestoreFocus, isEnabled, open, getTabbable]);\n const onFocus = event => {\n if (nodeToRestore.current === null) {\n nodeToRestore.current = event.relatedTarget;\n }\n activated.current = true;\n reactFocusEventTarget.current = event.target;\n const childrenPropsHandler = children.props.onFocus;\n if (childrenPropsHandler) {\n childrenPropsHandler(event);\n }\n };\n const handleFocusSentinel = event => {\n if (nodeToRestore.current === null) {\n nodeToRestore.current = event.relatedTarget;\n }\n activated.current = true;\n };\n return /*#__PURE__*/_jsxs(React.Fragment, {\n children: [/*#__PURE__*/_jsx(\"div\", {\n tabIndex: open ? 0 : -1,\n onFocus: handleFocusSentinel,\n ref: sentinelStart,\n \"data-testid\": \"sentinelStart\"\n }), /*#__PURE__*/React.cloneElement(children, {\n ref: handleRef,\n onFocus\n }), /*#__PURE__*/_jsx(\"div\", {\n tabIndex: open ? 0 : -1,\n onFocus: handleFocusSentinel,\n ref: sentinelEnd,\n \"data-testid\": \"sentinelEnd\"\n })]\n });\n}\nprocess.env.NODE_ENV !== \"production\" ? FocusTrap.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * A single child content element.\n */\n children: elementAcceptingRef,\n /**\n * If `true`, the focus trap will not automatically shift focus to itself when it opens, and\n * replace it to the last focused element when it closes.\n * This also works correctly with any focus trap children that have the `disableAutoFocus` prop.\n *\n * Generally this should never be set to `true` as it makes the focus trap less\n * accessible to assistive technologies, like screen readers.\n * @default false\n */\n disableAutoFocus: PropTypes.bool,\n /**\n * If `true`, the focus trap will not prevent focus from leaving the focus trap while open.\n *\n * Generally this should never be set to `true` as it makes the focus trap less\n * accessible to assistive technologies, like screen readers.\n * @default false\n */\n disableEnforceFocus: PropTypes.bool,\n /**\n * If `true`, the focus trap will not restore focus to previously focused element once\n * focus trap is hidden or unmounted.\n * @default false\n */\n disableRestoreFocus: PropTypes.bool,\n /**\n * Returns an array of ordered tabbable nodes (i.e. in tab order) within the root.\n * For instance, you can provide the \"tabbable\" npm dependency.\n * @param {HTMLElement} root\n */\n getTabbable: PropTypes.func,\n /**\n * This prop extends the `open` prop.\n * It allows to toggle the open state without having to wait for a rerender when changing the `open` prop.\n * This prop should be memoized.\n * It can be used to support multiple focus trap mounted at the same time.\n * @default function defaultIsEnabled(): boolean {\n * return true;\n * }\n */\n isEnabled: PropTypes.func,\n /**\n * If `true`, focus is locked.\n */\n open: PropTypes.bool.isRequired\n} : void 0;\nif (process.env.NODE_ENV !== 'production') {\n // eslint-disable-next-line\n FocusTrap['propTypes' + ''] = exactProp(FocusTrap.propTypes);\n}\nexport { FocusTrap };"],"mappings":"AAAA,YAAY;;AAEZ;AACA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAC9B,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,SAAS,EAAEC,mBAAmB,EAAEC,mBAAmB,IAAIC,UAAU,EAAEC,sBAAsB,IAAIC,aAAa,QAAQ,YAAY;AACvI,SAASC,GAAG,IAAIC,IAAI,QAAQ,mBAAmB;AAC/C,SAASC,IAAI,IAAIC,KAAK,QAAQ,mBAAmB;AACjD;AACA,MAAMC,kBAAkB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,kDAAkD,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;AACjM,SAASC,WAAWA,CAACC,IAAI,EAAE;EACzB,MAAMC,YAAY,GAAGC,QAAQ,CAACF,IAAI,CAACG,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC;EACtE,IAAI,CAACC,MAAM,CAACC,KAAK,CAACJ,YAAY,CAAC,EAAE;IAC/B,OAAOA,YAAY;EACrB;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,IAAID,IAAI,CAACM,eAAe,KAAK,MAAM,IAAI,CA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nF;EACA;EACA;EACA;EACA;AACF;AACA;EACE3D,QAAQ,EAAEnD,mBAAmB;EAC7B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACEoD,gBAAgB,EAAEtD,SAAS,CAACiH,IAAI;EAChC;AACF;AACA;AACA;AACA;AACA;AACA;EACE1D,mBAAmB,EAAEvD,SAAS,CAACiH,IAAI;EACnC;AACF;AACA;AACA;AACA;EACEzD,mBAAmB,EAAExD,SAAS,CAACiH,IAAI;EACnC;AACF;AACA;AACA;AACA;EACExD,WAAW,EAAEzD,SAAS,CAACkH,IAAI;EAC3B;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACExD,SAAS,EAAE1D,SAAS,CAACkH,IAAI;EACzB;AACF;AACA;EACEvD,IAAI,EAAE3D,SAAS,CAACiH,IAAI,CAACE;AACvB,CAAC,GAAG,KAAK,CAAC;AACV,IAAItC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;EACzC;EACA5B,SAAS,CAAC,WAAW,GAAG,EAAE,CAAC,GAAGlD,SAAS,CAACkD,SAAS,CAAC6D,SAAS,CAAC;AAC9D;AACA,SAAS7D,SAAS","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]} |