@kbgarcia8/react-dynamic-form 2.0.1 → 2.0.2
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/components/atoms/Button/Button.d.ts +1 -1
- package/dist/components/atoms/Button/Button.d.ts.map +1 -1
- package/dist/components/atoms/Label/Label.d.ts +1 -1
- package/dist/components/atoms/Label/Label.d.ts.map +1 -1
- package/dist/components/molecules/FormActionButtons/FormActionButtons.d.ts +1 -1
- package/dist/components/molecules/FormActionButtons/FormActionButtons.d.ts.map +1 -1
- package/dist/components/molecules/LabeledInput/LabeledInput.d.ts.map +1 -1
- package/dist/components/organisms/DynamicForm/DynamicForm.d.ts +1 -1
- package/dist/components/organisms/DynamicForm/DynamicForm.d.ts.map +1 -1
- package/dist/react-dynamic-form.cjs.js +26 -26
- package/dist/react-dynamic-form.es.js +328 -308
- package/dist/type/propTypes.d.ts +7 -4
- package/dist/type/propTypes.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ButtonProps } from "../../../type/propTypes";
|
|
2
|
-
declare const Button: ({ onClick, id, buttonType,
|
|
2
|
+
declare const Button: ({ onClick, id, buttonType, startIcon, endIcon, alt, text, className, dataAttributes }: ButtonProps) => import("react/jsx-runtime").JSX.Element | undefined;
|
|
3
3
|
export default Button;
|
|
4
4
|
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Button/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,QAAA,MAAM,MAAM,GAAI,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Button/Button.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,QAAA,MAAM,MAAM,GAAI,uFAUd,WAAW,wDAmCZ,CAAA;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { LabelProps } from "../../../type/propTypes";
|
|
3
|
-
declare const Label: ({ htmlFor, textLabel, additionalInfo, $labelFlexDirection,
|
|
3
|
+
declare const Label: ({ htmlFor, textLabel, additionalInfo, $labelFlexDirection, startIcon, endIcon, className, children }: React.PropsWithChildren<LabelProps>) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default Label;
|
|
5
5
|
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Label/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,QAAA,MAAM,KAAK,GAAI
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../../src/components/atoms/Label/Label.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,QAAA,MAAM,KAAK,GAAI,sGASZ,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,4CAgBrC,CAAA;AAED,eAAe,KAAK,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { FormActionButtonsProps } from "../../../type/propTypes";
|
|
2
|
-
declare const FormActionButtons: ({ id, submitText, hasReset, resetText, handleReset, hasCancel, cancelText, handleCancel, }: FormActionButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
declare const FormActionButtons: ({ id, submitText, submitIcon, hasReset, resetText, resetIcon, handleReset, hasCancel, cancelText, cancelIcon, handleCancel, }: FormActionButtonsProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
export default FormActionButtons;
|
|
4
4
|
//# sourceMappingURL=FormActionButtons.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormActionButtons.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/FormActionButtons/FormActionButtons.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,QAAA,MAAM,iBAAiB,GAAI,
|
|
1
|
+
{"version":3,"file":"FormActionButtons.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/FormActionButtons/FormActionButtons.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEtE,QAAA,MAAM,iBAAiB,GAAI,+HAYzB,sBAAsB,4CAQvB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LabeledInput.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/LabeledInput/LabeledInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAgB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"LabeledInput.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/LabeledInput/LabeledInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,eAAe,EAAgB,MAAM,yBAAyB,CAAC;AAGrG,QAAA,MAAM,YAAY,GAAI,OAAM,KAAK,CAAC,iBAAiB,CAAC,sBAAsB,GAAG,eAAe,CAAC,4CA+F5F,CAAA;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { DynamicFormProps } from "../../../type/propTypes";
|
|
3
|
-
declare const DynamicForm: ({ fieldsets, legendText, isExpandable, id, formInputs, labelAndInputContainerClass, labelClass, inputClass, onChangeOfEditableOption, handleAddingInputEntry, submitText, hasReset, resetText, handleReset, hasCancel, cancelText, handleCancel, handleSubmitForm, className, children }: React.PropsWithChildren<DynamicFormProps>) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
declare const DynamicForm: ({ fieldsets, legendText, isExpandable, id, formInputs, labelAndInputContainerClass, labelClass, inputClass, onChangeOfEditableOption, handleAddingInputEntry, submitText, submitIcon, hasReset, resetText, resetIcon, handleReset, hasCancel, cancelText, cancelIcon, handleCancel, handleSubmitForm, className, children }: React.PropsWithChildren<DynamicFormProps>) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default DynamicForm;
|
|
5
5
|
//# sourceMappingURL=DynamicForm.d.ts.map
|
|
@@ -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,
|
|
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,6TAwBnB,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,4CAoJ1C,CAAA;AAGD,eAAe,WAAW,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),E=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"}},B=r.button`
|
|
2
2
|
display: flex;
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
@@ -24,33 +24,33 @@
|
|
|
24
24
|
& .button-icon-text-space svg {
|
|
25
25
|
max-width: 100%;
|
|
26
26
|
}
|
|
27
|
-
`,
|
|
27
|
+
`,P=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
|
-
|
|
33
|
+
`;r.img`
|
|
34
34
|
maxwidth: 100%;
|
|
35
|
-
|
|
35
|
+
`;const W=r.span`
|
|
36
36
|
font-size: ${t.fontSize.xsmall};
|
|
37
37
|
font-weight: ${t.fontWeight.medium};
|
|
38
38
|
font-family: ${t.fonts.tertiary}, ${t.fonts.fallback};
|
|
39
39
|
display: flex;
|
|
40
40
|
align-items: center;
|
|
41
41
|
justify-content: center;
|
|
42
|
-
|
|
42
|
+
`,f=({onClick:a,id:i,buttonType:n,startIcon:o,endIcon:d,alt:m="alt-button-icon",text:c="",className:x="",dataAttributes:h={}})=>{if(n==="button")return e.jsx(B,{onClick:a,id:i,type:n,className:x,...h,children:e.jsxs(P,{className:"button-icon-text-space",children:[o||"",c&&e.jsx(W,{id:i,children:c}),d||""]})});if(n==="submit")return e.jsx(B,{id:i,type:n,className:x,...h,children:e.jsxs(P,{className:"button-icon-text-space",children:[o||"",c&&e.jsx(W,{id:i,children:c}),d||""]})})},Z=r.div`
|
|
43
43
|
display: flex;
|
|
44
44
|
flex-direction: column;
|
|
45
45
|
align-items: left;
|
|
46
46
|
width: 100%;
|
|
47
47
|
margin-bottom: ${t.spacing.small};
|
|
48
|
-
`,
|
|
48
|
+
`,_=r.div`
|
|
49
49
|
display: flex;
|
|
50
50
|
gap: ${t.spacing.xsmall};
|
|
51
51
|
width: auto;
|
|
52
52
|
height: auto;
|
|
53
|
-
`,
|
|
53
|
+
`,I=r.label`
|
|
54
54
|
display: flex;
|
|
55
55
|
align-items: center;
|
|
56
56
|
justify-content:center;
|
|
@@ -67,21 +67,21 @@
|
|
|
67
67
|
height: auto;
|
|
68
68
|
object-fit: contain;
|
|
69
69
|
}
|
|
70
|
-
`,
|
|
70
|
+
`,ee=r.div`
|
|
71
71
|
display: flex;
|
|
72
72
|
flex-direction: column;
|
|
73
73
|
align-items: center;
|
|
74
74
|
justify-content: center;
|
|
75
75
|
gap: ${t.spacing.xxxsmall};
|
|
76
|
-
`,
|
|
76
|
+
`,te=r.span`
|
|
77
77
|
font-weight: ${t.fontWeight.bolder};
|
|
78
|
-
`,
|
|
78
|
+
`,M=r.div`
|
|
79
79
|
max-width: 100%;
|
|
80
80
|
display: flex;
|
|
81
81
|
align-items: center;
|
|
82
|
-
`,
|
|
82
|
+
`,ae=r.span`
|
|
83
83
|
font-weight: ${t.fontWeight.light};
|
|
84
|
-
`,
|
|
84
|
+
`,U=({htmlFor:a,textLabel:i,additionalInfo:n,$labelFlexDirection:o,startIcon:d,endIcon:m,className:c,children:x})=>e.jsxs(I,{htmlFor:a,className:c,$labelFlexDirection:o,children:[d&&e.jsx(M,{className:"label-icon-container",children:d}),e.jsxs(ee,{className:"label-text-container",children:[e.jsx(te,{className:"main-label",children:i}),n&&e.jsx(ae,{className:"additional-info",children:n})]}),m&&e.jsx(M,{className:"label-icon-container",children:m}),x]}),O=r.input`
|
|
85
85
|
display: flex;
|
|
86
86
|
place-content: center;
|
|
87
87
|
font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
&:focus{
|
|
99
99
|
border: ${t.borderThickness.thin} solid ${({theme:a})=>a.colors.teal};
|
|
100
100
|
}
|
|
101
|
-
`,
|
|
101
|
+
`,ne=r.textarea`
|
|
102
102
|
display: flex;
|
|
103
103
|
place-content: center;
|
|
104
104
|
border: ${t.borderThickness.light} solid ${({theme:a})=>a.colors.text};
|
|
@@ -111,46 +111,46 @@
|
|
|
111
111
|
max-width: 100%;
|
|
112
112
|
resize: none;
|
|
113
113
|
overflow-y: auto;
|
|
114
|
-
`,D=
|
|
114
|
+
`,D=E.forwardRef((a,i)=>{const{type:n,id:o,onChange:d,isRequired:m,dataAttributes:c={},disabled:x,className:h,name:u}=a;if(n==="textarea"){const{rows:p=5,cols:w=30,value:v,...T}=a;return e.jsx(ne,{ref:i,value:v,rows:p,cols:w,id:o,onChange:d,required:m,disabled:x,...c,className:h,name:u})}if(n==="radio"||n==="checkbox"){const{checked:p,...w}=a;return e.jsx(O,{ref:i,type:n,checked:p,id:o,onChange:d,required:m,...c,disabled:x,className:h,name:u})}const $=a,{value:k,pattern:y,placeholderText:N,...C}=$;return e.jsx(O,{ref:i,type:n,value:k,pattern:y,placeholder:N,id:o,onChange:d,required:m,...c,disabled:x,className:h,name:u})}),F=a=>{const{className:i,type:n,id:o,textLabel:d,additionalInfo:m,$labelFlexDirection:c,startIcon:x,endIcon:h,labelClass:u,onChange:$,isRequired:k,dataAttributes:y,inputClass:N,ref:C,disabled:p,isEditable:w,editIcon:v,onClickEdit:T,deleteIcon:S,onClickDelete:q,idx:A,children:z}=a;return e.jsxs(Z,{className:`${i} ${o.replace("#","")}-label-input-container`,children:[n!=="radio"&&n!=="checkbox"&&e.jsx(U,{startIcon:x,endIcon:h,htmlFor:o,textLabel:d,additionalInfo:m,$labelFlexDirection:c,className:u}),n!=="radio"&&n!=="checkbox"&&n==="textarea"&&(()=>{const{rows:s=5,cols:g=30,value:l,...j}=a;return e.jsx(D,{id:o,name:o,type:"textarea",isRequired:k,onChange:$,value:l,rows:s,cols:g,dataAttributes:y,className:N,ref:C,disabled:p})})(),n!=="radio"&&n!=="checkbox"&&n!=="textarea"&&(()=>{const s=a,{value:g,pattern:l,placeholderText:j,...L}=s;return e.jsx(D,{id:o,name:o,placeholderText:j,onChange:$,value:g,type:n,isRequired:k,dataAttributes:y,className:N,ref:C,disabled:p,pattern:l})})(),(n==="radio"||n==="checkbox")&&(()=>{const{checked:s,...g}=a;return e.jsxs(e.Fragment,{children:[e.jsx(D,{ref:C,type:n,name:o,id:o,isRequired:k,checked:s,onChange:$,disabled:p,className:N,dataAttributes:y}),e.jsx(U,{startIcon:x,endIcon:h,htmlFor:o,textLabel:d,additionalInfo:m,$labelFlexDirection:c,className:u})]})})(),w&&e.jsxs(_,{className:"input-edit-buttons",children:[e.jsx(f,{id:`editable-${o}-edit-btn`,startIcon:v,buttonType:"button",onClick:T,className:`edit-radio-${A}`,dataAttributes:y}),e.jsx(f,{id:`editable-${o}-delete-btn`,startIcon:S,buttonType:"button",onClick:q,className:`delete-radio-${A}`,dataAttributes:y})]}),z]})},se=r.fieldset`
|
|
115
115
|
padding: 0;
|
|
116
116
|
height: auto;
|
|
117
117
|
width: 100%;
|
|
118
|
-
`,
|
|
118
|
+
`,oe=r.legend`
|
|
119
119
|
font-size: ${t.spacing.medium};
|
|
120
120
|
font-weight: 500;
|
|
121
121
|
margin: 0 auto ${t.spacing.small} auto;
|
|
122
122
|
text-align: center;
|
|
123
123
|
font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
|
|
124
|
-
`,
|
|
124
|
+
`,ie=r.div`
|
|
125
125
|
display: flex;
|
|
126
126
|
flex-direction: column;
|
|
127
127
|
align-items: flex-start;
|
|
128
128
|
width: 100%;
|
|
129
129
|
margin-bottom: ${t.spacing.small};
|
|
130
|
-
`,
|
|
130
|
+
`,le=r.div`
|
|
131
131
|
display: flex;
|
|
132
132
|
justify-content: space-between;
|
|
133
133
|
width: 100%;
|
|
134
|
-
`,
|
|
134
|
+
`,H=({legend:a,fieldsetIndex:i,idx:n,editableInformation:o,onChangeOfEditableOption:d,onClickSaveEdit:m,onClickCancelEdit:c,onClickDeleteEntry:x})=>e.jsxs(se,{className:"editable-option-fieldset",children:[e.jsx(oe,{children:`${a} ${n+1}`}),o?.map((h,u)=>e.jsx(ie,{className:"editable-option-container",children:e.jsx(D,{id:`editable-option-${u}`,name:`editable-option-${u}`,placeholderText:h.name.charAt(0).toUpperCase()+h.name.slice(1),onChange:d,value:h.info,type:h.type,isRequired:!0,className:"editable-option",dataAttributes:{"data-index":u,"data-fieldsetindex":i,"data-key":h.info}})},`${h.name}-${u}`)),e.jsxs(le,{className:"editable-option-button-space",children:[e.jsx(f,{id:`editable-option-${n}-submit`,buttonType:"button",text:"Save",onClick:m,className:"editable-option-btn",dataAttributes:{"data-index":n,"data-fieldsetindex":i}}),e.jsx(f,{id:`editable-option-${n}-cancel`,buttonType:"button",text:"Cancel",onClick:c,className:"editable-option-btn",dataAttributes:{"data-index":n,"data-fieldsetindex":i}}),e.jsx(f,{id:`editable-option-${n}-delete`,buttonType:"button",text:"Delete",onClick:x,className:"editable-option-btn",dataAttributes:{"data-index":n,"data-fieldsetindex":i}})]})]}),ce=r.div`
|
|
135
135
|
display: flex;
|
|
136
136
|
justify-content: space-between;
|
|
137
137
|
max-width: 100%;
|
|
138
|
-
`,
|
|
138
|
+
`,re=({id:a,submitText:i,submitIcon:n,hasReset:o,resetText:d,resetIcon:m,handleReset:c,hasCancel:x,cancelText:h,cancelIcon:u,handleCancel:$})=>e.jsxs(ce,{className:"form-main-button-container",children:[e.jsx(f,{id:`form-${a}-submit`,startIcon:n,buttonType:"submit",text:i??"Submit",className:"submit-form-btn"}),o&&e.jsx(f,{id:`form-${a}-edit`,startIcon:m,buttonType:"button",text:d??"Reset",onClick:c,className:"reset-form-btn"}),x&&e.jsx(f,{id:`form-${a}-cancel`,startIcon:u,buttonType:"button",text:h??"Cancel",onClick:$,className:"cancel-form-btn"})]}),G=r.legend`
|
|
139
139
|
font-size: ${t.spacing.medium};
|
|
140
140
|
font-weight: 500;
|
|
141
141
|
margin-bottom: ${t.spacing.small};
|
|
142
142
|
width: auto;
|
|
143
143
|
text-align: center;
|
|
144
144
|
font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
|
|
145
|
-
`,
|
|
145
|
+
`,J=r.fieldset`
|
|
146
146
|
padding: 0;
|
|
147
147
|
height: auto;
|
|
148
148
|
width: 100%;
|
|
149
|
-
`,
|
|
149
|
+
`,K=r.div`
|
|
150
150
|
padding: ${t.spacing.small};
|
|
151
151
|
height: auto;
|
|
152
152
|
width: 100%;
|
|
153
|
-
`,
|
|
153
|
+
`,Q=r.div`
|
|
154
154
|
display: flex;
|
|
155
155
|
justify-content: center;
|
|
156
156
|
align-items: center;
|
|
@@ -159,19 +159,19 @@
|
|
|
159
159
|
font-family: ${t.fonts.tertiary}, ${t.fonts.fallback};
|
|
160
160
|
font-size: ${t.fontSize.xsmall};
|
|
161
161
|
font-weight: ${t.fontWeight.bold};
|
|
162
|
-
`,
|
|
162
|
+
`,de=r.form`
|
|
163
163
|
display: flex;
|
|
164
164
|
flex-direction: column;
|
|
165
165
|
align-items: center;
|
|
166
166
|
width: 100%;
|
|
167
|
-
`,
|
|
167
|
+
`,V=r.div`
|
|
168
168
|
display: flex;
|
|
169
169
|
justify-content: space-between;
|
|
170
170
|
width: 100%;
|
|
171
|
-
`,
|
|
171
|
+
`,me=r.div`
|
|
172
172
|
width: 100%;
|
|
173
173
|
display: flex;
|
|
174
174
|
flex-direction: column;
|
|
175
175
|
align-items: center;
|
|
176
176
|
justify-content: center;
|
|
177
|
-
`,
|
|
177
|
+
`,xe=({fieldsets:a=null,legendText:i,isExpandable:n,id:o,formInputs:d,labelAndInputContainerClass:m,labelClass:c,inputClass:x,onChangeOfEditableOption:h,handleAddingInputEntry:u,submitText:$,submitIcon:k,hasReset:y=!1,resetText:N,resetIcon:C,handleReset:p,hasCancel:w=!1,cancelText:v,cancelIcon:T,handleCancel:S,handleSubmitForm:q,className:A,children:z})=>e.jsxs(de,{id:`${o}-form`,className:A,onSubmit:q,children:[a?a.map((s,g)=>e.jsxs(K,{className:`${o}-fieldset-wrapper`,children:[e.jsxs(J,{id:`${o}-form-fieldset-${g}`,className:`${s.legend}-fieldset`,children:[s.legend&&e.jsx(G,{className:`${s.legend}-legend`,children:s.legend}),s.inputs.length!==0?s.inputs.map((l,j)=>e.jsxs(E.Fragment,{children:[l.type==="textarea"&&e.jsx(F,{...l,id:l.id??`${s.legend}-input`,labelClass:c,inputClass:x,idx:j,className:`${m} ${l?.uniqueClass}`}),l.type!=="textarea"&&l.type!=="radio"&&l.type!=="checkbox"&&e.jsx(F,{...l,id:l.id??`${s.legend}-input`,labelClass:c,inputClass:x,idx:j,className:`${m} ${l?.uniqueClass}`}),(l.type==="radio"||l.type==="checkbox")&&e.jsxs(e.Fragment,{children:[e.jsx(F,{...l,id:l.id??`${s.legend}-input`,labelClass:c,inputClass:x,idx:j,className:`${m} ${l?.uniqueClass}`}),l.editing&&l.isEditable&&e.jsx(H,{legend:`${s.legend}`,fieldsetIndex:g,idx:j,editableInformation:l?.editableInformation||[],onChangeOfEditableOption:h,onClickSaveEdit:l?.onClickSave||(L=>{}),onClickCancelEdit:l?.onClickCancel||(L=>{}),onClickDeleteEntry:l?.onClickDelete||(L=>{})})]})]},`form-${o}-${j}`)):s.isExpandable?e.jsx(Q,{children:`No entry yet on ${s.legend}. Click "+" button to add entry.`}):""]}),s.isExpandable&&e.jsx(V,{className:"add-input-button-space",children:e.jsx(f,{id:`expand-${s.legend}-inputs`,buttonType:"button",text:"+",onClick:u,className:"add-input-entry",dataAttributes:{"data-fieldsetindex":g}})})]},`${s.legend}-${g}`)):e.jsxs(K,{className:`${o}-fieldset-wrapper`,children:[e.jsxs(J,{id:`${o}-form-fieldset`,className:`${i}-fieldset`,children:[i&&e.jsx(G,{className:`${i}-legend`,children:i}),!a&&d&&d.length!==0?d.map((s,g)=>e.jsxs(E.Fragment,{children:[s.type==="textarea"&&e.jsx(F,{...s,id:s.id??`${i}-input`,labelClass:c,inputClass:x,idx:g,className:`${m} ${s?.uniqueClass}`}),s.type!=="textarea"&&s.type!=="radio"&&s.type!=="checkbox"&&e.jsx(F,{...s,id:s.id??`${i}-input`,labelClass:c,inputClass:x,idx:g,className:`${m} ${s?.uniqueClass}`}),(s.type==="radio"||s.type==="checkbox")&&e.jsxs(e.Fragment,{children:[e.jsx(F,{...s,id:s.id??`${i}-input`,labelClass:c,inputClass:x,idx:g,className:`${m} ${s?.uniqueClass}`}),s.editing&&s.isEditable&&e.jsx(H,{legend:`${i}`,idx:g,editableInformation:s?.editableInformation,onChangeOfEditableOption:h,onClickSaveEdit:s?.onClickSave||(l=>{}),onClickCancelEdit:s?.onClickCancel||(l=>{}),onClickDeleteEntry:s?.onClickDelete||(l=>{})})]})]},`form-${o}-${g}`)):n?e.jsx(Q,{children:`No entry yet on ${i}. Please click "+" button to add`}):""]}),n&&e.jsx(V,{className:"add-input-button-space",children:e.jsx(f,{id:`expand-${i}-inputs`,buttonType:"button",text:"+",onClick:u,className:"add-input-entry"})})]}),e.jsx(re,{id:o,submitText:$,submitIcon:k,hasReset:y,resetText:N,resetIcon:C,handleReset:p,hasCancel:w,cancelText:v,cancelIcon:T,handleCancel:S}),e.jsx(me,{className:"children-container",children:z})]}),be=a=>{const i=/^#([0-9A-Fa-f]{3}){1,2}$/,n=/^rgb(a)?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}(?:\s*,\s*(0|1|0?\.\d+))?\s*\)$/;return i.test(a)||n.test(a)||CSS.supports("color",a)},b=a=>{if(!be(a))throw new Error(`Invalid color: ${a}`);return a},he={mobile:"320px",tablet:"768px",desktop:"992px",largeDesktop:"1200px",largerDesktop:"1400px"},X={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")}},Y={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")}},R=E.createContext({}),ue=({children:a,initialTheme:i=X,secondTheme:n=Y})=>{const[o,d]=E.useState(i),m=()=>{d(c=>c===i?n:i)};return e.jsx(R.Provider,{value:{currentTheme:o,toggleTheme:m},children:e.jsx(r.ThemeProvider,{theme:o,children:a})})},ge=()=>E.useContext(R);exports.DynamicForm=xe;exports.ThemeContext=R;exports.ThemeContextProvider=ue;exports.breakpoints=he;exports.darkTheme=Y;exports.lightTheme=X;exports.useTheme=ge;
|