Build 545032stable
Module 27192
2,065 characters · in no known chunkDependencies
Source Raw
function(e,t,n){"use strict";n.d(t,{DO:()=>A,Kj:()=>T,Lc:()=>S,Or:()=>m,zI:()=>g});var i,r,s=n(627968),a=n(64700),o=n(503698),l=n.n(o),u=n(284009),c=n.n(u),d=n(317097),_=n(661531),f=n(187322),h=n(820081),p=n(818348),E=n(693491),m=((i=m||{}).DEFAULT="default",i.INVERTED="inverted",i.GHOST="ghost",i.ROW="row",i),g=((r=g||{}).TOP="top",r.CENTER="center",r);let A={BOX:E.aP,ROUND:E.LI,SMALL_BOX:E.tk},I={top:E.t8,center:E.Hu},T=e=>{let{disabled:t=!1,readOnly:n=!1,displayOnly:i=!1,value:r=!1,size:o=24,type:u="default",align:c="center",onChange:d=p.tE,onClick:_,className:h,innerClassName:m,children:g,reverse:T=!1,shape:N=A.BOX,checkboxColor:y}=e,C=a.useCallback(e=>{d?.(e,e.currentTarget.checked)},[d]),v=null!=g?(0,s.jsx)("div",{className:l()(E.Pf,t?E.fR:E.ru,T?E.dT:E.a5),style:{lineHeight:`${o}px`},children:g}):null,O=t?E.pR:n?E.bB:E.qw;return(0,s.jsxs)(i?"span":"label",{"data-toggleable-component":"checkbox",className:l()(t?E.Tc:E.TQ,I[c],h,{[E.nM]:"row"===u,[E.KD]:r}),children:[T?v:null,!i&&(0,s.jsx)(f.vN,{children:(0,s.jsx)("input",{className:l()(m,O),type:"checkbox",onClick:_,onChange:t||n?p.tE:C,checked:r,style:{width:o,height:o}})}),(0,s.jsx)(S,{value:r,size:o,shape:N,checkboxColor:y,disabled:t}),T?null:v]})};function S(e){let{indicatorClassName:t,value:n,size:i,shape:r,checkboxColor:o,disabled:u}=e,f=function(e){let{value:t,type:n,color:i}=e,r=e.style??{};if(!1===t)return r;if(r={...r},null!=i)switch(n){case"default":r.borderColor=i;break;case"ghost":if(i.startsWith("var(--")){let e=`${i.slice(0,-1)}-hsl)`;r.borderColor=`rgba(${e}, 0.15)`,r.backgroundColor=`rgba(${e}, 0.15)`}else c()((0,d.qt)(i),`Checkbox: ${i} is not a valid hex color`),r.borderColor=(0,d.xp)(i,.15),r.backgroundColor=(0,d.xp)(i,.15);break;case"row":case"inverted":r.backgroundColor=i,r.borderColor=i}return r}(e),p=a.useMemo(()=>n?_.A.colors.WHITE.css:_.A.unsafe_rawColors.TRANSPARENT.css,[n]);return(0,s.jsx)("div",{className:l()(E.kv,r,t,{[E.KD]:n,[E.Ab]:u}),style:{width:i,height:i,borderColor:o,...f},children:(0,s.jsx)(h.B,{size:"sm",color:p,"aria-hidden":!0})})}}