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