@kbgarcia8/react-dynamic-form 2.0.0 → 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 +310 -295
- package/dist/type/propTypes.d.ts +7 -4
- package/dist/type/propTypes.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
const
|
|
1
|
+
import { jsx as t, jsxs as f, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import B, { forwardRef as Z, createContext as _, useState as I, useContext as ee } from "react";
|
|
3
|
+
import r, { ThemeProvider as te } from "styled-components";
|
|
4
|
+
const e = {
|
|
5
5
|
fonts: {
|
|
6
6
|
secondary: "Raleway",
|
|
7
7
|
tertiary: "Lato",
|
|
@@ -32,15 +32,15 @@ const t = {
|
|
|
32
32
|
thin: "0.0625rem",
|
|
33
33
|
light: "0.125rem"
|
|
34
34
|
}
|
|
35
|
-
},
|
|
35
|
+
}, W = r.button`
|
|
36
36
|
display: flex;
|
|
37
37
|
align-items: center;
|
|
38
38
|
justify-content: center;
|
|
39
39
|
background-color: ${({ theme: a }) => a.colors.blue || "blue"};
|
|
40
40
|
color: ${({ theme: a }) => a.colors.bg || "white"};
|
|
41
|
-
border: ${
|
|
42
|
-
border-radius: ${
|
|
43
|
-
padding: ${
|
|
41
|
+
border: ${e.borderThickness.light} solid ${({ theme: a }) => a.colors.text || "black"};
|
|
42
|
+
border-radius: ${e.borderRadius.xlarge};
|
|
43
|
+
padding: ${e.spacing.xxxsmall} ${e.spacing.small};
|
|
44
44
|
margin: 0.125rem;
|
|
45
45
|
width: auto;
|
|
46
46
|
cursor: pointer;
|
|
@@ -48,7 +48,7 @@ const t = {
|
|
|
48
48
|
|
|
49
49
|
&:hover {
|
|
50
50
|
background-color: lightblue;
|
|
51
|
-
border: ${
|
|
51
|
+
border: ${e.borderThickness.light} solid gray;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
& .button-icon-text-space {
|
|
@@ -58,82 +58,86 @@ const t = {
|
|
|
58
58
|
& .button-icon-text-space svg {
|
|
59
59
|
max-width: 100%;
|
|
60
60
|
}
|
|
61
|
-
`,
|
|
61
|
+
`, P = r.div`
|
|
62
62
|
width: 100%;
|
|
63
63
|
display: flex;
|
|
64
64
|
flex-direction: row;
|
|
65
65
|
align-items: center;
|
|
66
66
|
justify-content: center;
|
|
67
|
-
|
|
67
|
+
`;
|
|
68
|
+
r.img`
|
|
68
69
|
maxwidth: 100%;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
font-
|
|
72
|
-
font-
|
|
70
|
+
`;
|
|
71
|
+
const M = r.span`
|
|
72
|
+
font-size: ${e.fontSize.xsmall};
|
|
73
|
+
font-weight: ${e.fontWeight.medium};
|
|
74
|
+
font-family: ${e.fonts.tertiary}, ${e.fonts.fallback};
|
|
73
75
|
display: flex;
|
|
74
76
|
align-items: center;
|
|
75
77
|
justify-content: center;
|
|
76
|
-
`,
|
|
78
|
+
`, x = ({
|
|
77
79
|
onClick: a,
|
|
78
80
|
id: l,
|
|
79
81
|
buttonType: n,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
alt:
|
|
83
|
-
text:
|
|
82
|
+
startIcon: i,
|
|
83
|
+
endIcon: d,
|
|
84
|
+
alt: m = "alt-button-icon",
|
|
85
|
+
text: c = "",
|
|
84
86
|
className: b = "",
|
|
85
|
-
dataAttributes:
|
|
87
|
+
dataAttributes: u = {}
|
|
86
88
|
}) => {
|
|
87
89
|
if (n === "button")
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
-
|
|
90
|
+
return /* @__PURE__ */ t(
|
|
91
|
+
W,
|
|
90
92
|
{
|
|
91
93
|
onClick: a,
|
|
92
94
|
id: l,
|
|
93
95
|
type: n,
|
|
94
96
|
className: b,
|
|
95
|
-
...
|
|
96
|
-
children: /* @__PURE__ */
|
|
97
|
-
i
|
|
98
|
-
|
|
97
|
+
...u,
|
|
98
|
+
children: /* @__PURE__ */ f(P, { className: "button-icon-text-space", children: [
|
|
99
|
+
i || "",
|
|
100
|
+
c && /* @__PURE__ */ t(M, { id: l, children: c }),
|
|
101
|
+
d || ""
|
|
99
102
|
] })
|
|
100
103
|
}
|
|
101
104
|
);
|
|
102
105
|
if (n === "submit")
|
|
103
|
-
return /* @__PURE__ */
|
|
104
|
-
|
|
106
|
+
return /* @__PURE__ */ t(
|
|
107
|
+
W,
|
|
105
108
|
{
|
|
106
109
|
id: l,
|
|
107
110
|
type: n,
|
|
108
111
|
className: b,
|
|
109
|
-
...
|
|
110
|
-
children: /* @__PURE__ */
|
|
111
|
-
i
|
|
112
|
-
|
|
112
|
+
...u,
|
|
113
|
+
children: /* @__PURE__ */ f(P, { className: "button-icon-text-space", children: [
|
|
114
|
+
i || "",
|
|
115
|
+
c && /* @__PURE__ */ t(M, { id: l, children: c }),
|
|
116
|
+
d || ""
|
|
113
117
|
] })
|
|
114
118
|
}
|
|
115
119
|
);
|
|
116
|
-
},
|
|
120
|
+
}, ae = r.div`
|
|
117
121
|
display: flex;
|
|
118
122
|
flex-direction: column;
|
|
119
123
|
align-items: left;
|
|
120
124
|
width: 100%;
|
|
121
|
-
margin-bottom: ${
|
|
122
|
-
`,
|
|
125
|
+
margin-bottom: ${e.spacing.small};
|
|
126
|
+
`, ne = r.div`
|
|
123
127
|
display: flex;
|
|
124
|
-
gap: ${
|
|
128
|
+
gap: ${e.spacing.xsmall};
|
|
125
129
|
width: auto;
|
|
126
130
|
height: auto;
|
|
127
|
-
`,
|
|
131
|
+
`, oe = r.label`
|
|
128
132
|
display: flex;
|
|
129
133
|
align-items: center;
|
|
130
134
|
justify-content:center;
|
|
131
135
|
height: auto;
|
|
132
136
|
flex-direction: ${(a) => a.$labelFlexDirection || "column"};
|
|
133
|
-
font-family: ${
|
|
134
|
-
font-size: ${
|
|
135
|
-
font-weight: ${
|
|
136
|
-
gap: ${
|
|
137
|
+
font-family: ${e.fonts.secondary}, ${e.fonts.fallback};
|
|
138
|
+
font-size: ${e.fontSize.xsmall};
|
|
139
|
+
font-weight: ${e.fontWeight.bold};
|
|
140
|
+
gap: ${e.spacing.xxsmall};
|
|
137
141
|
|
|
138
142
|
& .label-icon-container img,
|
|
139
143
|
& .label-icon-container svg {
|
|
@@ -141,321 +145,326 @@ const t = {
|
|
|
141
145
|
height: auto;
|
|
142
146
|
object-fit: contain;
|
|
143
147
|
}
|
|
144
|
-
`,
|
|
148
|
+
`, ie = r.div`
|
|
145
149
|
display: flex;
|
|
146
150
|
flex-direction: column;
|
|
147
151
|
align-items: center;
|
|
148
152
|
justify-content: center;
|
|
149
|
-
gap: ${
|
|
150
|
-
`,
|
|
151
|
-
font-weight: ${
|
|
152
|
-
`,
|
|
153
|
+
gap: ${e.spacing.xxxsmall};
|
|
154
|
+
`, le = r.span`
|
|
155
|
+
font-weight: ${e.fontWeight.bolder};
|
|
156
|
+
`, U = r.div`
|
|
153
157
|
max-width: 100%;
|
|
154
158
|
display: flex;
|
|
155
159
|
align-items: center;
|
|
156
|
-
`,
|
|
157
|
-
font-weight: ${
|
|
158
|
-
`,
|
|
160
|
+
`, se = r.span`
|
|
161
|
+
font-weight: ${e.fontWeight.light};
|
|
162
|
+
`, H = ({
|
|
159
163
|
htmlFor: a,
|
|
160
164
|
textLabel: l,
|
|
161
165
|
additionalInfo: n,
|
|
162
166
|
$labelFlexDirection: i,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
className:
|
|
167
|
+
startIcon: d,
|
|
168
|
+
endIcon: m,
|
|
169
|
+
className: c,
|
|
166
170
|
children: b
|
|
167
|
-
}) => /* @__PURE__ */
|
|
168
|
-
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
-
/* @__PURE__ */
|
|
171
|
-
n && /* @__PURE__ */
|
|
171
|
+
}) => /* @__PURE__ */ f(oe, { htmlFor: a, className: c, $labelFlexDirection: i, children: [
|
|
172
|
+
d && /* @__PURE__ */ t(U, { className: "label-icon-container", children: d }),
|
|
173
|
+
/* @__PURE__ */ f(ie, { className: "label-text-container", children: [
|
|
174
|
+
/* @__PURE__ */ t(le, { className: "main-label", children: l }),
|
|
175
|
+
n && /* @__PURE__ */ t(se, { className: "additional-info", children: n })
|
|
172
176
|
] }),
|
|
177
|
+
m && /* @__PURE__ */ t(U, { className: "label-icon-container", children: m }),
|
|
173
178
|
b
|
|
174
|
-
] }),
|
|
179
|
+
] }), O = r.input`
|
|
175
180
|
display: flex;
|
|
176
181
|
place-content: center;
|
|
177
|
-
font-family: ${
|
|
178
|
-
font-size: ${
|
|
182
|
+
font-family: ${e.fonts.secondary}, ${e.fonts.fallback};
|
|
183
|
+
font-size: ${e.fontSize.xsmall};
|
|
179
184
|
line-height: 1.75;
|
|
180
|
-
padding: ${
|
|
185
|
+
padding: ${e.spacing.xxxsmall} ${e.spacing.xsmall};
|
|
181
186
|
max-width: 100%;
|
|
182
187
|
height: auto;
|
|
183
188
|
background-color: #FFFFFF;
|
|
184
189
|
outline: none;
|
|
185
|
-
border: ${
|
|
186
|
-
border-radius: ${
|
|
190
|
+
border: ${e.borderThickness.thin} solid #000000;
|
|
191
|
+
border-radius: ${e.borderRadius.xsmall};
|
|
187
192
|
|
|
188
193
|
&:focus{
|
|
189
|
-
border: ${
|
|
194
|
+
border: ${e.borderThickness.thin} solid ${({ theme: a }) => a.colors.teal};
|
|
190
195
|
}
|
|
191
|
-
`,
|
|
196
|
+
`, ce = r.textarea`
|
|
192
197
|
display: flex;
|
|
193
198
|
place-content: center;
|
|
194
|
-
border: ${
|
|
195
|
-
border-radius: ${
|
|
199
|
+
border: ${e.borderThickness.light} solid ${({ theme: a }) => a.colors.text};
|
|
200
|
+
border-radius: ${e.borderRadius.small};
|
|
196
201
|
outline: none;
|
|
197
|
-
line-height: ${
|
|
198
|
-
padding: ${
|
|
199
|
-
font-family: ${
|
|
200
|
-
font-size: ${
|
|
202
|
+
line-height: ${e.spacing.small};
|
|
203
|
+
padding: ${e.spacing.xxxsmall};
|
|
204
|
+
font-family: ${e.fonts.secondary}, ${e.fonts.fallback};
|
|
205
|
+
font-size: ${e.fontSize.xsmall};
|
|
201
206
|
max-width: 100%;
|
|
202
207
|
resize: none;
|
|
203
208
|
overflow-y: auto;
|
|
204
|
-
`, T =
|
|
205
|
-
const { type: n, id: i, onChange: d, isRequired:
|
|
209
|
+
`, T = Z((a, l) => {
|
|
210
|
+
const { type: n, id: i, onChange: d, isRequired: m, dataAttributes: c = {}, disabled: b, className: u, name: g } = a;
|
|
206
211
|
if (n === "textarea") {
|
|
207
|
-
const { rows:
|
|
208
|
-
return /* @__PURE__ */
|
|
209
|
-
|
|
212
|
+
const { rows: k = 5, cols: E = 30, value: A, ...D } = a;
|
|
213
|
+
return /* @__PURE__ */ t(
|
|
214
|
+
ce,
|
|
210
215
|
{
|
|
211
216
|
ref: l,
|
|
212
|
-
value:
|
|
213
|
-
rows:
|
|
217
|
+
value: A,
|
|
218
|
+
rows: k,
|
|
214
219
|
cols: E,
|
|
215
220
|
id: i,
|
|
216
221
|
onChange: d,
|
|
217
|
-
required:
|
|
222
|
+
required: m,
|
|
218
223
|
disabled: b,
|
|
219
|
-
...
|
|
220
|
-
className:
|
|
221
|
-
name:
|
|
224
|
+
...c,
|
|
225
|
+
className: u,
|
|
226
|
+
name: g
|
|
222
227
|
}
|
|
223
228
|
);
|
|
224
229
|
}
|
|
225
230
|
if (n === "radio" || n === "checkbox") {
|
|
226
|
-
const { checked:
|
|
227
|
-
return /* @__PURE__ */
|
|
228
|
-
|
|
231
|
+
const { checked: k, ...E } = a;
|
|
232
|
+
return /* @__PURE__ */ t(
|
|
233
|
+
O,
|
|
229
234
|
{
|
|
230
235
|
ref: l,
|
|
231
236
|
type: n,
|
|
232
|
-
checked:
|
|
237
|
+
checked: k,
|
|
233
238
|
id: i,
|
|
234
239
|
onChange: d,
|
|
235
|
-
required:
|
|
236
|
-
...
|
|
240
|
+
required: m,
|
|
241
|
+
...c,
|
|
237
242
|
disabled: b,
|
|
238
|
-
className:
|
|
239
|
-
name:
|
|
243
|
+
className: u,
|
|
244
|
+
name: g
|
|
240
245
|
}
|
|
241
246
|
);
|
|
242
247
|
}
|
|
243
|
-
const
|
|
244
|
-
return /* @__PURE__ */
|
|
245
|
-
|
|
248
|
+
const p = a, { value: C, pattern: y, placeholderText: w, ...F } = p;
|
|
249
|
+
return /* @__PURE__ */ t(
|
|
250
|
+
O,
|
|
246
251
|
{
|
|
247
252
|
ref: l,
|
|
248
253
|
type: n,
|
|
249
|
-
value:
|
|
250
|
-
pattern:
|
|
251
|
-
placeholder:
|
|
254
|
+
value: C,
|
|
255
|
+
pattern: y,
|
|
256
|
+
placeholder: w,
|
|
252
257
|
id: i,
|
|
253
258
|
onChange: d,
|
|
254
|
-
required:
|
|
255
|
-
...
|
|
259
|
+
required: m,
|
|
260
|
+
...c,
|
|
256
261
|
disabled: b,
|
|
257
|
-
className:
|
|
258
|
-
name:
|
|
262
|
+
className: u,
|
|
263
|
+
name: g
|
|
259
264
|
}
|
|
260
265
|
);
|
|
261
|
-
}),
|
|
266
|
+
}), v = (a) => {
|
|
262
267
|
const {
|
|
263
268
|
className: l,
|
|
264
269
|
type: n,
|
|
265
270
|
id: i,
|
|
266
271
|
textLabel: d,
|
|
267
|
-
additionalInfo:
|
|
268
|
-
$labelFlexDirection:
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
272
|
+
additionalInfo: m,
|
|
273
|
+
$labelFlexDirection: c,
|
|
274
|
+
startIcon: b,
|
|
275
|
+
endIcon: u,
|
|
276
|
+
labelClass: g,
|
|
277
|
+
onChange: p,
|
|
278
|
+
isRequired: C,
|
|
273
279
|
dataAttributes: y,
|
|
274
|
-
inputClass:
|
|
275
|
-
ref:
|
|
276
|
-
disabled:
|
|
277
|
-
isEditable:
|
|
278
|
-
editIcon:
|
|
280
|
+
inputClass: w,
|
|
281
|
+
ref: F,
|
|
282
|
+
disabled: k,
|
|
283
|
+
isEditable: E,
|
|
284
|
+
editIcon: A,
|
|
279
285
|
onClickEdit: D,
|
|
280
|
-
deleteIcon:
|
|
281
|
-
onClickDelete:
|
|
282
|
-
idx:
|
|
283
|
-
children:
|
|
286
|
+
deleteIcon: z,
|
|
287
|
+
onClickDelete: j,
|
|
288
|
+
idx: S,
|
|
289
|
+
children: L
|
|
284
290
|
} = a;
|
|
285
|
-
return /* @__PURE__ */
|
|
286
|
-
n !== "radio" && n !== "checkbox" && /* @__PURE__ */
|
|
291
|
+
return /* @__PURE__ */ f(ae, { className: `${l} ${i.replace("#", "")}-label-input-container`, children: [
|
|
292
|
+
n !== "radio" && n !== "checkbox" && /* @__PURE__ */ t(H, { startIcon: b, endIcon: u, htmlFor: i, textLabel: d, additionalInfo: m, $labelFlexDirection: c, className: g }),
|
|
287
293
|
n !== "radio" && n !== "checkbox" && n === "textarea" && (() => {
|
|
288
|
-
const { rows:
|
|
289
|
-
return /* @__PURE__ */
|
|
294
|
+
const { rows: o = 5, cols: $ = 30, value: s, ...N } = a;
|
|
295
|
+
return /* @__PURE__ */ t(
|
|
290
296
|
T,
|
|
291
297
|
{
|
|
292
298
|
id: i,
|
|
293
299
|
name: i,
|
|
294
300
|
type: "textarea",
|
|
295
|
-
isRequired:
|
|
296
|
-
onChange:
|
|
297
|
-
value:
|
|
298
|
-
rows:
|
|
299
|
-
cols:
|
|
301
|
+
isRequired: C,
|
|
302
|
+
onChange: p,
|
|
303
|
+
value: s,
|
|
304
|
+
rows: o,
|
|
305
|
+
cols: $,
|
|
300
306
|
dataAttributes: y,
|
|
301
|
-
className:
|
|
302
|
-
ref:
|
|
303
|
-
disabled:
|
|
307
|
+
className: w,
|
|
308
|
+
ref: F,
|
|
309
|
+
disabled: k
|
|
304
310
|
}
|
|
305
311
|
);
|
|
306
312
|
})(),
|
|
307
313
|
n !== "radio" && n !== "checkbox" && n !== "textarea" && (() => {
|
|
308
|
-
const
|
|
309
|
-
return /* @__PURE__ */
|
|
314
|
+
const o = a, { value: $, pattern: s, placeholderText: N, ...q } = o;
|
|
315
|
+
return /* @__PURE__ */ t(
|
|
310
316
|
T,
|
|
311
317
|
{
|
|
312
318
|
id: i,
|
|
313
319
|
name: i,
|
|
314
|
-
placeholderText:
|
|
315
|
-
onChange:
|
|
316
|
-
value:
|
|
320
|
+
placeholderText: N,
|
|
321
|
+
onChange: p,
|
|
322
|
+
value: $,
|
|
317
323
|
type: n,
|
|
318
|
-
isRequired:
|
|
324
|
+
isRequired: C,
|
|
319
325
|
dataAttributes: y,
|
|
320
|
-
className:
|
|
321
|
-
ref:
|
|
322
|
-
disabled:
|
|
323
|
-
pattern:
|
|
326
|
+
className: w,
|
|
327
|
+
ref: F,
|
|
328
|
+
disabled: k,
|
|
329
|
+
pattern: s
|
|
324
330
|
}
|
|
325
331
|
);
|
|
326
332
|
})(),
|
|
327
333
|
(n === "radio" || n === "checkbox") && (() => {
|
|
328
|
-
const { checked:
|
|
329
|
-
return /* @__PURE__ */
|
|
330
|
-
/* @__PURE__ */
|
|
334
|
+
const { checked: o, ...$ } = a;
|
|
335
|
+
return /* @__PURE__ */ f(R, { children: [
|
|
336
|
+
/* @__PURE__ */ t(
|
|
331
337
|
T,
|
|
332
338
|
{
|
|
333
|
-
ref:
|
|
339
|
+
ref: F,
|
|
334
340
|
type: n,
|
|
335
341
|
name: i,
|
|
336
342
|
id: i,
|
|
337
|
-
isRequired:
|
|
338
|
-
checked:
|
|
339
|
-
onChange:
|
|
340
|
-
disabled:
|
|
341
|
-
className:
|
|
343
|
+
isRequired: C,
|
|
344
|
+
checked: o,
|
|
345
|
+
onChange: p,
|
|
346
|
+
disabled: k,
|
|
347
|
+
className: w,
|
|
342
348
|
dataAttributes: y
|
|
343
349
|
}
|
|
344
350
|
),
|
|
345
|
-
/* @__PURE__ */
|
|
351
|
+
/* @__PURE__ */ t(H, { startIcon: b, endIcon: u, htmlFor: i, textLabel: d, additionalInfo: m, $labelFlexDirection: c, className: g })
|
|
346
352
|
] });
|
|
347
353
|
})(),
|
|
348
|
-
|
|
349
|
-
/* @__PURE__ */
|
|
350
|
-
/* @__PURE__ */
|
|
354
|
+
E && /* @__PURE__ */ f(ne, { className: "input-edit-buttons", children: [
|
|
355
|
+
/* @__PURE__ */ t(x, { id: `editable-${i}-edit-btn`, startIcon: A, buttonType: "button", onClick: D, className: `edit-radio-${S}`, dataAttributes: y }),
|
|
356
|
+
/* @__PURE__ */ t(x, { id: `editable-${i}-delete-btn`, startIcon: z, buttonType: "button", onClick: j, className: `delete-radio-${S}`, dataAttributes: y })
|
|
351
357
|
] }),
|
|
352
|
-
|
|
358
|
+
L
|
|
353
359
|
] });
|
|
354
|
-
},
|
|
360
|
+
}, re = r.fieldset`
|
|
355
361
|
padding: 0;
|
|
356
362
|
height: auto;
|
|
357
363
|
width: 100%;
|
|
358
|
-
`,
|
|
359
|
-
font-size: ${
|
|
364
|
+
`, de = r.legend`
|
|
365
|
+
font-size: ${e.spacing.medium};
|
|
360
366
|
font-weight: 500;
|
|
361
|
-
margin: 0 auto ${
|
|
367
|
+
margin: 0 auto ${e.spacing.small} auto;
|
|
362
368
|
text-align: center;
|
|
363
|
-
font-family: ${
|
|
364
|
-
`,
|
|
369
|
+
font-family: ${e.fonts.secondary}, ${e.fonts.fallback};
|
|
370
|
+
`, me = r.div`
|
|
365
371
|
display: flex;
|
|
366
372
|
flex-direction: column;
|
|
367
373
|
align-items: flex-start;
|
|
368
374
|
width: 100%;
|
|
369
|
-
margin-bottom: ${
|
|
370
|
-
`,
|
|
375
|
+
margin-bottom: ${e.spacing.small};
|
|
376
|
+
`, be = r.div`
|
|
371
377
|
display: flex;
|
|
372
378
|
justify-content: space-between;
|
|
373
379
|
width: 100%;
|
|
374
|
-
`,
|
|
380
|
+
`, G = ({
|
|
375
381
|
legend: a,
|
|
376
382
|
fieldsetIndex: l,
|
|
377
383
|
idx: n,
|
|
378
384
|
editableInformation: i,
|
|
379
385
|
onChangeOfEditableOption: d,
|
|
380
|
-
onClickSaveEdit:
|
|
381
|
-
onClickCancelEdit:
|
|
386
|
+
onClickSaveEdit: m,
|
|
387
|
+
onClickCancelEdit: c,
|
|
382
388
|
onClickDeleteEntry: b
|
|
383
|
-
}) => /* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
i?.map((
|
|
389
|
+
}) => /* @__PURE__ */ f(re, { className: "editable-option-fieldset", children: [
|
|
390
|
+
/* @__PURE__ */ t(de, { children: `${a} ${n + 1}` }),
|
|
391
|
+
i?.map((u, g) => /* @__PURE__ */ t(me, { className: "editable-option-container", children: /* @__PURE__ */ t(
|
|
386
392
|
T,
|
|
387
393
|
{
|
|
388
|
-
id: `editable-option-${
|
|
389
|
-
name: `editable-option-${
|
|
390
|
-
placeholderText:
|
|
394
|
+
id: `editable-option-${g}`,
|
|
395
|
+
name: `editable-option-${g}`,
|
|
396
|
+
placeholderText: u.name.charAt(0).toUpperCase() + u.name.slice(1),
|
|
391
397
|
onChange: d,
|
|
392
|
-
value:
|
|
393
|
-
type:
|
|
398
|
+
value: u.info,
|
|
399
|
+
type: u.type,
|
|
394
400
|
isRequired: !0,
|
|
395
401
|
className: "editable-option",
|
|
396
402
|
dataAttributes: {
|
|
397
|
-
"data-index":
|
|
403
|
+
"data-index": g,
|
|
398
404
|
"data-fieldsetindex": l,
|
|
399
|
-
"data-key":
|
|
405
|
+
"data-key": u.info
|
|
400
406
|
}
|
|
401
407
|
}
|
|
402
|
-
) }, `${
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
/* @__PURE__ */
|
|
405
|
-
/* @__PURE__ */
|
|
406
|
-
/* @__PURE__ */
|
|
408
|
+
) }, `${u.name}-${g}`)),
|
|
409
|
+
/* @__PURE__ */ f(be, { className: "editable-option-button-space", children: [
|
|
410
|
+
/* @__PURE__ */ t(x, { id: `editable-option-${n}-submit`, buttonType: "button", text: "Save", onClick: m, className: "editable-option-btn", dataAttributes: { "data-index": n, "data-fieldsetindex": l } }),
|
|
411
|
+
/* @__PURE__ */ t(x, { id: `editable-option-${n}-cancel`, buttonType: "button", text: "Cancel", onClick: c, className: "editable-option-btn", dataAttributes: { "data-index": n, "data-fieldsetindex": l } }),
|
|
412
|
+
/* @__PURE__ */ t(x, { id: `editable-option-${n}-delete`, buttonType: "button", text: "Delete", onClick: b, className: "editable-option-btn", dataAttributes: { "data-index": n, "data-fieldsetindex": l } })
|
|
407
413
|
] })
|
|
408
|
-
] }),
|
|
414
|
+
] }), he = r.div`
|
|
409
415
|
display: flex;
|
|
410
416
|
justify-content: space-between;
|
|
411
417
|
max-width: 100%;
|
|
412
|
-
`,
|
|
418
|
+
`, ue = ({
|
|
413
419
|
id: a,
|
|
414
420
|
submitText: l,
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
421
|
+
submitIcon: n,
|
|
422
|
+
hasReset: i,
|
|
423
|
+
resetText: d,
|
|
424
|
+
resetIcon: m,
|
|
425
|
+
handleReset: c,
|
|
426
|
+
hasCancel: b,
|
|
427
|
+
cancelText: u,
|
|
428
|
+
cancelIcon: g,
|
|
429
|
+
handleCancel: p
|
|
430
|
+
}) => /* @__PURE__ */ f(he, { className: "form-main-button-container", children: [
|
|
431
|
+
/* @__PURE__ */ t(x, { id: `form-${a}-submit`, startIcon: n, buttonType: "submit", text: l ?? "Submit", className: "submit-form-btn" }),
|
|
432
|
+
i && /* @__PURE__ */ t(x, { id: `form-${a}-edit`, startIcon: m, buttonType: "button", text: d ?? "Reset", onClick: c, className: "reset-form-btn" }),
|
|
433
|
+
b && /* @__PURE__ */ t(x, { id: `form-${a}-cancel`, startIcon: g, buttonType: "button", text: u ?? "Cancel", onClick: p, className: "cancel-form-btn" })
|
|
434
|
+
] }), J = r.legend`
|
|
435
|
+
font-size: ${e.spacing.medium};
|
|
427
436
|
font-weight: 500;
|
|
428
|
-
margin-bottom: ${
|
|
437
|
+
margin-bottom: ${e.spacing.small};
|
|
429
438
|
width: auto;
|
|
430
439
|
text-align: center;
|
|
431
|
-
font-family: ${
|
|
432
|
-
`,
|
|
440
|
+
font-family: ${e.fonts.secondary}, ${e.fonts.fallback};
|
|
441
|
+
`, K = r.fieldset`
|
|
433
442
|
padding: 0;
|
|
434
443
|
height: auto;
|
|
435
444
|
width: 100%;
|
|
436
|
-
`,
|
|
437
|
-
padding: ${
|
|
445
|
+
`, Q = r.div`
|
|
446
|
+
padding: ${e.spacing.small};
|
|
438
447
|
height: auto;
|
|
439
448
|
width: 100%;
|
|
440
|
-
`,
|
|
449
|
+
`, V = r.div`
|
|
441
450
|
display: flex;
|
|
442
451
|
justify-content: center;
|
|
443
452
|
align-items: center;
|
|
444
453
|
width: 100%;
|
|
445
454
|
height: auto;
|
|
446
|
-
font-family: ${
|
|
447
|
-
font-size: ${
|
|
448
|
-
font-weight: ${
|
|
449
|
-
`, fe =
|
|
455
|
+
font-family: ${e.fonts.tertiary}, ${e.fonts.fallback};
|
|
456
|
+
font-size: ${e.fontSize.xsmall};
|
|
457
|
+
font-weight: ${e.fontWeight.bold};
|
|
458
|
+
`, fe = r.form`
|
|
450
459
|
display: flex;
|
|
451
460
|
flex-direction: column;
|
|
452
461
|
align-items: center;
|
|
453
462
|
width: 100%;
|
|
454
|
-
`,
|
|
463
|
+
`, X = r.div`
|
|
455
464
|
display: flex;
|
|
456
465
|
justify-content: space-between;
|
|
457
466
|
width: 100%;
|
|
458
|
-
`,
|
|
467
|
+
`, ge = r.div`
|
|
459
468
|
width: 100%;
|
|
460
469
|
display: flex;
|
|
461
470
|
flex-direction: column;
|
|
@@ -467,125 +476,128 @@ const t = {
|
|
|
467
476
|
isExpandable: n,
|
|
468
477
|
id: i,
|
|
469
478
|
formInputs: d,
|
|
470
|
-
labelAndInputContainerClass:
|
|
471
|
-
labelClass:
|
|
479
|
+
labelAndInputContainerClass: m,
|
|
480
|
+
labelClass: c,
|
|
472
481
|
inputClass: b,
|
|
473
|
-
onChangeOfEditableOption:
|
|
474
|
-
handleAddingInputEntry:
|
|
475
|
-
submitText:
|
|
482
|
+
onChangeOfEditableOption: u,
|
|
483
|
+
handleAddingInputEntry: g,
|
|
484
|
+
submitText: p,
|
|
485
|
+
submitIcon: C,
|
|
476
486
|
hasReset: y = !1,
|
|
477
|
-
resetText:
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
487
|
+
resetText: w,
|
|
488
|
+
resetIcon: F,
|
|
489
|
+
handleReset: k,
|
|
490
|
+
hasCancel: E = !1,
|
|
491
|
+
cancelText: A,
|
|
492
|
+
cancelIcon: D,
|
|
493
|
+
handleCancel: z,
|
|
494
|
+
handleSubmitForm: j,
|
|
483
495
|
className: S,
|
|
484
|
-
children:
|
|
485
|
-
}) => /* @__PURE__ */
|
|
486
|
-
a ? a.map((o,
|
|
487
|
-
/* @__PURE__ */
|
|
488
|
-
o.legend && /* @__PURE__ */
|
|
489
|
-
o.inputs.length !== 0 ? o.inputs.map((s,
|
|
490
|
-
s.type === "textarea" && /* @__PURE__ */
|
|
491
|
-
|
|
496
|
+
children: L
|
|
497
|
+
}) => /* @__PURE__ */ f(fe, { id: `${i}-form`, className: S, onSubmit: j, children: [
|
|
498
|
+
a ? a.map((o, $) => /* @__PURE__ */ f(Q, { className: `${i}-fieldset-wrapper`, children: [
|
|
499
|
+
/* @__PURE__ */ f(K, { id: `${i}-form-fieldset-${$}`, className: `${o.legend}-fieldset`, children: [
|
|
500
|
+
o.legend && /* @__PURE__ */ t(J, { className: `${o.legend}-legend`, children: o.legend }),
|
|
501
|
+
o.inputs.length !== 0 ? o.inputs.map((s, N) => /* @__PURE__ */ f(B.Fragment, { children: [
|
|
502
|
+
s.type === "textarea" && /* @__PURE__ */ t(
|
|
503
|
+
v,
|
|
492
504
|
{
|
|
493
505
|
...s,
|
|
494
506
|
id: s.id ?? `${o.legend}-input`,
|
|
495
|
-
labelClass:
|
|
507
|
+
labelClass: c,
|
|
496
508
|
inputClass: b,
|
|
497
|
-
idx:
|
|
498
|
-
className: `${
|
|
509
|
+
idx: N,
|
|
510
|
+
className: `${m} ${s?.uniqueClass}`
|
|
499
511
|
}
|
|
500
512
|
),
|
|
501
|
-
s.type !== "textarea" && s.type !== "radio" && s.type !== "checkbox" && /* @__PURE__ */
|
|
502
|
-
|
|
513
|
+
s.type !== "textarea" && s.type !== "radio" && s.type !== "checkbox" && /* @__PURE__ */ t(
|
|
514
|
+
v,
|
|
503
515
|
{
|
|
504
516
|
...s,
|
|
505
517
|
id: s.id ?? `${o.legend}-input`,
|
|
506
|
-
labelClass:
|
|
518
|
+
labelClass: c,
|
|
507
519
|
inputClass: b,
|
|
508
|
-
idx:
|
|
509
|
-
className: `${
|
|
520
|
+
idx: N,
|
|
521
|
+
className: `${m} ${s?.uniqueClass}`
|
|
510
522
|
}
|
|
511
523
|
),
|
|
512
|
-
(s.type === "radio" || s.type === "checkbox") && /* @__PURE__ */
|
|
513
|
-
/* @__PURE__ */
|
|
514
|
-
|
|
524
|
+
(s.type === "radio" || s.type === "checkbox") && /* @__PURE__ */ f(R, { children: [
|
|
525
|
+
/* @__PURE__ */ t(
|
|
526
|
+
v,
|
|
515
527
|
{
|
|
516
528
|
...s,
|
|
517
529
|
id: s.id ?? `${o.legend}-input`,
|
|
518
|
-
labelClass:
|
|
530
|
+
labelClass: c,
|
|
519
531
|
inputClass: b,
|
|
520
|
-
idx:
|
|
521
|
-
className: `${
|
|
532
|
+
idx: N,
|
|
533
|
+
className: `${m} ${s?.uniqueClass}`
|
|
522
534
|
}
|
|
523
535
|
),
|
|
524
|
-
s.editing && s.isEditable && /* @__PURE__ */
|
|
525
|
-
|
|
536
|
+
s.editing && s.isEditable && /* @__PURE__ */ t(
|
|
537
|
+
G,
|
|
526
538
|
{
|
|
527
539
|
legend: `${o.legend}`,
|
|
528
|
-
fieldsetIndex:
|
|
529
|
-
idx:
|
|
540
|
+
fieldsetIndex: $,
|
|
541
|
+
idx: N,
|
|
530
542
|
editableInformation: s?.editableInformation || [],
|
|
531
|
-
onChangeOfEditableOption:
|
|
532
|
-
onClickSaveEdit: s?.onClickSave || ((
|
|
543
|
+
onChangeOfEditableOption: u,
|
|
544
|
+
onClickSaveEdit: s?.onClickSave || ((q) => {
|
|
533
545
|
}),
|
|
534
|
-
onClickCancelEdit: s?.onClickCancel || ((
|
|
546
|
+
onClickCancelEdit: s?.onClickCancel || ((q) => {
|
|
535
547
|
}),
|
|
536
|
-
onClickDeleteEntry: s?.onClickDelete || ((
|
|
548
|
+
onClickDeleteEntry: s?.onClickDelete || ((q) => {
|
|
537
549
|
})
|
|
538
550
|
}
|
|
539
551
|
)
|
|
540
552
|
] })
|
|
541
|
-
] }, `form-${i}-${
|
|
553
|
+
] }, `form-${i}-${N}`)) : o.isExpandable ? /* @__PURE__ */ t(V, { children: `No entry yet on ${o.legend}. Click "+" button to add entry.` }) : ""
|
|
542
554
|
] }),
|
|
543
|
-
o.isExpandable && /* @__PURE__ */
|
|
544
|
-
] }, `${o.legend}-${
|
|
545
|
-
/* @__PURE__ */
|
|
546
|
-
l && /* @__PURE__ */
|
|
547
|
-
!a && d && d.length !== 0 ? d.map((o,
|
|
548
|
-
o.type === "textarea" && /* @__PURE__ */
|
|
549
|
-
|
|
555
|
+
o.isExpandable && /* @__PURE__ */ t(X, { className: "add-input-button-space", children: /* @__PURE__ */ t(x, { id: `expand-${o.legend}-inputs`, buttonType: "button", text: "+", onClick: g, className: "add-input-entry", dataAttributes: { "data-fieldsetindex": $ } }) })
|
|
556
|
+
] }, `${o.legend}-${$}`)) : /* @__PURE__ */ f(Q, { className: `${i}-fieldset-wrapper`, children: [
|
|
557
|
+
/* @__PURE__ */ f(K, { id: `${i}-form-fieldset`, className: `${l}-fieldset`, children: [
|
|
558
|
+
l && /* @__PURE__ */ t(J, { className: `${l}-legend`, children: l }),
|
|
559
|
+
!a && d && d.length !== 0 ? d.map((o, $) => /* @__PURE__ */ f(B.Fragment, { children: [
|
|
560
|
+
o.type === "textarea" && /* @__PURE__ */ t(
|
|
561
|
+
v,
|
|
550
562
|
{
|
|
551
563
|
...o,
|
|
552
564
|
id: o.id ?? `${l}-input`,
|
|
553
|
-
labelClass:
|
|
565
|
+
labelClass: c,
|
|
554
566
|
inputClass: b,
|
|
555
|
-
idx:
|
|
556
|
-
className: `${
|
|
567
|
+
idx: $,
|
|
568
|
+
className: `${m} ${o?.uniqueClass}`
|
|
557
569
|
}
|
|
558
570
|
),
|
|
559
|
-
o.type !== "textarea" && o.type !== "radio" && o.type !== "checkbox" && /* @__PURE__ */
|
|
560
|
-
|
|
571
|
+
o.type !== "textarea" && o.type !== "radio" && o.type !== "checkbox" && /* @__PURE__ */ t(
|
|
572
|
+
v,
|
|
561
573
|
{
|
|
562
574
|
...o,
|
|
563
575
|
id: o.id ?? `${l}-input`,
|
|
564
|
-
labelClass:
|
|
576
|
+
labelClass: c,
|
|
565
577
|
inputClass: b,
|
|
566
|
-
idx:
|
|
567
|
-
className: `${
|
|
578
|
+
idx: $,
|
|
579
|
+
className: `${m} ${o?.uniqueClass}`
|
|
568
580
|
}
|
|
569
581
|
),
|
|
570
|
-
(o.type === "radio" || o.type === "checkbox") && /* @__PURE__ */
|
|
571
|
-
/* @__PURE__ */
|
|
572
|
-
|
|
582
|
+
(o.type === "radio" || o.type === "checkbox") && /* @__PURE__ */ f(R, { children: [
|
|
583
|
+
/* @__PURE__ */ t(
|
|
584
|
+
v,
|
|
573
585
|
{
|
|
574
586
|
...o,
|
|
575
587
|
id: o.id ?? `${l}-input`,
|
|
576
|
-
labelClass:
|
|
588
|
+
labelClass: c,
|
|
577
589
|
inputClass: b,
|
|
578
|
-
idx:
|
|
579
|
-
className: `${
|
|
590
|
+
idx: $,
|
|
591
|
+
className: `${m} ${o?.uniqueClass}`
|
|
580
592
|
}
|
|
581
593
|
),
|
|
582
|
-
o.editing && o.isEditable && /* @__PURE__ */
|
|
583
|
-
|
|
594
|
+
o.editing && o.isEditable && /* @__PURE__ */ t(
|
|
595
|
+
G,
|
|
584
596
|
{
|
|
585
597
|
legend: `${l}`,
|
|
586
|
-
idx:
|
|
598
|
+
idx: $,
|
|
587
599
|
editableInformation: o?.editableInformation,
|
|
588
|
-
onChangeOfEditableOption:
|
|
600
|
+
onChangeOfEditableOption: u,
|
|
589
601
|
onClickSaveEdit: o?.onClickSave || ((s) => {
|
|
590
602
|
}),
|
|
591
603
|
onClickCancelEdit: o?.onClickCancel || ((s) => {
|
|
@@ -595,24 +607,27 @@ const t = {
|
|
|
595
607
|
}
|
|
596
608
|
)
|
|
597
609
|
] })
|
|
598
|
-
] }, `form-${i}-${
|
|
610
|
+
] }, `form-${i}-${$}`)) : n ? /* @__PURE__ */ t(V, { children: `No entry yet on ${l}. Please click "+" button to add` }) : ""
|
|
599
611
|
] }),
|
|
600
|
-
n && /* @__PURE__ */
|
|
612
|
+
n && /* @__PURE__ */ t(X, { className: "add-input-button-space", children: /* @__PURE__ */ t(x, { id: `expand-${l}-inputs`, buttonType: "button", text: "+", onClick: g, className: "add-input-entry" }) })
|
|
601
613
|
] }),
|
|
602
|
-
/* @__PURE__ */
|
|
603
|
-
|
|
614
|
+
/* @__PURE__ */ t(
|
|
615
|
+
ue,
|
|
604
616
|
{
|
|
605
617
|
id: i,
|
|
606
|
-
submitText:
|
|
618
|
+
submitText: p,
|
|
619
|
+
submitIcon: C,
|
|
607
620
|
hasReset: y,
|
|
608
|
-
resetText:
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
621
|
+
resetText: w,
|
|
622
|
+
resetIcon: F,
|
|
623
|
+
handleReset: k,
|
|
624
|
+
hasCancel: E,
|
|
625
|
+
cancelText: A,
|
|
626
|
+
cancelIcon: D,
|
|
627
|
+
handleCancel: z
|
|
613
628
|
}
|
|
614
629
|
),
|
|
615
|
-
/* @__PURE__ */
|
|
630
|
+
/* @__PURE__ */ t(ge, { className: "children-container", children: L })
|
|
616
631
|
] }), $e = (a) => {
|
|
617
632
|
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*\)$/;
|
|
618
633
|
return l.test(a) || n.test(a) || CSS.supports("color", a);
|
|
@@ -628,7 +643,7 @@ const t = {
|
|
|
628
643
|
//Macbook 13" (1280x800)
|
|
629
644
|
largeDesktop: "1200px",
|
|
630
645
|
largerDesktop: "1400px"
|
|
631
|
-
},
|
|
646
|
+
}, xe = {
|
|
632
647
|
name: "light",
|
|
633
648
|
colors: {
|
|
634
649
|
text: h("#333446"),
|
|
@@ -643,7 +658,7 @@ const t = {
|
|
|
643
658
|
warning: h("#F2C265"),
|
|
644
659
|
error: h("#990000")
|
|
645
660
|
}
|
|
646
|
-
},
|
|
661
|
+
}, pe = {
|
|
647
662
|
name: "dark",
|
|
648
663
|
colors: {
|
|
649
664
|
bg: h("#333446"),
|
|
@@ -658,22 +673,22 @@ const t = {
|
|
|
658
673
|
warning: h("#FCFFC1"),
|
|
659
674
|
error: h("#FAD4D4")
|
|
660
675
|
}
|
|
661
|
-
},
|
|
676
|
+
}, Y = _({}), Fe = ({
|
|
662
677
|
children: a,
|
|
663
|
-
initialTheme: l =
|
|
664
|
-
secondTheme: n =
|
|
678
|
+
initialTheme: l = xe,
|
|
679
|
+
secondTheme: n = pe
|
|
665
680
|
}) => {
|
|
666
|
-
const [i, d] =
|
|
667
|
-
d((
|
|
681
|
+
const [i, d] = I(l), m = () => {
|
|
682
|
+
d((c) => c === l ? n : l);
|
|
668
683
|
};
|
|
669
|
-
return /* @__PURE__ */
|
|
670
|
-
}, Ee = () =>
|
|
684
|
+
return /* @__PURE__ */ t(Y.Provider, { value: { currentTheme: i, toggleTheme: m }, children: /* @__PURE__ */ t(te, { theme: i, children: a }) });
|
|
685
|
+
}, Ee = () => ee(Y);
|
|
671
686
|
export {
|
|
672
687
|
Ce as DynamicForm,
|
|
673
|
-
|
|
688
|
+
Y as ThemeContext,
|
|
674
689
|
Fe as ThemeContextProvider,
|
|
675
690
|
we as breakpoints,
|
|
676
|
-
|
|
677
|
-
|
|
691
|
+
pe as darkTheme,
|
|
692
|
+
xe as lightTheme,
|
|
678
693
|
Ee as useTheme
|
|
679
694
|
};
|