@start-base/react-form-elements
Version:
Simplify form elements and form management. Selection of user friendly inputs and wide customization abilities to match your design and functionality.
1 lines • 1.86 kB
JavaScript
import*as e from"react";import l,{forwardRef as o,useMemo as r}from"react";import t from"clsx";var a=Object.defineProperty,n=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,m=Object.prototype.propertyIsEnumerable,s=(e,l,o)=>l in e?a(e,l,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[l]=o,b=(e,l)=>{for(var o in l||(l={}))c.call(l,o)&&s(e,o,l[o]);if(n)for(var o of n(l))m.call(l,o)&&s(e,o,l[o]);return e},u=l=>e.createElement("svg",b({xmlns:"http://www.w3.org/2000/svg",width:12,height:12,fill:"none"},l),e.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.666 3.666 4.999 8.332 2.666 6"})),i="SUI-Checkbox-module-root-B5Qjx",d="SUI-Checkbox-module-inputRoot-evAlL",p="SUI-Checkbox-module-label-tLN4u",h="SUI-Checkbox-module-box-XqQz7",k="SUI-Checkbox-module-noLabel-Yw7Pk",x="SUI-Checkbox-module-inputError-gCI-z",C="SUI-Checkbox-module-boxDisabled-8Rl3P",f="SUI-Checkbox-module-icon-pLAK2",g="SUI-Checkbox-module-input-fHLWQ",v="SUI-Checkbox-module-errorLabel-mLjpi",y=o((({name:e,onChange:o,label:a=null,checked:n=!1,inputClassName:c=null,labelClassName:m=null,errorClassName:s=null,disabled:y=!1,error:I=null},N)=>{const E=r((()=>I&&"string"==typeof I?I:I&&"object"==typeof I&&(null==I?void 0:I.message)?I.message:null),[I]);return l.createElement("label",{htmlFor:`checkbox_${e}`,className:i},l.createElement("div",{className:t(d)},l.createElement("input",{ref:N,className:g,name:e,type:"checkbox",checked:n,onChange:o,id:`checkbox_${e}`,disabled:y}),l.createElement("span",{className:t(h,b({[C]:y,[k]:!a,[x]:"boolean"==typeof I&&I},c?{[c]:!0}:{}))},l.createElement(u,{className:f})),l.createElement("div",{className:t(p,b({},m?{[m]:!0}:{}))},a)),E?l.createElement("div",{className:t(v,b({},s?{[s]:!0}:{}))},E):null)}));y.displayName="Checkbox";var I=y;export{I as default};