Files
aso/public/dashboard/assets/FormControlLabel.9a854fe5.js
2022-08-04 08:45:27 +07:00

2 lines
4.1 KiB
JavaScript

import{v as z,w as E,t as v,U as X,z as i,r as w,y as M,V as Y,M as j,j as D,f as _,D as q,J as S,E as O,x as Z,N as ee,T as U}from"./index.8dfdc9ed.js";function oe(e){return z("PrivateSwitchBase",e)}E("PrivateSwitchBase",["root","checked","disabled","input","edgeStart","edgeEnd"]);const te=["autoFocus","checked","checkedIcon","className","defaultChecked","disabled","disableFocusRipple","edge","icon","id","inputProps","inputRef","name","onBlur","onChange","onFocus","readOnly","required","tabIndex","type","value"],ae=e=>{const{classes:o,checked:a,disabled:t,edge:l}=e,d={root:["root",a&&"checked",t&&"disabled",l&&`edge${S(l)}`],input:["input"]};return O(d,oe,o)},le=v(X)(({ownerState:e})=>i({padding:9,borderRadius:"50%"},e.edge==="start"&&{marginLeft:e.size==="small"?-3:-12},e.edge==="end"&&{marginRight:e.size==="small"?-3:-12})),se=v("input")({cursor:"inherit",position:"absolute",opacity:0,width:"100%",height:"100%",top:0,left:0,margin:0,padding:0,zIndex:1}),ne=w.exports.forwardRef(function(o,a){const{autoFocus:t,checked:l,checkedIcon:d,className:u,defaultChecked:g,disabled:x,disableFocusRipple:C=!1,edge:k=!1,icon:B,id:b,inputProps:n,inputRef:y,name:L,onBlur:m,onChange:f,onFocus:r,readOnly:p,required:W,tabIndex:A,type:P,value:$}=o,H=M(o,te),[I,J]=Y({controlled:l,default:Boolean(g),name:"SwitchBase",state:"checked"}),c=j(),V=s=>{r&&r(s),c&&c.onFocus&&c.onFocus(s)},G=s=>{m&&m(s),c&&c.onBlur&&c.onBlur(s)},K=s=>{if(s.nativeEvent.defaultPrevented)return;const T=s.target.checked;J(T),f&&f(s,T)};let h=x;c&&typeof h=="undefined"&&(h=c.disabled);const Q=P==="checkbox"||P==="radio",R=i({},o,{checked:I,disabled:h,disableFocusRipple:C,edge:k}),N=ae(R);return D(le,i({component:"span",className:q(N.root,u),centerRipple:!0,focusRipple:!C,disabled:h,tabIndex:null,role:void 0,onFocus:V,onBlur:G,ownerState:R,ref:a},H,{children:[_(se,i({autoFocus:t,checked:l,defaultChecked:g,className:N.input,disabled:h,id:Q&&b,name:L,onChange:K,readOnly:p,ref:y,required:W,ownerState:R,tabIndex:A,type:P},P==="checkbox"&&$===void 0?{}:{value:$},n)),I?d:B]}))});var me=ne;function re(e){return z("MuiFormControlLabel",e)}const ce=E("MuiFormControlLabel",["root","labelPlacementStart","labelPlacementTop","labelPlacementBottom","disabled","label","error"]);var F=ce;const ie=["checked","className","componentsProps","control","disabled","disableTypography","inputRef","label","labelPlacement","name","onChange","value"],de=e=>{const{classes:o,disabled:a,labelPlacement:t,error:l}=e,d={root:["root",a&&"disabled",`labelPlacement${S(t)}`,l&&"error"],label:["label",a&&"disabled"]};return O(d,re,o)},ue=v("label",{name:"MuiFormControlLabel",slot:"Root",overridesResolver:(e,o)=>{const{ownerState:a}=e;return[{[`& .${F.label}`]:o.label},o.root,o[`labelPlacement${S(a.labelPlacement)}`]]}})(({theme:e,ownerState:o})=>i({display:"inline-flex",alignItems:"center",cursor:"pointer",verticalAlign:"middle",WebkitTapHighlightColor:"transparent",marginLeft:-11,marginRight:16,[`&.${F.disabled}`]:{cursor:"default"}},o.labelPlacement==="start"&&{flexDirection:"row-reverse",marginLeft:16,marginRight:-11},o.labelPlacement==="top"&&{flexDirection:"column-reverse",marginLeft:16},o.labelPlacement==="bottom"&&{flexDirection:"column",marginLeft:16},{[`& .${F.label}`]:{[`&.${F.disabled}`]:{color:(e.vars||e).palette.text.disabled}}})),pe=w.exports.forwardRef(function(o,a){const t=Z({props:o,name:"MuiFormControlLabel"}),{className:l,componentsProps:d={},control:u,disabled:g,disableTypography:x,label:C,labelPlacement:k="end"}=t,B=M(t,ie),b=j();let n=g;typeof n=="undefined"&&typeof u.props.disabled!="undefined"&&(n=u.props.disabled),typeof n=="undefined"&&b&&(n=b.disabled);const y={disabled:n};["checked","name","onChange","value","inputRef"].forEach(p=>{typeof u.props[p]=="undefined"&&typeof t[p]!="undefined"&&(y[p]=t[p])});const L=ee({props:t,muiFormControl:b,states:["error"]}),m=i({},t,{disabled:n,labelPlacement:k,error:L.error}),f=de(m);let r=C;return r!=null&&r.type!==U&&!x&&(r=_(U,i({component:"span",className:f.label},d.typography,{children:r}))),D(ue,i({className:q(f.root,l),ownerState:m,ref:a},B,{children:[w.exports.cloneElement(u,y),r]}))});var fe=pe;export{fe as F,me as S};