@kbgarcia8/react-dynamic-form 2.0.2 → 2.0.4
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/README.md +77 -8
- 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/Button/Button.styles.d.ts +32 -4
- package/dist/components/atoms/Button/Button.styles.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/FormActionButtons/FormActionButtons.styles.d.ts.map +1 -1
- package/dist/components/molecules/LabeledInput/LabeledInput.d.ts.map +1 -1
- package/dist/components/molecules/NestedEditableOption/NestedEditableOption.d.ts +1 -1
- package/dist/components/molecules/NestedEditableOption/NestedEditableOption.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 +183 -82
- package/dist/react-dynamic-form.es.js +710 -466
- package/dist/styles/theme.d.ts +16 -0
- package/dist/styles/theme.d.ts.map +1 -1
- package/dist/styles/variables.d.ts +69 -2
- package/dist/styles/variables.d.ts.map +1 -1
- package/dist/testcase/App.d.ts +4 -0
- package/dist/testcase/App.d.ts.map +1 -0
- package/dist/testcase/DynamicForm.styles.d.ts +2 -0
- package/dist/testcase/DynamicForm.styles.d.ts.map +1 -0
- package/dist/testcase/main.d.ts +2 -0
- package/dist/testcase/main.d.ts.map +1 -0
- package/dist/type/constantTypes.d.ts +9 -24
- package/dist/type/constantTypes.d.ts.map +1 -1
- package/dist/type/propTypes.d.ts +65 -13
- package/dist/type/propTypes.d.ts.map +1 -1
- package/dist/utils/utils.d.ts +4 -0
- package/dist/utils/utils.d.ts.map +1 -1
- package/package.json +4 -1
|
@@ -1,65 +1,162 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),D=require("react"),s=require("styled-components"),o={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,regular:400,medium:500,bold:700,bolder:900},fontSize:{xxsmall:"0.55rem",xsmall:"0.75rem",small:"1rem",medium:"1.25rem",large:"1.5rem",xlarge:"1.75rem"},spacing:{xxxsmall:"0.25rem",xxsmall:"0.375rem",xsmall:"0.5rem",small:"0.75rem",medium:"1.25rem"},borderRadius:{xsmall:"0.125rem",small:"0.25rem",medium:"0.5rem",large:"1rem",xlarge:"2rem",circle:"50%"},borderThickness:{thin:"0.0625rem",light:"0.125rem"},breakpoints:{mobile:"320px",tablet:"768px",laptop:"1024px",desktop:"1440px",largeDesktop:"1920px"}},te=e=>{const l=/^#([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 l.test(e)||n.test(e)||CSS.supports("color",e)},b=e=>{if(!te(e))throw new Error(`Invalid color: ${e}`);return e},z=Object.keys(o.breakpoints).reduce((e,l)=>{const n=l;return e[n]=(...a)=>s.css`
|
|
2
|
+
@media (min-width: ${o.breakpoints[n]}) {
|
|
3
|
+
${s.css(...a)}
|
|
4
|
+
}
|
|
5
|
+
`,e},{}),re={primary:s.css`
|
|
6
|
+
background-color: ${({theme:e})=>e.colors.backgroundColor1};
|
|
7
|
+
color: ${({theme:e})=>e.colors.textColor3};
|
|
8
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.borderColor2};
|
|
9
|
+
|
|
10
|
+
&:hover {
|
|
11
|
+
background-color: ${({theme:e})=>e.colors.backgroundColor2};
|
|
12
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.textColor3};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&:disabled{
|
|
16
|
+
background-color: ${({theme:e})=>e.notificationPalette.infoText};
|
|
17
|
+
color: ${({theme:e})=>e.colors.shadow};
|
|
18
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.shadow};
|
|
19
|
+
cursor: not-allowed;
|
|
20
|
+
}
|
|
21
|
+
`,secondary:s.css`
|
|
22
|
+
background-color: ${({theme:e})=>e.colors.backgroundColor4};
|
|
23
|
+
color: ${({theme:e})=>e.colors.textColor1};
|
|
24
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.borderColor1};
|
|
25
|
+
|
|
26
|
+
&:hover {
|
|
27
|
+
background-color: ${({theme:e})=>e.colors.backgroundColor4};
|
|
28
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.borderColor2};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&:disabled{
|
|
32
|
+
background-color: ${({theme:e})=>e.notificationPalette.warningText};
|
|
33
|
+
color: ${({theme:e})=>e.colors.shadow};
|
|
34
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.shadow};
|
|
35
|
+
}
|
|
36
|
+
`,ghost:s.css`
|
|
37
|
+
background-color: transparent;
|
|
38
|
+
color: ${({theme:e})=>e.colors.textColor3};
|
|
39
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.textColor3};
|
|
40
|
+
|
|
41
|
+
&:hover {
|
|
42
|
+
background-color: ${({theme:e})=>e.colors.textColor2};
|
|
43
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.backgroundColor3};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:disabled{
|
|
47
|
+
background-color: ${({theme:e})=>e.notificationPalette.shadow};
|
|
48
|
+
color: ${({theme:e})=>e.colors.shadow};
|
|
49
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.shadow};
|
|
50
|
+
}
|
|
51
|
+
`,bnw:s.css`
|
|
52
|
+
background-color: ${({theme:e})=>e.colors.borderColor1};
|
|
53
|
+
color: ${({theme:e})=>e.colors.borderColor2};
|
|
54
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.borderColor2};
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
background-color: ${({theme:e})=>e.colors.textColor2};
|
|
58
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.textColor1};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
&:disabled{
|
|
62
|
+
background-color: ${({theme:e})=>e.notificationPalette.shadow};
|
|
63
|
+
color: ${({theme:e})=>e.colors.shadow};
|
|
64
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.shadow};
|
|
65
|
+
}
|
|
66
|
+
`},ae={smallest:s.css`
|
|
67
|
+
${z.mobile`
|
|
68
|
+
font-size: ${o.fontSize.xxsmall};
|
|
69
|
+
font-weight: ${o.fontWeight.regular};
|
|
70
|
+
`}
|
|
71
|
+
`,smaller:s.css`
|
|
72
|
+
${z.mobile`
|
|
73
|
+
font-size: ${o.fontSize.xsmall};
|
|
74
|
+
font-weight: ${o.fontWeight.regular};
|
|
75
|
+
`}
|
|
76
|
+
`,small:s.css`
|
|
77
|
+
${z.mobile`
|
|
78
|
+
font-size: ${o.fontSize.small};
|
|
79
|
+
font-weight: ${o.fontWeight.medium};
|
|
80
|
+
`}
|
|
81
|
+
`,medium:s.css`
|
|
82
|
+
${z.mobile`
|
|
83
|
+
font-size: ${o.fontSize.medium};
|
|
84
|
+
font-weight: ${o.fontWeight.bold};
|
|
85
|
+
`}
|
|
86
|
+
`,large:s.css`
|
|
87
|
+
${z.mobile`
|
|
88
|
+
font-size: ${o.fontSize.large};
|
|
89
|
+
font-weight: ${o.fontWeight.bolder};
|
|
90
|
+
`}
|
|
91
|
+
`,larger:s.css`
|
|
92
|
+
${z.mobile`
|
|
93
|
+
font-size: ${o.fontSize.xlarge};
|
|
94
|
+
font-weight: ${o.fontWeight.bolder};
|
|
95
|
+
`}
|
|
96
|
+
`},se={square:s.css`border-radius: ${o.borderRadius.xsmall};`,roundedsquare:s.css`border-radius: ${o.borderRadius.medium};`,squircle:s.css`border-radius: ${o.borderRadius.large};`,pill:s.css`border-radius: ${o.borderRadius.xlarge};`,circle:s.css`border-radius: ${o.borderRadius.circle};`},M=s.button`
|
|
97
|
+
width: 100%;
|
|
2
98
|
display: flex;
|
|
3
99
|
align-items: center;
|
|
4
100
|
justify-content: center;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
border-radius: ${t.borderRadius.xlarge};
|
|
9
|
-
padding: ${t.spacing.xxxsmall} ${t.spacing.small};
|
|
10
|
-
margin: 0.125rem;
|
|
11
|
-
width: auto;
|
|
101
|
+
padding: ${o.spacing.xxxsmall} ${o.spacing.xxsmall};
|
|
102
|
+
flex: 1;
|
|
103
|
+
margin: 0;
|
|
12
104
|
cursor: pointer;
|
|
13
105
|
transition: background-color 0.2s ease, border-color 0.2s ease;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
background-color: lightblue;
|
|
17
|
-
border: ${t.borderThickness.light} solid gray;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
& .button-icon-text-space {
|
|
21
|
-
max-width: 100%;
|
|
22
|
-
}
|
|
106
|
+
${({$color:e})=>re[e||"primary"]}
|
|
107
|
+
${({$radius:e})=>se[e||"square"]}
|
|
23
108
|
|
|
24
109
|
& .button-icon-text-space svg {
|
|
110
|
+
height: auto;
|
|
111
|
+
max-height: 100%;
|
|
25
112
|
max-width: 100%;
|
|
26
113
|
}
|
|
27
|
-
|
|
114
|
+
|
|
115
|
+
&:disabled {
|
|
116
|
+
cursor: not-allowed;
|
|
117
|
+
opacity: 0.6;
|
|
118
|
+
}
|
|
119
|
+
`,U=s.div`
|
|
28
120
|
width: 100%;
|
|
29
121
|
display: flex;
|
|
30
122
|
flex-direction: row;
|
|
31
123
|
align-items: center;
|
|
32
|
-
justify-content:
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
124
|
+
justify-content: space-around;
|
|
125
|
+
|
|
126
|
+
${({$hasIcon:e,$hasText:l})=>e&&l?s.css``:s.css`
|
|
127
|
+
& > * {
|
|
128
|
+
flex: 1;
|
|
129
|
+
}
|
|
130
|
+
`}
|
|
131
|
+
`,H=s.span`
|
|
132
|
+
flex: 2;
|
|
133
|
+
${({$size:e})=>ae[e||"small"]}
|
|
134
|
+
font-family: ${o.fonts.tertiary}, ${o.fonts.fallback};
|
|
39
135
|
display: flex;
|
|
40
136
|
align-items: center;
|
|
41
137
|
justify-content: center;
|
|
42
|
-
|
|
138
|
+
max-width: 80%;
|
|
139
|
+
`,w=({onClick:e,id:l,buttonType:n="button",startIcon:a,endIcon:m,text:d="",className:x="",dataAttributes:u={},color:h,radius:$,size:g})=>n==="submit"?t.jsx(M,{id:l,type:"submit",className:x,...u,$color:h||"primary",$radius:$||"squircle",children:t.jsxs(U,{className:"button-icon-text-space",$hasIcon:!!(a||m),$hasText:!!d,children:[a||"",d&&t.jsx(H,{$size:g||"small",id:l,children:d}),m||""]})}):t.jsx(M,{onClick:e,id:l,type:n,className:x,...u,$color:h||"primary",$radius:$||"squircle",children:t.jsxs(U,{className:"button-icon-text-space",$hasIcon:!!(a||m),$hasText:!!d,children:[a||"",d&&t.jsx(H,{$size:g||"small",id:l,children:d}),m||""]})}),ne=s.div`
|
|
43
140
|
display: flex;
|
|
44
141
|
flex-direction: column;
|
|
45
142
|
align-items: left;
|
|
46
143
|
width: 100%;
|
|
47
|
-
margin-bottom: ${
|
|
48
|
-
`,
|
|
144
|
+
margin-bottom: ${o.spacing.small};
|
|
145
|
+
`,le=s.div`
|
|
49
146
|
display: flex;
|
|
50
|
-
gap: ${
|
|
147
|
+
gap: ${o.spacing.xsmall};
|
|
51
148
|
width: auto;
|
|
52
149
|
height: auto;
|
|
53
|
-
`,
|
|
150
|
+
`,ce=s.label`
|
|
54
151
|
display: flex;
|
|
55
152
|
align-items: center;
|
|
56
|
-
justify-content:center;
|
|
153
|
+
justify-content: center;
|
|
57
154
|
height: auto;
|
|
58
|
-
flex-direction: ${
|
|
59
|
-
font-family: ${
|
|
60
|
-
font-size: ${
|
|
61
|
-
font-weight: ${
|
|
62
|
-
gap: ${
|
|
155
|
+
flex-direction: ${e=>e.$labelFlexDirection||"column"};
|
|
156
|
+
font-family: ${o.fonts.secondary}, ${o.fonts.fallback};
|
|
157
|
+
font-size: ${o.fontSize.xsmall};
|
|
158
|
+
font-weight: ${o.fontWeight.bold};
|
|
159
|
+
gap: ${o.spacing.xxsmall};
|
|
63
160
|
|
|
64
161
|
& .label-icon-container img,
|
|
65
162
|
& .label-icon-container svg {
|
|
@@ -67,111 +164,115 @@
|
|
|
67
164
|
height: auto;
|
|
68
165
|
object-fit: contain;
|
|
69
166
|
}
|
|
70
|
-
`,
|
|
167
|
+
`,ie=s.div`
|
|
71
168
|
display: flex;
|
|
72
169
|
flex-direction: column;
|
|
73
170
|
align-items: center;
|
|
74
171
|
justify-content: center;
|
|
75
|
-
gap: ${
|
|
76
|
-
`,
|
|
77
|
-
font-weight: ${
|
|
78
|
-
`,
|
|
172
|
+
gap: ${o.spacing.xxxsmall};
|
|
173
|
+
`,de=s.span`
|
|
174
|
+
font-weight: ${o.fontWeight.bolder};
|
|
175
|
+
`,Z=s.div`
|
|
79
176
|
max-width: 100%;
|
|
80
177
|
display: flex;
|
|
81
178
|
align-items: center;
|
|
82
|
-
`,
|
|
83
|
-
font-weight: ${
|
|
84
|
-
`,
|
|
179
|
+
`,me=s.span`
|
|
180
|
+
font-weight: ${o.fontWeight.light};
|
|
181
|
+
`,G=({htmlFor:e,textLabel:l,additionalInfo:n,$labelFlexDirection:a,startIcon:m,endIcon:d,className:x,children:u})=>t.jsxs(ce,{htmlFor:e,className:x,$labelFlexDirection:a,children:[m&&t.jsx(Z,{className:"label-icon-container",children:m}),t.jsxs(ie,{className:"label-text-container",children:[t.jsx(de,{className:"main-label",children:l}),n&&t.jsx(me,{className:"additional-info",children:n})]}),d&&t.jsx(Z,{className:"label-icon-container",children:d}),u]}),J=s.input`
|
|
85
182
|
display: flex;
|
|
86
183
|
place-content: center;
|
|
87
|
-
font-family: ${
|
|
88
|
-
font-size: ${
|
|
184
|
+
font-family: ${o.fonts.secondary}, ${o.fonts.fallback};
|
|
185
|
+
font-size: ${o.fontSize.xsmall};
|
|
89
186
|
line-height: 1.75;
|
|
90
|
-
padding: ${
|
|
187
|
+
padding: ${o.spacing.xxxsmall} ${o.spacing.xsmall};
|
|
91
188
|
max-width: 100%;
|
|
92
189
|
height: auto;
|
|
93
190
|
background-color: #FFFFFF;
|
|
94
191
|
outline: none;
|
|
95
|
-
border: ${
|
|
96
|
-
border-radius: ${
|
|
192
|
+
border: ${o.borderThickness.thin} solid #000000;
|
|
193
|
+
border-radius: ${o.borderRadius.xsmall};
|
|
97
194
|
|
|
98
195
|
&:focus{
|
|
99
|
-
border: ${
|
|
196
|
+
border: ${o.borderThickness.thin} solid ${({theme:e})=>e.colors.teal};
|
|
100
197
|
}
|
|
101
|
-
`,
|
|
198
|
+
`,be=s.textarea`
|
|
102
199
|
display: flex;
|
|
103
200
|
place-content: center;
|
|
104
|
-
border: ${
|
|
105
|
-
border-radius: ${
|
|
201
|
+
border: ${o.borderThickness.light} solid ${({theme:e})=>e.colors.text};
|
|
202
|
+
border-radius: ${o.borderRadius.small};
|
|
106
203
|
outline: none;
|
|
107
|
-
line-height: ${
|
|
108
|
-
padding: ${
|
|
109
|
-
font-family: ${
|
|
110
|
-
font-size: ${
|
|
204
|
+
line-height: ${o.spacing.small};
|
|
205
|
+
padding: ${o.spacing.xxxsmall};
|
|
206
|
+
font-family: ${o.fonts.secondary}, ${o.fonts.fallback};
|
|
207
|
+
font-size: ${o.fontSize.xsmall};
|
|
111
208
|
max-width: 100%;
|
|
112
209
|
resize: none;
|
|
113
210
|
overflow-y: auto;
|
|
114
|
-
`,D
|
|
211
|
+
`,P=D.forwardRef((e,l)=>{const{type:n,id:a,onChange:m,isRequired:d,dataAttributes:x={},disabled:u,className:h,name:$}=e;if(n==="textarea"){const{rows:p=5,cols:F=30,value:B,...S}=e;return t.jsx(be,{ref:l,value:B,rows:p,cols:F,id:a,onChange:m,required:d,disabled:u,...x,className:h,name:$})}if(n==="radio"||n==="checkbox"){const{checked:p,...F}=e;return t.jsx(J,{ref:l,type:n,checked:p,id:a,onChange:m,required:d,...x,disabled:u,className:h,name:$})}const g=e,{value:y,pattern:f,placeholderText:k,...T}=g;return t.jsx(J,{ref:l,type:n,value:y,pattern:f,placeholder:k,id:a,onChange:m,required:d,...x,disabled:u,className:h,name:$})}),q=e=>{const{className:l,type:n,id:a,textLabel:m,additionalInfo:d,$labelFlexDirection:x,startIcon:u,endIcon:h,labelClass:$="",onChange:g,isRequired:y,dataAttributes:f,inputClass:k="",ref:T,disabled:p,isEditable:F,editIcon:B,onClickEdit:S,deleteIcon:I,onClickDelete:j,idx:v,children:W}=e;return t.jsxs(ne,{className:`${l} ${a.replace("#","")}-label-input-container`,children:[n!=="radio"&&n!=="checkbox"&&t.jsx(G,{startIcon:u,endIcon:h,htmlFor:a,textLabel:m,additionalInfo:d,$labelFlexDirection:x,className:$}),n!=="radio"&&n!=="checkbox"&&n==="textarea"&&(()=>{const{rows:N=5,cols:E=30,value:R,...r}=e;return t.jsx(P,{id:a,name:a,type:"textarea",isRequired:y,onChange:g,value:R,rows:N,cols:E,dataAttributes:f,className:k,ref:T,disabled:p})})(),n!=="radio"&&n!=="checkbox"&&n!=="textarea"&&(()=>{const N=e,{value:E,pattern:R,placeholderText:r,...C}=N;return t.jsx(P,{id:a,name:a,placeholderText:r,onChange:g,value:E,type:n,isRequired:y,dataAttributes:f,className:k,ref:T,disabled:p,pattern:R})})(),(n==="radio"||n==="checkbox")&&(()=>{const{checked:N,...E}=e;return t.jsxs(t.Fragment,{children:[t.jsx(P,{ref:T,type:n,name:a,id:a,isRequired:y,checked:N,onChange:g,disabled:p,className:k,dataAttributes:f}),t.jsx(G,{startIcon:u,endIcon:h,htmlFor:a,textLabel:m,additionalInfo:d,$labelFlexDirection:x,className:$})]})})(),F&&t.jsxs(le,{className:"input-edit-buttons",children:[t.jsx(w,{id:`editable-${a}-edit-btn`,startIcon:B,buttonType:"button",onClick:S,className:`edit-radio-${v}`,dataAttributes:f}),t.jsx(w,{id:`editable-${a}-delete-btn`,startIcon:I,buttonType:"button",onClick:j,className:`delete-radio-${v}`,dataAttributes:f})]}),W]})},xe=s.fieldset`
|
|
115
212
|
padding: 0;
|
|
116
213
|
height: auto;
|
|
117
214
|
width: 100%;
|
|
118
|
-
`,
|
|
119
|
-
font-size: ${
|
|
215
|
+
`,ue=s.legend`
|
|
216
|
+
font-size: ${o.spacing.medium};
|
|
120
217
|
font-weight: 500;
|
|
121
|
-
margin: 0 auto ${
|
|
218
|
+
margin: 0 auto ${o.spacing.small} auto;
|
|
122
219
|
text-align: center;
|
|
123
|
-
font-family: ${
|
|
124
|
-
`,
|
|
220
|
+
font-family: ${o.fonts.secondary}, ${o.fonts.fallback};
|
|
221
|
+
`,he=s.div`
|
|
125
222
|
display: flex;
|
|
126
223
|
flex-direction: column;
|
|
127
224
|
align-items: flex-start;
|
|
128
225
|
width: 100%;
|
|
129
|
-
margin-bottom: ${
|
|
130
|
-
|
|
226
|
+
margin-bottom: ${o.spacing.small};
|
|
227
|
+
`,$e=s.div`
|
|
131
228
|
display: flex;
|
|
132
229
|
justify-content: space-between;
|
|
133
230
|
width: 100%;
|
|
134
|
-
`,
|
|
231
|
+
`,K=({editableButtonSize:e,editableButtonColor:l,editableButtonRadius:n,legend:a,fieldsetIndex:m,idx:d,editableInformation:x,saveText:u,saveButtonStartIcon:h,saveButtonEndIcon:$,cancelText:g,cancelButtonStartIcon:y,cancelButtonEndIcon:f,deleteText:k,deleteButtonStartIcon:T,deleteButtonEndIcon:p,onChangeOfEditableOption:F,onClickSaveEdit:B,onClickCancelEdit:S,onClickDeleteEntry:I})=>t.jsxs(xe,{className:"editable-option-fieldset",children:[t.jsx(ue,{children:`${a} ${d+1}`}),x?.map((j,v)=>t.jsx(he,{className:"editable-option-container",children:t.jsx(P,{id:`editable-option-${v}`,name:`editable-option-${v}`,placeholderText:j.name.charAt(0).toUpperCase()+j.name.slice(1),onChange:F,value:j.info,type:j.type,isRequired:!0,className:"editable-option",dataAttributes:{"data-index":v,"data-fieldsetindex":m,"data-key":j.info}})},`${j.name}-${v}`)),t.jsxs($e,{className:"editable-option-button-space",children:[t.jsx(w,{startIcon:h,endIcon:$,size:e||"small",color:l||"primary",radius:n||"squircle",id:`editable-option-${d}-submit`,buttonType:"button",text:u||"Save",onClick:B,className:"editable-option-btn",dataAttributes:{"data-index":d,"data-fieldsetindex":m}}),t.jsx(w,{startIcon:y,endIcon:f,size:e||"small",color:l||"primary",radius:n||"squircle",id:`editable-option-${d}-cancel`,buttonType:"button",text:g||"Cancel",onClick:S,className:"editable-option-btn",dataAttributes:{"data-index":d,"data-fieldsetindex":m}}),t.jsx(w,{startIcon:T,endIcon:p,size:e||"small",color:l||"primary",radius:n||"squircle",id:`editable-option-${d}-delete`,buttonType:"button",text:k||"Delete",onClick:I,className:"editable-option-btn",dataAttributes:{"data-index":d,"data-fieldsetindex":m}})]})]}),ge=s.div`
|
|
135
232
|
display: flex;
|
|
136
|
-
justify-content: space-
|
|
233
|
+
justify-content: space-around;
|
|
234
|
+
align-content: center;
|
|
137
235
|
max-width: 100%;
|
|
138
|
-
|
|
139
|
-
|
|
236
|
+
& button {
|
|
237
|
+
margin-inline: 0.25rem;
|
|
238
|
+
}
|
|
239
|
+
`,fe=({id:e,formActionButtonSize:l,formActionButtonColor:n,formActionButtonRadius:a,submitText:m,submitIcon:d,hasReset:x,resetText:u,resetIcon:h,handleReset:$,hasCancel:g,cancelText:y,cancelIcon:f,handleCancel:k})=>t.jsxs(ge,{className:"form-main-button-container",children:[t.jsx(w,{id:`form-${e}-submit`,size:l||"small",color:n||"primary",radius:a||"squircle",startIcon:d,buttonType:"submit",text:m??"Submit",className:"submit-form-btn"}),x&&t.jsx(w,{id:`form-${e}-edit`,size:l||"small",color:n||"primary",radius:a||"squircle",startIcon:h,buttonType:"button",text:u??"Reset",onClick:$,className:"reset-form-btn"}),g&&t.jsx(w,{id:`form-${e}-cancel`,size:l||"small",color:n||"primary",radius:a||"squircle",startIcon:f,buttonType:"button",text:y??"Cancel",onClick:k,className:"cancel-form-btn"})]}),Q=s.legend`
|
|
240
|
+
font-size: ${o.spacing.medium};
|
|
140
241
|
font-weight: 500;
|
|
141
|
-
margin-bottom: ${
|
|
242
|
+
margin-bottom: ${o.spacing.small};
|
|
142
243
|
width: auto;
|
|
143
244
|
text-align: center;
|
|
144
|
-
font-family: ${
|
|
145
|
-
`,
|
|
245
|
+
font-family: ${o.fonts.secondary}, ${o.fonts.fallback};
|
|
246
|
+
`,V=s.fieldset`
|
|
146
247
|
padding: 0;
|
|
147
248
|
height: auto;
|
|
148
249
|
width: 100%;
|
|
149
|
-
`,
|
|
150
|
-
padding: ${
|
|
250
|
+
`,X=s.div`
|
|
251
|
+
padding: ${o.spacing.small};
|
|
151
252
|
height: auto;
|
|
152
253
|
width: 100%;
|
|
153
|
-
`,
|
|
254
|
+
`,Y=s.div`
|
|
154
255
|
display: flex;
|
|
155
256
|
justify-content: center;
|
|
156
257
|
align-items: center;
|
|
157
258
|
width: 100%;
|
|
158
259
|
height: auto;
|
|
159
|
-
font-family: ${
|
|
160
|
-
font-size: ${
|
|
161
|
-
font-weight: ${
|
|
162
|
-
`,
|
|
260
|
+
font-family: ${o.fonts.tertiary}, ${o.fonts.fallback};
|
|
261
|
+
font-size: ${o.fontSize.xsmall};
|
|
262
|
+
font-weight: ${o.fontWeight.bold};
|
|
263
|
+
`,ye=s.form`
|
|
163
264
|
display: flex;
|
|
164
265
|
flex-direction: column;
|
|
165
266
|
align-items: center;
|
|
166
267
|
width: 100%;
|
|
167
|
-
`,
|
|
268
|
+
`,_=s.div`
|
|
168
269
|
display: flex;
|
|
169
270
|
justify-content: space-between;
|
|
170
271
|
width: 100%;
|
|
171
|
-
`,
|
|
272
|
+
`,ke=s.div`
|
|
172
273
|
width: 100%;
|
|
173
274
|
display: flex;
|
|
174
275
|
flex-direction: column;
|
|
175
276
|
align-items: center;
|
|
176
277
|
justify-content: center;
|
|
177
|
-
`,
|
|
278
|
+
`,pe=({fieldsets:e=null,legendText:l,isExpandable:n,id:a,formInputs:m,labelAndInputContainerClass:d,labelClass:x,inputClass:u,onChangeOfEditableOption:h,handleAddingInputEntry:$,formActionButtonSize:g,formActionButtonColor:y,formActionButtonRadius:f,submitText:k,submitIcon:T,hasReset:p=!1,resetText:F,resetIcon:B,handleReset:S,hasCancel:I=!1,cancelText:j,cancelIcon:v,handleCancel:W,handleSubmitForm:N,className:E,children:R})=>t.jsxs(ye,{id:`${a}-form`,className:E,onSubmit:N,children:[e?e.map((r,C)=>t.jsxs(X,{className:`${a}-fieldset-wrapper`,children:[t.jsxs(V,{id:`${a}-form-fieldset-${C}`,className:`${r.legend}-fieldset`,children:[r.legend&&t.jsx(Q,{className:`${r.legend}-legend`,children:r.legend}),r.inputs.length!==0?r.inputs.map((c,L)=>t.jsxs(D.Fragment,{children:[c.type==="textarea"&&t.jsx(q,{...c,id:c.id??`${r.legend}-input`,labelClass:x,inputClass:u,idx:L,className:`${d} ${c?.uniqueClass}`}),c.type!=="textarea"&&c.type!=="radio"&&c.type!=="checkbox"&&t.jsx(q,{...c,id:c.id??`${r.legend}-input`,labelClass:x,inputClass:u,idx:L,className:`${d} ${c?.uniqueClass}`}),(c.type==="radio"||c.type==="checkbox")&&t.jsxs(t.Fragment,{children:[t.jsx(q,{...c,id:c.id??`${r.legend}-input`,labelClass:x,inputClass:u,idx:L,className:`${d} ${c?.uniqueClass}`}),c.editing&&c.isEditable&&t.jsx(K,{editableButtonSize:c.editableButtonSize,editableButtonColor:c.editableButtonColor,editableButtonRadius:c.editableButtonRadius,legend:`${r.legend}`,fieldsetIndex:C,idx:L,saveText:c.saveText??void 0,saveButtonStartIcon:c.saveButtonStartIcon??void 0,saveButtonEndIcon:c.saveButtonEndIcon??void 0,cancelText:c.cancelText??void 0,cancelButtonStartIcon:c.cancelButtonStartIcon??void 0,cancelButtonEndIcon:c.cancelButtonEndIcon??void 0,deleteText:c.deleteText??void 0,deleteButtonStartIcon:c.deleteButtonStartIcon??void 0,deleteButtonEndIcon:c.deleteButtonEndIcon??void 0,editableInformation:c?.editableInformation||[],onChangeOfEditableOption:h,onClickSaveEdit:c?.onClickSave||(O=>{}),onClickCancelEdit:c?.onClickCancel||(O=>{}),onClickDeleteEntry:c?.onClickDelete||(O=>{})})]})]},`form-${a}-${L}`)):r.isExpandable?t.jsx(Y,{children:`No entry yet on ${r.legend}. Click "+" button to add entry.`}):""]}),r.isExpandable&&t.jsx(_,{className:"add-input-button-space",children:t.jsx(w,{id:`expand-${r.legend}-inputs`,buttonType:"button",text:"+",onClick:$,className:"add-input-entry",dataAttributes:{"data-fieldsetindex":C}})})]},`${r.legend}-${C}`)):t.jsxs(X,{className:`${a}-fieldset-wrapper`,children:[t.jsxs(V,{id:`${a}-form-fieldset`,className:`${l}-fieldset`,children:[l&&t.jsx(Q,{className:`${l}-legend`,children:l}),!e&&m&&m.length!==0?m.map((r,C)=>t.jsxs(D.Fragment,{children:[r.type==="textarea"&&t.jsx(q,{...r,id:r.id??`${l}-input`,labelClass:x,inputClass:u,idx:C,className:`${d} ${r?.uniqueClass}`}),r.type!=="textarea"&&r.type!=="radio"&&r.type!=="checkbox"&&t.jsx(q,{...r,id:r.id??`${l}-input`,labelClass:x,inputClass:u,idx:C,className:`${d} ${r?.uniqueClass}`}),(r.type==="radio"||r.type==="checkbox")&&t.jsxs(t.Fragment,{children:[t.jsx(q,{...r,id:r.id??`${l}-input`,labelClass:x,inputClass:u,idx:C,className:`${d} ${r?.uniqueClass}`}),r.editing&&r.isEditable&&t.jsx(K,{editableButtonSize:r.editableButtonSize,editableButtonColor:r.editableButtonColor,editableButtonRadius:r.editableButtonRadius,legend:`${l}`,idx:C,saveText:r.saveText??void 0,saveButtonStartIcon:r.saveButtonStartIcon??void 0,saveButtonEndIcon:r.saveButtonEndIcon??void 0,cancelText:r.cancelText??void 0,cancelButtonStartIcon:r.cancelButtonStartIcon??void 0,cancelButtonEndIcon:r.cancelButtonEndIcon??void 0,deleteText:r.deleteText??void 0,deleteButtonStartIcon:r.deleteButtonStartIcon??void 0,deleteButtonEndIcon:r.deleteButtonEndIcon??void 0,editableInformation:r?.editableInformation,onChangeOfEditableOption:h,onClickSaveEdit:r?.onClickSave||(c=>{}),onClickCancelEdit:r?.onClickCancel||(c=>{}),onClickDeleteEntry:r?.onClickDelete||(c=>{})})]})]},`form-${a}-${C}`)):n?t.jsx(Y,{children:`No entry yet on ${l}. Please click "+" button to add`}):""]}),n&&t.jsx(_,{className:"add-input-button-space",children:t.jsx(w,{id:`expand-${l}-inputs`,buttonType:"button",text:"+",onClick:$,className:"add-input-entry"})})]}),t.jsx(fe,{id:a,formActionButtonSize:g,formActionButtonColor:y,formActionButtonRadius:f,submitText:k,submitIcon:T,hasReset:p,resetText:F,resetIcon:B,handleReset:S,hasCancel:I,cancelText:j,cancelIcon:v,handleCancel:W}),t.jsx(ke,{className:"children-container",children:R})]}),Ce={mobile:"320px",tablet:"768px",desktop:"992px",largeDesktop:"1200px",largerDesktop:"1400px"},i={primary1:b("#202234"),primary2:b("#3C5E83"),primary3:b("#0F60B6"),secondary1:b("#C67E10"),secondary2:b("#F6C46D"),neutral1:b("#FFFFFF"),neutral2:b("#F2F2F2"),neutral3:b("#ABABAB"),neutral4:b("#373A40"),neutral5:b("#000000"),accent:b("#E1D3B7"),shadow1:b("rgb(88, 88, 88)"),shadow2:b("rgba(255, 255, 255, 0.50)")},ee={name:"light",colors:{screenColor:i.neutral2,backgroundColor1:i.primary1,backgroundColor2:i.primary2,backgroundColor3:i.secondary2,backgroundColor4:i.secondary1,borderColor1:i.neutral5,borderColor2:i.neutral3,textColor1:i.neutral5,textColor2:i.neutral4,textColor3:i.accent,shadow:i.shadow1},anchorTheme:{visited:i.neutral5,hover:i.primary2,active:i.secondary2},footerTheme:{backgroundColor:i.neutral5,textColor:i.secondary1,shadowColor:i.shadow1},notificationPalette:{infoText:b("#C9E6F0"),infoBackground:b("#202234"),warningText:b("#FCFFC1"),warningBackground:b("#F2C265"),successText:b("#9EDF9C"),successBackground:b("#123524"),errorText:b("#FAD4D4"),errorBackground:b("#990000")}},oe={name:"dark",colors:{screenColor:i.neutral5,backgroundColor1:i.primary2,backgroundColor2:i.primary3,backgroundColor3:i.secondary1,backgroundColor4:i.secondary2,borderColor1:i.neutral2,borderColor2:i.neutral3,textColor1:i.neutral1,textColor2:i.accent,textColor3:i.neutral2,shadow:i.shadow2},anchorTheme:{link:i.neutral1,visited:i.neutral1,hover:i.primary3,active:i.secondary1},footerTheme:{backgroundColor:i.accent,textColor:i.primary1,shadowColor:i.shadow2},notificationPalette:{infoText:b("#202234"),infoBackground:b("#C9E6F0"),warningText:b("#F2C265"),warningBackground:b("#FCFFC1"),successText:b("#123524"),successBackground:b("#9EDF9C"),errorBackground:b("#FAD4D4"),errorText:b("#990000")}},A=D.createContext({}),je=({children:e,initialTheme:l=ee,secondTheme:n=oe})=>{const[a,m]=D.useState(l),d=()=>{m(x=>x===l?n:l)};return t.jsx(A.Provider,{value:{currentTheme:a,toggleTheme:d},children:t.jsx(s.ThemeProvider,{theme:a,children:e})})},we=()=>D.useContext(A);exports.DynamicForm=pe;exports.ThemeContext=A;exports.ThemeContextProvider=je;exports.breakpoints=Ce;exports.darkTheme=oe;exports.lightTheme=ee;exports.palette=i;exports.useTheme=we;
|