@kbgarcia8/react-dynamic-form 1.1.3 → 1.1.26

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,12 +1,12 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("react"),c=require("styled-components"),n={fonts:{secondary:"Raleway",tertiary:"Lato",fallback:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif"},fontWeight:{light:300,medium:500,bold:700,bolder:900},fontSize:{xsmall:"0.75rem"},spacing:{xxxsmall:"0.25rem",xxsmall:"0.375rem",xsmall:"0.5rem",small:"0.75rem",medium:"1.25rem"},borderRadius:{xsmall:"0.125rem",small:"0.25rem",xlarge:"2rem"},borderThickness:{thin:"0.0625rem",light:"0.125rem"}},V=c.button`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),F=require("react"),r=require("styled-components"),t={fonts:{secondary:"Raleway",tertiary:"Lato",fallback:"system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif"},fontWeight:{light:300,medium:500,bold:700,bolder:900},fontSize:{xsmall:"0.75rem"},spacing:{xxxsmall:"0.25rem",xxsmall:"0.375rem",xsmall:"0.5rem",small:"0.75rem",medium:"1.25rem"},borderRadius:{xsmall:"0.125rem",small:"0.25rem",xlarge:"2rem"},borderThickness:{thin:"0.0625rem",light:"0.125rem"}},J=r.button`
2
2
  display: flex;
3
3
  align-items: center;
4
4
  justify-content: center;
5
- background-color: ${({theme:t})=>t.colors.blue||"blue"};
6
- color: ${({theme:t})=>t.colors.bg||"white"};
7
- border: ${n.borderThickness.light} solid ${({theme:t})=>t.colors.text||"black"};
8
- border-radius: ${n.borderRadius.xlarge};
9
- padding: ${n.spacing.xxxsmall} ${n.spacing.small};
5
+ background-color: ${({theme:n})=>n.colors.blue||"blue"};
6
+ color: ${({theme:n})=>n.colors.bg||"white"};
7
+ border: ${t.borderThickness.light} solid ${({theme:n})=>n.colors.text||"black"};
8
+ border-radius: ${t.borderRadius.xlarge};
9
+ padding: ${t.spacing.xxxsmall} ${t.spacing.small};
10
10
  margin: 0.125rem;
11
11
  width: auto;
12
12
  cursor: pointer;
@@ -14,7 +14,7 @@
14
14
 
15
15
  &:hover {
16
16
  background-color: lightblue;
17
- border: ${n.borderThickness.light} solid gray;
17
+ border: ${t.borderThickness.light} solid gray;
18
18
  }
19
19
 
20
20
  & .button-icon-text-space {
@@ -24,42 +24,42 @@
24
24
  & .button-icon-text-space svg {
25
25
  max-width: 100%;
26
26
  }
27
- `,X=c.div`
27
+ `,K=r.div`
28
28
  width: 100%;
29
29
  display: flex;
30
30
  flex-direction: row;
31
31
  align-items: center;
32
32
  justify-content: center;
33
- `,Y=c.img`
33
+ `,Q=r.img`
34
34
  maxwidth: 100%;
35
- `,Z=c.span`
36
- font-size: ${n.fontSize.xsmall};
37
- font-weight: ${n.fontWeight.medium};
38
- font-family: ${n.fonts.tertiary}, ${n.fonts.fallback};
35
+ `,V=r.span`
36
+ font-size: ${t.fontSize.xsmall};
37
+ font-weight: ${t.fontWeight.medium};
38
+ font-family: ${t.fonts.tertiary}, ${t.fonts.fallback};
39
39
  display: flex;
40
40
  align-items: center;
41
41
  justify-content: center;
42
- `,g=({onClick:t,id:o,buttonType:i,source:s,svg:r,alt:d="alt-button-icon",text:m="",className:l="",dataAttributes:b={}})=>e.jsx(V,{onClick:t,id:o,type:i,className:l,...b,children:e.jsxs(X,{className:"button-icon-text-space",children:[s?e.jsx(Y,{src:s,alt:d}):r||"",m&&e.jsx(Z,{id:o,children:m})]})}),_=c.div`
42
+ `,f=({onClick:n,id:s,buttonType:l,source:o,svg:x,alt:d="alt-button-icon",text:m="",className:c="",dataAttributes:h={}})=>e.jsx(J,{onClick:n,id:s,type:l,className:c,...h,children:e.jsxs(K,{className:"button-icon-text-space",children:[o?e.jsx(Q,{src:o,alt:d}):x||"",m&&e.jsx(V,{id:s,children:m})]})}),X=r.div`
43
43
  display: flex;
44
44
  flex-direction: column;
45
45
  align-items: left;
46
46
  width: 100%;
47
- margin-bottom: ${n.spacing.small};
48
- `,I=c.div`
47
+ margin-bottom: ${t.spacing.small};
48
+ `,Y=r.div`
49
49
  display: flex;
50
- gap: ${n.spacing.xsmall};
50
+ gap: ${t.spacing.xsmall};
51
51
  width: auto;
52
52
  height: auto;
53
- `,ee=c.label`
53
+ `,Z=r.label`
54
54
  display: flex;
55
55
  align-items: center;
56
56
  justify-content:center;
57
57
  height: auto;
58
- flex-direction: ${t=>t.$labelFlexDirection||"column"};
59
- font-family: ${n.fonts.secondary}, ${n.fonts.fallback};
60
- font-size: ${n.fontSize.xsmall};
61
- font-weight: ${n.fontWeight.bold};
62
- gap: ${n.spacing.xxsmall};
58
+ flex-direction: ${n=>n.$labelFlexDirection||"column"};
59
+ font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
60
+ font-size: ${t.fontSize.xsmall};
61
+ font-weight: ${t.fontWeight.bold};
62
+ gap: ${t.spacing.xxsmall};
63
63
 
64
64
  & .label-icon-container img,
65
65
  & .label-icon-container svg {
@@ -67,105 +67,111 @@
67
67
  height: auto;
68
68
  object-fit: contain;
69
69
  }
70
- `,te=c.span`
71
- font-weight: ${n.fontWeight.bolder};
72
- `,ne=c.div`
70
+ `,_=r.div`
71
+ display: flex;
72
+ flex-direction: column;
73
+ align-items: center;
74
+ justify-content: center;
75
+ gap: ${t.spacing.xxxsmall};
76
+ `,ee=r.span`
77
+ font-weight: ${t.fontWeight.bolder};
78
+ `,te=r.div`
73
79
  max-width: 100%;
74
80
  display: flex;
75
81
  align-items: center;
76
- `,ae=c.span`
77
- font-weight: ${n.fontWeight.light};
78
- `,P=({htmlFor:t,textLabel:o,additionalInfo:i,$labelFlexDirection:s,source:r,svg:d,className:m,children:l})=>e.jsxs(ee,{htmlFor:t,className:m,$labelFlexDirection:s,children:[(r||d)&&e.jsx(ne,{className:"label-icon-container",children:r?e.jsx("img",{src:r,alt:`${t}-label-icon`}):d||""}),e.jsx(te,{className:"main-label",children:o}),i&&e.jsx(ae,{className:"additional-info",children:i}),l]}),W=c.input`
82
+ `,ne=r.span`
83
+ font-weight: ${t.fontWeight.light};
84
+ `,R=({htmlFor:n,textLabel:s,additionalInfo:l,$labelFlexDirection:o,source:x,svg:d,className:m,children:c})=>e.jsxs(Z,{htmlFor:n,className:m,$labelFlexDirection:o,children:[(x||d)&&e.jsx(te,{className:"label-icon-container",children:x?e.jsx("img",{src:x,alt:`${n}-label-icon`}):d||""}),e.jsxs(_,{className:"label-text-container",children:[e.jsx(ee,{className:"main-label",children:s}),l&&e.jsx(ne,{className:"additional-info",children:l})]}),c]}),B=r.input`
79
85
  display: flex;
80
86
  place-content: center;
81
- font-family: ${n.fonts.secondary}, ${n.fonts.fallback};
82
- font-size: ${n.fontSize.xsmall};
87
+ font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
88
+ font-size: ${t.fontSize.xsmall};
83
89
  line-height: 1.75;
84
- padding: ${n.spacing.xxxsmall} ${n.spacing.xsmall};
90
+ padding: ${t.spacing.xxxsmall} ${t.spacing.xsmall};
85
91
  max-width: 100%;
86
92
  height: auto;
87
93
  background-color: #FFFFFF;
88
94
  outline: none;
89
- border: ${n.borderThickness.thin} solid #000000;
90
- border-radius: ${n.borderRadius.xsmall};
95
+ border: ${t.borderThickness.thin} solid #000000;
96
+ border-radius: ${t.borderRadius.xsmall};
91
97
 
92
98
  &:focus{
93
- border: ${n.borderThickness.thin} solid ${({theme:t})=>t.colors.teal};
99
+ border: ${t.borderThickness.thin} solid ${({theme:n})=>n.colors.teal};
94
100
  }
95
- `,oe=c.textarea`
101
+ `,ae=r.textarea`
96
102
  display: flex;
97
103
  place-content: center;
98
- border: ${n.borderThickness.light} solid ${({theme:t})=>t.colors.text};
99
- border-radius: ${n.borderRadius.small};
104
+ border: ${t.borderThickness.light} solid ${({theme:n})=>n.colors.text};
105
+ border-radius: ${t.borderRadius.small};
100
106
  outline: none;
101
- line-height: ${n.spacing.small};
102
- padding: ${n.spacing.xxxsmall};
103
- font-family: ${n.fonts.secondary}, ${n.fonts.fallback};
104
- font-size: ${n.fontSize.xsmall};
107
+ line-height: ${t.spacing.small};
108
+ padding: ${t.spacing.xxxsmall};
109
+ font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
110
+ font-size: ${t.fontSize.xsmall};
105
111
  max-width: 100%;
106
112
  resize: none;
107
113
  overflow-y: auto;
108
- `,z=v.forwardRef((t,o)=>{const{type:i,id:s,onChange:r,isRequired:d,dataAttributes:m,disabled:l,className:b}=t;if(i==="textarea"){const{rows:j=5,cols:N=30,value:T,...A}=t;return e.jsx(oe,{id:s,onChange:r,value:T,rows:j,cols:N,...m,className:b,ref:o,disabled:l,required:d})}if(i==="radio"||i==="checkbox"){const{checked:j,...N}=t;return e.jsx(W,{ref:o,type:"checkbox",id:s,checked:j,onChange:r,disabled:l,className:b,...m})}const u=t,{value:y,pattern:f,placeholderText:p,...C}=u;return e.jsx(W,{id:s,name:s,placeholder:p,onChange:r,value:y,type:i,required:d,...m,className:b,ref:o,disabled:l,pattern:f})}),F=t=>{const{className:o,type:i,id:s,textLabel:r,additionalInfo:d,$labelFlexDirection:m,svg:l,labelClass:b,onChange:u,isRequired:y,dataAttributes:f,inputClass:p,ref:C,disabled:j,isEditable:N,editIcon:T,onClickEdit:A,deleteIcon:R,onClickDelete:B,idx:S,children:q}=t;return e.jsxs(_,{className:`${o} ${s.replace("#","")}-label-input-container`,children:[i!=="radio"&&i!=="checkbox"&&e.jsx(P,{htmlFor:s,textLabel:r,additionalInfo:d,$labelFlexDirection:m,svg:l,className:b}),i!=="radio"&&i!=="checkbox"&&i==="textarea"&&(()=>{const{rows:k=5,cols:w=30,value:D,...a}=t;return e.jsx(z,{id:s,name:s,type:"textarea",isRequired:y,onChange:u,value:D,rows:k,cols:w,dataAttributes:f,className:p,ref:C,disabled:j})})(),i!=="radio"&&i!=="checkbox"&&i!=="textarea"&&(()=>{const k=t,{value:w,pattern:D,placeholderText:a,...$}=k;return e.jsx(z,{id:s,name:s,placeholderText:a,onChange:u,value:w,type:i,isRequired:y,dataAttributes:f,className:p,ref:C,disabled:j,pattern:D})})(),(i==="radio"||i==="checkbox")&&(()=>{const{checked:k,...w}=t;return e.jsxs(e.Fragment,{children:[e.jsx(z,{ref:C,type:"checkbox",name:s,id:s,isRequired:y,checked:k,onChange:u,disabled:j,className:p,dataAttributes:f}),e.jsx(P,{htmlFor:s,textLabel:r,additionalInfo:d,$labelFlexDirection:m,svg:l,className:b})]})})(),N&&e.jsxs(I,{className:"input-edit-buttons",children:[e.jsx(g,{id:`editable-${s}-edit-btn`,svg:T,buttonType:"button",onClick:A,className:`edit-radio-${S}`,dataAttributes:f}),e.jsx(g,{id:`editable-${s}-delete-btn`,svg:R,buttonType:"button",onClick:B,className:`delete-radio-${S}`,dataAttributes:f})]}),q]})},se=c.fieldset`
114
+ `,A=F.forwardRef((n,s)=>{const{type:l,id:o,onChange:x,isRequired:d,dataAttributes:m,disabled:c,className:h}=n;if(l==="textarea"){const{rows:y=5,cols:N=30,value:E,...v}=n;return e.jsx(ae,{id:o,onChange:x,value:E,rows:y,cols:N,...m,className:h,ref:s,disabled:c,required:d})}if(l==="radio"||l==="checkbox"){const{checked:y,...N}=n;return e.jsx(B,{ref:s,type:"checkbox",id:o,checked:y,onChange:x,disabled:c,className:h,...m})}const g=n,{value:j,pattern:$,placeholderText:k,...C}=g;return e.jsx(B,{id:o,name:o,placeholder:k,onChange:x,value:j,type:l,required:d,...m,className:h,ref:s,disabled:c,pattern:$})}),w=n=>{const{className:s,type:l,id:o,textLabel:x,additionalInfo:d,$labelFlexDirection:m,svg:c,labelClass:h,onChange:g,isRequired:j,dataAttributes:$,inputClass:k,ref:C,disabled:y,isEditable:N,editIcon:E,onClickEdit:v,deleteIcon:D,onClickDelete:S,idx:T,children:q}=n;return e.jsxs(X,{className:`${s} ${o.replace("#","")}-label-input-container`,children:[l!=="radio"&&l!=="checkbox"&&e.jsx(R,{htmlFor:o,textLabel:x,additionalInfo:d,$labelFlexDirection:m,svg:c,className:h}),l!=="radio"&&l!=="checkbox"&&l==="textarea"&&(()=>{const{rows:a=5,cols:u=30,value:i,...p}=n;return e.jsx(A,{id:o,name:o,type:"textarea",isRequired:j,onChange:g,value:i,rows:a,cols:u,dataAttributes:$,className:k,ref:C,disabled:y})})(),l!=="radio"&&l!=="checkbox"&&l!=="textarea"&&(()=>{const a=n,{value:u,pattern:i,placeholderText:p,...z}=a;return e.jsx(A,{id:o,name:o,placeholderText:p,onChange:g,value:u,type:l,isRequired:j,dataAttributes:$,className:k,ref:C,disabled:y,pattern:i})})(),(l==="radio"||l==="checkbox")&&(()=>{const{checked:a,...u}=n;return e.jsxs(e.Fragment,{children:[e.jsx(A,{ref:C,type:"checkbox",name:o,id:o,isRequired:j,checked:a,onChange:g,disabled:y,className:k,dataAttributes:$}),e.jsx(R,{htmlFor:o,textLabel:x,additionalInfo:d,$labelFlexDirection:m,svg:c,className:h})]})})(),N&&e.jsxs(Y,{className:"input-edit-buttons",children:[e.jsx(f,{id:`editable-${o}-edit-btn`,svg:E,buttonType:"button",onClick:v,className:`edit-radio-${T}`,dataAttributes:$}),e.jsx(f,{id:`editable-${o}-delete-btn`,svg:D,buttonType:"button",onClick:S,className:`delete-radio-${T}`,dataAttributes:$})]}),q]})},se=r.fieldset`
109
115
  padding: 0;
110
116
  height: auto;
111
117
  width: 100%;
112
- `,ie=c.legend`
113
- font-size: ${n.spacing.medium};
118
+ `,oe=r.legend`
119
+ font-size: ${t.spacing.medium};
114
120
  font-weight: 500;
115
- margin: 0 auto ${n.spacing.small} auto;
121
+ margin: 0 auto ${t.spacing.small} auto;
116
122
  text-align: center;
117
- font-family: ${n.fonts.secondary}, ${n.fonts.fallback};
118
- `,le=c.div`
123
+ font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
124
+ `,le=r.div`
119
125
  display: flex;
120
126
  flex-direction: column;
121
127
  align-items: flex-start;
122
128
  width: 100%;
123
- margin-bottom: ${n.spacing.small};
124
- `,ce=c.div`
129
+ margin-bottom: ${t.spacing.small};
130
+ `,ie=r.div`
125
131
  display: flex;
126
132
  justify-content: space-between;
127
133
  width: 100%;
128
- `,M=({legend:t,idx:o,editableInformation:i,onChangeOfEditableOption:s,onClickSaveEdit:r,onClickCancelEdit:d,onClickDeleteEntry:m})=>e.jsxs(se,{className:"editable-selection-fieldset",children:[e.jsx(ie,{children:`${t} ${o+1}`}),i.map((l,b)=>e.jsx(le,{className:"editable-selection-container",children:e.jsx(z,{id:`editable-selection-${b}`,name:`editable-selection-${b}`,placeholderText:l.name.charAt(0).toUpperCase()+l.name.slice(1),onChange:s,value:l.info,type:l.type,isRequired:!0,className:"editable-selection",dataAttributes:{"data-index":b,"data-key":l.info}})},`${l.name}-${b}`)),e.jsxs(ce,{className:"editable-selection-button-space",children:[e.jsx(g,{id:`editable-selection-${o}-submit`,buttonType:"submit",text:"Save",onClick:r,className:"editable-selection-btn",dataAttributes:{"data-index":o}}),e.jsx(g,{id:`editable-selection-${o}-cancel`,buttonType:"button",text:"Cancel",onClick:d,className:"editable-selection-btn",dataAttributes:{"data-index":o}}),e.jsx(g,{id:`editable-selection-${o}-delete`,buttonType:"button",text:"Delete",onClick:m,className:"editable-selection-btn",dataAttributes:{"data-index":o}})]})]}),re=c.div`
134
+ `,P=({legend:n,idx:s,editableInformation:l,onChangeOfEditableOption:o,onClickSaveEdit:x,onClickCancelEdit:d,onClickDeleteEntry:m})=>e.jsxs(se,{className:"editable-option-fieldset",children:[e.jsx(oe,{children:`${n} ${s+1}`}),l?.map((c,h)=>e.jsx(le,{className:"editable-option-container",children:e.jsx(A,{id:`editable-option-${h}`,name:`editable-option-${h}`,placeholderText:c.name.charAt(0).toUpperCase()+c.name.slice(1),onChange:o,value:c.info,type:c.type,isRequired:!0,className:"editable-option",dataAttributes:{"data-index":h,"data-key":c.info}})},`${c.name}-${h}`)),e.jsxs(ie,{className:"editable-option-button-space",children:[e.jsx(f,{id:`editable-option-${s}-submit`,buttonType:"button",text:"Save",onClick:x,className:"editable-option-btn",dataAttributes:{"data-index":s}}),e.jsx(f,{id:`editable-option-${s}-cancel`,buttonType:"button",text:"Cancel",onClick:d,className:"editable-option-btn",dataAttributes:{"data-index":s}}),e.jsx(f,{id:`editable-option-${s}-delete`,buttonType:"button",text:"Delete",onClick:m,className:"editable-option-btn",dataAttributes:{"data-index":s}})]})]}),ce=r.div`
129
135
  display: flex;
130
136
  justify-content: space-between;
131
137
  max-width: 100%;
132
- `,de=({id:t,hasSubmit:o,submitText:i,handleSubmit:s,hasEdit:r,editText:d,handleEdit:m,hasCancel:l,cancelText:b,handleCancel:u,hasDelete:y,deleteText:f,handleDelete:p})=>e.jsxs(re,{className:"form-main-button-container",children:[o&&e.jsx(g,{id:`form-${t}-submit`,buttonType:"submit",text:i??"Submit",onClick:s,className:"submit-form-btn"}),r&&e.jsx(g,{id:`form-${t}-edit`,buttonType:"button",text:d??"Edit",onClick:m,className:"edit-form-btn"}),l&&e.jsx(g,{id:`form-${t}-cancel`,buttonType:"button",text:b??"Cancel",onClick:u,className:"cancel-form-btn"}),y&&e.jsx(g,{id:`form-${t}-delete`,buttonType:"button",text:f??"Delete",onClick:p,className:"delete-form-btn"})]}),U=c.legend`
133
- font-size: ${n.spacing.medium};
138
+ `,re=({id:n,hasSubmit:s,submitText:l,handleSubmit:o,hasReset:x,resetText:d,handleReset:m,hasCancel:c,cancelText:h,handleCancel:g})=>e.jsxs(ce,{className:"form-main-button-container",children:[s&&e.jsx(f,{id:`form-${n}-submit`,buttonType:"submit",text:l??"Submit",onClick:o,className:"submit-form-btn"}),x&&e.jsx(f,{id:`form-${n}-edit`,buttonType:"button",text:d??"Reset",onClick:m,className:"reset-form-btn"}),c&&e.jsx(f,{id:`form-${n}-cancel`,buttonType:"button",text:h??"Cancel",onClick:g,className:"cancel-form-btn"})]}),W=r.legend`
139
+ font-size: ${t.spacing.medium};
134
140
  font-weight: 500;
135
- margin-bottom: ${n.spacing.small};
141
+ margin-bottom: ${t.spacing.small};
136
142
  width: auto;
137
143
  text-align: center;
138
- font-family: ${n.fonts.secondary}, ${n.fonts.fallback};
139
- `,H=c.fieldset`
144
+ font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
145
+ `,M=r.fieldset`
140
146
  padding: 0;
141
147
  height: auto;
142
148
  width: 100%;
143
- `,G=c.div`
144
- padding: ${n.spacing.small};
149
+ `,U=r.div`
150
+ padding: ${t.spacing.small};
145
151
  height: auto;
146
152
  width: 100%;
147
- `,J=c.div`
153
+ `,O=r.div`
148
154
  display: flex;
149
155
  justify-content: center;
150
156
  align-items: center;
151
157
  width: 100%;
152
158
  height: auto;
153
- font-family: ${n.fonts.tertiary}, ${n.fonts.fallback};
154
- font-size: ${n.fontSize.xsmall};
155
- font-weight: ${n.fontWeight.bold};
156
- `,me=c.form`
159
+ font-family: ${t.fonts.tertiary}, ${t.fonts.fallback};
160
+ font-size: ${t.fontSize.xsmall};
161
+ font-weight: ${t.fontWeight.bold};
162
+ `,de=r.form`
157
163
  display: flex;
158
164
  flex-direction: column;
159
165
  align-items: center;
160
166
  width: 100%;
161
- `,K=c.div`
167
+ `,H=r.div`
162
168
  display: flex;
163
169
  justify-content: space-between;
164
170
  width: 100%;
165
- `,xe=c.div`
171
+ `,me=r.div`
166
172
  width: 100%;
167
173
  display: flex;
168
174
  flex-direction: column;
169
175
  align-items: center;
170
176
  justify-content: center;
171
- `,be=({fieldsets:t=null,legendText:o,isExpandable:i,id:s,formInputs:r,labelAndInputContainerClass:d,labelClass:m,inputClass:l,handleEditableInputEntryChange:b,handleAddingInputEntry:u,hasSubmit:y=!1,hasCancel:f=!1,hasDelete:p=!1,hasEdit:C=!1,submitText:j,handleSubmitForm:N,handleSubmit:T,cancelText:A,handleCancel:R,deleteText:B,handleDelete:S,editText:q,handleEdit:k,className:w,children:D})=>e.jsxs(me,{id:`${s}-form`,className:w,onSubmit:N,children:[t?t.map((a,$)=>e.jsxs(G,{children:[e.jsxs(H,{id:`${s}-form-fieldset-${$}`,className:"form-fieldset",children:[a.legend&&e.jsx(U,{children:a.legend}),a.inputs.length!==0?a.inputs.map((h,E)=>e.jsxs(v.Fragment,{children:[h.type==="textarea"&&e.jsx(F,{...h,id:h.id??`${a.legend}-input`,labelClass:m,inputClass:l,idx:E,className:d}),(h.type==="radio"||h.type==="checkbox")&&e.jsx(F,{...h,id:h.id??`${a.legend}-input`,labelClass:m,inputClass:l,idx:E,className:d}),h.type!=="textarea"&&h.type!=="radio"&&h.type!=="checkbox"&&e.jsx(F,{...h,id:h.id??`${a.legend}-input`,labelClass:m,inputClass:l,idx:E,className:d}),h.isEditable&&h.editing&&e.jsx(M,{legend:`${a.legend} ${E+1}`,idx:E,editableInformation:h?.editableInformation,onChangeOfEditableOption:b,onClickSaveEdit:h?.onClickSave,onClickCancelEdit:h?.onClickCancel,onClickDeleteEntry:h?.onClickDelete})]},`form-${s}-${E}`)):a.isExpandable?e.jsx(J,{children:`No entry yet on ${a.legend}. Click "+" button to add entry.`}):""]}),a.isExpandable&&e.jsx(K,{className:"add-input-button-space",children:e.jsx(g,{id:`expand-${a.legend}-inputs`,buttonType:"button",text:"+",onClick:u,className:"add-input-entry"})})]},`${a.legend}-${$}`)):e.jsxs(G,{children:[e.jsxs(H,{id:`${s}-form-fieldset`,className:"form-fieldset",children:[o&&e.jsx(U,{children:o}),!t&&r&&r.length!==0?r.map((a,$)=>e.jsxs(v.Fragment,{children:[a.type==="textarea"&&e.jsx(F,{...a,id:a.id??`${o}-input`,labelClass:m,inputClass:l,idx:$,className:d}),(a.type==="radio"||a.type==="checkbox")&&e.jsx(F,{...a,id:a.id??`${o}-input`,labelClass:m,inputClass:l,idx:$,className:d}),a.type!=="textarea"&&a.type!=="radio"&&a.type!=="checkbox"&&e.jsx(F,{...a,id:a.id??`${o}-input`,labelClass:m,inputClass:l,idx:$,className:d}),a.isEditable&&a.editing&&e.jsx(M,{legend:`${o} ${$+1}`,idx:$,editableInformation:a?.editableInformation,onChangeOfEditableOption:b,onClickSaveEdit:a?.onClickSave,onClickCancelEdit:a?.onClickEdit,onClickDeleteEntry:a?.onClickDelete})]},`form-${s}-${$}`)):i?e.jsx(J,{children:`No entry yet on ${o}. Please click "+" button to add`}):""]}),i&&e.jsx(K,{className:"add-input-button-space",children:e.jsx(g,{id:`expand-${o}-inputs`,buttonType:"button",text:"+",onClick:u,className:"add-input-entry"})})]}),e.jsx(de,{id:s,hasSubmit:y,submitText:j,handleSubmit:T,hasEdit:C,editText:q,handleEdit:k,hasCancel:f,cancelText:A,handleCancel:R,hasDelete:p,deleteText:B,handleDelete:S}),e.jsx(xe,{className:"children-container",children:D})]}),he=t=>{const o=/^#([0-9A-Fa-f]{3}){1,2}$/,i=/^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(t)||i.test(t)||CSS.supports("color",t)},x=t=>{if(!he(t))throw new Error(`Invalid color: ${t}`);return t},fe={mobile:"320px",tablet:"768px",desktop:"992px",largeDesktop:"1200px",largerDesktop:"1400px"},L={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")}},Q={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")}},O=v.createContext(void 0),ge=({children:t})=>{const[o,i]=v.useState(L),s=()=>{i(r=>r===L?Q:L)};return e.jsx(O.Provider,{value:{currentTheme:o,toggleTheme:s},children:e.jsx(c.ThemeProvider,{theme:o,children:t})})},ue=()=>v.useContext(O);exports.DynamicForm=be;exports.ThemeContext=O;exports.ThemeContextProvider=ge;exports.breakpoints=fe;exports.darkTheme=Q;exports.lightTheme=L;exports.useTheme=ue;
177
+ `,xe=({fieldsets:n=null,legendText:s,isExpandable:l,id:o,formInputs:x,labelAndInputContainerClass:d,labelClass:m,inputClass:c,onChangeOfEditableOption:h,handleAddingInputEntry:g,hasSubmit:j=!1,submitText:$,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:`${o}-form`,className:T,onSubmit:S,children:[n?n.map((a,u)=>e.jsxs(U,{className:`${o}-fieldset-wrapper`,children:[e.jsxs(M,{id:`${o}-form-fieldset-${u}`,className:`${a.legend}-fieldset`,children:[a.legend&&e.jsx(W,{className:`${a.legend}-legend`,children:a.legend}),a.inputs.length!==0?a.inputs.map((i,p)=>e.jsxs(F.Fragment,{children:[i.type==="textarea"&&e.jsx(w,{...i,id:i.id??`${a.legend}-input`,labelClass:m,inputClass:c,idx:p,className:`${d} ${i?.uniqueClass}`}),i.type!=="textarea"&&i.type!=="radio"&&i.type!=="checkbox"&&e.jsx(w,{...i,id:i.id??`${a.legend}-input`,labelClass:m,inputClass:c,idx:p,className:`${d} ${i?.uniqueClass}`}),(i.type==="radio"||i.type==="checkbox")&&e.jsxs(e.Fragment,{children:[e.jsx(w,{...i,id:i.id??`${a.legend}-input`,labelClass:m,inputClass:c,idx:p,className:`${d} ${i?.uniqueClass}`}),i.editing&&i.isEditable&&e.jsx(P,{legend:`${a.legend}`,idx:p,editableInformation:i?.editableInformation||[],onChangeOfEditableOption:h,onClickSaveEdit:i?.onClickSave||(z=>{}),onClickCancelEdit:i?.onClickCancel||(z=>{}),onClickDeleteEntry:i?.onClickDelete||(z=>{})})]})]},`form-${o}-${p}`)):a.isExpandable?e.jsx(O,{children:`No entry yet on ${a.legend}. Click "+" button to add entry.`}):""]}),a.isExpandable&&e.jsx(H,{className:"add-input-button-space",children:e.jsx(f,{id:`expand-${a.legend}-inputs`,buttonType:"button",text:"+",onClick:g,className:"add-input-entry"})})]},`${a.legend}-${u}`)):e.jsxs(U,{className:`${o}-fieldset-wrapper`,children:[e.jsxs(M,{id:`${o}-form-fieldset`,className:`${s}-fieldset`,children:[s&&e.jsx(W,{className:`${s}-legend`,children:s}),!n&&x&&x.length!==0?x.map((a,u)=>e.jsxs(F.Fragment,{children:[a.type==="textarea"&&e.jsx(w,{...a,id:a.id??`${s}-input`,labelClass:m,inputClass:c,idx:u,className:`${d} ${a?.uniqueClass}`}),a.type!=="textarea"&&a.type!=="radio"&&a.type!=="checkbox"&&e.jsx(w,{...a,id:a.id??`${s}-input`,labelClass:m,inputClass:c,idx:u,className:`${d} ${a?.uniqueClass}`}),(a.type==="radio"||a.type==="checkbox")&&e.jsxs(e.Fragment,{children:[e.jsx(w,{...a,id:a.id??`${s}-input`,labelClass:m,inputClass:c,idx:u,className:`${d} ${a?.uniqueClass}`}),a.editing&&a.isEditable&&e.jsx(P,{legend:`${s}`,idx:u,editableInformation:a?.editableInformation,onChangeOfEditableOption:h,onClickSaveEdit:a?.onClickSave||(i=>{}),onClickCancelEdit:a?.onClickCancel||(i=>{}),onClickDeleteEntry:a?.onClickDelete||(i=>{})})]})]},`form-${o}-${u}`)):l?e.jsx(O,{children:`No entry yet on ${s}. Please click "+" button to add`}):""]}),l&&e.jsx(H,{className:"add-input-button-space",children:e.jsx(f,{id:`expand-${s}-inputs`,buttonType:"button",text:"+",onClick:g,className:"add-input-entry"})})]}),e.jsx(re,{id:o,hasSubmit:j,submitText:$,handleSubmit:k,hasReset:C,resetText:y,handleReset:N,hasCancel:E,cancelText:v,handleCancel:D}),e.jsx(me,{className:"children-container",children:q})]}),be=n=>{const s=/^#([0-9A-Fa-f]{3}){1,2}$/,l=/^rgb(a)?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/;return s.test(n)||l.test(n)||CSS.supports("color",n)},b=n=>{if(!be(n))throw new Error(`Invalid color: ${n}`);return n},he={mobile:"320px",tablet:"768px",desktop:"992px",largeDesktop:"1200px",largerDesktop:"1400px"},I={name:"light",colors:{text:b("#333446"),bg:b("#EEEEEE"),blue:b("#7F8CAA"),blue2:b("#80A6FF"),teal:b("#5b8280ff"),teal2:b("#AEEAE7"),gray:b("#AEAEAE"),information:b("#202234"),success:b("#123524"),warning:b("#F2C265"),error:b("#990000")}},G={name:"dark",colors:{bg:b("#333446"),text:b("#EEEEEE"),blue:b("#80A6FF"),blue2:b("#7F8CAA"),teal:b("#AEEAE7"),teal2:b("#5b8280ff"),gray:b("#D0D0DD"),information:b("#C9E6F0"),success:b("#9EDF9C"),warning:b("#FCFFC1"),error:b("#FAD4D4")}},L=F.createContext({}),ue=({children:n,initialTheme:s=I,secondTheme:l=G})=>{const[o,x]=F.useState(s),d=()=>{x(m=>m===s?l:s)};return e.jsx(L.Provider,{value:{currentTheme:o,toggleTheme:d},children:e.jsx(r.ThemeProvider,{theme:o,children:n})})},ge=()=>F.useContext(L);exports.DynamicForm=xe;exports.ThemeContext=L;exports.ThemeContextProvider=ue;exports.breakpoints=he;exports.darkTheme=G;exports.lightTheme=I;exports.useTheme=ge;