@cronocode/react-box 1.0.6 → 1.0.8

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,5 +1,8 @@
1
- declare type FormValueType = string | string[] | number | number[] | boolean;
1
+ declare type FormValue = string | string[] | number | number[] | boolean;
2
+ interface FormObject {
3
+ [index: string]: FormValue | FormObject;
4
+ }
2
5
  declare namespace FormUtils {
3
- function getFormEntries(form: HTMLFormElement): Record<string, FormValueType>;
6
+ function getFormEntries(form: HTMLFormElement): FormObject;
4
7
  }
5
8
  export default FormUtils;
package/utils/utils.js CHANGED
@@ -1,4 +1,4 @@
1
- const a = [
1
+ const g = [
2
2
  "shadow",
3
3
  "shadowH",
4
4
  "shadowA",
@@ -24,40 +24,57 @@ const a = [
24
24
  "outlineColorH",
25
25
  "outlineColorA"
26
26
  ];
27
- var n;
28
- ((i) => {
29
- function u(...s) {
30
- return s.reduce((t, r) => typeof r == "string" ? (t.push(r), t) : Array.isArray(r) ? (t.push(...u(...r)), t) : (Object.entries(r).forEach(([e, o]) => {
31
- o && t.push(e);
27
+ var b;
28
+ ((a) => {
29
+ function l(...d) {
30
+ return d.reduce((t, c) => typeof c == "string" ? (t.push(c), t) : Array.isArray(c) ? (t.push(...l(...c)), t) : (Object.entries(c).forEach(([o, s]) => {
31
+ s && t.push(o);
32
32
  }), t), []);
33
33
  }
34
- i.classNames = u;
35
- })(n || (n = {}));
36
- const g = n;
37
- var l;
38
- ((i) => {
39
- function u(s) {
40
- const t = Array.from(s.elements).reduce((r, e) => {
41
- const o = e.name;
42
- return o && (r[o] || (r[o] = []), r[o].push(e)), r;
34
+ a.classNames = l;
35
+ })(b || (b = {}));
36
+ const C = b;
37
+ var f;
38
+ ((a) => {
39
+ function l(t) {
40
+ const c = Array.from(t.elements).reduce((o, s) => {
41
+ const r = s.name;
42
+ return r && (o[r] || (o[r] = []), o[r].push(s)), o;
43
43
  }, {});
44
- return Object.entries(t).reduce((r, [e, o]) => {
45
- if (o.length === 1) {
46
- const c = o[0];
47
- r[e] = c.type === "checkbox" || c.type === "radio" ? c.checked : c.value;
48
- } else
49
- r[e] = [], o.forEach((c) => {
50
- var d;
51
- c.type === "checkbox" ? c.checked && r[e].push(c.value) : c.type === "radio" ? r[e] = (d = o.find((h) => h.checked)) == null ? void 0 : d.value : r[e].push(c.value);
52
- });
53
- return r;
44
+ return Object.entries(c).reduce((o, [s, r]) => {
45
+ if (r.length === 1) {
46
+ const e = r[0];
47
+ d(o, s, e.type === "checkbox" || e.type === "radio" ? e.checked : e.value);
48
+ } else {
49
+ const e = r.reduce((i, n) => (n.type === "checkbox" || n.type === "radio" ? n.checked && i.push(n.value) : i.push(n.value), i), []);
50
+ d(o, s, e);
51
+ }
52
+ return o;
54
53
  }, {});
55
54
  }
56
- i.getFormEntries = u;
57
- })(l || (l = {}));
58
- const C = l;
55
+ a.getFormEntries = l;
56
+ function d(t, c, o) {
57
+ if (c.includes(".")) {
58
+ const s = c.split(".");
59
+ let r = t;
60
+ s.forEach((e, i) => {
61
+ if (s.length > i + 1) {
62
+ const n = e.match(/^(.+)\[(\d)\]$/);
63
+ if (n) {
64
+ const [, u, h] = n;
65
+ r[u] = r[u] || [], r[u][h] = r[u][h] || {}, r = r[u][h];
66
+ } else
67
+ r[e] = r[e] || {}, r = r[e];
68
+ } else
69
+ r[e] = o;
70
+ });
71
+ } else
72
+ t[c] = o;
73
+ }
74
+ })(f || (f = {}));
75
+ const p = f;
59
76
  export {
60
- g as C,
61
- C as F,
62
- a as t
77
+ C,
78
+ p as F,
79
+ g as t
63
80
  };