import{defineProperty as e}from"../../../../../_virtual/_rollupPluginBabelHelpers.js";import{useRef as o,useCallback as r,useMemo as n}from"react";import t from"classnames";import s from"./useIconScreenReaderAccessProps.js";import{noop as a}from"es-toolkit";import c from"../Icon.module.scss.js";import{keyCodes as l}from"../../../../../shared/dist/constants/keyCodes.js";import{useEventListener as i}from"../../../../../shared/dist/hooks/useEventListener.js";import{useKeyEvent as m}from"../../../../../shared/dist/hooks/useKeyEvent.js";var u=[l.ENTER,l.SPACE];function f(l){var f=l.onClick,p=l.className,d=l.clickable,k=l.ignoreFocusStyle,b=l.isDecorationOnly,v=l.iconLabel,y=l.externalTabIndex,C=o(null),E=r((function(e){document.activeElement===C.current&&f(e)}),[C,f]),j=r((function(e){e.preventDefault()}),[]),P=n((function(){return t(c.icon,p,e(e({},c.clickable,d),c.noFocusStyle,k))}),[d,p,k]);i({eventName:"mousedown",callback:j,ref:C}),m({keys:u,ref:C,callback:E,ignoreDocumentFallback:!0,capture:!0,stopPropagation:!0,preventDefault:!0});var h=r((function(e){(f||a)(e)}),[f]),x=s({isClickable:d,label:v,isDecorationOnly:b});return x.tabIndex=null!=y?y:x.tabIndex,{screenReaderAccessProps:x,onClickCallback:h,computedClassName:P,onEnterCallback:E,iconRef:C}}export{f as default};
//# sourceMappingURL=useIconProps.js.map
