import{defineProperty as e}from"../../_virtual/_rollupPluginBabelHelpers.js";import{jsx as s}from"react/jsx-runtime";import{forwardRef as i,useRef as o,useCallback as t}from"react";import r from"classnames";import n from"../../hooks/useMergeRefs.js";import{SIZES as a}from"../../constants/sizes.js";import{keyCodes as l}from"../../constants/keyCodes.js";import{NOOP as c}from"../../utils/function-utils.js";import"./ListItem.scss.js";function m(e){return"".concat("list-item","--").concat(e)}var d=i((function(i,d){var u,f=i.className,p=i.id,v=i.onClick,j=void 0===v?c:v,b=i.onHover,k=void 0===b?c:b,y=i.selected,g=i.disabled,x=void 0!==g&&g,C=i.size,E=void 0===C?a.SMALL:C,I=i.tabIndex,L=void 0===I?0:I,N=i.children,h=o(null),z=n({refs:[d,h]}),M=t((function(e){x||j(e,p)}),[x,j,p]),P=t((function(e){x||[l.ENTER,l.SPACE].includes(e.key)&&j(e,p)}),[x,j,p]),A=t((function(e){x||k(e,p)}),[x,k,p]);return s("div",Object.assign({ref:z,className:r("list-item",f,m(""+E),(u={},e(u,m("selected"),y&&!x),e(u,m("disabled"),x),u)),id:p,"aria-disabled":x,onClick:M,onKeyDown:P,onMouseEnter:A,onFocus:A,role:"listitem",tabIndex:L},{children:N}))}));Object.assign(d,{sizes:a,displayName:"ListItem"});var u=d;export{u as default};
