@cronocode/react-box 1.2.6 → 1.3.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/baseSvg.module.css.mjs +4 -0
- package/box.d.ts +2 -1
- package/box.mjs +18 -14
- package/box.module.css.mjs +1 -1
- package/components/baseSvg.mjs +14 -14
- package/components/{buttonCore.d.ts → button.d.ts} +3 -2
- package/components/button.mjs +15 -0
- package/components/{radioButtonCore.d.ts → checkbox.d.ts} +7 -5
- package/components/checkbox.mjs +30 -0
- package/components/dataGrid.d.ts +2 -0
- package/components/dataGrid.mjs +36 -0
- package/components/flex.mjs +1 -0
- package/components/form.d.ts +10 -0
- package/components/{formAsync.mjs → form.mjs} +6 -5
- package/components/{checkboxCore.d.ts → radioButton.d.ts} +7 -5
- package/components/radioButton.mjs +26 -0
- package/components/{textareaCore.d.ts → textarea.d.ts} +6 -4
- package/components/textarea.mjs +30 -0
- package/components/textbox.d.ts +3 -4
- package/components/textbox.mjs +11 -11
- package/components/tooltip.d.ts +8 -0
- package/components/tooltip.mjs +55 -0
- package/hooks/usePortalContainer.d.ts +1 -0
- package/package.json +5 -2
- package/style.css +1 -1
- package/theme.d.ts +30 -21
- package/theme.mjs +24 -24
- package/types.d.ts +12 -2
- package/utils/object/objectUtils.d.ts +1 -439
- package/utils/utils.mjs +55 -44
- package/components/buttonCore.mjs +0 -13
- package/components/checkboxCore.mjs +0 -25
- package/components/formAsync.d.ts +0 -10
- package/components/radioButtonCore.mjs +0 -25
- package/components/textareaCore.mjs +0 -29
- package/components/textboxCore.d.ts +0 -24
- package/components/textboxCore.mjs +0 -28
package/utils/utils.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { useMemo as h } from "react";
|
|
2
|
+
const p = {
|
|
2
3
|
hover: "_h",
|
|
3
4
|
focus: "_f",
|
|
4
5
|
shadow: "shadow_",
|
|
@@ -33,7 +34,7 @@ const h = {
|
|
|
33
34
|
outlineColorH: "outlineColor_h_",
|
|
34
35
|
outlineColorF: "outlineColor_f_",
|
|
35
36
|
outlineColorA: "outlineColor_a_"
|
|
36
|
-
},
|
|
37
|
+
}, F = {
|
|
37
38
|
fill: "fill_",
|
|
38
39
|
fillH: "fill_h_",
|
|
39
40
|
fillF: "fill_f_",
|
|
@@ -44,76 +45,86 @@ const h = {
|
|
|
44
45
|
strokeA: "stroke_a_"
|
|
45
46
|
};
|
|
46
47
|
var f;
|
|
47
|
-
((
|
|
48
|
-
function
|
|
49
|
-
return
|
|
48
|
+
((_) => {
|
|
49
|
+
function n(...u) {
|
|
50
|
+
return u.reduce((l, s) => s ? typeof s == "string" ? (l.push(s), l) : Array.isArray(s) ? (l.push(...n(...s)), l) : (Object.entries(s).forEach(([r, e]) => {
|
|
50
51
|
e && l.push(r);
|
|
51
52
|
}), l) : l, []);
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
+
_.classNames = n;
|
|
54
55
|
})(f || (f = {}));
|
|
55
|
-
const
|
|
56
|
-
var
|
|
57
|
-
((
|
|
58
|
-
function
|
|
56
|
+
const k = f;
|
|
57
|
+
var b;
|
|
58
|
+
((_) => {
|
|
59
|
+
function n(l, ...s) {
|
|
59
60
|
const r = { ...l }, e = {};
|
|
60
|
-
return
|
|
61
|
+
return s.forEach((o) => {
|
|
61
62
|
o in r && (e[o] = r[o], delete r[o]);
|
|
62
63
|
}), [e, r];
|
|
63
64
|
}
|
|
64
|
-
|
|
65
|
-
function
|
|
66
|
-
const e = { ...
|
|
67
|
-
return
|
|
65
|
+
_.moveToTagProps = n;
|
|
66
|
+
function u(l, s, r) {
|
|
67
|
+
const e = { ...l }, o = e.props || {};
|
|
68
|
+
return s.forEach((t) => {
|
|
68
69
|
t in e && (o[t] = e[t], delete e[t]);
|
|
70
|
+
}), r && Object.entries(r).forEach(([t, i]) => {
|
|
71
|
+
o[t] = i;
|
|
69
72
|
}), e.props = o, e;
|
|
70
73
|
}
|
|
71
|
-
|
|
72
|
-
})(
|
|
73
|
-
const
|
|
74
|
-
var
|
|
75
|
-
((
|
|
76
|
-
function
|
|
77
|
-
const
|
|
74
|
+
_.buildProps = u;
|
|
75
|
+
})(b || (b = {}));
|
|
76
|
+
const A = b;
|
|
77
|
+
var g;
|
|
78
|
+
((_) => {
|
|
79
|
+
function n(l) {
|
|
80
|
+
const s = Array.from(l.elements).reduce((r, e) => {
|
|
78
81
|
const o = e.name;
|
|
79
82
|
return o && (r[o] || (r[o] = []), r[o].push(e)), r;
|
|
80
83
|
}, {});
|
|
81
|
-
return Object.entries(
|
|
84
|
+
return Object.entries(s).reduce((r, [e, o]) => {
|
|
82
85
|
if (o.length === 1) {
|
|
83
86
|
const t = o[0];
|
|
84
|
-
|
|
87
|
+
u(r, e, t.type === "checkbox" || t.type === "radio" ? t.checked : t.value);
|
|
85
88
|
} else {
|
|
86
|
-
const t = o.reduce((
|
|
87
|
-
|
|
89
|
+
const t = o.reduce((i, c) => (c.type === "checkbox" || c.type === "radio" ? c.checked && i.push(c.value) : i.push(c.value), i), []);
|
|
90
|
+
u(r, e, t);
|
|
88
91
|
}
|
|
89
92
|
return r;
|
|
90
93
|
}, {});
|
|
91
94
|
}
|
|
92
|
-
|
|
93
|
-
function
|
|
94
|
-
if (
|
|
95
|
-
const e =
|
|
95
|
+
_.getFormEntries = n;
|
|
96
|
+
function u(l, s, r) {
|
|
97
|
+
if (s.includes(".")) {
|
|
98
|
+
const e = s.split(".");
|
|
96
99
|
let o = l;
|
|
97
|
-
e.forEach((t,
|
|
98
|
-
if (e.length >
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
const [,
|
|
102
|
-
o[
|
|
100
|
+
e.forEach((t, i) => {
|
|
101
|
+
if (e.length > i + 1) {
|
|
102
|
+
const c = t.match(/^(.+)\[(\d)\]$/);
|
|
103
|
+
if (c) {
|
|
104
|
+
const [, a, d] = c;
|
|
105
|
+
o[a] = o[a] || [], o[a][d] = o[a][d] || {}, o = o[a][d];
|
|
103
106
|
} else
|
|
104
107
|
o[t] = o[t] || {}, o = o[t];
|
|
105
108
|
} else
|
|
106
109
|
o[t] = r;
|
|
107
110
|
});
|
|
108
111
|
} else
|
|
109
|
-
l[
|
|
112
|
+
l[s] = r;
|
|
110
113
|
}
|
|
111
|
-
})(
|
|
112
|
-
const
|
|
114
|
+
})(g || (g = {}));
|
|
115
|
+
const m = g;
|
|
116
|
+
function w() {
|
|
117
|
+
return h(() => {
|
|
118
|
+
const _ = "crono-box";
|
|
119
|
+
let n = document.getElementById(_);
|
|
120
|
+
return n || (n = document.createElement("div"), n.id = _, document.body.appendChild(n)), n;
|
|
121
|
+
}, []);
|
|
122
|
+
}
|
|
113
123
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
124
|
+
k as C,
|
|
125
|
+
m as F,
|
|
126
|
+
A as O,
|
|
127
|
+
p as a,
|
|
128
|
+
F as t,
|
|
129
|
+
w as u
|
|
119
130
|
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as p } from "react";
|
|
3
|
-
import i from "../box.mjs";
|
|
4
|
-
import { O as s } from "../utils/utils.mjs";
|
|
5
|
-
import "../box.module.css.mjs";
|
|
6
|
-
function m(o, r) {
|
|
7
|
-
const [t, e] = s.moveToTagProps(o, "type", "onClick", "disabled");
|
|
8
|
-
return /* @__PURE__ */ n(i, { ref: r, tag: "button", cursor: "pointer", inline: !0, ...e, props: { ...o.props, ...t } });
|
|
9
|
-
}
|
|
10
|
-
const b = p(m);
|
|
11
|
-
export {
|
|
12
|
-
b as default
|
|
13
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as n } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as a } from "react";
|
|
3
|
-
import p from "../box.mjs";
|
|
4
|
-
import { O as c } from "../utils/utils.mjs";
|
|
5
|
-
import "../box.module.css.mjs";
|
|
6
|
-
function i(o, e) {
|
|
7
|
-
const [r, t] = c.moveToTagProps(
|
|
8
|
-
o,
|
|
9
|
-
"name",
|
|
10
|
-
"onInput",
|
|
11
|
-
"onChange",
|
|
12
|
-
"disabled",
|
|
13
|
-
"value",
|
|
14
|
-
"autoFocus",
|
|
15
|
-
"readOnly",
|
|
16
|
-
"required",
|
|
17
|
-
"checked",
|
|
18
|
-
"defaultChecked"
|
|
19
|
-
);
|
|
20
|
-
return /* @__PURE__ */ n(p, { ref: e, tag: "input", inline: !0, ...t, props: { ...o.props, ...r, type: "checkbox" } });
|
|
21
|
-
}
|
|
22
|
-
const l = a(i);
|
|
23
|
-
export {
|
|
24
|
-
l as default
|
|
25
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import Box from '../box';
|
|
2
|
-
type BoxProps = React.ComponentProps<typeof Box<'form'>>;
|
|
3
|
-
type BoxTagProps = Required<BoxProps>['props'];
|
|
4
|
-
type FormAsyncTagProps = Omit<BoxTagProps, 'onSubmit' | 'ref'>;
|
|
5
|
-
interface Props<T> extends Omit<BoxProps, 'props' | 'tag'> {
|
|
6
|
-
props?: FormAsyncTagProps;
|
|
7
|
-
onSubmit: (obj: T, e: React.FormEvent<HTMLFormElement>) => void;
|
|
8
|
-
}
|
|
9
|
-
export default function FormAsync<T>(props: Props<T>): JSX.Element;
|
|
10
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as n } from "react";
|
|
3
|
-
import i from "../box.mjs";
|
|
4
|
-
import { O as p } from "../utils/utils.mjs";
|
|
5
|
-
import "../box.module.css.mjs";
|
|
6
|
-
function u(o, r) {
|
|
7
|
-
const [t, e] = p.moveToTagProps(
|
|
8
|
-
o,
|
|
9
|
-
"name",
|
|
10
|
-
"onInput",
|
|
11
|
-
"onChange",
|
|
12
|
-
"disabled",
|
|
13
|
-
"value",
|
|
14
|
-
"autoFocus",
|
|
15
|
-
"readOnly",
|
|
16
|
-
"required",
|
|
17
|
-
"checked",
|
|
18
|
-
"defaultChecked"
|
|
19
|
-
);
|
|
20
|
-
return /* @__PURE__ */ a(i, { ref: r, tag: "input", inline: !0, ...e, props: { ...o.props, ...t, type: "radio" } });
|
|
21
|
-
}
|
|
22
|
-
const l = n(u);
|
|
23
|
-
export {
|
|
24
|
-
l as default
|
|
25
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as n } from "react";
|
|
3
|
-
import s from "../box.mjs";
|
|
4
|
-
import { O as m } from "../utils/utils.mjs";
|
|
5
|
-
import "../box.module.css.mjs";
|
|
6
|
-
function p(e, o) {
|
|
7
|
-
const [r, t] = m.moveToTagProps(
|
|
8
|
-
e,
|
|
9
|
-
"name",
|
|
10
|
-
"onInput",
|
|
11
|
-
"onChange",
|
|
12
|
-
"placeholder",
|
|
13
|
-
"disabled",
|
|
14
|
-
"value",
|
|
15
|
-
"defaultValue",
|
|
16
|
-
"rows",
|
|
17
|
-
"cols",
|
|
18
|
-
"autoFocus",
|
|
19
|
-
"maxLength",
|
|
20
|
-
"minLength",
|
|
21
|
-
"readOnly",
|
|
22
|
-
"required"
|
|
23
|
-
);
|
|
24
|
-
return /* @__PURE__ */ a(s, { ref: o, tag: "textarea", inline: !0, ...t, props: { ...e.props, ...r } });
|
|
25
|
-
}
|
|
26
|
-
const c = n(p);
|
|
27
|
-
export {
|
|
28
|
-
c as default
|
|
29
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Box from '../box';
|
|
3
|
-
type BoxProps = Omit<React.ComponentProps<typeof Box<'input'>>, 'ref' | 'tag'>;
|
|
4
|
-
type BoxTagProps = Required<BoxProps>['props'];
|
|
5
|
-
type TextboxCoreTagProps = Omit<BoxTagProps, 'name' | 'onInput' | 'onChange' | 'type' | 'placeholder' | 'disabled' | 'defaultValue' | 'autoFocus' | 'readOnly' | 'required' | 'value' | 'pattern'>;
|
|
6
|
-
type TextboxCoreType = 'date' | 'datetime-local' | 'email' | 'hidden' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week';
|
|
7
|
-
interface Props extends Omit<BoxProps, 'props'> {
|
|
8
|
-
name?: string;
|
|
9
|
-
props?: TextboxCoreTagProps;
|
|
10
|
-
onInput?: (e: React.FormEvent<HTMLInputElement>) => void;
|
|
11
|
-
onChange?: (e: React.FormEvent<HTMLInputElement>) => void;
|
|
12
|
-
type?: TextboxCoreType;
|
|
13
|
-
placeholder?: string;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
value?: string | number;
|
|
16
|
-
defaultValue?: string | number;
|
|
17
|
-
pattern?: string;
|
|
18
|
-
autoFocus?: boolean;
|
|
19
|
-
readOnly?: boolean;
|
|
20
|
-
required?: boolean;
|
|
21
|
-
step?: number | string;
|
|
22
|
-
}
|
|
23
|
-
declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLInputElement>>;
|
|
24
|
-
export default _default;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef as p } from "react";
|
|
3
|
-
import n from "../box.mjs";
|
|
4
|
-
import { O as s } from "../utils/utils.mjs";
|
|
5
|
-
import "../box.module.css.mjs";
|
|
6
|
-
function i(o, e) {
|
|
7
|
-
const [t, r] = s.moveToTagProps(
|
|
8
|
-
o,
|
|
9
|
-
"name",
|
|
10
|
-
"onInput",
|
|
11
|
-
"onChange",
|
|
12
|
-
"type",
|
|
13
|
-
"placeholder",
|
|
14
|
-
"disabled",
|
|
15
|
-
"value",
|
|
16
|
-
"defaultValue",
|
|
17
|
-
"pattern",
|
|
18
|
-
"autoFocus",
|
|
19
|
-
"readOnly",
|
|
20
|
-
"required",
|
|
21
|
-
"step"
|
|
22
|
-
);
|
|
23
|
-
return /* @__PURE__ */ a(n, { ref: e, tag: "input", inline: !0, ...r, props: { ...o.props, ...t } });
|
|
24
|
-
}
|
|
25
|
-
const x = p(i);
|
|
26
|
-
export {
|
|
27
|
-
x as default
|
|
28
|
-
};
|