import{R as p,r as c,j as e,ak as f,B as i,al as b}from"./index-8cf47a1c.js";import{T}from"./Toggle-cc905705.js";import{I as y}from"./Input-6985be35.js";import{Z as v,a as h}from"./ZapAnimated-d32c4141.js";const S="_ToggleSwitch_10mtp_1",w="_slider_10mtp_28",j={ToggleSwitch:S,slider:w};function L({options:t,value:n,name:x,onChange:u}){const d=c.useMemo(()=>t.map(s=>s.value).indexOf(n),[t,n]),r=c.useCallback(s=>{const a=Math.floor(100/t.length);if(s===t.length-1)return 100-t.length*a+a;if(s>-1)return a},[t]),g=c.useMemo(()=>({width:r(d)+"%",left:d*r(0)+"%"}),[d,r]);return e.jsxs("div",{className:j.ToggleSwitch,children:[e.jsx("div",{className:j.slider,style:g}),t.map((s,a)=>{const o=`${x}-${s.label}`,m=a===0?"":"border-left";return e.jsxs("label",{htmlFor:o,className:m,style:{width:r(a)+"%"},children:[e.jsx("input",{id:o,name:x,type:"radio",value:s.value,checked:n===s.value,onChange:u}),e.jsx("div",{children:s.label})]},o)})]})}const R=p.memo(L),_=()=>{},P={padding:"20px 0"},k=[{label:"Global",value:"Global"},{label:"Rule",value:"Rule"},{label:"Direct",value:"Direct"}],l=({children:t,style:n})=>e.jsx("div",{style:{...P,...n},children:t});class G extends c.PureComponent{render(){return e.jsxs("div",{children:[e.jsx(l,{children:e.jsx(f,{})}),e.jsxs(l,{children:[e.jsx(T,{id:"t0"}),e.jsx("label",{htmlFor:"t0",style:{paddingLeft:12},children:"Toggle Me"})]}),e.jsx(l,{children:e.jsx("input",{})}),e.jsx(l,{children:e.jsx(v,{})}),e.jsx(l,{children:e.jsx(y,{})}),e.jsx(l,{children:e.jsx(R,{name:"test",options:k,value:"Rule",onChange:_})}),e.jsxs(l,{children:[e.jsx(i,{text:"Test Lxatency",start:e.jsx(h,{size:16})}),e.jsx(i,{text:"Test Lxatency",start:e.jsx(h,{size:16}),isLoading:!0}),e.jsx(i,{label:"Test Lxatency"}),e.jsx(i,{label:"Button Plain",kind:"minimal"})]}),e.jsx(l,{style:{paddingLeft:20},children:e.jsx(b,{})})]})}}export{G as default};
