"use strict";const q=require("./tslib.es6-C4EgNkz1.js"),c=require("react"),I=require("classnames"),F=require("./label-BRztS0pw.js"),j=require("./utils-C9NL3q0j.js"),O=require("./icons/ebay-icon-checkbox-checked-24/index.js"),U=require("./icons/ebay-icon-checkbox-checked-18/index.js"),w=require("./icons/ebay-icon-checkbox-unchecked-24/index.js"),D=require("./icons/ebay-icon-checkbox-unchecked-18/index.js"),K=o=>typeof o<"u",B=o=>{var{id:l,size:t="default",className:i,style:r,checked:h,defaultChecked:k=!1,onChange:u=()=>{},onFocus:b=()=>{},onKeyDown:C=()=>{},children:d,inputRef:m}=o,y=q.__rest(o,["id","size","className","style","checked","defaultChecked","onChange","onFocus","onKeyDown","children","inputRef"]);const[_,g]=c.useState(k),x=n=>{const e=n.target;u(n,{value:e?.value,checked:!!e?.checked}),g(e?.checked)},v=n=>{var e,s;return b(n,{value:(e=n.target)===null||e===void 0?void 0:e.value,checked:!!(!((s=n.target)===null||s===void 0)&&s.checked)})},E=n=>{const e=n.target;C(n,{value:e.value,checked:!!e.checked})},p=I("checkbox",i,{"checkbox--large":t==="large"}),f=t==="large"?c.createElement(O.EbayIconCheckboxChecked24,{className:"checkbox__checked"}):c.createElement(U.EbayIconCheckboxChecked18,{className:"checkbox__checked"}),N=t==="large"?c.createElement(w.EbayIconCheckboxUnchecked24,{className:"checkbox__unchecked"}):c.createElement(D.EbayIconCheckboxUnchecked18,{className:"checkbox__unchecked"}),a=j.findComponent(d,F.Label);return c.createElement(c.Fragment,null,c.createElement("span",{className:p,style:Object.assign(Object.assign({},r),{alignItems:"center"})},c.createElement("input",Object.assign({},y,{id:l,className:"checkbox__control",type:"checkbox",checked:K(h)?h:_,onChange:x,onFocus:v,onKeyDown:E,ref:m})),c.createElement("span",{className:"checkbox__icon",hidden:!0},f,N)),a?c.cloneElement(a,Object.assign(Object.assign({},a.props),{position:"end",htmlFor:l})):d)};exports.EbayCheckbox=B;
