@kbgarcia8/react-dynamic-form 1.1.40 → 2.0.0

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