"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var c=require("../../_virtual/jsx-runtime.js"),r=require("react"),l=require("./styles.js"),o=require("../../utils/index.js"),S=require("./components/segment/Segment.js");const j="6px 60px",E="2px 62px",f=28,h=44;function I(t,i){return t||(i==="small"?E:j)}function L(t){const{active:i,className:g,onClick:m=o.noop,segmentList:d,size:n="large",segmentPadding:x}=t,u=r.useRef(null),v=o.getId(t["data-testid"]),[e,p]=r.useState(),[a,R]=r.useState({height:n==="small"?f:h,left:0,width:0});return r.useEffect(()=>{e&&e.current&&R({left:e.current.offsetLeft,width:e.current.offsetWidth,height:e.current.offsetHeight})},[u.current,e==null?void 0:e.current,d,n]),c.jsxRuntimeExports.jsxs(l.Wrapper,{className:g,ref:u,height:n==="small"?f:h,"data-testid":t["data-testid"],"data-trackid":t["data-trackid"],children:[d.map(s=>c.jsxRuntimeExports.jsx(S.Segment,{segment:s,active:i.value===s.value,size:n,setActiveRef:p,segmentPadding:I(x,n),onChange:m},s.value)),c.jsxRuntimeExports.jsxs(l.Indicator,{width:a.width,left:a.left,height:a.height,title:i.tooltip,"data-testid":v("indicator"),children:[i.icon&&i.icon,i.label]})]})}exports.SegmentedControl=L;
