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{useEventListener as l}from"../../../../../shared/dist/hooks/useEventListener.js";import{useKeyEvent as i}from"../../../../../shared/dist/hooks/useKeyEvent.js";import{keyCodes as m}from"../../../../../shared/dist/constants/keyCodes.js";var u=[m.ENTER,m.SPACE];function f(m){var f=m.onClick,p=m.className,d=m.clickable,k=m.ignoreFocusStyle,b=m.isDecorationOnly,v=m.iconLabel,y=m.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]);l({eventName:"mousedown",callback:j,ref:C}),i({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
