"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var b=require("../../../_virtual/jsx-runtime.js"),u=require("react"),v=require("../../../hooks/useHasFocus.js"),q=require("../../../hooks/useKeyPress.js"),E=require("../styles.js");function j({tab:e,selected:s,narrow:n,expandClickFlag:t,setSelectedRef:o,onChange:a,testId:d,trackId:l}){const r=u.useRef(null),{hasFocus:i}=v.useHasFocus(r),c=q.useKeyPress("Enter",r);return u.useEffect(()=>{s&&o(r)},[s]),u.useEffect(()=>{c&&i&&!e.disabled&&a(e)},[c,i]),u.useEffect(()=>{var f;t&&((f=r.current)==null||f.scrollIntoView())},[t]),b.jsxRuntimeExports.jsx(E.TabWrapper,{ref:r,tabIndex:0,role:"tab","aria-selected":s?"true":"false",narrow:n,selected:s,disabled:e.disabled,onClick:()=>a(e),"data-testid":d,"data-trackid":l,children:e.label})}exports.Tab=j;
