@kbgarcia8/react-dynamic-form 2.0.1 → 2.0.2

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