import{r as u,a7 as R,a9 as s,l as F,aj as H}from"./index-91e9700c.js";import{u as b}from"./useSlot-6d750ee3.js";import{g as W,a as _,s as f,u as $}from"./useThemeProps-1bc4d723.js";import{F as q}from"./FormControlContext-40f5ffa3.js";function w(o){return W("MuiFormLabel",o)}_("MuiFormLabel",["root","asterisk"]);const z=["children","component","htmlFor","id","slots","slotProps"],T=()=>H({root:["root"],asterisk:["asterisk"]},w,{}),U=f("label",{name:"JoyFormLabel",slot:"Root",overridesResolver:(o,e)=>e.root})(({theme:o})=>({"--Icon-fontSize":"calc(var(--FormLabel-lineHeight) * 1em)",WebkitTapHighlightColor:"transparent",alignSelf:"var(--FormLabel-alignSelf)",display:"flex",gap:"2px",alignItems:"center",flexWrap:"wrap",userSelect:"none",fontFamily:o.vars.fontFamily.body,fontSize:`var(--FormLabel-fontSize, ${o.vars.fontSize.sm})`,fontWeight:o.vars.fontWeight.md,lineHeight:`var(--FormLabel-lineHeight, ${o.vars.lineHeight.sm})`,color:`var(--FormLabel-color, ${o.vars.palette.text.primary})`,margin:"var(--FormLabel-margin, 0px)"})),j=f("span",{name:"JoyFormLabel",slot:"Asterisk",overridesResolver:(o,e)=>e.asterisk})({color:"var(--FormLabel-asteriskColor)"}),A=u.forwardRef(function(e,v){var l,a;const t=$({props:e,name:"JoyFormLabel"}),{children:g,component:L="label",htmlFor:n,id:i,slots:h={},slotProps:y={}}=t,x=R(t,z),r=u.useContext(q),m=(l=(a=e.required)!=null?a:r==null?void 0:r.required)!=null?l:!1,p=s({},t,{required:m}),c=T(),d=s({},x,{component:L,slots:h,slotProps:y}),[k,C]=b("root",{additionalProps:{htmlFor:n??(r==null?void 0:r.htmlFor),id:i??(r==null?void 0:r.labelId)},ref:v,className:c.root,elementType:U,externalForwardedProps:d,ownerState:p}),[S,P]=b("asterisk",{additionalProps:{"aria-hidden":!0},className:c.asterisk,elementType:j,externalForwardedProps:d,ownerState:p});return F(k,s({},C,{children:[g,m&&F(S,s({},P,{children:[" ","*"]}))]}))}),E=A;export{E as F};
