@kbgarcia8/react-dynamic-form 1.1.40 → 2.0.1

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