@kbgarcia8/react-dynamic-form 1.1.32 → 1.1.33

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 +1 @@
1
- {"version":3,"file":"DynamicForm.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/DynamicForm/DynamicForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAgB,gBAAgB,EAA+D,MAAM,yBAAyB,CAAC;AAE3I,QAAA,MAAM,WAAW,GAAI,mTAuBnB,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,4CAmJ1C,CAAA;AAGD,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"DynamicForm.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/DynamicForm/DynamicForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAgB,gBAAgB,EAA+D,MAAM,yBAAyB,CAAC;AAE3I,QAAA,MAAM,WAAW,GAAI,mTAuBnB,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,4CAoJ1C,CAAA;AAGD,eAAe,WAAW,CAAC"}
@@ -111,7 +111,7 @@
111
111
  max-width: 100%;
112
112
  resize: none;
113
113
  overflow-y: auto;
114
- `,A=F.forwardRef((a,o)=>{const{type:s,id:i,onChange:m,isRequired:r,dataAttributes:d,disabled:b,className:h}=a;if(s==="textarea"){const{rows:y=5,cols:N=30,value:E,...v}=a;return e.jsx(ne,{onChange:m,value:E,rows:y,cols:N,className:h,ref:o,disabled:b,required:r,...v,...d})}if(s==="radio"||s==="checkbox"){const{checked:y,...N}=a;return e.jsx(B,{ref:o,checked:y,onChange:m,disabled:b,className:h,...N,...d})}const u=a,{value:j,pattern:f,placeholderText:k,...C}=u;return e.jsx(B,{placeholder:k,onChange:m,value:j,required:r,className:h,ref:o,disabled:b,pattern:f,...C,...d})}),w=a=>{const{className:o,type:s,id:i,textLabel:m,additionalInfo:r,$labelFlexDirection:d,svg:b,labelClass:h,onChange:u,isRequired:j,dataAttributes:f,inputClass:k,ref:C,disabled:y,isEditable:N,editIcon:E,onClickEdit:v,deleteIcon:D,onClickDelete:S,idx:T,children:q}=a;return e.jsxs(Y,{className:`${o} ${i.replace("#","")}-label-input-container`,children:[s!=="radio"&&s!=="checkbox"&&e.jsx(R,{htmlFor:i,textLabel:m,additionalInfo:r,$labelFlexDirection:d,svg:b,className:h}),s!=="radio"&&s!=="checkbox"&&s==="textarea"&&(()=>{const{rows:n=5,cols:g=30,value:l,...p}=a;return e.jsx(A,{id:i,name:i,type:"textarea",isRequired:j,onChange:u,value:l,rows:n,cols:g,dataAttributes:f,className:k,ref:C,disabled:y})})(),s!=="radio"&&s!=="checkbox"&&s!=="textarea"&&(()=>{const n=a,{value:g,pattern:l,placeholderText:p,...z}=n;return e.jsx(A,{id:i,name:i,placeholderText:p,onChange:u,value:g,type:s,isRequired:j,dataAttributes:f,className:k,ref:C,disabled:y,pattern:l})})(),(s==="radio"||s==="checkbox")&&(()=>{const{checked:n,...g}=a;return e.jsxs(e.Fragment,{children:[e.jsx(A,{ref:C,type:"checkbox",name:i,id:i,isRequired:j,checked:n,onChange:u,disabled:y,className:k,dataAttributes:f}),e.jsx(R,{htmlFor:i,textLabel:m,additionalInfo:r,$labelFlexDirection:d,svg:b,className:h})]})})(),N&&e.jsxs(Z,{className:"input-edit-buttons",children:[e.jsx($,{id:`editable-${i}-edit-btn`,svg:E,buttonType:"button",onClick:v,className:`edit-radio-${T}`,dataAttributes:f}),e.jsx($,{id:`editable-${i}-delete-btn`,svg:D,buttonType:"button",onClick:S,className:`delete-radio-${T}`,dataAttributes:f})]}),q]})},se=c.fieldset`
114
+ `,A=F.forwardRef((a,o)=>{const{type:s,id:i,onChange:m,isRequired:r,dataAttributes:d,disabled:b,className:h}=a;if(s==="textarea"){const{rows:y=5,cols:N=30,value:E,...v}=a;return e.jsx(ne,{onChange:m,value:E,rows:y,cols:N,className:h,ref:o,disabled:b,required:r,...v,...d})}if(s==="radio"||s==="checkbox"){const{checked:y,...N}=a;return e.jsx(B,{ref:o,checked:y,onChange:m,disabled:b,className:h,...N,...d})}const g=a,{value:j,pattern:f,placeholderText:k,...C}=g;return e.jsx(B,{placeholder:k,onChange:m,value:j,required:r,className:h,ref:o,disabled:b,pattern:f,...C,...d})}),w=a=>{const{className:o,type:s,id:i,textLabel:m,additionalInfo:r,$labelFlexDirection:d,svg:b,labelClass:h,onChange:g,isRequired:j,dataAttributes:f,inputClass:k,ref:C,disabled:y,isEditable:N,editIcon:E,onClickEdit:v,deleteIcon:D,onClickDelete:S,idx:T,children:q}=a;return e.jsxs(Y,{className:`${o} ${i.replace("#","")}-label-input-container`,children:[s!=="radio"&&s!=="checkbox"&&e.jsx(R,{htmlFor:i,textLabel:m,additionalInfo:r,$labelFlexDirection:d,svg:b,className:h}),s!=="radio"&&s!=="checkbox"&&s==="textarea"&&(()=>{const{rows:n=5,cols:u=30,value:l,...p}=a;return e.jsx(A,{id:i,name:i,type:"textarea",isRequired:j,onChange:g,value:l,rows:n,cols:u,dataAttributes:f,className:k,ref:C,disabled:y})})(),s!=="radio"&&s!=="checkbox"&&s!=="textarea"&&(()=>{const n=a,{value:u,pattern:l,placeholderText:p,...z}=n;return e.jsx(A,{id:i,name:i,placeholderText:p,onChange:g,value:u,type:s,isRequired:j,dataAttributes:f,className:k,ref:C,disabled:y,pattern:l})})(),(s==="radio"||s==="checkbox")&&(()=>{const{checked:n,...u}=a;return e.jsxs(e.Fragment,{children:[e.jsx(A,{ref:C,type:"checkbox",name:i,id:i,isRequired:j,checked:n,onChange:g,disabled:y,className:k,dataAttributes:f}),e.jsx(R,{htmlFor:i,textLabel:m,additionalInfo:r,$labelFlexDirection:d,svg:b,className:h})]})})(),N&&e.jsxs(Z,{className:"input-edit-buttons",children:[e.jsx($,{id:`editable-${i}-edit-btn`,svg:E,buttonType:"button",onClick:v,className:`edit-radio-${T}`,dataAttributes:f}),e.jsx($,{id:`editable-${i}-delete-btn`,svg:D,buttonType:"button",onClick:S,className:`delete-radio-${T}`,dataAttributes:f})]}),q]})},se=c.fieldset`
115
115
  padding: 0;
116
116
  height: auto;
117
117
  width: 100%;
@@ -131,11 +131,11 @@
131
131
  display: flex;
132
132
  justify-content: space-between;
133
133
  width: 100%;
134
- `,P=({legend:a,fieldsetIndex:o,idx:s,editableInformation:i,onChangeOfEditableOption:m,onClickSaveEdit:r,onClickCancelEdit:d,onClickDeleteEntry:b})=>(console.log(o),e.jsxs(se,{className:"editable-option-fieldset",children:[e.jsx(oe,{children:`${a} ${s+1}`}),i?.map((h,u)=>e.jsx(ie,{className:"editable-option-container",children:e.jsx(A,{id:`editable-option-${u}`,name:`editable-option-${u}`,placeholderText:h.name.charAt(0).toUpperCase()+h.name.slice(1),onChange:m,value:h.info,type:h.type,isRequired:!0,className:"editable-option",dataAttributes:{"data-index":u,"data-fieldsetindex":o,"data-key":h.info}})},`${h.name}-${u}`)),e.jsxs(le,{className:"editable-option-button-space",children:[e.jsx($,{id:`editable-option-${s}-submit`,buttonType:"button",text:"Save",onClick:r,className:"editable-option-btn",dataAttributes:{"data-index":s,"data-fieldsetindex":o}}),e.jsx($,{id:`editable-option-${s}-cancel`,buttonType:"button",text:"Cancel",onClick:d,className:"editable-option-btn",dataAttributes:{"data-index":s,"data-fieldsetindex":o}}),e.jsx($,{id:`editable-option-${s}-delete`,buttonType:"button",text:"Delete",onClick:b,className:"editable-option-btn",dataAttributes:{"data-index":s,"data-fieldsetindex":o}})]})]})),ce=c.div`
134
+ `,P=({legend:a,fieldsetIndex:o,idx:s,editableInformation:i,onChangeOfEditableOption:m,onClickSaveEdit:r,onClickCancelEdit:d,onClickDeleteEntry:b})=>(console.log(o),e.jsxs(se,{className:"editable-option-fieldset",children:[e.jsx(oe,{children:`${a} ${s+1}`}),i?.map((h,g)=>e.jsx(ie,{className:"editable-option-container",children:e.jsx(A,{id:`editable-option-${g}`,name:`editable-option-${g}`,placeholderText:h.name.charAt(0).toUpperCase()+h.name.slice(1),onChange:m,value:h.info,type:h.type,isRequired:!0,className:"editable-option",dataAttributes:{"data-index":g,"data-fieldsetindex":o,"data-key":h.info}})},`${h.name}-${g}`)),e.jsxs(le,{className:"editable-option-button-space",children:[e.jsx($,{id:`editable-option-${s}-submit`,buttonType:"button",text:"Save",onClick:r,className:"editable-option-btn",dataAttributes:{"data-index":s,"data-fieldsetindex":o}}),e.jsx($,{id:`editable-option-${s}-cancel`,buttonType:"button",text:"Cancel",onClick:d,className:"editable-option-btn",dataAttributes:{"data-index":s,"data-fieldsetindex":o}}),e.jsx($,{id:`editable-option-${s}-delete`,buttonType:"button",text:"Delete",onClick:b,className:"editable-option-btn",dataAttributes:{"data-index":s,"data-fieldsetindex":o}})]})]})),ce=c.div`
135
135
  display: flex;
136
136
  justify-content: space-between;
137
137
  max-width: 100%;
138
- `,re=({id:a,hasSubmit:o,submitText:s,handleSubmit:i,hasReset:m,resetText:r,handleReset:d,hasCancel:b,cancelText:h,handleCancel:u})=>e.jsxs(ce,{className:"form-main-button-container",children:[o&&e.jsx($,{id:`form-${a}-submit`,buttonType:"submit",text:s??"Submit",onClick:i,className:"submit-form-btn"}),m&&e.jsx($,{id:`form-${a}-edit`,buttonType:"button",text:r??"Reset",onClick:d,className:"reset-form-btn"}),b&&e.jsx($,{id:`form-${a}-cancel`,buttonType:"button",text:h??"Cancel",onClick:u,className:"cancel-form-btn"})]}),W=c.legend`
138
+ `,re=({id:a,hasSubmit:o,submitText:s,handleSubmit:i,hasReset:m,resetText:r,handleReset:d,hasCancel:b,cancelText:h,handleCancel:g})=>e.jsxs(ce,{className:"form-main-button-container",children:[o&&e.jsx($,{id:`form-${a}-submit`,buttonType:"submit",text:s??"Submit",onClick:i,className:"submit-form-btn"}),m&&e.jsx($,{id:`form-${a}-edit`,buttonType:"button",text:r??"Reset",onClick:d,className:"reset-form-btn"}),b&&e.jsx($,{id:`form-${a}-cancel`,buttonType:"button",text:h??"Cancel",onClick:g,className:"cancel-form-btn"})]}),W=c.legend`
139
139
  font-size: ${t.spacing.medium};
140
140
  font-weight: 500;
141
141
  margin-bottom: ${t.spacing.small};
@@ -174,4 +174,4 @@
174
174
  flex-direction: column;
175
175
  align-items: center;
176
176
  justify-content: center;
177
- `,xe=({fieldsets:a=null,legendText:o,isExpandable:s,id:i,formInputs:m,labelAndInputContainerClass:r,labelClass:d,inputClass:b,onChangeOfEditableOption:h,handleAddingInputEntry:u,hasSubmit:j=!1,submitText:f,handleSubmit:k,hasReset:C=!1,resetText:y,handleReset:N,hasCancel:E=!1,cancelText:v,handleCancel:D,handleSubmitForm:S,className:T,children:q})=>e.jsxs(de,{id:`${i}-form`,className:T,onSubmit:S,children:[a?a.map((n,g)=>e.jsxs(U,{className:`${i}-fieldset-wrapper`,children:[e.jsxs(M,{id:`${i}-form-fieldset-${g}`,className:`${n.legend}-fieldset`,children:[n.legend&&e.jsx(W,{className:`${n.legend}-legend`,children:n.legend}),n.inputs.length!==0?n.inputs.map((l,p)=>e.jsxs(F.Fragment,{children:[l.type==="textarea"&&e.jsx(w,{...l,id:l.id??`${n.legend}-input`,labelClass:d,inputClass:b,idx:p,className:`${r} ${l?.uniqueClass}`}),l.type!=="textarea"&&l.type!=="radio"&&l.type!=="checkbox"&&e.jsx(w,{...l,id:l.id??`${n.legend}-input`,labelClass:d,inputClass:b,idx:p,className:`${r} ${l?.uniqueClass}`}),(l.type==="radio"||l.type==="checkbox")&&e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,id:l.id??`${n.legend}-input`,labelClass:d,inputClass:b,idx:p,className:`${r} ${l?.uniqueClass}`}),l.editing&&l.isEditable&&e.jsx(P,{legend:`${n.legend}`,fieldsetIndex:g,idx:p,editableInformation:l?.editableInformation||[],onChangeOfEditableOption:h,onClickSaveEdit:l?.onClickSave||(z=>{}),onClickCancelEdit:l?.onClickCancel||(z=>{}),onClickDeleteEntry:l?.onClickDelete||(z=>{})})]})]},`form-${i}-${p}`)):n.isExpandable?e.jsx(O,{children:`No entry yet on ${n.legend}. Click "+" button to add entry.`}):""]}),n.isExpandable&&e.jsx(H,{className:"add-input-button-space",children:e.jsx($,{id:`expand-${n.legend}-inputs`,buttonType:"button",text:"+",onClick:u,className:"add-input-entry",dataAttributes:{"data-fieldsetindex":g}})})]},`${n.legend}-${g}`)):e.jsxs(U,{className:`${i}-fieldset-wrapper`,children:[e.jsxs(M,{id:`${i}-form-fieldset`,className:`${o}-fieldset`,children:[o&&e.jsx(W,{className:`${o}-legend`,children:o}),!a&&m&&m.length!==0?m.map((n,g)=>e.jsxs(F.Fragment,{children:[n.type==="textarea"&&e.jsx(w,{...n,id:n.id??`${o}-input`,labelClass:d,inputClass:b,idx:g,className:`${r} ${n?.uniqueClass}`}),n.type!=="textarea"&&n.type!=="radio"&&n.type!=="checkbox"&&e.jsx(w,{...n,id:n.id??`${o}-input`,labelClass:d,inputClass:b,idx:g,className:`${r} ${n?.uniqueClass}`}),(n.type==="radio"||n.type==="checkbox")&&e.jsxs(e.Fragment,{children:[e.jsx(w,{...n,id:n.id??`${o}-input`,labelClass:d,inputClass:b,idx:g,className:`${r} ${n?.uniqueClass}`}),n.editing&&n.isEditable&&e.jsx(P,{legend:`${o}`,idx:g,editableInformation:n?.editableInformation,onChangeOfEditableOption:h,onClickSaveEdit:n?.onClickSave||(l=>{}),onClickCancelEdit:n?.onClickCancel||(l=>{}),onClickDeleteEntry:n?.onClickDelete||(l=>{})})]})]},`form-${i}-${g}`)):s?e.jsx(O,{children:`No entry yet on ${o}. Please click "+" button to add`}):""]}),s&&e.jsx(H,{className:"add-input-button-space",children:e.jsx($,{id:`expand-${o}-inputs`,buttonType:"button",text:"+",onClick:u,className:"add-input-entry"})})]}),e.jsx(re,{id:i,hasSubmit:j,submitText:f,handleSubmit:k,hasReset:C,resetText:y,handleReset:N,hasCancel:E,cancelText:v,handleCancel:D}),e.jsx(me,{className:"children-container",children:q})]}),be=a=>{const o=/^#([0-9A-Fa-f]{3}){1,2}$/,s=/^rgb(a)?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/;return o.test(a)||s.test(a)||CSS.supports("color",a)},x=a=>{if(!be(a))throw new Error(`Invalid color: ${a}`);return a},he={mobile:"320px",tablet:"768px",desktop:"992px",largeDesktop:"1200px",largerDesktop:"1400px"},G={name:"light",colors:{text:x("#333446"),bg:x("#EEEEEE"),blue:x("#7F8CAA"),blue2:x("#80A6FF"),teal:x("#5b8280ff"),teal2:x("#AEEAE7"),gray:x("#AEAEAE"),information:x("#202234"),success:x("#123524"),warning:x("#F2C265"),error:x("#990000")}},J={name:"dark",colors:{bg:x("#333446"),text:x("#EEEEEE"),blue:x("#80A6FF"),blue2:x("#7F8CAA"),teal:x("#AEEAE7"),teal2:x("#5b8280ff"),gray:x("#D0D0DD"),information:x("#C9E6F0"),success:x("#9EDF9C"),warning:x("#FCFFC1"),error:x("#FAD4D4")}},L=F.createContext({}),ue=({children:a,initialTheme:o=G,secondTheme:s=J})=>{const[i,m]=F.useState(o),r=()=>{m(d=>d===o?s:o)};return e.jsx(L.Provider,{value:{currentTheme:i,toggleTheme:r},children:e.jsx(c.ThemeProvider,{theme:i,children:a})})},ge=()=>F.useContext(L);exports.DynamicForm=xe;exports.ThemeContext=L;exports.ThemeContextProvider=ue;exports.breakpoints=he;exports.darkTheme=J;exports.lightTheme=G;exports.useTheme=ge;
177
+ `,xe=({fieldsets:a=null,legendText:o,isExpandable:s,id:i,formInputs:m,labelAndInputContainerClass:r,labelClass:d,inputClass:b,onChangeOfEditableOption:h,handleAddingInputEntry:g,hasSubmit:j=!1,submitText:f,handleSubmit:k,hasReset:C=!1,resetText:y,handleReset:N,hasCancel:E=!1,cancelText:v,handleCancel:D,handleSubmitForm:S,className:T,children:q})=>e.jsxs(de,{id:`${i}-form`,className:T,onSubmit:S,children:[a?a.map((n,u)=>(console.log(u),e.jsxs(U,{className:`${i}-fieldset-wrapper`,children:[e.jsxs(M,{id:`${i}-form-fieldset-${u}`,className:`${n.legend}-fieldset`,children:[n.legend&&e.jsx(W,{className:`${n.legend}-legend`,children:n.legend}),n.inputs.length!==0?n.inputs.map((l,p)=>e.jsxs(F.Fragment,{children:[l.type==="textarea"&&e.jsx(w,{...l,id:l.id??`${n.legend}-input`,labelClass:d,inputClass:b,idx:p,className:`${r} ${l?.uniqueClass}`}),l.type!=="textarea"&&l.type!=="radio"&&l.type!=="checkbox"&&e.jsx(w,{...l,id:l.id??`${n.legend}-input`,labelClass:d,inputClass:b,idx:p,className:`${r} ${l?.uniqueClass}`}),(l.type==="radio"||l.type==="checkbox")&&e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,id:l.id??`${n.legend}-input`,labelClass:d,inputClass:b,idx:p,className:`${r} ${l?.uniqueClass}`}),l.editing&&l.isEditable&&e.jsx(P,{legend:`${n.legend}`,fieldsetIndex:u,idx:p,editableInformation:l?.editableInformation||[],onChangeOfEditableOption:h,onClickSaveEdit:l?.onClickSave||(z=>{}),onClickCancelEdit:l?.onClickCancel||(z=>{}),onClickDeleteEntry:l?.onClickDelete||(z=>{})})]})]},`form-${i}-${p}`)):n.isExpandable?e.jsx(O,{children:`No entry yet on ${n.legend}. Click "+" button to add entry.`}):""]}),n.isExpandable&&e.jsx(H,{className:"add-input-button-space",children:e.jsx($,{id:`expand-${n.legend}-inputs`,buttonType:"button",text:"+",onClick:g,className:"add-input-entry",dataAttributes:{"data-fieldsetindex":u}})})]},`${n.legend}-${u}`))):e.jsxs(U,{className:`${i}-fieldset-wrapper`,children:[e.jsxs(M,{id:`${i}-form-fieldset`,className:`${o}-fieldset`,children:[o&&e.jsx(W,{className:`${o}-legend`,children:o}),!a&&m&&m.length!==0?m.map((n,u)=>e.jsxs(F.Fragment,{children:[n.type==="textarea"&&e.jsx(w,{...n,id:n.id??`${o}-input`,labelClass:d,inputClass:b,idx:u,className:`${r} ${n?.uniqueClass}`}),n.type!=="textarea"&&n.type!=="radio"&&n.type!=="checkbox"&&e.jsx(w,{...n,id:n.id??`${o}-input`,labelClass:d,inputClass:b,idx:u,className:`${r} ${n?.uniqueClass}`}),(n.type==="radio"||n.type==="checkbox")&&e.jsxs(e.Fragment,{children:[e.jsx(w,{...n,id:n.id??`${o}-input`,labelClass:d,inputClass:b,idx:u,className:`${r} ${n?.uniqueClass}`}),n.editing&&n.isEditable&&e.jsx(P,{legend:`${o}`,idx:u,editableInformation:n?.editableInformation,onChangeOfEditableOption:h,onClickSaveEdit:n?.onClickSave||(l=>{}),onClickCancelEdit:n?.onClickCancel||(l=>{}),onClickDeleteEntry:n?.onClickDelete||(l=>{})})]})]},`form-${i}-${u}`)):s?e.jsx(O,{children:`No entry yet on ${o}. Please click "+" button to add`}):""]}),s&&e.jsx(H,{className:"add-input-button-space",children:e.jsx($,{id:`expand-${o}-inputs`,buttonType:"button",text:"+",onClick:g,className:"add-input-entry"})})]}),e.jsx(re,{id:i,hasSubmit:j,submitText:f,handleSubmit:k,hasReset:C,resetText:y,handleReset:N,hasCancel:E,cancelText:v,handleCancel:D}),e.jsx(me,{className:"children-container",children:q})]}),be=a=>{const o=/^#([0-9A-Fa-f]{3}){1,2}$/,s=/^rgb(a)?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/;return o.test(a)||s.test(a)||CSS.supports("color",a)},x=a=>{if(!be(a))throw new Error(`Invalid color: ${a}`);return a},he={mobile:"320px",tablet:"768px",desktop:"992px",largeDesktop:"1200px",largerDesktop:"1400px"},G={name:"light",colors:{text:x("#333446"),bg:x("#EEEEEE"),blue:x("#7F8CAA"),blue2:x("#80A6FF"),teal:x("#5b8280ff"),teal2:x("#AEEAE7"),gray:x("#AEAEAE"),information:x("#202234"),success:x("#123524"),warning:x("#F2C265"),error:x("#990000")}},J={name:"dark",colors:{bg:x("#333446"),text:x("#EEEEEE"),blue:x("#80A6FF"),blue2:x("#7F8CAA"),teal:x("#AEEAE7"),teal2:x("#5b8280ff"),gray:x("#D0D0DD"),information:x("#C9E6F0"),success:x("#9EDF9C"),warning:x("#FCFFC1"),error:x("#FAD4D4")}},L=F.createContext({}),ue=({children:a,initialTheme:o=G,secondTheme:s=J})=>{const[i,m]=F.useState(o),r=()=>{m(d=>d===o?s:o)};return e.jsx(L.Provider,{value:{currentTheme:i,toggleTheme:r},children:e.jsx(c.ThemeProvider,{theme:i,children:a})})},ge=()=>F.useContext(L);exports.DynamicForm=xe;exports.ThemeContext=L;exports.ThemeContextProvider=ue;exports.breakpoints=he;exports.darkTheme=J;exports.lightTheme=G;exports.useTheme=ge;
@@ -219,7 +219,7 @@ const e = {
219
219
  }
220
220
  );
221
221
  }
222
- const f = t, { value: N, pattern: p, placeholderText: C, ...w } = f;
222
+ const $ = t, { value: N, pattern: p, placeholderText: C, ...w } = $;
223
223
  return /* @__PURE__ */ a(
224
224
  W,
225
225
  {
@@ -245,7 +245,7 @@ const e = {
245
245
  $labelFlexDirection: d,
246
246
  svg: h,
247
247
  labelClass: g,
248
- onChange: f,
248
+ onChange: $,
249
249
  isRequired: N,
250
250
  dataAttributes: p,
251
251
  inputClass: C,
@@ -262,7 +262,7 @@ const e = {
262
262
  return /* @__PURE__ */ u(te, { className: `${l} ${i.replace("#", "")}-label-input-container`, children: [
263
263
  o !== "radio" && o !== "checkbox" && /* @__PURE__ */ a(B, { htmlFor: i, textLabel: m, additionalInfo: r, $labelFlexDirection: d, svg: h, className: g }),
264
264
  o !== "radio" && o !== "checkbox" && o === "textarea" && (() => {
265
- const { rows: n = 5, cols: $ = 30, value: s, ...k } = t;
265
+ const { rows: n = 5, cols: f = 30, value: s, ...k } = t;
266
266
  return /* @__PURE__ */ a(
267
267
  D,
268
268
  {
@@ -270,10 +270,10 @@ const e = {
270
270
  name: i,
271
271
  type: "textarea",
272
272
  isRequired: N,
273
- onChange: f,
273
+ onChange: $,
274
274
  value: s,
275
275
  rows: n,
276
- cols: $,
276
+ cols: f,
277
277
  dataAttributes: p,
278
278
  className: C,
279
279
  ref: w,
@@ -282,15 +282,15 @@ const e = {
282
282
  );
283
283
  })(),
284
284
  o !== "radio" && o !== "checkbox" && o !== "textarea" && (() => {
285
- const n = t, { value: $, pattern: s, placeholderText: k, ...L } = n;
285
+ const n = t, { value: f, pattern: s, placeholderText: k, ...L } = n;
286
286
  return /* @__PURE__ */ a(
287
287
  D,
288
288
  {
289
289
  id: i,
290
290
  name: i,
291
291
  placeholderText: k,
292
- onChange: f,
293
- value: $,
292
+ onChange: $,
293
+ value: f,
294
294
  type: o,
295
295
  isRequired: N,
296
296
  dataAttributes: p,
@@ -302,7 +302,7 @@ const e = {
302
302
  );
303
303
  })(),
304
304
  (o === "radio" || o === "checkbox") && (() => {
305
- const { checked: n, ...$ } = t;
305
+ const { checked: n, ...f } = t;
306
306
  return /* @__PURE__ */ u(R, { children: [
307
307
  /* @__PURE__ */ a(
308
308
  D,
@@ -313,7 +313,7 @@ const e = {
313
313
  id: i,
314
314
  isRequired: N,
315
315
  checked: n,
316
- onChange: f,
316
+ onChange: $,
317
317
  disabled: y,
318
318
  className: C,
319
319
  dataAttributes: p
@@ -359,11 +359,11 @@ const e = {
359
359
  onClickDeleteEntry: h
360
360
  }) => (console.log(l), /* @__PURE__ */ u(re, { className: "editable-option-fieldset", children: [
361
361
  /* @__PURE__ */ a(de, { children: `${t} ${o + 1}` }),
362
- i?.map((g, f) => /* @__PURE__ */ a(me, { className: "editable-option-container", children: /* @__PURE__ */ a(
362
+ i?.map((g, $) => /* @__PURE__ */ a(me, { className: "editable-option-container", children: /* @__PURE__ */ a(
363
363
  D,
364
364
  {
365
- id: `editable-option-${f}`,
366
- name: `editable-option-${f}`,
365
+ id: `editable-option-${$}`,
366
+ name: `editable-option-${$}`,
367
367
  placeholderText: g.name.charAt(0).toUpperCase() + g.name.slice(1),
368
368
  onChange: m,
369
369
  value: g.info,
@@ -371,12 +371,12 @@ const e = {
371
371
  isRequired: !0,
372
372
  className: "editable-option",
373
373
  dataAttributes: {
374
- "data-index": f,
374
+ "data-index": $,
375
375
  "data-fieldsetindex": l,
376
376
  "data-key": g.info
377
377
  }
378
378
  }
379
- ) }, `${g.name}-${f}`)),
379
+ ) }, `${g.name}-${$}`)),
380
380
  /* @__PURE__ */ u(be, { className: "editable-option-button-space", children: [
381
381
  /* @__PURE__ */ a(x, { id: `editable-option-${o}-submit`, buttonType: "button", text: "Save", onClick: r, className: "editable-option-btn", dataAttributes: { "data-index": o, "data-fieldsetindex": l } }),
382
382
  /* @__PURE__ */ a(x, { id: `editable-option-${o}-cancel`, buttonType: "button", text: "Cancel", onClick: d, className: "editable-option-btn", dataAttributes: { "data-index": o, "data-fieldsetindex": l } }),
@@ -396,11 +396,11 @@ const e = {
396
396
  handleReset: d,
397
397
  hasCancel: h,
398
398
  cancelText: g,
399
- handleCancel: f
399
+ handleCancel: $
400
400
  }) => /* @__PURE__ */ u(he, { className: "form-main-button-container", children: [
401
401
  l && /* @__PURE__ */ a(x, { id: `form-${t}-submit`, buttonType: "submit", text: o ?? "Submit", onClick: i, className: "submit-form-btn" }),
402
402
  m && /* @__PURE__ */ a(x, { id: `form-${t}-edit`, buttonType: "button", text: r ?? "Reset", onClick: d, className: "reset-form-btn" }),
403
- h && /* @__PURE__ */ a(x, { id: `form-${t}-cancel`, buttonType: "button", text: g ?? "Cancel", onClick: f, className: "cancel-form-btn" })
403
+ h && /* @__PURE__ */ a(x, { id: `form-${t}-cancel`, buttonType: "button", text: g ?? "Cancel", onClick: $, className: "cancel-form-btn" })
404
404
  ] }), M = c.legend`
405
405
  font-size: ${e.spacing.medium};
406
406
  font-weight: 500;
@@ -450,7 +450,7 @@ const e = {
450
450
  labelClass: d,
451
451
  inputClass: h,
452
452
  onChangeOfEditableOption: g,
453
- handleAddingInputEntry: f,
453
+ handleAddingInputEntry: $,
454
454
  hasSubmit: N = !1,
455
455
  submitText: p,
456
456
  handleSubmit: C,
@@ -464,8 +464,8 @@ const e = {
464
464
  className: T,
465
465
  children: j
466
466
  }) => /* @__PURE__ */ u(ue, { id: `${i}-form`, className: T, onSubmit: z, children: [
467
- t ? t.map((n, $) => /* @__PURE__ */ u(H, { className: `${i}-fieldset-wrapper`, children: [
468
- /* @__PURE__ */ u(U, { id: `${i}-form-fieldset-${$}`, className: `${n.legend}-fieldset`, children: [
467
+ t ? t.map((n, f) => (console.log(f), /* @__PURE__ */ u(H, { className: `${i}-fieldset-wrapper`, children: [
468
+ /* @__PURE__ */ u(U, { id: `${i}-form-fieldset-${f}`, className: `${n.legend}-fieldset`, children: [
469
469
  n.legend && /* @__PURE__ */ a(M, { className: `${n.legend}-legend`, children: n.legend }),
470
470
  n.inputs.length !== 0 ? n.inputs.map((s, k) => /* @__PURE__ */ u(q.Fragment, { children: [
471
471
  s.type === "textarea" && /* @__PURE__ */ a(
@@ -506,7 +506,7 @@ const e = {
506
506
  P,
507
507
  {
508
508
  legend: `${n.legend}`,
509
- fieldsetIndex: $,
509
+ fieldsetIndex: f,
510
510
  idx: k,
511
511
  editableInformation: s?.editableInformation || [],
512
512
  onChangeOfEditableOption: g,
@@ -521,11 +521,11 @@ const e = {
521
521
  ] })
522
522
  ] }, `form-${i}-${k}`)) : n.isExpandable ? /* @__PURE__ */ a(O, { children: `No entry yet on ${n.legend}. Click "+" button to add entry.` }) : ""
523
523
  ] }),
524
- n.isExpandable && /* @__PURE__ */ a(G, { className: "add-input-button-space", children: /* @__PURE__ */ a(x, { id: `expand-${n.legend}-inputs`, buttonType: "button", text: "+", onClick: f, className: "add-input-entry", dataAttributes: { "data-fieldsetindex": $ } }) })
525
- ] }, `${n.legend}-${$}`)) : /* @__PURE__ */ u(H, { className: `${i}-fieldset-wrapper`, children: [
524
+ n.isExpandable && /* @__PURE__ */ a(G, { className: "add-input-button-space", children: /* @__PURE__ */ a(x, { id: `expand-${n.legend}-inputs`, buttonType: "button", text: "+", onClick: $, className: "add-input-entry", dataAttributes: { "data-fieldsetindex": f } }) })
525
+ ] }, `${n.legend}-${f}`))) : /* @__PURE__ */ u(H, { className: `${i}-fieldset-wrapper`, children: [
526
526
  /* @__PURE__ */ u(U, { id: `${i}-form-fieldset`, className: `${l}-fieldset`, children: [
527
527
  l && /* @__PURE__ */ a(M, { className: `${l}-legend`, children: l }),
528
- !t && m && m.length !== 0 ? m.map((n, $) => /* @__PURE__ */ u(q.Fragment, { children: [
528
+ !t && m && m.length !== 0 ? m.map((n, f) => /* @__PURE__ */ u(q.Fragment, { children: [
529
529
  n.type === "textarea" && /* @__PURE__ */ a(
530
530
  E,
531
531
  {
@@ -533,7 +533,7 @@ const e = {
533
533
  id: n.id ?? `${l}-input`,
534
534
  labelClass: d,
535
535
  inputClass: h,
536
- idx: $,
536
+ idx: f,
537
537
  className: `${r} ${n?.uniqueClass}`
538
538
  }
539
539
  ),
@@ -544,7 +544,7 @@ const e = {
544
544
  id: n.id ?? `${l}-input`,
545
545
  labelClass: d,
546
546
  inputClass: h,
547
- idx: $,
547
+ idx: f,
548
548
  className: `${r} ${n?.uniqueClass}`
549
549
  }
550
550
  ),
@@ -556,7 +556,7 @@ const e = {
556
556
  id: n.id ?? `${l}-input`,
557
557
  labelClass: d,
558
558
  inputClass: h,
559
- idx: $,
559
+ idx: f,
560
560
  className: `${r} ${n?.uniqueClass}`
561
561
  }
562
562
  ),
@@ -564,7 +564,7 @@ const e = {
564
564
  P,
565
565
  {
566
566
  legend: `${l}`,
567
- idx: $,
567
+ idx: f,
568
568
  editableInformation: n?.editableInformation,
569
569
  onChangeOfEditableOption: g,
570
570
  onClickSaveEdit: n?.onClickSave || ((s) => {
@@ -576,9 +576,9 @@ const e = {
576
576
  }
577
577
  )
578
578
  ] })
579
- ] }, `form-${i}-${$}`)) : o ? /* @__PURE__ */ a(O, { children: `No entry yet on ${l}. Please click "+" button to add` }) : ""
579
+ ] }, `form-${i}-${f}`)) : o ? /* @__PURE__ */ a(O, { children: `No entry yet on ${l}. Please click "+" button to add` }) : ""
580
580
  ] }),
581
- o && /* @__PURE__ */ a(G, { className: "add-input-button-space", children: /* @__PURE__ */ a(x, { id: `expand-${l}-inputs`, buttonType: "button", text: "+", onClick: f, className: "add-input-entry" }) })
581
+ o && /* @__PURE__ */ a(G, { className: "add-input-button-space", children: /* @__PURE__ */ a(x, { id: `expand-${l}-inputs`, buttonType: "button", text: "+", onClick: $, className: "add-input-entry" }) })
582
582
  ] }),
583
583
  /* @__PURE__ */ a(
584
584
  ge,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbgarcia8/react-dynamic-form",
3
- "version": "1.1.32",
3
+ "version": "1.1.33",
4
4
  "description": "A form that can be nested with editable, expandable and flexible input-forms",
5
5
  "keywords": [
6
6
  "form",