"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("../tslib.es6-C4EgNkz1.js"),e=require("react"),E=require("classnames"),b=require("../utils-C9NL3q0j.js"),g=require("../icon-I30uh1Ov.js"),p=n=>{var{selected:l,children:s,className:u}=n,i=m.__rest(n,["selected","children","className"]);const a=b.findComponent(s,g.EbayIcon),o=()=>{const d=b.excludeComponent(s,g.EbayIcon);return e.createElement("span",{className:"segmented-buttons__button-cell"},a,e.createElement("span",null,d))};return e.createElement("li",null,e.createElement("button",Object.assign({className:E("segmented-buttons__button",u),"aria-current":l||void 0},i),a?o():s))},v=n=>{var{size:l,className:s,onChange:u=()=>{},children:i}=n,a=m.__rest(n,["size","className","onChange","children"]);const o=b.filterByType(i,p),[d,_]=e.useState(o.findIndex(t=>t.props.selected)||0),y=(t,c,r)=>{_(c),u(t,{index:c,value:r})};return e.createElement("div",Object.assign({className:E("segmented-buttons",l&&`segmented-buttons--${l}`,s)},a),e.createElement("ul",null,o.map((t,c)=>{const r=t.props,{value:h}=r,N=m.__rest(r,["value"]);return e.cloneElement(t,Object.assign(Object.assign({},N),{onClick:S=>y(S,c,h),selected:c===d}))})))};exports.EbaySegmentedButton=p;exports.EbaySegmentedButtons=v;
