@cronocode/react-box 1.8.0 → 1.8.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.
- package/box.cjs +1 -1
- package/box.d.ts +5 -2
- package/box.mjs +8 -8
- package/components/baseSvg.d.ts +2 -3
- package/components/button.cjs +1 -1
- package/components/button.d.ts +1 -1
- package/components/button.mjs +7 -7
- package/components/checkbox.cjs +1 -1
- package/components/checkbox.d.ts +6 -6
- package/components/checkbox.mjs +11 -20
- package/components/radioButton.cjs +1 -1
- package/components/radioButton.d.ts +1 -1
- package/components/radioButton.mjs +4 -15
- package/components/textarea.cjs +1 -1
- package/components/textarea.d.ts +1 -1
- package/components/textarea.mjs +7 -8
- package/components/textbox.cjs +1 -1
- package/components/textbox.d.ts +1 -1
- package/components/textbox.mjs +5 -6
- package/core/boxStyles.d.ts +3 -1
- package/core/theme.d.ts +15 -17
- package/core/types.d.ts +11 -3
- package/core/useTheme.d.ts +0 -1
- package/core.cjs +24 -60
- package/core.mjs +345 -359
- package/package.json +1 -1
- package/utils/object/objectUtils.d.ts +0 -1
- package/utils.cjs +1 -1
- package/utils.mjs +43 -54
package/package.json
CHANGED
|
@@ -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
|
|
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
|
-
((
|
|
27
|
-
function
|
|
28
|
-
const s =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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(
|
|
36
|
-
if (
|
|
37
|
-
const
|
|
38
|
-
|
|
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
|
|
41
|
-
|
|
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
|
|
32
|
+
return r;
|
|
44
33
|
}, {});
|
|
45
34
|
}
|
|
46
|
-
|
|
47
|
-
function
|
|
48
|
-
if (
|
|
49
|
-
const
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
if (
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
const [, u, d] =
|
|
56
|
-
|
|
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
|
-
|
|
47
|
+
e[t] = e[t] || {}, e = e[t];
|
|
59
48
|
} else
|
|
60
|
-
|
|
49
|
+
e[t] = r;
|
|
61
50
|
});
|
|
62
51
|
} else
|
|
63
|
-
c
|
|
52
|
+
i[c] = r;
|
|
64
53
|
}
|
|
65
|
-
})(
|
|
66
|
-
const
|
|
54
|
+
})(a || (a = {}));
|
|
55
|
+
const b = a;
|
|
67
56
|
export {
|
|
68
|
-
|
|
57
|
+
b as F,
|
|
69
58
|
m as O
|
|
70
59
|
};
|