{"ast":null,"code":"'use client';\n\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { unstable_useForkRef as useForkRef, unstable_useId as useId } from '@mui/utils';\nimport { extractEventHandlers } from '../utils/extractEventHandlers';\nimport { useListItem } from '../useList';\nimport { useCompoundItem } from '../useCompound';\nimport { useButton } from '../useButton';\nimport { combineHooksSlotProps } from '../utils/combineHooksSlotProps';\n/**\n *\n * Demos:\n *\n * - [Select](https://mui.com/base-ui/react-select/#hooks)\n *\n * API:\n *\n * - [useOption API](https://mui.com/base-ui/react-select/hooks-api/#use-option)\n */\nexport function useOption(params) {\n const {\n value,\n label,\n disabled,\n rootRef: optionRefParam,\n id: idParam\n } = params;\n const {\n getRootProps: getListItemProps,\n highlighted,\n selected\n } = useListItem({\n item: value\n });\n const {\n getRootProps: getButtonProps,\n rootRef: buttonRefHandler\n } = useButton({\n disabled,\n focusableWhenDisabled: true\n });\n const id = useId(idParam);\n const optionRef = React.useRef(null);\n const selectOption = React.useMemo(() => ({\n disabled,\n label,\n value,\n ref: optionRef,\n id\n }), [disabled, label, value, id]);\n const {\n index\n } = useCompoundItem(value, selectOption);\n const handleRef = useForkRef(optionRefParam, optionRef, buttonRefHandler);\n const createHandleKeyDown = otherHandlers => event => {\n var _otherHandlers$onKeyD;\n (_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event);\n if (event.defaultMuiPrevented) {\n return;\n }\n if ([' ', 'Enter'].includes(event.key)) {\n event.defaultMuiPrevented = true; // prevent listbox onKeyDown\n }\n };\n const getOwnHandlers = (otherHandlers = {}) => ({\n onKeyDown: createHandleKeyDown(otherHandlers)\n });\n return {\n getRootProps: (externalProps = {}) => {\n const externalEventHandlers = extractEventHandlers(externalProps);\n const getCombinedRootProps = combineHooksSlotProps(getListItemProps, combineHooksSlotProps(getButtonProps, getOwnHandlers));\n return _extends({}, externalProps, externalEventHandlers, getCombinedRootProps(externalEventHandlers), {\n id,\n ref: handleRef,\n role: 'option',\n 'aria-selected': selected\n });\n },\n highlighted,\n index,\n selected,\n rootRef: handleRef\n };\n}","map":{"version":3,"names":["_extends","React","unstable_useForkRef","useForkRef","unstable_useId","useId","extractEventHandlers","useListItem","useCompoundItem","useButton","combineHooksSlotProps","useOption","params","value","label","disabled","rootRef","optionRefParam","id","idParam","getRootProps","getListItemProps","highlighted","selected","item","getButtonProps","buttonRefHandler","focusableWhenDisabled","optionRef","useRef","selectOption","useMemo","ref","index","handleRef","createHandleKeyDown","otherHandlers","event","_otherHandlers$onKeyD","onKeyDown","call","defaultMuiPrevented","includes","key","getOwnHandlers","externalProps","externalEventHandlers","getCombinedRootProps","role"],"sources":["/home/gnx/Desktop/ETB/ETB-FrontEnd/node_modules/@mui/base/useOption/useOption.js"],"sourcesContent":["'use client';\n\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport * as React from 'react';\nimport { unstable_useForkRef as useForkRef, unstable_useId as useId } from '@mui/utils';\nimport { extractEventHandlers } from '../utils/extractEventHandlers';\nimport { useListItem } from '../useList';\nimport { useCompoundItem } from '../useCompound';\nimport { useButton } from '../useButton';\nimport { combineHooksSlotProps } from '../utils/combineHooksSlotProps';\n/**\n *\n * Demos:\n *\n * - [Select](https://mui.com/base-ui/react-select/#hooks)\n *\n * API:\n *\n * - [useOption API](https://mui.com/base-ui/react-select/hooks-api/#use-option)\n */\nexport function useOption(params) {\n const {\n value,\n label,\n disabled,\n rootRef: optionRefParam,\n id: idParam\n } = params;\n const {\n getRootProps: getListItemProps,\n highlighted,\n selected\n } = useListItem({\n item: value\n });\n const {\n getRootProps: getButtonProps,\n rootRef: buttonRefHandler\n } = useButton({\n disabled,\n focusableWhenDisabled: true\n });\n const id = useId(idParam);\n const optionRef = React.useRef(null);\n const selectOption = React.useMemo(() => ({\n disabled,\n label,\n value,\n ref: optionRef,\n id\n }), [disabled, label, value, id]);\n const {\n index\n } = useCompoundItem(value, selectOption);\n const handleRef = useForkRef(optionRefParam, optionRef, buttonRefHandler);\n const createHandleKeyDown = otherHandlers => event => {\n var _otherHandlers$onKeyD;\n (_otherHandlers$onKeyD = otherHandlers.onKeyDown) == null || _otherHandlers$onKeyD.call(otherHandlers, event);\n if (event.defaultMuiPrevented) {\n return;\n }\n if ([' ', 'Enter'].includes(event.key)) {\n event.defaultMuiPrevented = true; // prevent listbox onKeyDown\n }\n };\n const getOwnHandlers = (otherHandlers = {}) => ({\n onKeyDown: createHandleKeyDown(otherHandlers)\n });\n return {\n getRootProps: (externalProps = {}) => {\n const externalEventHandlers = extractEventHandlers(externalProps);\n const getCombinedRootProps = combineHooksSlotProps(getListItemProps, combineHooksSlotProps(getButtonProps, getOwnHandlers));\n return _extends({}, externalProps, externalEventHandlers, getCombinedRootProps(externalEventHandlers), {\n id,\n ref: handleRef,\n role: 'option',\n 'aria-selected': selected\n });\n },\n highlighted,\n index,\n selected,\n rootRef: handleRef\n };\n}"],"mappings":"AAAA,YAAY;;AAEZ,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,mBAAmB,IAAIC,UAAU,EAAEC,cAAc,IAAIC,KAAK,QAAQ,YAAY;AACvF,SAASC,oBAAoB,QAAQ,+BAA+B;AACpE,SAASC,WAAW,QAAQ,YAAY;AACxC,SAASC,eAAe,QAAQ,gBAAgB;AAChD,SAASC,SAAS,QAAQ,cAAc;AACxC,SAASC,qBAAqB,QAAQ,gCAAgC;AACtE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,SAASA,CAACC,MAAM,EAAE;EAChC,MAAM;IACJC,KAAK;IACLC,KAAK;IACLC,QAAQ;IACRC,OAAO,EAAEC,cAAc;IACvBC,EAAE,EAAEC;EACN,CAAC,GAAGP,MAAM;EACV,MAAM;IACJQ,YAAY,EAAEC,gBAAgB;IAC9BC,WAAW;IACXC;EACF,CAAC,GAAGhB,WAAW,CAAC;IACdiB,IAAI,EAAEX;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