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