@cronocode/react-box 1.1.4 → 1.1.6

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.
@@ -0,0 +1,4 @@
1
+ declare namespace ObjectUtils {
2
+ function moveToTagProps<T extends Object, TKey extends keyof T>(props: T, ...keys: TKey[]): Record<TKey, T[TKey]>[];
3
+ }
4
+ export default ObjectUtils;
package/utils/utils.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const g = [
1
+ const p = [
2
2
  "shadow",
3
3
  "shadowH",
4
4
  "shadowA",
@@ -24,57 +24,69 @@ const g = [
24
24
  "outlineColorH",
25
25
  "outlineColorA"
26
26
  ];
27
- var a;
28
- ((h) => {
29
- function l(...d) {
30
- return d.reduce((e, t) => t ? typeof t == "string" ? (e.push(t), e) : Array.isArray(t) ? (e.push(...l(...t)), e) : (Object.entries(t).forEach(([o, s]) => {
31
- s && e.push(o);
32
- }), e) : e, []);
27
+ var g;
28
+ ((l) => {
29
+ function i(...u) {
30
+ return u.reduce((s, o) => o ? typeof o == "string" ? (s.push(o), s) : Array.isArray(o) ? (s.push(...i(...o)), s) : (Object.entries(o).forEach(([t, e]) => {
31
+ e && s.push(t);
32
+ }), s) : s, []);
33
33
  }
34
- h.classNames = l;
35
- })(a || (a = {}));
36
- const C = a;
34
+ l.classNames = i;
35
+ })(g || (g = {}));
36
+ const C = g;
37
+ var h;
38
+ ((l) => {
39
+ function i(u, ...s) {
40
+ const o = { ...u }, t = {};
41
+ return s.forEach((e) => {
42
+ e in o && (t[e] = o[e], delete o[e]);
43
+ }), [t, o];
44
+ }
45
+ l.moveToTagProps = i;
46
+ })(h || (h = {}));
47
+ const A = h;
37
48
  var b;
38
- ((h) => {
39
- function l(e) {
40
- const t = Array.from(e.elements).reduce((o, s) => {
41
- const r = s.name;
42
- return r && (o[r] || (o[r] = []), o[r].push(s)), o;
49
+ ((l) => {
50
+ function i(s) {
51
+ const o = Array.from(s.elements).reduce((t, e) => {
52
+ const r = e.name;
53
+ return r && (t[r] || (t[r] = []), t[r].push(e)), t;
43
54
  }, {});
44
- return Object.entries(t).reduce((o, [s, r]) => {
55
+ return Object.entries(o).reduce((t, [e, r]) => {
45
56
  if (r.length === 1) {
46
57
  const c = r[0];
47
- d(o, s, c.type === "checkbox" || c.type === "radio" ? c.checked : c.value);
58
+ u(t, e, c.type === "checkbox" || c.type === "radio" ? c.checked : c.value);
48
59
  } else {
49
- const c = 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, c);
60
+ const c = r.reduce((d, n) => (n.type === "checkbox" || n.type === "radio" ? n.checked && d.push(n.value) : d.push(n.value), d), []);
61
+ u(t, e, c);
51
62
  }
52
- return o;
63
+ return t;
53
64
  }, {});
54
65
  }
55
- h.getFormEntries = l;
56
- function d(e, t, o) {
57
- if (t.includes(".")) {
58
- const s = t.split(".");
59
- let r = e;
60
- s.forEach((c, i) => {
61
- if (s.length > i + 1) {
66
+ l.getFormEntries = i;
67
+ function u(s, o, t) {
68
+ if (o.includes(".")) {
69
+ const e = o.split(".");
70
+ let r = s;
71
+ e.forEach((c, d) => {
72
+ if (e.length > d + 1) {
62
73
  const n = c.match(/^(.+)\[(\d)\]$/);
63
74
  if (n) {
64
- const [, u, f] = n;
65
- r[u] = r[u] || [], r[u][f] = r[u][f] || {}, r = r[u][f];
75
+ const [, a, f] = n;
76
+ r[a] = r[a] || [], r[a][f] = r[a][f] || {}, r = r[a][f];
66
77
  } else
67
78
  r[c] = r[c] || {}, r = r[c];
68
79
  } else
69
- r[c] = o;
80
+ r[c] = t;
70
81
  });
71
82
  } else
72
- e[t] = o;
83
+ s[o] = t;
73
84
  }
74
85
  })(b || (b = {}));
75
- const p = b;
86
+ const H = b;
76
87
  export {
77
88
  C,
78
- p as F,
79
- g as t
89
+ H as F,
90
+ A as O,
91
+ p as t
80
92
  };
@@ -1,27 +0,0 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { forwardRef as h } from "react";
3
- import x from "../box.mjs";
4
- import "../box.module.css.mjs";
5
- import "../utils/utils.mjs";
6
- function C(o, e) {
7
- const { props: r, name: t, disabled: n, placeholder: a, value: p, onInput: c, onChange: l, autoFocus: u, readOnly: d, required: i, defaultChecked: s } = o, m = {
8
- ...r,
9
- type: "checkbox",
10
- name: t,
11
- disabled: n,
12
- placeholder: a,
13
- onInput: c,
14
- onChange: l,
15
- value: p,
16
- autoFocus: u,
17
- readOnly: d,
18
- required: i,
19
- defaultChecked: s,
20
- ref: e
21
- };
22
- return /* @__PURE__ */ f(x, { tag: "input", inline: !0, ...o, props: m });
23
- }
24
- const P = h(C);
25
- export {
26
- P as default
27
- };
@@ -1,27 +0,0 @@
1
- import { jsx as f } from "react/jsx-runtime";
2
- import { forwardRef as g } from "react";
3
- import C from "../box.mjs";
4
- import "../box.module.css.mjs";
5
- import "../utils/utils.mjs";
6
- function h(o, r) {
7
- const { props: t, name: e, disabled: n, placeholder: a, value: d, onInput: i, onChange: p, autoFocus: u, readOnly: l, required: s, defaultChecked: c } = o, m = {
8
- ...t,
9
- type: "radio",
10
- name: e,
11
- disabled: n,
12
- placeholder: a,
13
- onInput: i,
14
- onChange: p,
15
- value: d,
16
- autoFocus: u,
17
- readOnly: l,
18
- required: s,
19
- defaultChecked: c,
20
- ref: r
21
- };
22
- return /* @__PURE__ */ f(C, { tag: "input", inline: !0, ...o, props: m });
23
- }
24
- const P = g(h);
25
- export {
26
- P as default
27
- };
@@ -1,44 +0,0 @@
1
- import { jsx as h } from "react/jsx-runtime";
2
- import { forwardRef as w } from "react";
3
- import C from "../box.mjs";
4
- import "../box.module.css.mjs";
5
- import "../utils/utils.mjs";
6
- function T(o, e) {
7
- const {
8
- props: r,
9
- name: t,
10
- disabled: n,
11
- placeholder: a,
12
- defaultValue: l,
13
- onInput: p,
14
- onChange: s,
15
- rows: i,
16
- cols: m,
17
- autoFocus: u,
18
- maxLength: d,
19
- minLength: c,
20
- readOnly: f,
21
- required: x
22
- } = o, g = {
23
- ...r,
24
- name: t,
25
- disabled: n,
26
- placeholder: a,
27
- onInput: p,
28
- onChange: s,
29
- defaultValue: l,
30
- rows: i,
31
- cols: m,
32
- autoFocus: u,
33
- maxLength: d,
34
- minLength: c,
35
- readOnly: f,
36
- required: x,
37
- ref: e
38
- };
39
- return /* @__PURE__ */ h(C, { tag: "textarea", inline: !0, ...o, props: g });
40
- }
41
- const y = w(T);
42
- export {
43
- y as default
44
- };
@@ -1,40 +0,0 @@
1
- import { jsx as x } from "react/jsx-runtime";
2
- import { forwardRef as g } from "react";
3
- import b from "../box.mjs";
4
- import "../box.module.css.mjs";
5
- import "../utils/utils.mjs";
6
- function y(o, t) {
7
- const {
8
- props: e,
9
- name: r,
10
- type: n,
11
- disabled: p,
12
- placeholder: a,
13
- defaultValue: l,
14
- onInput: u,
15
- onChange: i,
16
- autoFocus: s,
17
- readOnly: d,
18
- required: m,
19
- step: c
20
- } = o, f = {
21
- ...e,
22
- type: n || "text",
23
- name: r,
24
- disabled: p,
25
- placeholder: a,
26
- onInput: u,
27
- onChange: i,
28
- defaultValue: l,
29
- autoFocus: s,
30
- readOnly: d,
31
- required: m,
32
- step: c,
33
- ref: t
34
- };
35
- return /* @__PURE__ */ x(b, { tag: "input", inline: !0, ...o, props: f });
36
- }
37
- const j = g(y);
38
- export {
39
- j as default
40
- };