@opengov/form-renderer 0.2.7-beta-field-wrappers.2 → 0.2.7-beta-field-wrappers.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib.js +2 -2
- package/dist/lib.umd.cjs +1 -1
- package/dist/renderer/Field.d.ts +2 -0
- package/dist/renderer/Section.d.ts +2 -0
- package/package.json +1 -1
package/dist/lib.js
CHANGED
|
@@ -20979,8 +20979,8 @@ function N3({
|
|
|
20979
20979
|
"Missing render for field type ",
|
|
20980
20980
|
i.type
|
|
20981
20981
|
] });
|
|
20982
|
-
const { renderField: s, ...f } = a, l = u == null ? void 0 : u(i, f), c = n ||
|
|
20983
|
-
return /* @__PURE__ */ K.jsx(
|
|
20982
|
+
const { renderField: s, ...f } = a, l = u == null ? void 0 : u(i, f), c = n || Mr;
|
|
20983
|
+
return /* @__PURE__ */ K.jsx(c, { "data-testid": "field-container", field: i, sx: l, children: s(i, f, { readonly: t, name: r }) });
|
|
20984
20984
|
}
|
|
20985
20985
|
function z3({
|
|
20986
20986
|
section: e,
|
package/dist/lib.umd.cjs
CHANGED
|
@@ -161,4 +161,4 @@ theme.transitions = createTransitions(theme.transitions || {});
|
|
|
161
161
|
export default theme;`}function Cs(e={},...r){const{breakpoints:t,mixins:n={},spacing:u,palette:i={},transitions:a={},typography:s={},shape:f,...l}=e;if(e.vars)throw new Error(process.env.NODE_ENV!=="production"?"MUI: `vars` is a private field used for CSS variables support.\nPlease use another name.":$r(20));const c=As(i),p=Hl(e);let o=zt(p,{mixins:Ky(p.breakpoints,n),palette:c,shadows:iv.slice(),typography:tv(c,s),transitions:cv(a),zIndex:{...lv}});if(o=zt(o,l),o=r.reduce((d,m)=>zt(d,m),o),process.env.NODE_ENV!=="production"){const d=["active","checked","completed","disabled","error","expanded","focused","focusVisible","required","selected"],m=(h,b)=>{let g;for(g in h){const w=h[g];if(d.includes(g)&&Object.keys(w).length>0){if(process.env.NODE_ENV!=="production"){const v=ss("",g);console.error([`MUI: The \`${b}\` component increases the CSS specificity of the \`${g}\` internal state.`,"You can not override it like this: ",JSON.stringify(h,null,2),"",`Instead, you need to use the '&.${v}' syntax:`,JSON.stringify({root:{[`&.${v}`]:w}},null,2),"","https://mui.com/r/state-classes-guide"].join(`
|
|
162
162
|
`))}h[g]={}}}};Object.keys(o.components).forEach(h=>{const b=o.components[h].styleOverrides;b&&h.startsWith("Mui")&&m(b,h)})}return o.unstable_sxConfig={...li,...l==null?void 0:l.unstable_sxConfig},o.unstable_sx=function(m){return Dn({sx:m,theme:this})},o.toRuntimeSource=uf,o}function dv(e){let r;return e<1?r=5.11916*e**2:r=4.5*Math.log(e+1)+2,Math.round(r*10)/1e3}const hv=[...Array(25)].map((e,r)=>{if(r===0)return"none";const t=dv(r);return`linear-gradient(rgba(255 255 255 / ${t}), rgba(255 255 255 / ${t}))`});function af(e){return{inputPlaceholder:e==="dark"?.5:.42,inputUnderline:e==="dark"?.7:.42,switchTrackDisabled:e==="dark"?.2:.12,switchTrack:e==="dark"?.3:.38}}function sf(e){return e==="dark"?hv:[]}function pv(e){const{palette:r={mode:"light"},opacity:t,overlays:n,...u}=e,i=As(r);return{palette:i,opacity:{...af(i.mode),...t},overlays:n||sf(i.mode),...u}}function mv(e){var r;return!!e[0].match(/(cssVarPrefix|colorSchemeSelector|rootSelector|typography|mixins|breakpoints|direction|transitions)/)||!!e[0].match(/sxConfig$/)||e[0]==="palette"&&!!((r=e[1])!=null&&r.match(/(mode|contrastThreshold|tonalOffset)/))}const gv=e=>[...[...Array(25)].map((r,t)=>`--${e?`${e}-`:""}overlays-${t}`),`--${e?`${e}-`:""}palette-AppBar-darkBg`,`--${e?`${e}-`:""}palette-AppBar-darkColor`],bv=e=>(r,t)=>{const n=e.rootSelector||":root",u=e.colorSchemeSelector;let i=u;if(u==="class"&&(i=".%s"),u==="data"&&(i="[data-%s]"),u!=null&&u.startsWith("data-")&&!u.includes("%s")&&(i=`[${u}="%s"]`),e.defaultColorScheme===r){if(r==="dark"){const a={};return gv(e.cssVarPrefix).forEach(s=>{a[s]=t[s],delete t[s]}),i==="media"?{[n]:t,"@media (prefers-color-scheme: dark)":{[n]:a}}:i?{[i.replace("%s",r)]:a,[`${n}, ${i.replace("%s",r)}`]:t}:{[n]:{...t,...a}}}if(i&&i!=="media")return`${n}, ${i.replace("%s",String(r))}`}else if(r){if(i==="media")return{[`@media (prefers-color-scheme: ${String(r)})`]:{[n]:t}};if(i)return i.replace("%s",String(r))}return n};function yv(e,r){r.forEach(t=>{e[t]||(e[t]={})})}function j(e,r,t){!e[r]&&t&&(e[r]=t)}function ou(e){return typeof e!="string"||!e.startsWith("hsl")?e:Yl(e)}function _r(e,r){`${r}Channel`in e||(e[`${r}Channel`]=iu(ou(e[r]),`MUI: Can't create \`palette.${r}Channel\` because \`palette.${r}\` is not one of these formats: #nnn, #nnnnnn, rgb(), rgba(), hsl(), hsla(), color().
|
|
163
163
|
To suppress this warning, you need to explicitly provide the \`palette.${r}Channel\` as a string (in rgb format, for example "12 12 12") or undefined if you want to remove the channel token.`))}function vv(e){return typeof e=="number"?`${e}px`:typeof e=="string"||typeof e=="function"||Array.isArray(e)?e:"8px"}const yr=e=>{try{return e()}catch{}},wv=(e="mui")=>qy(e);function Ts(e,r,t,n){if(!r)return;r=r===!0?{}:r;const u=n==="dark"?"dark":"light";if(!t){e[n]=pv({...r,palette:{mode:u,...r==null?void 0:r.palette}});return}const{palette:i,...a}=Cs({...t,palette:{mode:u,...r==null?void 0:r.palette}});return e[n]={...r,palette:i,opacity:{...af(u),...r==null?void 0:r.opacity},overlays:(r==null?void 0:r.overlays)||sf(u)},a}function Dv(e={},...r){const{colorSchemes:t={light:!0},defaultColorScheme:n,disableCssColorScheme:u=!1,cssVarPrefix:i="mui",shouldSkipGeneratingVar:a=mv,colorSchemeSelector:s=t.light&&t.dark?"media":void 0,rootSelector:f=":root",...l}=e,c=Object.keys(t)[0],p=n||(t.light&&c!=="light"?"light":c),o=wv(i),{[p]:d,light:m,dark:h,...b}=t,g={...b};let w=d;if((p==="dark"&&!("dark"in t)||p==="light"&&!("light"in t))&&(w=!0),!w)throw new Error(process.env.NODE_ENV!=="production"?`MUI: The \`colorSchemes.${p}\` option is either missing or invalid.`:$r(21,p));const v=Ts(g,w,l,p);m&&!g.light&&Ts(g,m,void 0,"light"),h&&!g.dark&&Ts(g,h,void 0,"dark");let D={defaultColorScheme:p,...v,cssVarPrefix:i,colorSchemeSelector:s,rootSelector:f,getCssVar:o,colorSchemes:g,font:{...Jy(v.typography),...v.font},spacing:vv(l.spacing)};Object.keys(D.colorSchemes).forEach(F=>{const x=D.colorSchemes[F].palette,T=_=>{const P=_.split("-"),B=P[1],N=P[2];return o(_,x[B][N])};if(x.mode==="light"&&(j(x.common,"background","#fff"),j(x.common,"onBackground","#000")),x.mode==="dark"&&(j(x.common,"background","#000"),j(x.common,"onBackground","#fff")),yv(x,["Alert","AppBar","Avatar","Button","Chip","FilledInput","LinearProgress","Skeleton","Slider","SnackbarContent","SpeedDialAction","StepConnector","StepContent","Switch","TableCell","Tooltip"]),x.mode==="light"){j(x.Alert,"errorColor",Qe(x.error.light,.6)),j(x.Alert,"infoColor",Qe(x.info.light,.6)),j(x.Alert,"successColor",Qe(x.success.light,.6)),j(x.Alert,"warningColor",Qe(x.warning.light,.6)),j(x.Alert,"errorFilledBg",T("palette-error-main")),j(x.Alert,"infoFilledBg",T("palette-info-main")),j(x.Alert,"successFilledBg",T("palette-success-main")),j(x.Alert,"warningFilledBg",T("palette-warning-main")),j(x.Alert,"errorFilledColor",yr(()=>x.getContrastText(x.error.main))),j(x.Alert,"infoFilledColor",yr(()=>x.getContrastText(x.info.main))),j(x.Alert,"successFilledColor",yr(()=>x.getContrastText(x.success.main))),j(x.Alert,"warningFilledColor",yr(()=>x.getContrastText(x.warning.main))),j(x.Alert,"errorStandardBg",Ze(x.error.light,.9)),j(x.Alert,"infoStandardBg",Ze(x.info.light,.9)),j(x.Alert,"successStandardBg",Ze(x.success.light,.9)),j(x.Alert,"warningStandardBg",Ze(x.warning.light,.9)),j(x.Alert,"errorIconColor",T("palette-error-main")),j(x.Alert,"infoIconColor",T("palette-info-main")),j(x.Alert,"successIconColor",T("palette-success-main")),j(x.Alert,"warningIconColor",T("palette-warning-main")),j(x.AppBar,"defaultBg",T("palette-grey-100")),j(x.Avatar,"defaultBg",T("palette-grey-400")),j(x.Button,"inheritContainedBg",T("palette-grey-300")),j(x.Button,"inheritContainedHoverBg",T("palette-grey-A100")),j(x.Chip,"defaultBorder",T("palette-grey-400")),j(x.Chip,"defaultAvatarColor",T("palette-grey-700")),j(x.Chip,"defaultIconColor",T("palette-grey-700")),j(x.FilledInput,"bg","rgba(0, 0, 0, 0.06)"),j(x.FilledInput,"hoverBg","rgba(0, 0, 0, 0.09)"),j(x.FilledInput,"disabledBg","rgba(0, 0, 0, 0.12)"),j(x.LinearProgress,"primaryBg",Ze(x.primary.main,.62)),j(x.LinearProgress,"secondaryBg",Ze(x.secondary.main,.62)),j(x.LinearProgress,"errorBg",Ze(x.error.main,.62)),j(x.LinearProgress,"infoBg",Ze(x.info.main,.62)),j(x.LinearProgress,"successBg",Ze(x.success.main,.62)),j(x.LinearProgress,"warningBg",Ze(x.warning.main,.62)),j(x.Skeleton,"bg",`rgba(${T("palette-text-primaryChannel")} / 0.11)`),j(x.Slider,"primaryTrack",Ze(x.primary.main,.62)),j(x.Slider,"secondaryTrack",Ze(x.secondary.main,.62)),j(x.Slider,"errorTrack",Ze(x.error.main,.62)),j(x.Slider,"infoTrack",Ze(x.info.main,.62)),j(x.Slider,"successTrack",Ze(x.success.main,.62)),j(x.Slider,"warningTrack",Ze(x.warning.main,.62));const _=Ei(x.background.default,.8);j(x.SnackbarContent,"bg",_),j(x.SnackbarContent,"color",yr(()=>x.getContrastText(_))),j(x.SpeedDialAction,"fabHoverBg",Ei(x.background.paper,.15)),j(x.StepConnector,"border",T("palette-grey-400")),j(x.StepContent,"border",T("palette-grey-400")),j(x.Switch,"defaultColor",T("palette-common-white")),j(x.Switch,"defaultDisabledColor",T("palette-grey-100")),j(x.Switch,"primaryDisabledColor",Ze(x.primary.main,.62)),j(x.Switch,"secondaryDisabledColor",Ze(x.secondary.main,.62)),j(x.Switch,"errorDisabledColor",Ze(x.error.main,.62)),j(x.Switch,"infoDisabledColor",Ze(x.info.main,.62)),j(x.Switch,"successDisabledColor",Ze(x.success.main,.62)),j(x.Switch,"warningDisabledColor",Ze(x.warning.main,.62)),j(x.TableCell,"border",Ze(Di(x.divider,1),.88)),j(x.Tooltip,"bg",Di(x.grey[700],.92))}if(x.mode==="dark"){j(x.Alert,"errorColor",Ze(x.error.light,.6)),j(x.Alert,"infoColor",Ze(x.info.light,.6)),j(x.Alert,"successColor",Ze(x.success.light,.6)),j(x.Alert,"warningColor",Ze(x.warning.light,.6)),j(x.Alert,"errorFilledBg",T("palette-error-dark")),j(x.Alert,"infoFilledBg",T("palette-info-dark")),j(x.Alert,"successFilledBg",T("palette-success-dark")),j(x.Alert,"warningFilledBg",T("palette-warning-dark")),j(x.Alert,"errorFilledColor",yr(()=>x.getContrastText(x.error.dark))),j(x.Alert,"infoFilledColor",yr(()=>x.getContrastText(x.info.dark))),j(x.Alert,"successFilledColor",yr(()=>x.getContrastText(x.success.dark))),j(x.Alert,"warningFilledColor",yr(()=>x.getContrastText(x.warning.dark))),j(x.Alert,"errorStandardBg",Qe(x.error.light,.9)),j(x.Alert,"infoStandardBg",Qe(x.info.light,.9)),j(x.Alert,"successStandardBg",Qe(x.success.light,.9)),j(x.Alert,"warningStandardBg",Qe(x.warning.light,.9)),j(x.Alert,"errorIconColor",T("palette-error-main")),j(x.Alert,"infoIconColor",T("palette-info-main")),j(x.Alert,"successIconColor",T("palette-success-main")),j(x.Alert,"warningIconColor",T("palette-warning-main")),j(x.AppBar,"defaultBg",T("palette-grey-900")),j(x.AppBar,"darkBg",T("palette-background-paper")),j(x.AppBar,"darkColor",T("palette-text-primary")),j(x.Avatar,"defaultBg",T("palette-grey-600")),j(x.Button,"inheritContainedBg",T("palette-grey-800")),j(x.Button,"inheritContainedHoverBg",T("palette-grey-700")),j(x.Chip,"defaultBorder",T("palette-grey-700")),j(x.Chip,"defaultAvatarColor",T("palette-grey-300")),j(x.Chip,"defaultIconColor",T("palette-grey-300")),j(x.FilledInput,"bg","rgba(255, 255, 255, 0.09)"),j(x.FilledInput,"hoverBg","rgba(255, 255, 255, 0.13)"),j(x.FilledInput,"disabledBg","rgba(255, 255, 255, 0.12)"),j(x.LinearProgress,"primaryBg",Qe(x.primary.main,.5)),j(x.LinearProgress,"secondaryBg",Qe(x.secondary.main,.5)),j(x.LinearProgress,"errorBg",Qe(x.error.main,.5)),j(x.LinearProgress,"infoBg",Qe(x.info.main,.5)),j(x.LinearProgress,"successBg",Qe(x.success.main,.5)),j(x.LinearProgress,"warningBg",Qe(x.warning.main,.5)),j(x.Skeleton,"bg",`rgba(${T("palette-text-primaryChannel")} / 0.13)`),j(x.Slider,"primaryTrack",Qe(x.primary.main,.5)),j(x.Slider,"secondaryTrack",Qe(x.secondary.main,.5)),j(x.Slider,"errorTrack",Qe(x.error.main,.5)),j(x.Slider,"infoTrack",Qe(x.info.main,.5)),j(x.Slider,"successTrack",Qe(x.success.main,.5)),j(x.Slider,"warningTrack",Qe(x.warning.main,.5));const _=Ei(x.background.default,.98);j(x.SnackbarContent,"bg",_),j(x.SnackbarContent,"color",yr(()=>x.getContrastText(_))),j(x.SpeedDialAction,"fabHoverBg",Ei(x.background.paper,.15)),j(x.StepConnector,"border",T("palette-grey-600")),j(x.StepContent,"border",T("palette-grey-600")),j(x.Switch,"defaultColor",T("palette-grey-300")),j(x.Switch,"defaultDisabledColor",T("palette-grey-600")),j(x.Switch,"primaryDisabledColor",Qe(x.primary.main,.55)),j(x.Switch,"secondaryDisabledColor",Qe(x.secondary.main,.55)),j(x.Switch,"errorDisabledColor",Qe(x.error.main,.55)),j(x.Switch,"infoDisabledColor",Qe(x.info.main,.55)),j(x.Switch,"successDisabledColor",Qe(x.success.main,.55)),j(x.Switch,"warningDisabledColor",Qe(x.warning.main,.55)),j(x.TableCell,"border",Qe(Di(x.divider,1),.68)),j(x.Tooltip,"bg",Di(x.grey[700],.92))}_r(x.background,"default"),_r(x.background,"paper"),_r(x.common,"background"),_r(x.common,"onBackground"),_r(x,"divider"),Object.keys(x).forEach(_=>{const P=x[_];_!=="tonalOffset"&&P&&typeof P=="object"&&(P.main&&j(x[_],"mainChannel",iu(ou(P.main))),P.light&&j(x[_],"lightChannel",iu(ou(P.light))),P.dark&&j(x[_],"darkChannel",iu(ou(P.dark))),P.contrastText&&j(x[_],"contrastTextChannel",iu(ou(P.contrastText))),_==="text"&&(_r(x[_],"primary"),_r(x[_],"secondary")),_==="action"&&(P.active&&_r(x[_],"active"),P.selected&&_r(x[_],"selected")))})}),D=r.reduce((F,x)=>zt(F,x),D);const y={prefix:i,disableCssColorScheme:u,shouldSkipGeneratingVar:a,getSelector:bv(D)},{vars:E,generateThemeVars:A,generateStyleSheets:C}=zy(D,y);return D.vars=E,Object.entries(D.colorSchemes[D.defaultColorScheme]).forEach(([F,x])=>{D[F]=x}),D.generateThemeVars=A,D.generateStyleSheets=C,D.generateSpacing=function(){return zl(l.spacing,os(this))},D.getColorSchemeSelector=Hy(s),D.spacing=D.generateSpacing(),D.shouldSkipGeneratingVar=a,D.unstable_sxConfig={...li,...l==null?void 0:l.unstable_sxConfig},D.unstable_sx=function(x){return Dn({sx:x,theme:this})},D.toRuntimeSource=uf,D}function of(e,r,t){e.colorSchemes&&t&&(e.colorSchemes[r]={...t!==!0&&t,palette:As({...t===!0?{}:t.palette,mode:r})})}function Ev(e={},...r){const{palette:t,cssVariables:n=!1,colorSchemes:u=t?void 0:{light:!0},defaultColorScheme:i=t==null?void 0:t.mode,...a}=e,s=i||"light",f=u==null?void 0:u[s],l={...u,...t?{[s]:{...typeof f!="boolean"&&f,palette:t}}:void 0};if(n===!1){if(!("colorSchemes"in e))return Cs(e,...r);let c=t;"palette"in e||l[s]&&(l[s]!==!0?c=l[s].palette:s==="dark"&&(c={mode:"dark"}));const p=Cs({...e,palette:c},...r);return p.defaultColorScheme=s,p.colorSchemes=l,p.palette.mode==="light"&&(p.colorSchemes.light={...l.light!==!0&&l.light,palette:p.palette},of(p,"dark",l.dark)),p.palette.mode==="dark"&&(p.colorSchemes.dark={...l.dark!==!0&&l.dark,palette:p.palette},of(p,"light",l.light)),p}return!t&&!("light"in l)&&s==="light"&&(l.light=!0),Dv({...a,colorSchemes:l,defaultColorScheme:s,...typeof n!="boolean"&&n},...r)}const xv=Ev(),Av="$$material";function Cv(e){return e!=="ownerState"&&e!=="theme"&&e!=="sx"&&e!=="as"}const Tv=Ty({themeId:Av,defaultTheme:xv,rootShouldForwardProp:e=>Cv(e)&&e!=="classes"}),Sv=Ly;process.env.NODE_ENV!=="production"&&(Ne.node,Ne.object.isRequired);function Fv(e){return ky(e)}function _v(e){return ss("MuiSvgIcon",e)}Eb("MuiSvgIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Ov=e=>{const{color:r,fontSize:t,classes:n}=e,u={root:["root",r!=="inherit"&&`color${nn(r)}`,`fontSize${nn(t)}`]};return vb(u,_v,n)},Nv=Tv("svg",{name:"MuiSvgIcon",slot:"Root",overridesResolver:(e,r)=>{const{ownerState:t}=e;return[r.root,t.color!=="inherit"&&r[`color${nn(t.color)}`],r[`fontSize${nn(t.fontSize)}`]]}})(Sv(({theme:e})=>{var r,t,n,u,i,a,s,f,l,c,p,o,d,m;return{userSelect:"none",width:"1em",height:"1em",display:"inline-block",flexShrink:0,transition:(u=(r=e.transitions)==null?void 0:r.create)==null?void 0:u.call(r,"fill",{duration:(n=(t=(e.vars??e).transitions)==null?void 0:t.duration)==null?void 0:n.shorter}),variants:[{props:h=>!h.hasSvgAsChild,style:{fill:"currentColor"}},{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:((a=(i=e.typography)==null?void 0:i.pxToRem)==null?void 0:a.call(i,20))||"1.25rem"}},{props:{fontSize:"medium"},style:{fontSize:((f=(s=e.typography)==null?void 0:s.pxToRem)==null?void 0:f.call(s,24))||"1.5rem"}},{props:{fontSize:"large"},style:{fontSize:((c=(l=e.typography)==null?void 0:l.pxToRem)==null?void 0:c.call(l,35))||"2.1875rem"}},...Object.entries((e.vars??e).palette).filter(([,h])=>h&&h.main).map(([h])=>{var b,g;return{props:{color:h},style:{color:(g=(b=(e.vars??e).palette)==null?void 0:b[h])==null?void 0:g.main}}}),{props:{color:"action"},style:{color:(o=(p=(e.vars??e).palette)==null?void 0:p.action)==null?void 0:o.active}},{props:{color:"disabled"},style:{color:(m=(d=(e.vars??e).palette)==null?void 0:d.action)==null?void 0:m.disabled}},{props:{color:"inherit"},style:{color:void 0}}]}})),xi=At.forwardRef(function(r,t){const n=Fv({props:r,name:"MuiSvgIcon"}),{children:u,className:i,color:a="inherit",component:s="svg",fontSize:f="medium",htmlColor:l,inheritViewBox:c=!1,titleAccess:p,viewBox:o="0 0 24 24",...d}=n,m=At.isValidElement(u)&&u.type==="svg",h={...n,color:a,component:s,fontSize:f,instanceFontSize:r.fontSize,inheritViewBox:c,viewBox:o,hasSvgAsChild:m},b={};c||(b.viewBox=o);const g=Ov(h);return K.jsxs(Nv,{as:s,className:Ab(g.root,i),focusable:"false",color:l,"aria-hidden":p?void 0:!0,role:p?"img":void 0,ref:t,...b,...d,...m&&u.props,ownerState:h,children:[m?u.props.children:u,p?K.jsx("title",{children:p}):null]})});process.env.NODE_ENV!=="production"&&(xi.propTypes={children:Ne.node,classes:Ne.object,className:Ne.string,color:Ne.oneOfType([Ne.oneOf(["inherit","action","disabled","primary","secondary","error","info","success","warning"]),Ne.string]),component:Ne.elementType,fontSize:Ne.oneOfType([Ne.oneOf(["inherit","large","medium","small"]),Ne.string]),htmlColor:Ne.string,inheritViewBox:Ne.bool,shapeRendering:Ne.string,sx:Ne.oneOfType([Ne.arrayOf(Ne.oneOfType([Ne.func,Ne.object,Ne.bool])),Ne.func,Ne.object]),titleAccess:Ne.string,viewBox:Ne.string}),xi.muiName="SvgIcon";function Ss(e,r){function t(n,u){return K.jsx(xi,{"data-testid":`${r}Icon`,ref:u,...n,children:e})}return process.env.NODE_ENV!=="production"&&(t.displayName=`${r}Icon`),t.muiName=xi.muiName,At.memo(At.forwardRef(t))}const Mv=Ss(K.jsx("path",{d:"m7 14 5-5 5 5z"}),"ArrowDropUp"),Pv=Ss(K.jsx("path",{d:"m7 10 5 5 5-5z"}),"ArrowDropDown");function Bv(e){let r=e.replace(/[^\d.-]/g,"");r=(r.indexOf("-")===0?"-":"")+r.replace(/-/g,"");const n=r.indexOf(".");if(n!==-1){const u=r.replace(/\./g,"");r=u.slice(0,n)+"."+u.slice(n)}return r}const Ai=e=>/^-?(?:\d+|\d*\.\d+|\d+\.)$/.test(e);function cf(e){const{disabled:r,readonly:t,decimalPlaces:n=14,name:u,rules:i,sx:a,...s}=e,{field:f,fieldState:{error:l}}=Kt.useController({name:u,rules:{...i,validate:d=>d&&!Ai(d)?"Please enter a valid number.":!0}}),c=d=>{const m=d.target.value,h=Bv(m);f.onChange(h)},p=d=>{const m=parseFloat(d);if(Ai(d)){const h=ub(m,n);f.onChange(tb(h))}f.onBlur()};if(t)return K.jsx(Jr,{label:s.label,text:f.value,sx:a,error:l==null?void 0:l.message});const o=K.jsxs(Le.InputAdornment,{position:"end",sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"center",height:"auto !important"},children:[K.jsx(Le.IconButton,{size:"small",onClick:()=>{if(Ai(f.value)||!f.value){const d=ab(f.value||0,1);f.onChange(d),p(d)}},disabled:r,sx:{pt:0,pb:0},children:K.jsx(Mv,{fontSize:"small","data-testid":"increment-button"})}),K.jsx(Le.IconButton,{size:"small",onClick:()=>{if(Ai(f.value)||!f.value){const d=sb(f.value||0,1);f.onChange(d),p(d)}},disabled:r,sx:{pt:0,pb:0},children:K.jsx(Pv,{fontSize:"small","data-testid":"decrement-button"})})]});return K.jsx(Le.TextField,{...f,...s,onChange:c,onBlur:d=>p(d.target.value),fullWidth:!0,placeholder:r?"0":"",error:!!l,helperText:!!l&&K.jsx(ln,{error:l.message}),disabled:r,sx:{...a,m:0},InputProps:{endAdornment:o},slotProps:{input:{endAdornment:o}}})}function lf({name:e,label:r,sx:t={}}){const{control:n}=Kt.useFormContext();return K.jsx(Kt.Controller,{name:e,control:n,render:({field:u,fieldState:{error:i}})=>K.jsx(Jr,{label:r,text:u.value||0,sx:t,error:i==null?void 0:i.message})})}function ff({name:e,label:r,options:t=[],sx:n={},disabled:u,rules:i={},readonly:a}){const{field:s,fieldState:{error:f}}=Kt.useController({name:e,rules:i}),l=t.map(p=>({label:p.displayValue,id:p.key})),{value:c}=s;return a?K.jsx(Jr,{label:r,text:c==null?void 0:c.displayValue,sx:n,error:f==null?void 0:f.message}):K.jsx(Le.Autocomplete,{"data-test-id":"form-field-select",...s,value:c==null?void 0:c.displayValue,onChange:(p,o)=>s.onChange(o?{displayValue:o.label,key:o.id}:null),options:l,renderInput:p=>K.jsx(Le.TextField,{...p,label:r,error:!!f,helperText:!!f&&K.jsx(ln,{error:f.message}),slotProps:{inputLabel:{shrink:!0}},sx:{...n,m:0}}),fullWidth:!0,disabled:u})}const Iv=Ss(K.jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 17h-2v-2h2zm2.07-7.75-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25"}),"Help");var Fs,df;function Rv(){return df||(df=1,Fs=function(e){var r={};function t(n){if(r[n])return r[n].exports;var u=r[n]={i:n,l:!1,exports:{}};return e[n].call(u.exports,u,u.exports,t),u.l=!0,u.exports}return t.m=e,t.c=r,t.d=function(n,u,i){t.o(n,u)||Object.defineProperty(n,u,{enumerable:!0,get:i})},t.r=function(n){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,u){if(1&u&&(n=t(n)),8&u||4&u&&typeof n=="object"&&n&&n.__esModule)return n;var i=Object.create(null);if(t.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:n}),2&u&&typeof n!="string")for(var a in n)t.d(i,a,(function(s){return n[s]}).bind(null,a));return i},t.n=function(n){var u=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(u,"a",u),u},t.o=function(n,u){return Object.prototype.hasOwnProperty.call(n,u)},t.p="",t(t.s=2)}([function(e,r){e.exports=dl()},function(e,r){e.exports=Je},function(e,r,t){t.r(r);var n=t(1),u=t(0),i=function(){return(i=Object.assign||function(m){for(var h,b=1,g=arguments.length;b<g;b++)for(var w in h=arguments[b])Object.prototype.hasOwnProperty.call(h,w)&&(m[w]=h[w]);return m}).apply(this,arguments)},a=function(m,h){var b={};for(var g in m)Object.prototype.hasOwnProperty.call(m,g)&&h.indexOf(g)<0&&(b[g]=m[g]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var w=0;for(g=Object.getOwnPropertySymbols(m);w<g.length;w++)h.indexOf(g[w])<0&&Object.prototype.propertyIsEnumerable.call(m,g[w])&&(b[g[w]]=m[g[w]])}return b},s=0,f=n.forwardRef(function(m,h){var b=m.title,g=b===void 0?null:b,w=m.description,v=w===void 0?null:w,D=m.size,y=D===void 0?null:D,E=m.color,A=E===void 0?"currentColor":E,C=m.horizontal,F=C===void 0?null:C,x=m.vertical,T=x===void 0?null:x,_=m.rotate,P=_===void 0?null:_,B=m.spin,N=B===void 0?null:B,I=m.style,J=I===void 0?{}:I,re=m.children,ie=a(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);s++;var L,Z=N!==null&&N,ce=n.Children.map(re,function(he){var oe=he;Z!==!0&&(Z=(N===null?oe.props.spin:N)===!0);var be=oe.props.size;typeof y=="number"&&typeof oe.props.size=="number"&&(be=oe.props.size/y);var ye={size:be,color:A===null?oe.props.color:A,horizontal:F===null?oe.props.horizontal:F,vertical:T===null?oe.props.vertical:T,rotate:P===null?oe.props.rotate:P,spin:N===null?oe.props.spin:N,inStack:!0};return n.cloneElement(oe,ye)});y!==null&&(J.width=typeof y=="string"?y:1.5*y+"rem");var Y,se="stack_labelledby_"+s,de="stack_describedby_"+s;if(g)L=v?se+" "+de:se;else if(Y="presentation",v)throw new Error("title attribute required when description is set");return n.createElement("svg",i({ref:h,viewBox:"0 0 24 24",style:J,role:Y,"aria-labelledby":L},ie),g&&n.createElement("title",{id:se},g),v&&n.createElement("desc",{id:de},v),Z&&n.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),ce)});f.displayName="Stack",f.propTypes={size:u.oneOfType([u.number,u.string]),color:u.string,horizontal:u.bool,vertical:u.bool,rotate:u.number,spin:u.oneOfType([u.bool,u.number]),children:u.oneOfType([u.arrayOf(u.node),u.node]).isRequired,className:u.string,style:u.object},f.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var l=f;t.d(r,"Icon",function(){return d}),t.d(r,"Stack",function(){return l});var c=function(){return(c=Object.assign||function(m){for(var h,b=1,g=arguments.length;b<g;b++)for(var w in h=arguments[b])Object.prototype.hasOwnProperty.call(h,w)&&(m[w]=h[w]);return m}).apply(this,arguments)},p=function(m,h){var b={};for(var g in m)Object.prototype.hasOwnProperty.call(m,g)&&h.indexOf(g)<0&&(b[g]=m[g]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var w=0;for(g=Object.getOwnPropertySymbols(m);w<g.length;w++)h.indexOf(g[w])<0&&Object.prototype.propertyIsEnumerable.call(m,g[w])&&(b[g[w]]=m[g[w]])}return b},o=0,d=n.forwardRef(function(m,h){var b=m.path,g=m.id,w=g===void 0?++o:g,v=m.title,D=v===void 0?null:v,y=m.description,E=y===void 0?null:y,A=m.size,C=A===void 0?null:A,F=m.color,x=F===void 0?"currentColor":F,T=m.horizontal,_=T!==void 0&&T,P=m.vertical,B=P!==void 0&&P,N=m.rotate,I=N===void 0?0:N,J=m.spin,re=J!==void 0&&J,ie=m.style,L=ie===void 0?{}:ie,Z=m.inStack,ce=Z!==void 0&&Z,Y=p(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),se={},de=[];C!==null&&(ce?de.push("scale("+C+")"):(L.width=typeof C=="string"?C:1.5*C+"rem",L.height=L.width)),_&&de.push("scaleX(-1)"),B&&de.push("scaleY(-1)"),I!==0&&de.push("rotate("+I+"deg)"),x!==null&&(se.fill=x);var he=n.createElement("path",c({d:b,style:se},ce?Y:{})),oe=he;de.length>0&&(L.transform=de.join(" "),L.transformOrigin="center",ce&&(oe=n.createElement("g",{style:L},he,n.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var be,ye=oe,ve=re===!0||typeof re!="number"?2:re,q=!ce&&(_||B);if(ve<0&&(q=!q),re&&(ye=n.createElement("g",{style:{animation:"spin"+(q?"-inverse":"")+" linear "+Math.abs(ve)+"s infinite",transformOrigin:"center"}},oe,!(_||B||I!==0)&&n.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),ce)return ye;var k,W="icon_labelledby_"+w,me="icon_describedby_"+w;if(D)be=E?W+" "+me:W;else if(k="presentation",E)throw new Error("title attribute required when description is set");return n.createElement("svg",c({ref:h,viewBox:"0 0 24 24",style:L,role:k,"aria-labelledby":be},Y),D&&n.createElement("title",{id:W},D),E&&n.createElement("desc",{id:me},E),!ce&&re&&(q?n.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):n.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),ye)});d.displayName="Icon",d.propTypes={path:u.string.isRequired,size:u.oneOfType([u.number,u.string]),color:u.string,horizontal:u.bool,vertical:u.bool,rotate:u.number,spin:u.oneOfType([u.bool,u.number]),style:u.object,inStack:u.bool,className:u.string},d.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},r.default=d}])),Fs}var kv=Rv();const _s=Ni(kv);var Lv="M7,2H17A2,2 0 0,1 19,4V20A2,2 0 0,1 17,22H7A2,2 0 0,1 5,20V4A2,2 0 0,1 7,2M7,4V8H17V4H7M7,10V12H9V10H7M11,10V12H13V10H11M15,10V12H17V10H15M7,14V16H9V14H7M11,14V16H13V14H11M15,14V16H17V14H15M7,18V20H9V18H7M11,18V20H13V18H11M15,18V20H17V18H15Z",qv="M12,1L3,5V11C3,16.55 6.84,21.74 12,23C17.16,21.74 21,16.55 21,11V5L12,1M12,7C13.4,7 14.8,8.1 14.8,9.5V11C15.4,11 16,11.6 16,12.3V15.8C16,16.4 15.4,17 14.7,17H9.2C8.6,17 8,16.4 8,15.7V12.2C8,11.6 8.6,11 9.2,11V9.5C9.2,8.1 10.6,7 12,7M12,8.2C11.2,8.2 10.5,8.7 10.5,9.5V11H13.5V9.5C13.5,8.7 12.8,8.2 12,8.2Z",$v="M9,3V4H4V6H5V19A2,2 0 0,0 7,21H17A2,2 0 0,0 19,19V6H20V4H15V3H9M7,6H17V19H7V6M9,8V17H11V8H9M13,8V17H15V8H13Z";function un({children:e,internal:r,required:t,helpText:n,isCalculated:u,readonly:i,deleted:a,isSection:s,variant:f="h4"}){const l={display:"flex",alignItems:"center"},c=i?{...l,gap:1}:{...l,justifyContent:"space-between"};return K.jsxs(Le.Box,{sx:c,children:[K.jsxs(Le.Typography,{"data-testid":"form-field-label",variant:f,color:"black",sx:{whiteSpace:"normal",wordBreak:"break-word"},children:[e,t&&"*"]}),K.jsxs(Le.Box,{sx:{display:"flex",gap:1},children:[r&&K.jsx(Le.Tooltip,{placement:"top",title:s?"This section is hidden from the applicant and visible to employees only.":"This field is hidden from the applicant and visible to employees only.",sx:{cursor:"default"},children:K.jsx(_s,{path:qv,size:"20px",color:sn.capitalDesignTokens.foundations.colors.yellow700,"data-testid":"internal-icon"})}),n&&n!==""&&K.jsx(Le.Tooltip,{placement:"top",title:K.jsx(Le.Typography,{variant:"bodyXSmall",sx:{whiteSpace:"pre-line"},children:n}),sx:{cursor:"default"},children:K.jsx(Iv,{fontSize:"small",htmlColor:sn.capitalDesignTokens.foundations.colors.gray600,"data-testid":"help-icon"})}),u&&K.jsx(Le.Tooltip,{placement:"top",title:"This field is calculated.",sx:{cursor:"default"},children:K.jsx(_s,{path:Lv,size:"20px",color:sn.capitalDesignTokens.foundations.colors.gray800,"data-testid":"calculation-icon"})}),a&&K.jsx(Le.Tooltip,{placement:"top",title:"This field was deleted.",sx:{cursor:"default"},children:K.jsx(_s,{path:$v,size:"20px",color:sn.capitalDesignTokens.foundations.colors.gray800})})]})]})}const jv={y:{sectionType:"year",contentType:"digit",maxLength:4},yy:"year",yyy:{sectionType:"year",contentType:"digit",maxLength:4},yyyy:"year",M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMMM:{sectionType:"month",contentType:"letter"},MMM:{sectionType:"month",contentType:"letter"},L:{sectionType:"month",contentType:"digit",maxLength:2},LL:"month",LLL:{sectionType:"month",contentType:"letter"},LLLL:{sectionType:"month",contentType:"letter"},d:{sectionType:"day",contentType:"digit",maxLength:2},dd:"day",do:{sectionType:"day",contentType:"digit-with-letter"},E:{sectionType:"weekDay",contentType:"letter"},EE:{sectionType:"weekDay",contentType:"letter"},EEE:{sectionType:"weekDay",contentType:"letter"},EEEE:{sectionType:"weekDay",contentType:"letter"},EEEEE:{sectionType:"weekDay",contentType:"letter"},i:{sectionType:"weekDay",contentType:"digit",maxLength:1},ii:"weekDay",iii:{sectionType:"weekDay",contentType:"letter"},iiii:{sectionType:"weekDay",contentType:"letter"},e:{sectionType:"weekDay",contentType:"digit",maxLength:1},ee:"weekDay",eee:{sectionType:"weekDay",contentType:"letter"},eeee:{sectionType:"weekDay",contentType:"letter"},eeeee:{sectionType:"weekDay",contentType:"letter"},eeeeee:{sectionType:"weekDay",contentType:"letter"},c:{sectionType:"weekDay",contentType:"digit",maxLength:1},cc:"weekDay",ccc:{sectionType:"weekDay",contentType:"letter"},cccc:{sectionType:"weekDay",contentType:"letter"},ccccc:{sectionType:"weekDay",contentType:"letter"},cccccc:{sectionType:"weekDay",contentType:"letter"},a:"meridiem",aa:"meridiem",aaa:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},zv={year:"yyyy",month:"LLLL",monthShort:"MMM",dayOfMonth:"d",dayOfMonthFull:"do",weekday:"EEEE",weekdayShort:"EEEEEE",hours24h:"HH",hours12h:"hh",meridiem:"aa",minutes:"mm",seconds:"ss",fullDate:"PP",keyboardDate:"P",shortDate:"MMM d",normalDate:"d MMMM",normalDateWithWeekday:"EEE, MMM d",fullTime:"p",fullTime12h:"hh:mm aa",fullTime24h:"HH:mm",keyboardDateTime:"P p",keyboardDateTime12h:"P hh:mm aa",keyboardDateTime24h:"P HH:mm"};class Hv{constructor(r){this.isMUIAdapter=!0,this.isTimezoneCompatible=!1,this.lib=void 0,this.locale=void 0,this.formats=void 0,this.formatTokenMap=jv,this.escapedCharacters={start:"'",end:"'"},this.longFormatters=void 0,this.date=a=>typeof a>"u"?new Date:a===null?null:new Date(a),this.getInvalidDate=()=>new Date("Invalid Date"),this.getTimezone=()=>"default",this.setTimezone=a=>a,this.toJsDate=a=>a,this.getCurrentLocaleCode=()=>this.locale.code,this.is12HourCycleInCurrentLocale=()=>/a/.test(this.locale.formatLong.time({width:"short"})),this.expandFormat=a=>{const s=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;return a.match(s).map(f=>{const l=f[0];if(l==="p"||l==="P"){const c=this.longFormatters[l];return c(f,this.locale.formatLong)}return f}).join("")},this.formatNumber=a=>a,this.getDayOfWeek=a=>a.getDay()+1;const{locale:t,formats:n,longFormatters:u,lib:i}=r;this.locale=t,this.formats=jn({},zv,n),this.longFormatters=u,this.lib=i||"date-fns"}}class Uv extends Hv{constructor({locale:r,formats:t}={}){if(process.env.NODE_ENV!=="production"){if(typeof Ur!="function")throw new Error(["MUI: The `date-fns` package v2.x is not compatible with this adapter.","Please, install v3.x or v4.x of the package or use the `AdapterDateFns` instead."].join(`
|
|
164
|
-
`));if(!kn)throw new Error("MUI: The minimum supported `date-fns` package version compatible with this adapter is `3.2.x`.")}super({locale:r??Pi,formats:t,longFormatters:kn}),this.parse=(n,u)=>n===""?null:Ph(n,u,new Date,{locale:this.locale}),this.isValid=n=>n==null?!1:Ys(n),this.format=(n,u)=>this.formatByString(n,this.formats[u]),this.formatByString=(n,u)=>ki(n,u,{locale:this.locale}),this.isEqual=(n,u)=>n===null&&u===null?!0:n===null||u===null?!1:Ld(n,u),this.isSameYear=(n,u)=>kh(n,u),this.isSameMonth=(n,u)=>Rh(n,u),this.isSameDay=(n,u)=>If(n,u),this.isSameHour=(n,u)=>Ih(n,u),this.isAfter=(n,u)=>mu(n,u),this.isAfterYear=(n,u)=>mu(n,Xs(u)),this.isAfterDay=(n,u)=>mu(n,Gs(u)),this.isBefore=(n,u)=>gu(n,u),this.isBeforeYear=(n,u)=>gu(n,this.startOfYear(u)),this.isBeforeDay=(n,u)=>gu(n,this.startOfDay(u)),this.isWithinRange=(n,[u,i])=>Lh(n,{start:u,end:i}),this.startOfYear=n=>Qs(n),this.startOfMonth=n=>Lf(n),this.startOfWeek=n=>wr(n,{locale:this.locale}),this.startOfDay=n=>Wr(n),this.endOfYear=n=>Xs(n),this.endOfMonth=n=>kf(n),this.endOfWeek=n=>qf(n,{locale:this.locale}),this.endOfDay=n=>Gs(n),this.addYears=(n,u)=>Bf(n,u),this.addMonths=(n,u)=>hu(n,u),this.addWeeks=(n,u)=>Pf(n,u),this.addDays=(n,u)=>Ur(n,u),this.addHours=(n,u)=>Sf(n,u),this.addMinutes=(n,u)=>Nf(n,u),this.addSeconds=(n,u)=>Mf(n,u),this.getYear=n=>kd(n),this.getMonth=n=>Id(n),this.getDate=n=>_d(n),this.getHours=n=>Nd(n),this.getMinutes=n=>Bd(n),this.getSeconds=n=>Rd(n),this.getMilliseconds=n=>Pd(n),this.setYear=(n,u)=>Wh(n,u),this.setMonth=(n,u)=>$h(n,u),this.setDate=(n,u)=>jh(n,u),this.setHours=(n,u)=>zh(n,u),this.setMinutes=(n,u)=>Uh(n,u),this.setSeconds=(n,u)=>Vh(n,u),this.setMilliseconds=(n,u)=>Hh(n,u),this.getDaysInMonth=n=>io(n),this.getWeekArray=n=>{const u=this.startOfWeek(this.startOfMonth(n)),i=this.endOfWeek(this.endOfMonth(n));let a=0,s=u;const f=[];for(;this.isBefore(s,i);){const l=Math.floor(a/7);f[l]=f[l]||[],f[l].push(s),s=this.addDays(s,1),a+=1}return f},this.getWeekNumber=n=>Ii(n,{locale:this.locale}),this.getYearRange=([n,u])=>{const i=this.startOfYear(n),a=this.endOfYear(u),s=[];let f=i;for(;this.isBefore(f,a);)s.push(f),f=this.addYears(f,1);return s}}}const hf=Je.createContext(void 0),Vv=({children:e,layout:r={section:()=>({}),field:()=>({})}})=>K.jsx(hf.Provider,{value:{layout:r},children:e}),pf=()=>{const e=Je.useContext(hf);if(!e)throw new Error("useFormLayout must be used within a FormLayoutProvider");return e.layout},mf=Je.createContext(void 0),Wv=({children:e,template:r,fieldTypes:t})=>K.jsx(mf.Provider,{value:{template:r,fieldTypes:t},children:e}),gf=()=>{const e=Je.useContext(mf);if(!e)throw new Error("useFormRenderer must be used within a FormRendererProvider");return e},Yv=e=>{const{fieldTypes:r}=gf();if(!e)return null;const t=r.find(i=>i.type===e);if(!t)throw new Error(`Field type ${e} not found`);const{renderField:n,...u}=t;return{renderField:n,fullWidth:u.fullWidth,...u}},Gv=e=>{const{template:r}=gf(),t=r.fields[e];if(!t)throw new Error(`Field template for ${e} not found`);return t},Xv={type:"DATE",name:"Date",groups:[],dateFormat:"MM/dd/yyyy",renderField:(e,r,{disabled:t,readonly:n,name:u})=>K.jsx(Bc,{name:u??e.id,label:K.jsx(un,{...e,readonly:n,children:e.label}),rules:On(e),constraints:e.constraints,dateFormat:r.dateFormat,disabled:t,readonly:n})},Qv={type:"DROPDOWN",name:"Dropdown",groups:[],renderField:(e,r,{disabled:t,readonly:n,name:u})=>K.jsx(ff,{name:u??e.id,label:K.jsx(un,{...e,children:e.label}),rules:On(e),options:e.options,disabled:t,readonly:n})},Zv={type:"CHECKBOX",name:"Checkbox",groups:[],renderField:(e,r,{disabled:t,readonly:n,name:u})=>K.jsx(Ic,{name:u??e.id,label:K.jsx(un,{...e,readonly:n,children:e.label}),rules:On(e),disabled:t,readonly:n})},Jv={type:"TEXTINPUT",name:"Text",groups:[],maxLength:262144,filter:e=>e.replace(/[^\u0000-\u00FF ]/g,""),renderField:(e,r,{disabled:t,readonly:n,name:u})=>K.jsx(Rc,{rules:On(e),label:K.jsx(un,{...e,readonly:n,children:e.label}),name:u??e.id,disabled:t,readonly:n,maxLength:r.maxLength,filter:r.filter})},Kv={type:"NUMBER",name:"Number",groups:[],decimalPlaces:14,renderField:(e,r,{disabled:t,readonly:n,name:u})=>K.jsx(cf,{name:u??e.id,label:K.jsx(un,{...e,readonly:n,children:e.label}),rules:{...On(e),min:{value:e.min,message:`Value must be at least ${e.min}.`},max:{value:e.max,message:`Value must be no more than ${e.max}.`}},disabled:t,readonly:n,decimalPlaces:r.decimalPlaces})},e3={type:"CALCULATEDNUMBER",name:"Calculated Number",groups:[],renderField:(e,r,{readonly:t,name:n})=>K.jsx(lf,{name:n??e.id,label:K.jsx(un,{...e,readonly:t,children:e.label}),rules:[]})},On=e=>({required:{value:e.required??!1,message:"This field is required."}}),bf=[Jv,Kv,e3,Qv,Zv,Xv];function t3({children:e,template:r,fieldTypes:t=bf,layout:n}){return K.jsx(Hr.LocalizationProvider,{dateAdapter:Uv,adapterLocale:void 0,children:K.jsx(Vv,{layout:n,children:K.jsx(Wv,{template:r,fieldTypes:t,children:e})})})}function r3(e,r){const{defaultValues:t}=r||{},n=!!t,u=Kt.useForm(r),i=Je.useRef(n);return Je.useEffect(()=>{!e&&t&&!i.current&&(u.reset(t),i.current=!0)},[e,t,u]),u}function n3({children:e,formOptions:r,submitOptions:t,loading:n}){const u=r3(n,r),{handleSubmit:i,reset:a}=u,{onSubmit:s,onReset:f,formId:l,submitOnChange:c,registerForm:p}=t||{},o=async m=>{await(s==null?void 0:s(m)),a(m)},d=async()=>{a(r==null?void 0:r.defaultValues),await(f==null?void 0:f())};return K.jsx(Kt.FormProvider,{...u,children:K.jsx("form",{"data-testid":l,onSubmit:i(o),onChange:c?i(o):void 0,onReset:d,ref:p,id:l,style:{width:"100%"},children:e})})}function u3({children:e,formOptions:r,submitOptions:t}){const{formId:n,onSubmit:u,onBlur:i}=t,a=Kt.useForm(r),{getFieldState:s,reset:f,getValues:l,handleSubmit:c,trigger:p}=a,o=async()=>{const d=l(),m=Object.keys(d).filter(g=>s(g).isDirty);await p(m);const b=m.filter(g=>!s(g).invalid).reduce((g,w)=>(g[w]=d[w],g),{});Object.keys(b).length>0&&(await(i==null?void 0:i(b)),f({...d,...b},{keepErrors:!0}))};return K.jsx(Kt.FormProvider,{...a,children:K.jsx("form",{onBlur:o,onSubmit:c(async d=>{await(u==null?void 0:u(d)),f(d)}),id:n,"data-testid":n,children:e})})}function yf({id:e,name:r,readonly:t,wrapper:n}){const{field:u}=pf(),i=Gv(e),a=Yv(i.type);if(!a||!a.renderField)return K.jsxs(Le.Box,{children:["Missing render for field type ",i.type]});const{renderField:s,...f}=a,l=u==null?void 0:u(i,f),c=n||
|
|
164
|
+
`));if(!kn)throw new Error("MUI: The minimum supported `date-fns` package version compatible with this adapter is `3.2.x`.")}super({locale:r??Pi,formats:t,longFormatters:kn}),this.parse=(n,u)=>n===""?null:Ph(n,u,new Date,{locale:this.locale}),this.isValid=n=>n==null?!1:Ys(n),this.format=(n,u)=>this.formatByString(n,this.formats[u]),this.formatByString=(n,u)=>ki(n,u,{locale:this.locale}),this.isEqual=(n,u)=>n===null&&u===null?!0:n===null||u===null?!1:Ld(n,u),this.isSameYear=(n,u)=>kh(n,u),this.isSameMonth=(n,u)=>Rh(n,u),this.isSameDay=(n,u)=>If(n,u),this.isSameHour=(n,u)=>Ih(n,u),this.isAfter=(n,u)=>mu(n,u),this.isAfterYear=(n,u)=>mu(n,Xs(u)),this.isAfterDay=(n,u)=>mu(n,Gs(u)),this.isBefore=(n,u)=>gu(n,u),this.isBeforeYear=(n,u)=>gu(n,this.startOfYear(u)),this.isBeforeDay=(n,u)=>gu(n,this.startOfDay(u)),this.isWithinRange=(n,[u,i])=>Lh(n,{start:u,end:i}),this.startOfYear=n=>Qs(n),this.startOfMonth=n=>Lf(n),this.startOfWeek=n=>wr(n,{locale:this.locale}),this.startOfDay=n=>Wr(n),this.endOfYear=n=>Xs(n),this.endOfMonth=n=>kf(n),this.endOfWeek=n=>qf(n,{locale:this.locale}),this.endOfDay=n=>Gs(n),this.addYears=(n,u)=>Bf(n,u),this.addMonths=(n,u)=>hu(n,u),this.addWeeks=(n,u)=>Pf(n,u),this.addDays=(n,u)=>Ur(n,u),this.addHours=(n,u)=>Sf(n,u),this.addMinutes=(n,u)=>Nf(n,u),this.addSeconds=(n,u)=>Mf(n,u),this.getYear=n=>kd(n),this.getMonth=n=>Id(n),this.getDate=n=>_d(n),this.getHours=n=>Nd(n),this.getMinutes=n=>Bd(n),this.getSeconds=n=>Rd(n),this.getMilliseconds=n=>Pd(n),this.setYear=(n,u)=>Wh(n,u),this.setMonth=(n,u)=>$h(n,u),this.setDate=(n,u)=>jh(n,u),this.setHours=(n,u)=>zh(n,u),this.setMinutes=(n,u)=>Uh(n,u),this.setSeconds=(n,u)=>Vh(n,u),this.setMilliseconds=(n,u)=>Hh(n,u),this.getDaysInMonth=n=>io(n),this.getWeekArray=n=>{const u=this.startOfWeek(this.startOfMonth(n)),i=this.endOfWeek(this.endOfMonth(n));let a=0,s=u;const f=[];for(;this.isBefore(s,i);){const l=Math.floor(a/7);f[l]=f[l]||[],f[l].push(s),s=this.addDays(s,1),a+=1}return f},this.getWeekNumber=n=>Ii(n,{locale:this.locale}),this.getYearRange=([n,u])=>{const i=this.startOfYear(n),a=this.endOfYear(u),s=[];let f=i;for(;this.isBefore(f,a);)s.push(f),f=this.addYears(f,1);return s}}}const hf=Je.createContext(void 0),Vv=({children:e,layout:r={section:()=>({}),field:()=>({})}})=>K.jsx(hf.Provider,{value:{layout:r},children:e}),pf=()=>{const e=Je.useContext(hf);if(!e)throw new Error("useFormLayout must be used within a FormLayoutProvider");return e.layout},mf=Je.createContext(void 0),Wv=({children:e,template:r,fieldTypes:t})=>K.jsx(mf.Provider,{value:{template:r,fieldTypes:t},children:e}),gf=()=>{const e=Je.useContext(mf);if(!e)throw new Error("useFormRenderer must be used within a FormRendererProvider");return e},Yv=e=>{const{fieldTypes:r}=gf();if(!e)return null;const t=r.find(i=>i.type===e);if(!t)throw new Error(`Field type ${e} not found`);const{renderField:n,...u}=t;return{renderField:n,fullWidth:u.fullWidth,...u}},Gv=e=>{const{template:r}=gf(),t=r.fields[e];if(!t)throw new Error(`Field template for ${e} not found`);return t},Xv={type:"DATE",name:"Date",groups:[],dateFormat:"MM/dd/yyyy",renderField:(e,r,{disabled:t,readonly:n,name:u})=>K.jsx(Bc,{name:u??e.id,label:K.jsx(un,{...e,readonly:n,children:e.label}),rules:On(e),constraints:e.constraints,dateFormat:r.dateFormat,disabled:t,readonly:n})},Qv={type:"DROPDOWN",name:"Dropdown",groups:[],renderField:(e,r,{disabled:t,readonly:n,name:u})=>K.jsx(ff,{name:u??e.id,label:K.jsx(un,{...e,children:e.label}),rules:On(e),options:e.options,disabled:t,readonly:n})},Zv={type:"CHECKBOX",name:"Checkbox",groups:[],renderField:(e,r,{disabled:t,readonly:n,name:u})=>K.jsx(Ic,{name:u??e.id,label:K.jsx(un,{...e,readonly:n,children:e.label}),rules:On(e),disabled:t,readonly:n})},Jv={type:"TEXTINPUT",name:"Text",groups:[],maxLength:262144,filter:e=>e.replace(/[^\u0000-\u00FF ]/g,""),renderField:(e,r,{disabled:t,readonly:n,name:u})=>K.jsx(Rc,{rules:On(e),label:K.jsx(un,{...e,readonly:n,children:e.label}),name:u??e.id,disabled:t,readonly:n,maxLength:r.maxLength,filter:r.filter})},Kv={type:"NUMBER",name:"Number",groups:[],decimalPlaces:14,renderField:(e,r,{disabled:t,readonly:n,name:u})=>K.jsx(cf,{name:u??e.id,label:K.jsx(un,{...e,readonly:n,children:e.label}),rules:{...On(e),min:{value:e.min,message:`Value must be at least ${e.min}.`},max:{value:e.max,message:`Value must be no more than ${e.max}.`}},disabled:t,readonly:n,decimalPlaces:r.decimalPlaces})},e3={type:"CALCULATEDNUMBER",name:"Calculated Number",groups:[],renderField:(e,r,{readonly:t,name:n})=>K.jsx(lf,{name:n??e.id,label:K.jsx(un,{...e,readonly:t,children:e.label}),rules:[]})},On=e=>({required:{value:e.required??!1,message:"This field is required."}}),bf=[Jv,Kv,e3,Qv,Zv,Xv];function t3({children:e,template:r,fieldTypes:t=bf,layout:n}){return K.jsx(Hr.LocalizationProvider,{dateAdapter:Uv,adapterLocale:void 0,children:K.jsx(Vv,{layout:n,children:K.jsx(Wv,{template:r,fieldTypes:t,children:e})})})}function r3(e,r){const{defaultValues:t}=r||{},n=!!t,u=Kt.useForm(r),i=Je.useRef(n);return Je.useEffect(()=>{!e&&t&&!i.current&&(u.reset(t),i.current=!0)},[e,t,u]),u}function n3({children:e,formOptions:r,submitOptions:t,loading:n}){const u=r3(n,r),{handleSubmit:i,reset:a}=u,{onSubmit:s,onReset:f,formId:l,submitOnChange:c,registerForm:p}=t||{},o=async m=>{await(s==null?void 0:s(m)),a(m)},d=async()=>{a(r==null?void 0:r.defaultValues),await(f==null?void 0:f())};return K.jsx(Kt.FormProvider,{...u,children:K.jsx("form",{"data-testid":l,onSubmit:i(o),onChange:c?i(o):void 0,onReset:d,ref:p,id:l,style:{width:"100%"},children:e})})}function u3({children:e,formOptions:r,submitOptions:t}){const{formId:n,onSubmit:u,onBlur:i}=t,a=Kt.useForm(r),{getFieldState:s,reset:f,getValues:l,handleSubmit:c,trigger:p}=a,o=async()=>{const d=l(),m=Object.keys(d).filter(g=>s(g).isDirty);await p(m);const b=m.filter(g=>!s(g).invalid).reduce((g,w)=>(g[w]=d[w],g),{});Object.keys(b).length>0&&(await(i==null?void 0:i(b)),f({...d,...b},{keepErrors:!0}))};return K.jsx(Kt.FormProvider,{...a,children:K.jsx("form",{onBlur:o,onSubmit:c(async d=>{await(u==null?void 0:u(d)),f(d)}),id:n,"data-testid":n,children:e})})}function yf({id:e,name:r,readonly:t,wrapper:n}){const{field:u}=pf(),i=Gv(e),a=Yv(i.type);if(!a||!a.renderField)return K.jsxs(Le.Box,{children:["Missing render for field type ",i.type]});const{renderField:s,...f}=a,l=u==null?void 0:u(i,f),c=n||Le.Box;return K.jsx(c,{"data-testid":"field-container",field:i,sx:l,children:s(i,f,{readonly:t,name:r})})}function i3({section:e,fields:r,fieldNames:t,readonly:n,fieldWrapper:u}){const{section:i}=pf(),a=i==null?void 0:i(e);return K.jsx(Le.Box,{"data-testid":"section-container",sx:a,children:r.map((s,f)=>K.jsx(yf,{id:s,name:(t==null?void 0:t[f])??s,readonly:n,wrapper:u},s))})}Fe.AutosaveForm=u3,Fe.CalculatedNumber=lf,Fe.CheckboxInput=Ic,Fe.DateInput=Bc,Fe.DropdownInput=ff,Fe.ErrorMessage=ln,Fe.Field=yf,Fe.Form=n3,Fe.FormFieldLabel=un,Fe.LabelWithChildren=Oa,Fe.NumberInput=cf,Fe.ReadOnlyField=Jr,Fe.RendererProvider=t3,Fe.Section=i3,Fe.TextInput=Rc,Fe.defaultFieldTypes=bf,Fe.defaultRules=On,Object.defineProperty(Fe,Symbol.toStringTag,{value:"Module"})});
|
package/dist/renderer/Field.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SxProps } from '@mui/material';
|
|
1
2
|
import { FieldTemplate } from '@opengov/form-utils';
|
|
2
3
|
/**
|
|
3
4
|
* Field is a component that renders a field.
|
|
@@ -16,5 +17,6 @@ export default function Field({ id, name, readonly, wrapper, }: {
|
|
|
16
17
|
wrapper?: React.ComponentType<{
|
|
17
18
|
children: React.ReactNode;
|
|
18
19
|
field: FieldTemplate;
|
|
20
|
+
sx?: SxProps;
|
|
19
21
|
}>;
|
|
20
22
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SxProps } from '@mui/material';
|
|
1
2
|
import { FieldTemplate, SectionTemplate } from '@opengov/form-utils';
|
|
2
3
|
/**
|
|
3
4
|
* Section is a component that renders a section.
|
|
@@ -17,5 +18,6 @@ export default function Section({ section, fields, fieldNames, readonly, fieldWr
|
|
|
17
18
|
fieldWrapper?: React.ComponentType<{
|
|
18
19
|
children: React.ReactNode;
|
|
19
20
|
field: FieldTemplate;
|
|
21
|
+
sx?: SxProps;
|
|
20
22
|
}>;
|
|
21
23
|
}): import("react/jsx-runtime").JSX.Element;
|