You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
12 KiB
1 line
12 KiB
{"ast":null,"code":"const _excluded = [\"children\"];\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n return target;\n}\nimport { useContext, useRef } from 'react';\nimport * as React from 'react';\nimport useCallbackRef from '@restart/hooks/useCallbackRef';\nimport DropdownContext from './DropdownContext';\nimport usePopper from './usePopper';\nimport useClickOutside from './useClickOutside';\nimport mergeOptionsWithPopperConfig from './mergeOptionsWithPopperConfig';\nimport { Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst noop = () => {};\n/**\n * @memberOf Dropdown\n * @param {object} options\n * @param {boolean} options.flip Automatically adjust the menu `drop` position based on viewport edge detection\n * @param {[number, number]} options.offset Define an offset distance between the Menu and the Toggle\n * @param {boolean} options.show Display the menu manually, ignored in the context of a `Dropdown`\n * @param {boolean} options.usePopper opt in/out of using PopperJS to position menus. When disabled you must position it yourself.\n * @param {string} options.rootCloseEvent The pointer event to listen for when determining \"clicks outside\" the menu for triggering a close.\n * @param {object} options.popperConfig Options passed to the [`usePopper`](/api/usePopper) hook.\n */\n\nexport function useDropdownMenu() {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n const context = useContext(DropdownContext);\n const [arrowElement, attachArrowRef] = useCallbackRef();\n const hasShownRef = useRef(false);\n const {\n flip,\n offset,\n rootCloseEvent,\n fixed = false,\n placement: placementOverride,\n popperConfig = {},\n enableEventListeners = true,\n usePopper: shouldUsePopper = !!context\n } = options;\n const show = (context == null ? void 0 : context.show) == null ? !!options.show : context.show;\n if (show && !hasShownRef.current) {\n hasShownRef.current = true;\n }\n const handleClose = e => {\n context == null ? void 0 : context.toggle(false, e);\n };\n const {\n placement,\n setMenu,\n menuElement,\n toggleElement\n } = context || {};\n const popper = usePopper(toggleElement, menuElement, mergeOptionsWithPopperConfig({\n placement: placementOverride || placement || 'bottom-start',\n enabled: shouldUsePopper,\n enableEvents: enableEventListeners == null ? show : enableEventListeners,\n offset,\n flip,\n fixed,\n arrowElement,\n popperConfig\n }));\n const menuProps = Object.assign({\n ref: setMenu || noop,\n 'aria-labelledby': toggleElement == null ? void 0 : toggleElement.id\n }, popper.attributes.popper, {\n style: popper.styles.popper\n });\n const metadata = {\n show,\n placement,\n hasShown: hasShownRef.current,\n toggle: context == null ? void 0 : context.toggle,\n popper: shouldUsePopper ? popper : null,\n arrowProps: shouldUsePopper ? Object.assign({\n ref: attachArrowRef\n }, popper.attributes.arrow, {\n style: popper.styles.arrow\n }) : {}\n };\n useClickOutside(menuElement, handleClose, {\n clickTrigger: rootCloseEvent,\n disabled: !show\n });\n return [menuProps, metadata];\n}\nconst defaultProps = {\n usePopper: true\n};\n\n/**\n * Also exported as `<Dropdown.Menu>` from `Dropdown`.\n *\n * @displayName DropdownMenu\n * @memberOf Dropdown\n */\nfunction DropdownMenu(_ref) {\n let {\n children\n } = _ref,\n options = _objectWithoutPropertiesLoose(_ref, _excluded);\n const [props, meta] = useDropdownMenu(options);\n return /*#__PURE__*/_jsx(_Fragment, {\n children: children(props, meta)\n });\n}\nDropdownMenu.displayName = 'DropdownMenu';\nDropdownMenu.defaultProps = defaultProps;\n/** @component */\n\nexport default DropdownMenu;","map":{"version":3,"names":["_excluded","_objectWithoutPropertiesLoose","source","excluded","target","sourceKeys","Object","keys","key","i","length","indexOf","useContext","useRef","React","useCallbackRef","DropdownContext","usePopper","useClickOutside","mergeOptionsWithPopperConfig","Fragment","_Fragment","jsx","_jsx","noop","useDropdownMenu","options","context","arrowElement","attachArrowRef","hasShownRef","flip","offset","rootCloseEvent","fixed","placement","placementOverride","popperConfig","enableEventListeners","shouldUsePopper","show","current","handleClose","e","toggle","setMenu","menuElement","toggleElement","popper","enabled","enableEvents","menuProps","assign","ref","id","attributes","style","styles","metadata","hasShown","arrowProps","arrow","clickTrigger","disabled","defaultProps","DropdownMenu","_ref","children","props","meta","displayName"],"sources":["C:/Cours/SAE/SAE-3.01/Scripted/Scripted/website/node_modules/@restart/ui/esm/DropdownMenu.js"],"sourcesContent":["const _excluded = [\"children\"];\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport { useContext, useRef } from 'react';\nimport * as React from 'react';\nimport useCallbackRef from '@restart/hooks/useCallbackRef';\nimport DropdownContext from './DropdownContext';\nimport usePopper from './usePopper';\nimport useClickOutside from './useClickOutside';\nimport mergeOptionsWithPopperConfig from './mergeOptionsWithPopperConfig';\nimport { Fragment as _Fragment } from \"react/jsx-runtime\";\nimport { jsx as _jsx } from \"react/jsx-runtime\";\n\nconst noop = () => {};\n/**\n * @memberOf Dropdown\n * @param {object} options\n * @param {boolean} options.flip Automatically adjust the menu `drop` position based on viewport edge detection\n * @param {[number, number]} options.offset Define an offset distance between the Menu and the Toggle\n * @param {boolean} options.show Display the menu manually, ignored in the context of a `Dropdown`\n * @param {boolean} options.usePopper opt in/out of using PopperJS to position menus. When disabled you must position it yourself.\n * @param {string} options.rootCloseEvent The pointer event to listen for when determining \"clicks outside\" the menu for triggering a close.\n * @param {object} options.popperConfig Options passed to the [`usePopper`](/api/usePopper) hook.\n */\n\n\nexport function useDropdownMenu(options = {}) {\n const context = useContext(DropdownContext);\n const [arrowElement, attachArrowRef] = useCallbackRef();\n const hasShownRef = useRef(false);\n const {\n flip,\n offset,\n rootCloseEvent,\n fixed = false,\n placement: placementOverride,\n popperConfig = {},\n enableEventListeners = true,\n usePopper: shouldUsePopper = !!context\n } = options;\n const show = (context == null ? void 0 : context.show) == null ? !!options.show : context.show;\n\n if (show && !hasShownRef.current) {\n hasShownRef.current = true;\n }\n\n const handleClose = e => {\n context == null ? void 0 : context.toggle(false, e);\n };\n\n const {\n placement,\n setMenu,\n menuElement,\n toggleElement\n } = context || {};\n const popper = usePopper(toggleElement, menuElement, mergeOptionsWithPopperConfig({\n placement: placementOverride || placement || 'bottom-start',\n enabled: shouldUsePopper,\n enableEvents: enableEventListeners == null ? show : enableEventListeners,\n offset,\n flip,\n fixed,\n arrowElement,\n popperConfig\n }));\n const menuProps = Object.assign({\n ref: setMenu || noop,\n 'aria-labelledby': toggleElement == null ? void 0 : toggleElement.id\n }, popper.attributes.popper, {\n style: popper.styles.popper\n });\n const metadata = {\n show,\n placement,\n hasShown: hasShownRef.current,\n toggle: context == null ? void 0 : context.toggle,\n popper: shouldUsePopper ? popper : null,\n arrowProps: shouldUsePopper ? Object.assign({\n ref: attachArrowRef\n }, popper.attributes.arrow, {\n style: popper.styles.arrow\n }) : {}\n };\n useClickOutside(menuElement, handleClose, {\n clickTrigger: rootCloseEvent,\n disabled: !show\n });\n return [menuProps, metadata];\n}\nconst defaultProps = {\n usePopper: true\n};\n\n/**\n * Also exported as `<Dropdown.Menu>` from `Dropdown`.\n *\n * @displayName DropdownMenu\n * @memberOf Dropdown\n */\nfunction DropdownMenu(_ref) {\n let {\n children\n } = _ref,\n options = _objectWithoutPropertiesLoose(_ref, _excluded);\n\n const [props, meta] = useDropdownMenu(options);\n return /*#__PURE__*/_jsx(_Fragment, {\n children: children(props, meta)\n });\n}\n\nDropdownMenu.displayName = 'DropdownMenu';\nDropdownMenu.defaultProps = defaultProps;\n/** @component */\n\nexport default DropdownMenu;"],"mappings":"AAAA,MAAMA,SAAS,GAAG,CAAC,UAAU,CAAC;AAE9B,SAASC,6BAA6B,CAACC,MAAM,EAAEC,QAAQ,EAAE;EAAE,IAAID,MAAM,IAAI,IAAI,EAAE,OAAO,CAAC,CAAC;EAAE,IAAIE,MAAM,GAAG,CAAC,CAAC;EAAE,I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