"use strict";const M=require("./tslib.es6-C4EgNkz1.js"),e=require("react"),S=require("classnames"),w=require("./icons/ebay-icon-checkbox-checked-18/index.js"),U=require("./icons/ebay-icon-checkbox-unchecked-18/index.js"),D=require("./icons/ebay-icon-checkbox-mixed-18/index.js"),F=require("./icons/ebay-icon-checkbox-checked-24/index.js"),K=require("./icons/ebay-icon-checkbox-unchecked-24/index.js"),R=require("./icons/ebay-icon-checkbox-mixed-24/index.js"),j=a=>a!==void 0,z=a=>{var{id:d,size:s="default",className:u,style:b,checked:r,defaultChecked:x="false",skipMixed:C=!1,onChange:y=()=>{},onFocus:m=()=>{},onKeyDown:_=()=>{},inputRef:E}=a,f=M.__rest(a,["id","size","className","style","checked","defaultChecked","skipMixed","onChange","onFocus","onKeyDown","inputRef"]);const[l,v]=e.useState(x),n=j(r)?r:l,I=o=>{const c=o.target;let t=l;n==="true"?t="false":n==="false"&&!C?t="mixed":t="true",y(o,{value:c?.value,checked:t}),v(t)},g=o=>{var c;return m(o,{value:(c=o.target)===null||c===void 0?void 0:c.value,checked:n})},p=o=>{const c=o.target;_(o,{value:c.value,checked:n})},N=S("checkbox",u,{"checkbox--large":s==="large"});let h=e.createElement(w.EbayIconCheckboxChecked18,{className:"checkbox__checked"}),i=e.createElement(U.EbayIconCheckboxUnchecked18,{className:"checkbox__unchecked"}),k=e.createElement(D.EbayIconCheckboxMixed18,null);s==="large"&&(h=e.createElement(F.EbayIconCheckboxChecked24,{className:"checkbox__checked"}),i=e.createElement(K.EbayIconCheckboxUnchecked24,{className:"checkbox__unchecked"}),k=e.createElement(R.EbayIconCheckboxMixed24,null));const q=()=>n==="true"?h:n==="mixed"?k:i;return e.createElement("span",{className:N,style:Object.assign({},b)},e.createElement("input",Object.assign({},f,{"aria-checked":n,id:d,className:"checkbox__control",type:"checkbox",checked:n==="true",onChange:I,onFocus:g,onKeyDown:p,ref:E})),e.createElement("span",{className:"checkbox__icon",hidden:!0},q()))};exports.EbayTriStateCheckbox=z;
