@cronocode/react-box 1.8.0 → 1.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "1.8.0",
3
+ "version": "1.8.2",
4
4
  "type": "module",
5
5
  "main": "./box.cjs",
6
6
  "module": "./box.mjs",
@@ -1,5 +1,4 @@
1
1
  declare namespace ObjectUtils {
2
- function moveToTagProps<T extends Object, TKey extends keyof T>(props: T, ...keys: TKey[]): Record<TKey, T[TKey]>[];
3
2
  function buildProps<T extends {
4
3
  props?: Object;
5
4
  }, TKey extends keyof T>(props: T, keys: Readonly<TKey[]>, extraTagProps?: Object): T;
package/utils.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var a;(f=>{function l(c,...s){const e={...c},o={};return s.forEach(r=>{r in e&&(o[r]=e[r],delete e[r])}),[o,e]}f.moveToTagProps=l;function p(c,s,e){const o={...c},r=o.props||{};return s.forEach(t=>{if(t in o){if(r[t]=o[t],t==="disabled")return;delete o[t]}}),e&&Object.entries(e).forEach(([t,n])=>{r[t]=n}),o.props=r,o}f.buildProps=p})(a||(a={}));const m=a;var h;(f=>{function l(c){const s=Array.from(c.elements).reduce((e,o)=>{const r=o.name;return r&&(e[r]||(e[r]=[]),e[r].push(o)),e},{});return Object.entries(s).reduce((e,[o,r])=>{if(r.length===1){const t=r[0];p(e,o,t.type==="checkbox"||t.type==="radio"?t.checked:t.value)}else{const t=r.reduce((n,i)=>(i.type==="checkbox"||i.type==="radio"?i.checked&&n.push(i.value):n.push(i.value),n),[]);p(e,o,t)}return e},{})}f.getFormEntries=l;function p(c,s,e){if(s.includes(".")){const o=s.split(".");let r=c;o.forEach((t,n)=>{if(o.length>n+1){const i=t.match(/^(.+)\[(\d)\]$/);if(i){const[,u,d]=i;r[u]=r[u]||[],r[u][d]=r[u][d]||{},r=r[u][d]}else r[t]=r[t]||{},r=r[t]}else r[t]=e})}else c[s]=e}})(h||(h={}));const P=h;exports.FormUtils=P;exports.ObjectUtils=m;
1
+ "use strict";var h;(l=>{function p(f,o,c){const r={...f},s=r.props||{};return o.forEach(e=>{e in r&&(s[e]=r[e],delete r[e])}),c&&Object.entries(c).forEach(([e,t])=>{s[e]=t}),r.props=s,r}l.buildProps=p})(h||(h={}));const m=h;var a;(l=>{function p(o){const c=Array.from(o.elements).reduce((r,s)=>{const e=s.name;return e&&(r[e]||(r[e]=[]),r[e].push(s)),r},{});return Object.entries(c).reduce((r,[s,e])=>{if(e.length===1){const t=e[0];f(r,s,t.type==="checkbox"||t.type==="radio"?t.checked:t.value)}else{const t=e.reduce((n,i)=>(i.type==="checkbox"||i.type==="radio"?i.checked&&n.push(i.value):n.push(i.value),n),[]);f(r,s,t)}return r},{})}l.getFormEntries=p;function f(o,c,r){if(c.includes(".")){const s=c.split(".");let e=o;s.forEach((t,n)=>{if(s.length>n+1){const i=t.match(/^(.+)\[(\d)\]$/);if(i){const[,u,d]=i;e[u]=e[u]||[],e[u][d]=e[u][d]||{},e=e[u][d]}else e[t]=e[t]||{},e=e[t]}else e[t]=r})}else o[c]=r}})(a||(a={}));const b=a;exports.FormUtils=b;exports.ObjectUtils=m;
package/utils.mjs CHANGED
@@ -1,70 +1,59 @@
1
- var l;
2
- ((f) => {
3
- function a(c, ...s) {
4
- const e = { ...c }, t = {};
5
- return s.forEach((r) => {
6
- r in e && (t[r] = e[r], delete e[r]);
7
- }), [t, e];
8
- }
9
- f.moveToTagProps = a;
10
- function p(c, s, e) {
11
- const t = { ...c }, r = t.props || {};
12
- return s.forEach((o) => {
13
- if (o in t) {
14
- if (r[o] = t[o], o === "disabled")
15
- return;
16
- delete t[o];
17
- }
18
- }), e && Object.entries(e).forEach(([o, i]) => {
19
- r[o] = i;
20
- }), t.props = r, t;
21
- }
22
- f.buildProps = p;
23
- })(l || (l = {}));
24
- const m = l;
25
1
  var h;
26
- ((f) => {
27
- function a(c) {
28
- const s = Array.from(c.elements).reduce(
29
- (e, t) => {
30
- const r = t.name;
31
- return r && (e[r] || (e[r] = []), e[r].push(t)), e;
2
+ ((p) => {
3
+ function l(f, i, c) {
4
+ const r = { ...f }, s = r.props || {};
5
+ return i.forEach((e) => {
6
+ e in r && (s[e] = r[e], delete r[e]);
7
+ }), c && Object.entries(c).forEach(([e, t]) => {
8
+ s[e] = t;
9
+ }), r.props = s, r;
10
+ }
11
+ p.buildProps = l;
12
+ })(h || (h = {}));
13
+ const m = h;
14
+ var a;
15
+ ((p) => {
16
+ function l(i) {
17
+ const c = Array.from(i.elements).reduce(
18
+ (r, s) => {
19
+ const e = s.name;
20
+ return e && (r[e] || (r[e] = []), r[e].push(s)), r;
32
21
  },
33
22
  {}
34
23
  );
35
- return Object.entries(s).reduce((e, [t, r]) => {
36
- if (r.length === 1) {
37
- const o = r[0];
38
- p(e, t, o.type === "checkbox" || o.type === "radio" ? o.checked : o.value);
24
+ return Object.entries(c).reduce((r, [s, e]) => {
25
+ if (e.length === 1) {
26
+ const t = e[0];
27
+ f(r, s, t.type === "checkbox" || t.type === "radio" ? t.checked : t.value);
39
28
  } else {
40
- const o = r.reduce((i, n) => (n.type === "checkbox" || n.type === "radio" ? n.checked && i.push(n.value) : i.push(n.value), i), []);
41
- p(e, t, o);
29
+ const t = e.reduce((n, o) => (o.type === "checkbox" || o.type === "radio" ? o.checked && n.push(o.value) : n.push(o.value), n), []);
30
+ f(r, s, t);
42
31
  }
43
- return e;
32
+ return r;
44
33
  }, {});
45
34
  }
46
- f.getFormEntries = a;
47
- function p(c, s, e) {
48
- if (s.includes(".")) {
49
- const t = s.split(".");
50
- let r = c;
51
- t.forEach((o, i) => {
52
- if (t.length > i + 1) {
53
- const n = o.match(/^(.+)\[(\d)\]$/);
54
- if (n) {
55
- const [, u, d] = n;
56
- r[u] = r[u] || [], r[u][d] = r[u][d] || {}, r = r[u][d];
35
+ p.getFormEntries = l;
36
+ function f(i, c, r) {
37
+ if (c.includes(".")) {
38
+ const s = c.split(".");
39
+ let e = i;
40
+ s.forEach((t, n) => {
41
+ if (s.length > n + 1) {
42
+ const o = t.match(/^(.+)\[(\d)\]$/);
43
+ if (o) {
44
+ const [, u, d] = o;
45
+ e[u] = e[u] || [], e[u][d] = e[u][d] || {}, e = e[u][d];
57
46
  } else
58
- r[o] = r[o] || {}, r = r[o];
47
+ e[t] = e[t] || {}, e = e[t];
59
48
  } else
60
- r[o] = e;
49
+ e[t] = r;
61
50
  });
62
51
  } else
63
- c[s] = e;
52
+ i[c] = r;
64
53
  }
65
- })(h || (h = {}));
66
- const P = h;
54
+ })(a || (a = {}));
55
+ const b = a;
67
56
  export {
68
- P as F,
57
+ b as F,
69
58
  m as O
70
59
  };