@opengov/form-renderer 0.0.1-beta3 → 0.0.1-beta5

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.
@@ -1,7 +1,7 @@
1
1
  import { GeneralInputProps } from './types';
2
2
  export default function SelectInput({ name, label, options, sx, disabled, rules, ...rest }: GeneralInputProps & {
3
3
  options: Array<{
4
- value: string;
5
- label: string;
4
+ displayValue: string;
5
+ key: string;
6
6
  }>;
7
7
  }): import("react/jsx-runtime").JSX.Element;
package/dist/lib.js CHANGED
@@ -740,7 +740,7 @@ function Cd({
740
740
  displayEmpty: !0,
741
741
  variant: "outlined",
742
742
  fullWidth: !0,
743
- children: t.map((h) => /* @__PURE__ */ G.jsx(ai, { value: h.value, children: h.label }, h.value))
743
+ children: t.map((h) => /* @__PURE__ */ G.jsx(ai, { value: h.key, children: h.displayValue }, h.key))
744
744
  }
745
745
  ),
746
746
  u && /* @__PURE__ */ G.jsx(Ra, { children: u.message })
package/dist/lib.umd.cjs CHANGED
@@ -27,7 +27,7 @@ Check the top-level render call using <`+P+">.")}return T}}function To(l,T){{if(
27
27
  <%s {...props} />
28
28
  React keys must be passed directly to JSX without using spread:
29
29
  let props = %s;
30
- <%s key={someKey} {...props} />`,Sn,dt,td,dt),So[dt+Sn]=!0}}return l===n?Xf(_e):Qf(_e),_e}}function Kf(l,T,P){return Co(l,T,P,!0)}function Jf(l,T,P){return Co(l,T,P,!1)}var Zf=Jf,ed=Kf;Pt.Fragment=n,Pt.jsx=Zf,Pt.jsxs=ed}()),Pt}process.env.NODE_ENV==="production"?Pr.exports=Po():Pr.exports=_o();var z=Pr.exports;const Pn=Me.createContext(void 0),Mo=({children:e,layout:r={}})=>z.jsx(Pn.Provider,{value:{layout:r},children:e}),_r=()=>{const e=Me.useContext(Pn);if(!e)throw new Error("useFormLayout must be used within a FormLayoutProvider");return e.layout};function Do({name:e,label:r,sx:t={},disabled:n,rules:a={},...o}){const{field:i,fieldState:{error:c}}=ht.useController({name:e,rules:a}),f={..._r(),...t};return z.jsx(ye.Box,{sx:f,children:z.jsxs(ye.FormControl,{error:!!c,component:"fieldset",children:[z.jsx(ye.FormControlLabel,{control:z.jsx(ye.Checkbox,{...i,checked:i.value,...o,disabled:n}),label:z.jsx(ye.FormLabel,{sx:{fontWeight:500,color:Kt.capitalDesignTokens.foundations.colors.gray1000},children:r})}),z.jsx(ye.FormHelperText,{children:!!c&&c.message})]})})}function Ro({name:e,rules:r={},sx:t={},...n}){const{field:a,fieldState:{error:o}}=ht.useController({name:e,rules:r});return z.jsx(ye.Box,{sx:t,children:z.jsx(Cn.DatePicker,{...a,value:new Date(a.value),...n,sx:{width:"100%"},slotProps:{textField:{helperText:!!o&&o.message,error:!!o}}})})}function _n({name:e,label:r,rules:t={},sx:n={},...a}){const{field:o,fieldState:{error:i}}=ht.useController({name:e,rules:t}),u={..._r(),...n};return z.jsx(ye.Box,{sx:u,children:z.jsx(ye.TextField,{...o,label:r,fullWidth:!0,...a,error:!!i,helperText:!!i&&i.message,onChange:f=>o.onChange(a.type==="number"?parseFloat(f.target.value):f.target.value)})})}function Ao(e){return z.jsx(_n,{...e,type:"number"})}function $o({name:e,label:r,options:t,sx:n={},disabled:a,rules:o={},...i}){const{field:c,fieldState:{error:u}}=ht.useController({name:e,rules:o}),d={..._r(),...n};return z.jsx(ye.Box,{sx:d,children:z.jsxs(ye.FormControl,{fullWidth:!0,error:!!u,disabled:a,children:[z.jsx(ye.FormLabel,{id:`${e}-label`,sx:{fontWeight:500,color:Kt.capitalDesignTokens.foundations.colors.gray1000,marginBottom:1},children:r}),z.jsx(ye.Select,{labelId:`${e}-label`,id:`${e}-select`,...c,...i,displayEmpty:!0,variant:"outlined",fullWidth:!0,children:t.map(h=>z.jsx(ye.MenuItem,{value:h.value,children:h.label},h.value))}),u&&z.jsx(ye.FormHelperText,{children:u.message})]})})}function et(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Mn(e){if(!et(e))return e;const r={};return Object.keys(e).forEach(t=>{r[t]=Mn(e[t])}),r}function Ye(e,r,t={clone:!0}){const n=t.clone?{...e}:e;return et(e)&&et(r)&&Object.keys(r).forEach(a=>{et(r[a])&&Object.prototype.hasOwnProperty.call(e,a)&&et(e[a])?n[a]=Ye(e[a],r[a],t):t.clone?n[a]=et(r[a])?Mn(r[a]):r[a]:n[a]=r[a]}),n}var Mr={exports:{}},Jt={exports:{}},ae={};/** @license React v16.13.1
30
+ <%s key={someKey} {...props} />`,Sn,dt,td,dt),So[dt+Sn]=!0}}return l===n?Xf(_e):Qf(_e),_e}}function Kf(l,T,P){return Co(l,T,P,!0)}function Jf(l,T,P){return Co(l,T,P,!1)}var Zf=Jf,ed=Kf;Pt.Fragment=n,Pt.jsx=Zf,Pt.jsxs=ed}()),Pt}process.env.NODE_ENV==="production"?Pr.exports=Po():Pr.exports=_o();var z=Pr.exports;const Pn=Me.createContext(void 0),Mo=({children:e,layout:r={}})=>z.jsx(Pn.Provider,{value:{layout:r},children:e}),_r=()=>{const e=Me.useContext(Pn);if(!e)throw new Error("useFormLayout must be used within a FormLayoutProvider");return e.layout};function Do({name:e,label:r,sx:t={},disabled:n,rules:a={},...o}){const{field:i,fieldState:{error:c}}=ht.useController({name:e,rules:a}),f={..._r(),...t};return z.jsx(ye.Box,{sx:f,children:z.jsxs(ye.FormControl,{error:!!c,component:"fieldset",children:[z.jsx(ye.FormControlLabel,{control:z.jsx(ye.Checkbox,{...i,checked:i.value,...o,disabled:n}),label:z.jsx(ye.FormLabel,{sx:{fontWeight:500,color:Kt.capitalDesignTokens.foundations.colors.gray1000},children:r})}),z.jsx(ye.FormHelperText,{children:!!c&&c.message})]})})}function Ro({name:e,rules:r={},sx:t={},...n}){const{field:a,fieldState:{error:o}}=ht.useController({name:e,rules:r});return z.jsx(ye.Box,{sx:t,children:z.jsx(Cn.DatePicker,{...a,value:new Date(a.value),...n,sx:{width:"100%"},slotProps:{textField:{helperText:!!o&&o.message,error:!!o}}})})}function _n({name:e,label:r,rules:t={},sx:n={},...a}){const{field:o,fieldState:{error:i}}=ht.useController({name:e,rules:t}),u={..._r(),...n};return z.jsx(ye.Box,{sx:u,children:z.jsx(ye.TextField,{...o,label:r,fullWidth:!0,...a,error:!!i,helperText:!!i&&i.message,onChange:f=>o.onChange(a.type==="number"?parseFloat(f.target.value):f.target.value)})})}function Ao(e){return z.jsx(_n,{...e,type:"number"})}function $o({name:e,label:r,options:t,sx:n={},disabled:a,rules:o={},...i}){const{field:c,fieldState:{error:u}}=ht.useController({name:e,rules:o}),d={..._r(),...n};return z.jsx(ye.Box,{sx:d,children:z.jsxs(ye.FormControl,{fullWidth:!0,error:!!u,disabled:a,children:[z.jsx(ye.FormLabel,{id:`${e}-label`,sx:{fontWeight:500,color:Kt.capitalDesignTokens.foundations.colors.gray1000,marginBottom:1},children:r}),z.jsx(ye.Select,{labelId:`${e}-label`,id:`${e}-select`,...c,...i,displayEmpty:!0,variant:"outlined",fullWidth:!0,children:t.map(h=>z.jsx(ye.MenuItem,{value:h.key,children:h.displayValue},h.key))}),u&&z.jsx(ye.FormHelperText,{children:u.message})]})})}function et(e){if(typeof e!="object"||e===null)return!1;const r=Object.getPrototypeOf(e);return(r===null||r===Object.prototype||Object.getPrototypeOf(r)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Mn(e){if(!et(e))return e;const r={};return Object.keys(e).forEach(t=>{r[t]=Mn(e[t])}),r}function Ye(e,r,t={clone:!0}){const n=t.clone?{...e}:e;return et(e)&&et(r)&&Object.keys(r).forEach(a=>{et(r[a])&&Object.prototype.hasOwnProperty.call(e,a)&&et(e[a])?n[a]=Ye(e[a],r[a],t):t.clone?n[a]=et(r[a])?Mn(r[a]):r[a]:n[a]=r[a]}),n}var Mr={exports:{}},Jt={exports:{}},ae={};/** @license React v16.13.1
31
31
  * react-is.production.min.js
32
32
  *
33
33
  * Copyright (c) Facebook, Inc. and its affiliates.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengov/form-renderer",
3
- "version": "0.0.1-beta3",
3
+ "version": "0.0.1-beta5",
4
4
  "description": "OpenGov Smart Forms form renderer",
5
5
  "type": "module",
6
6
  "files": [
@@ -14,7 +14,7 @@
14
14
  "require": "./dist/lib.umd.cjs"
15
15
  }
16
16
  },
17
- "types": "dist/index.d.ts",
17
+ "types": "dist/form-builder/src/index.d.ts",
18
18
  "scripts": {
19
19
  "test": "jest",
20
20
  "lint": "eslint .",