@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.
@@ -1,7 +1,7 @@
1
- import { jsx as e, jsxs as u, Fragment as j } from "react/jsx-runtime";
2
- import q, { forwardRef as X, createContext as Y, useState as Z, useContext as _ } from "react";
3
- import m, { ThemeProvider as I } from "styled-components";
4
- const t = {
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
- }, R = m.button`
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: ${t.borderThickness.light} solid ${({ theme: a }) => a.colors.text || "black"};
42
- border-radius: ${t.borderRadius.xlarge};
43
- padding: ${t.spacing.xxxsmall} ${t.spacing.small};
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: ${t.borderThickness.light} solid gray;
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
- `, B = m.div`
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
- `, W = m.img`
67
+ `;
68
+ r.img`
68
69
  maxwidth: 100%;
69
- `, P = m.span`
70
- font-size: ${t.fontSize.xsmall};
71
- font-weight: ${t.fontWeight.medium};
72
- font-family: ${t.fonts.tertiary}, ${t.fonts.fallback};
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
- `, p = ({
78
+ `, x = ({
77
79
  onClick: a,
78
80
  id: l,
79
81
  buttonType: n,
80
- source: i,
81
- svg: d,
82
- alt: c = "alt-button-icon",
83
- text: r = "",
82
+ startIcon: i,
83
+ endIcon: d,
84
+ alt: m = "alt-button-icon",
85
+ text: c = "",
84
86
  className: b = "",
85
- dataAttributes: f = {}
87
+ dataAttributes: u = {}
86
88
  }) => {
87
89
  if (n === "button")
88
- return /* @__PURE__ */ e(
89
- R,
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
- ...f,
96
- children: /* @__PURE__ */ u(B, { className: "button-icon-text-space", children: [
97
- i ? /* @__PURE__ */ e(W, { src: i, alt: c }) : d || "",
98
- r && /* @__PURE__ */ e(P, { id: l, children: r })
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__ */ e(
104
- R,
106
+ return /* @__PURE__ */ t(
107
+ W,
105
108
  {
106
109
  id: l,
107
110
  type: n,
108
111
  className: b,
109
- ...f,
110
- children: /* @__PURE__ */ u(B, { className: "button-icon-text-space", children: [
111
- i ? /* @__PURE__ */ e(W, { src: i, alt: c }) : d || "",
112
- r && /* @__PURE__ */ e(P, { id: l, children: r })
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
- }, ee = m.div`
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: ${t.spacing.small};
122
- `, te = m.div`
125
+ margin-bottom: ${e.spacing.small};
126
+ `, ne = r.div`
123
127
  display: flex;
124
- gap: ${t.spacing.xsmall};
128
+ gap: ${e.spacing.xsmall};
125
129
  width: auto;
126
130
  height: auto;
127
- `, ae = m.label`
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: ${t.fonts.secondary}, ${t.fonts.fallback};
134
- font-size: ${t.fontSize.xsmall};
135
- font-weight: ${t.fontWeight.bold};
136
- gap: ${t.spacing.xxsmall};
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
- `, ne = m.div`
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: ${t.spacing.xxxsmall};
150
- `, oe = m.span`
151
- font-weight: ${t.fontWeight.bolder};
152
- `, ie = m.div`
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
- `, le = m.span`
157
- font-weight: ${t.fontWeight.light};
158
- `, M = ({
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
- source: d,
164
- svg: c,
165
- className: r,
167
+ startIcon: d,
168
+ endIcon: m,
169
+ className: c,
166
170
  children: b
167
- }) => /* @__PURE__ */ u(ae, { htmlFor: a, className: r, $labelFlexDirection: i, children: [
168
- (d || c) && /* @__PURE__ */ e(ie, { className: "label-icon-container", children: d ? /* @__PURE__ */ e("img", { src: d, alt: `${a}-label-icon` }) : c || "" }),
169
- /* @__PURE__ */ u(ne, { className: "label-text-container", children: [
170
- /* @__PURE__ */ e(oe, { className: "main-label", children: l }),
171
- n && /* @__PURE__ */ e(le, { className: "additional-info", children: n })
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
- ] }), U = m.input`
179
+ ] }), O = r.input`
175
180
  display: flex;
176
181
  place-content: center;
177
- font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
178
- font-size: ${t.fontSize.xsmall};
182
+ font-family: ${e.fonts.secondary}, ${e.fonts.fallback};
183
+ font-size: ${e.fontSize.xsmall};
179
184
  line-height: 1.75;
180
- padding: ${t.spacing.xxxsmall} ${t.spacing.xsmall};
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: ${t.borderThickness.thin} solid #000000;
186
- border-radius: ${t.borderRadius.xsmall};
190
+ border: ${e.borderThickness.thin} solid #000000;
191
+ border-radius: ${e.borderRadius.xsmall};
187
192
 
188
193
  &:focus{
189
- border: ${t.borderThickness.thin} solid ${({ theme: a }) => a.colors.teal};
194
+ border: ${e.borderThickness.thin} solid ${({ theme: a }) => a.colors.teal};
190
195
  }
191
- `, se = m.textarea`
196
+ `, ce = r.textarea`
192
197
  display: flex;
193
198
  place-content: center;
194
- border: ${t.borderThickness.light} solid ${({ theme: a }) => a.colors.text};
195
- border-radius: ${t.borderRadius.small};
199
+ border: ${e.borderThickness.light} solid ${({ theme: a }) => a.colors.text};
200
+ border-radius: ${e.borderRadius.small};
196
201
  outline: none;
197
- line-height: ${t.spacing.small};
198
- padding: ${t.spacing.xxxsmall};
199
- font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
200
- font-size: ${t.fontSize.xsmall};
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 = X((a, l) => {
205
- const { type: n, id: i, onChange: d, isRequired: c, dataAttributes: r = {}, disabled: b, className: f, name: $ } = a;
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: w = 5, cols: E = 30, value: D, ...S } = a;
208
- return /* @__PURE__ */ e(
209
- se,
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: D,
213
- rows: w,
217
+ value: A,
218
+ rows: k,
214
219
  cols: E,
215
220
  id: i,
216
221
  onChange: d,
217
- required: c,
222
+ required: m,
218
223
  disabled: b,
219
- ...r,
220
- className: f,
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: w, ...E } = a;
227
- return /* @__PURE__ */ e(
228
- U,
231
+ const { checked: k, ...E } = a;
232
+ return /* @__PURE__ */ t(
233
+ O,
229
234
  {
230
235
  ref: l,
231
236
  type: n,
232
- checked: w,
237
+ checked: k,
233
238
  id: i,
234
239
  onChange: d,
235
- required: c,
236
- ...r,
240
+ required: m,
241
+ ...c,
237
242
  disabled: b,
238
- className: f,
239
- name: $
243
+ className: u,
244
+ name: g
240
245
  }
241
246
  );
242
247
  }
243
- const k = a, { value: y, pattern: N, placeholderText: C, ...F } = k;
244
- return /* @__PURE__ */ e(
245
- U,
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: y,
250
- pattern: N,
251
- placeholder: C,
254
+ value: C,
255
+ pattern: y,
256
+ placeholder: w,
252
257
  id: i,
253
258
  onChange: d,
254
- required: c,
255
- ...r,
259
+ required: m,
260
+ ...c,
256
261
  disabled: b,
257
- className: f,
258
- name: $
262
+ className: u,
263
+ name: g
259
264
  }
260
265
  );
261
- }), A = (a) => {
266
+ }), v = (a) => {
262
267
  const {
263
268
  className: l,
264
269
  type: n,
265
270
  id: i,
266
271
  textLabel: d,
267
- additionalInfo: c,
268
- $labelFlexDirection: r,
269
- svg: b,
270
- labelClass: f,
271
- onChange: $,
272
- isRequired: k,
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: N,
275
- ref: C,
276
- disabled: F,
277
- isEditable: w,
278
- editIcon: E,
280
+ inputClass: w,
281
+ ref: F,
282
+ disabled: k,
283
+ isEditable: E,
284
+ editIcon: A,
279
285
  onClickEdit: D,
280
- deleteIcon: S,
281
- onClickDelete: z,
282
- idx: o,
283
- children: g
286
+ deleteIcon: z,
287
+ onClickDelete: j,
288
+ idx: S,
289
+ children: L
284
290
  } = a;
285
- return /* @__PURE__ */ u(ee, { className: `${l} ${i.replace("#", "")}-label-input-container`, children: [
286
- n !== "radio" && n !== "checkbox" && /* @__PURE__ */ e(M, { htmlFor: i, textLabel: d, additionalInfo: c, $labelFlexDirection: r, svg: b, className: f }),
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: s = 5, cols: x = 30, value: v, ...L } = a;
289
- return /* @__PURE__ */ e(
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: k,
296
- onChange: $,
297
- value: v,
298
- rows: s,
299
- cols: x,
301
+ isRequired: C,
302
+ onChange: p,
303
+ value: s,
304
+ rows: o,
305
+ cols: $,
300
306
  dataAttributes: y,
301
- className: N,
302
- ref: C,
303
- disabled: F
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 s = a, { value: x, pattern: v, placeholderText: L, ...pe } = s;
309
- return /* @__PURE__ */ e(
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: L,
315
- onChange: $,
316
- value: x,
320
+ placeholderText: N,
321
+ onChange: p,
322
+ value: $,
317
323
  type: n,
318
- isRequired: k,
324
+ isRequired: C,
319
325
  dataAttributes: y,
320
- className: N,
321
- ref: C,
322
- disabled: F,
323
- pattern: v
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: s, ...x } = a;
329
- return /* @__PURE__ */ u(j, { children: [
330
- /* @__PURE__ */ e(
334
+ const { checked: o, ...$ } = a;
335
+ return /* @__PURE__ */ f(R, { children: [
336
+ /* @__PURE__ */ t(
331
337
  T,
332
338
  {
333
- ref: C,
339
+ ref: F,
334
340
  type: n,
335
341
  name: i,
336
342
  id: i,
337
- isRequired: k,
338
- checked: s,
339
- onChange: $,
340
- disabled: F,
341
- className: N,
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__ */ e(M, { htmlFor: i, textLabel: d, additionalInfo: c, $labelFlexDirection: r, svg: b, className: f })
351
+ /* @__PURE__ */ t(H, { startIcon: b, endIcon: u, htmlFor: i, textLabel: d, additionalInfo: m, $labelFlexDirection: c, className: g })
346
352
  ] });
347
353
  })(),
348
- w && /* @__PURE__ */ u(te, { className: "input-edit-buttons", children: [
349
- /* @__PURE__ */ e(p, { id: `editable-${i}-edit-btn`, svg: E, buttonType: "button", onClick: D, className: `edit-radio-${o}`, dataAttributes: y }),
350
- /* @__PURE__ */ e(p, { id: `editable-${i}-delete-btn`, svg: S, buttonType: "button", onClick: z, className: `delete-radio-${o}`, dataAttributes: y })
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
- g
358
+ L
353
359
  ] });
354
- }, ce = m.fieldset`
360
+ }, re = r.fieldset`
355
361
  padding: 0;
356
362
  height: auto;
357
363
  width: 100%;
358
- `, re = m.legend`
359
- font-size: ${t.spacing.medium};
364
+ `, de = r.legend`
365
+ font-size: ${e.spacing.medium};
360
366
  font-weight: 500;
361
- margin: 0 auto ${t.spacing.small} auto;
367
+ margin: 0 auto ${e.spacing.small} auto;
362
368
  text-align: center;
363
- font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
364
- `, de = m.div`
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: ${t.spacing.small};
370
- `, me = m.div`
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
- `, H = ({
380
+ `, G = ({
375
381
  legend: a,
376
382
  fieldsetIndex: l,
377
383
  idx: n,
378
384
  editableInformation: i,
379
385
  onChangeOfEditableOption: d,
380
- onClickSaveEdit: c,
381
- onClickCancelEdit: r,
386
+ onClickSaveEdit: m,
387
+ onClickCancelEdit: c,
382
388
  onClickDeleteEntry: b
383
- }) => /* @__PURE__ */ u(ce, { className: "editable-option-fieldset", children: [
384
- /* @__PURE__ */ e(re, { children: `${a} ${n + 1}` }),
385
- i?.map((f, $) => /* @__PURE__ */ e(de, { className: "editable-option-container", children: /* @__PURE__ */ e(
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: f.name.charAt(0).toUpperCase() + f.name.slice(1),
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: f.info,
393
- type: f.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": f.info
405
+ "data-key": u.info
400
406
  }
401
407
  }
402
- ) }, `${f.name}-${$}`)),
403
- /* @__PURE__ */ u(me, { className: "editable-option-button-space", children: [
404
- /* @__PURE__ */ e(p, { id: `editable-option-${n}-submit`, buttonType: "button", text: "Save", onClick: c, className: "editable-option-btn", dataAttributes: { "data-index": n, "data-fieldsetindex": l } }),
405
- /* @__PURE__ */ e(p, { id: `editable-option-${n}-cancel`, buttonType: "button", text: "Cancel", onClick: r, className: "editable-option-btn", dataAttributes: { "data-index": n, "data-fieldsetindex": l } }),
406
- /* @__PURE__ */ e(p, { id: `editable-option-${n}-delete`, buttonType: "button", text: "Delete", onClick: b, className: "editable-option-btn", dataAttributes: { "data-index": n, "data-fieldsetindex": l } })
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
- ] }), be = m.div`
414
+ ] }), he = r.div`
409
415
  display: flex;
410
416
  justify-content: space-between;
411
417
  max-width: 100%;
412
- `, he = ({
418
+ `, ue = ({
413
419
  id: a,
414
420
  submitText: l,
415
- hasReset: n,
416
- resetText: i,
417
- handleReset: d,
418
- hasCancel: c,
419
- cancelText: r,
420
- handleCancel: b
421
- }) => /* @__PURE__ */ u(be, { className: "form-main-button-container", children: [
422
- /* @__PURE__ */ e(p, { id: `form-${a}-submit`, buttonType: "submit", text: l ?? "Submit", className: "submit-form-btn" }),
423
- n && /* @__PURE__ */ e(p, { id: `form-${a}-edit`, buttonType: "button", text: i ?? "Reset", onClick: d, className: "reset-form-btn" }),
424
- c && /* @__PURE__ */ e(p, { id: `form-${a}-cancel`, buttonType: "button", text: r ?? "Cancel", onClick: b, className: "cancel-form-btn" })
425
- ] }), O = m.legend`
426
- font-size: ${t.spacing.medium};
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: ${t.spacing.small};
437
+ margin-bottom: ${e.spacing.small};
429
438
  width: auto;
430
439
  text-align: center;
431
- font-family: ${t.fonts.secondary}, ${t.fonts.fallback};
432
- `, G = m.fieldset`
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
- `, J = m.div`
437
- padding: ${t.spacing.small};
445
+ `, Q = r.div`
446
+ padding: ${e.spacing.small};
438
447
  height: auto;
439
448
  width: 100%;
440
- `, K = m.div`
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: ${t.fonts.tertiary}, ${t.fonts.fallback};
447
- font-size: ${t.fontSize.xsmall};
448
- font-weight: ${t.fontWeight.bold};
449
- `, fe = m.form`
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
- `, Q = m.div`
463
+ `, X = r.div`
455
464
  display: flex;
456
465
  justify-content: space-between;
457
466
  width: 100%;
458
- `, ue = m.div`
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: c,
471
- labelClass: r,
479
+ labelAndInputContainerClass: m,
480
+ labelClass: c,
472
481
  inputClass: b,
473
- onChangeOfEditableOption: f,
474
- handleAddingInputEntry: $,
475
- submitText: k,
482
+ onChangeOfEditableOption: u,
483
+ handleAddingInputEntry: g,
484
+ submitText: p,
485
+ submitIcon: C,
476
486
  hasReset: y = !1,
477
- resetText: N,
478
- handleReset: C,
479
- hasCancel: F = !1,
480
- cancelText: w,
481
- handleCancel: E,
482
- handleSubmitForm: D,
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: z
485
- }) => /* @__PURE__ */ u(fe, { id: `${i}-form`, className: S, onSubmit: D, children: [
486
- a ? a.map((o, g) => /* @__PURE__ */ u(J, { className: `${i}-fieldset-wrapper`, children: [
487
- /* @__PURE__ */ u(G, { id: `${i}-form-fieldset-${g}`, className: `${o.legend}-fieldset`, children: [
488
- o.legend && /* @__PURE__ */ e(O, { className: `${o.legend}-legend`, children: o.legend }),
489
- o.inputs.length !== 0 ? o.inputs.map((s, x) => /* @__PURE__ */ u(q.Fragment, { children: [
490
- s.type === "textarea" && /* @__PURE__ */ e(
491
- A,
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: r,
507
+ labelClass: c,
496
508
  inputClass: b,
497
- idx: x,
498
- className: `${c} ${s?.uniqueClass}`
509
+ idx: N,
510
+ className: `${m} ${s?.uniqueClass}`
499
511
  }
500
512
  ),
501
- s.type !== "textarea" && s.type !== "radio" && s.type !== "checkbox" && /* @__PURE__ */ e(
502
- A,
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: r,
518
+ labelClass: c,
507
519
  inputClass: b,
508
- idx: x,
509
- className: `${c} ${s?.uniqueClass}`
520
+ idx: N,
521
+ className: `${m} ${s?.uniqueClass}`
510
522
  }
511
523
  ),
512
- (s.type === "radio" || s.type === "checkbox") && /* @__PURE__ */ u(j, { children: [
513
- /* @__PURE__ */ e(
514
- A,
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: r,
530
+ labelClass: c,
519
531
  inputClass: b,
520
- idx: x,
521
- className: `${c} ${s?.uniqueClass}`
532
+ idx: N,
533
+ className: `${m} ${s?.uniqueClass}`
522
534
  }
523
535
  ),
524
- s.editing && s.isEditable && /* @__PURE__ */ e(
525
- H,
536
+ s.editing && s.isEditable && /* @__PURE__ */ t(
537
+ G,
526
538
  {
527
539
  legend: `${o.legend}`,
528
- fieldsetIndex: g,
529
- idx: x,
540
+ fieldsetIndex: $,
541
+ idx: N,
530
542
  editableInformation: s?.editableInformation || [],
531
- onChangeOfEditableOption: f,
532
- onClickSaveEdit: s?.onClickSave || ((v) => {
543
+ onChangeOfEditableOption: u,
544
+ onClickSaveEdit: s?.onClickSave || ((q) => {
533
545
  }),
534
- onClickCancelEdit: s?.onClickCancel || ((v) => {
546
+ onClickCancelEdit: s?.onClickCancel || ((q) => {
535
547
  }),
536
- onClickDeleteEntry: s?.onClickDelete || ((v) => {
548
+ onClickDeleteEntry: s?.onClickDelete || ((q) => {
537
549
  })
538
550
  }
539
551
  )
540
552
  ] })
541
- ] }, `form-${i}-${x}`)) : o.isExpandable ? /* @__PURE__ */ e(K, { children: `No entry yet on ${o.legend}. Click "+" button to add entry.` }) : ""
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__ */ e(Q, { className: "add-input-button-space", children: /* @__PURE__ */ e(p, { id: `expand-${o.legend}-inputs`, buttonType: "button", text: "+", onClick: $, className: "add-input-entry", dataAttributes: { "data-fieldsetindex": g } }) })
544
- ] }, `${o.legend}-${g}`)) : /* @__PURE__ */ u(J, { className: `${i}-fieldset-wrapper`, children: [
545
- /* @__PURE__ */ u(G, { id: `${i}-form-fieldset`, className: `${l}-fieldset`, children: [
546
- l && /* @__PURE__ */ e(O, { className: `${l}-legend`, children: l }),
547
- !a && d && d.length !== 0 ? d.map((o, g) => /* @__PURE__ */ u(q.Fragment, { children: [
548
- o.type === "textarea" && /* @__PURE__ */ e(
549
- A,
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: r,
565
+ labelClass: c,
554
566
  inputClass: b,
555
- idx: g,
556
- className: `${c} ${o?.uniqueClass}`
567
+ idx: $,
568
+ className: `${m} ${o?.uniqueClass}`
557
569
  }
558
570
  ),
559
- o.type !== "textarea" && o.type !== "radio" && o.type !== "checkbox" && /* @__PURE__ */ e(
560
- A,
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: r,
576
+ labelClass: c,
565
577
  inputClass: b,
566
- idx: g,
567
- className: `${c} ${o?.uniqueClass}`
578
+ idx: $,
579
+ className: `${m} ${o?.uniqueClass}`
568
580
  }
569
581
  ),
570
- (o.type === "radio" || o.type === "checkbox") && /* @__PURE__ */ u(j, { children: [
571
- /* @__PURE__ */ e(
572
- A,
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: r,
588
+ labelClass: c,
577
589
  inputClass: b,
578
- idx: g,
579
- className: `${c} ${o?.uniqueClass}`
590
+ idx: $,
591
+ className: `${m} ${o?.uniqueClass}`
580
592
  }
581
593
  ),
582
- o.editing && o.isEditable && /* @__PURE__ */ e(
583
- H,
594
+ o.editing && o.isEditable && /* @__PURE__ */ t(
595
+ G,
584
596
  {
585
597
  legend: `${l}`,
586
- idx: g,
598
+ idx: $,
587
599
  editableInformation: o?.editableInformation,
588
- onChangeOfEditableOption: f,
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}-${g}`)) : n ? /* @__PURE__ */ e(K, { children: `No entry yet on ${l}. Please click "+" button to add` }) : ""
610
+ ] }, `form-${i}-${$}`)) : n ? /* @__PURE__ */ t(V, { children: `No entry yet on ${l}. Please click "+" button to add` }) : ""
599
611
  ] }),
600
- n && /* @__PURE__ */ e(Q, { className: "add-input-button-space", children: /* @__PURE__ */ e(p, { id: `expand-${l}-inputs`, buttonType: "button", text: "+", onClick: $, className: "add-input-entry" }) })
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__ */ e(
603
- he,
614
+ /* @__PURE__ */ t(
615
+ ue,
604
616
  {
605
617
  id: i,
606
- submitText: k,
618
+ submitText: p,
619
+ submitIcon: C,
607
620
  hasReset: y,
608
- resetText: N,
609
- handleReset: C,
610
- hasCancel: F,
611
- cancelText: w,
612
- handleCancel: E
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__ */ e(ue, { className: "children-container", children: z })
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
- }, ge = {
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
- }, xe = {
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
- }, V = Y({}), Fe = ({
676
+ }, Y = _({}), Fe = ({
662
677
  children: a,
663
- initialTheme: l = ge,
664
- secondTheme: n = xe
678
+ initialTheme: l = xe,
679
+ secondTheme: n = pe
665
680
  }) => {
666
- const [i, d] = Z(l), c = () => {
667
- d((r) => r === l ? n : l);
681
+ const [i, d] = I(l), m = () => {
682
+ d((c) => c === l ? n : l);
668
683
  };
669
- return /* @__PURE__ */ e(V.Provider, { value: { currentTheme: i, toggleTheme: c }, children: /* @__PURE__ */ e(I, { theme: i, children: a }) });
670
- }, Ee = () => _(V);
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
- V as ThemeContext,
688
+ Y as ThemeContext,
674
689
  Fe as ThemeContextProvider,
675
690
  we as breakpoints,
676
- xe as darkTheme,
677
- ge as lightTheme,
691
+ pe as darkTheme,
692
+ xe as lightTheme,
678
693
  Ee as useTheme
679
694
  };