@cronocode/react-box 1.1.7 → 1.2.0
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.d.ts +2 -2
- package/box.mjs +12 -12
- package/box.module.css.mjs +2 -2
- package/components/baseSvg.d.ts +4 -4
- package/components/baseSvg.mjs +15 -15
- package/components/buttonCore.d.ts +4 -4
- package/components/checkboxCore.d.ts +3 -3
- package/components/flex.d.ts +2 -2
- package/components/formAsync.d.ts +3 -3
- package/components/radioButtonCore.d.ts +3 -3
- package/components/textareaCore.d.ts +3 -3
- package/components/textboxCore.d.ts +4 -4
- package/package.json +10 -8
- package/style.css +1 -1
- package/types.d.ts +29 -25
- package/utils/form/formUtils.d.ts +1 -1
- package/utils/utils.mjs +88 -78
- package/vite-env.d.ts +0 -1
package/types.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type Hovered<T> = {
|
|
2
2
|
[K in keyof T as K extends string ? `${K}H` : never]: T[K];
|
|
3
3
|
};
|
|
4
|
-
export
|
|
4
|
+
export type Focused<T> = {
|
|
5
5
|
[K in keyof T as K extends string ? `${K}F` : never]: T[K];
|
|
6
6
|
};
|
|
7
|
-
export
|
|
7
|
+
export type Activated<T> = {
|
|
8
8
|
[K in keyof T as K extends string ? `${K}A` : never]: T[K];
|
|
9
9
|
};
|
|
10
10
|
export declare const styleVariables: {
|
|
11
|
-
display: readonly ["none", "block", "inline-block", "flex", "inline-flex", "grid", "contents"];
|
|
11
|
+
display: readonly ["none", "block", "inline-block", "flex", "inline-flex", "grid", "inline-grid", "contents"];
|
|
12
12
|
boxSizing: readonly ["border-box", "content-box"];
|
|
13
13
|
position: readonly ["static", "relative", "absolute", "fixed", "sticky"];
|
|
14
14
|
sizeSpecialValues: readonly ["fit", "fit-screen", "auto", "fit-content", "max-content", "min-content"];
|
|
@@ -21,7 +21,6 @@ export declare const styleVariables: {
|
|
|
21
21
|
cursors: readonly ["auto", "default", "none", "context-menu", "help", "pointer", "progress", "wait", "cell", "crosshair", "text", "vertical-text", "alias", "copy", "move", "no-drop", "not-allowed", "e-resize", "n-resize", "ne-resize", "nw-resize", "s-resize", "se-resize", "sw-resize", "w-resize", "ew-resize", "ns-resize", "nesw-resize", "nwse-resize", "col-resize", "row-resize", "all-scroll", "zoom-in", "zoom-out", "grab", "grabbing"];
|
|
22
22
|
sizes: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100];
|
|
23
23
|
sizeMultiplier: number;
|
|
24
|
-
baseColors: readonly ["none", "transparent", "black", "white", "blue", "red", "purple", "yellow", "pink", "green", "orange", "navy", "teal", "violet", "gray", "brown", "orange"];
|
|
25
24
|
borderSizes: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
26
25
|
fontSizes: readonly [6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 54, 58, 64, 70, 78, 86, 96];
|
|
27
26
|
fontWeight: readonly [100, 200, 300, 400, 500, 600, 700, 800, 900];
|
|
@@ -39,24 +38,26 @@ export declare const styleVariables: {
|
|
|
39
38
|
outlineOffset: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
40
39
|
transition: readonly ["none"];
|
|
41
40
|
background: readonly ["none"];
|
|
41
|
+
userSelect: readonly ["none"];
|
|
42
42
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
43
|
+
type GapType = (typeof styleVariables.gap)[number];
|
|
44
|
+
type BoxSizeValue = (typeof styleVariables.sizeSpecialValues)[number];
|
|
45
|
+
type BorderSizeType = (typeof styleVariables.borderSizes)[number];
|
|
46
|
+
type SizeType = (typeof styleVariables.sizes)[number];
|
|
47
|
+
export type ColorType = string;
|
|
48
|
+
type CursorType = (typeof styleVariables.cursors)[number];
|
|
49
|
+
type OverflowType = (typeof styleVariables.overflows)[number];
|
|
50
|
+
type FontSizeType = (typeof styleVariables.fontSizes)[number];
|
|
51
|
+
type FontWeightType = (typeof styleVariables.fontWeight)[number];
|
|
52
|
+
type ZIndexSizeType = (typeof styleVariables.zIndexSizes)[number];
|
|
53
|
+
type OpacitySizeType = (typeof styleVariables.opacity)[number];
|
|
54
|
+
type TextDecorationType = (typeof styleVariables.textDecoration)[number];
|
|
55
|
+
type TextTransformType = (typeof styleVariables.textTransform)[number];
|
|
56
|
+
type TextAlignType = (typeof styleVariables.textAlign)[number];
|
|
57
|
+
type BorderAndOutlineStyleType = (typeof styleVariables.borderAndOutlineStyles)[number];
|
|
58
|
+
type TransitionType = (typeof styleVariables.transition)[number];
|
|
59
|
+
type BackgroundType = (typeof styleVariables.background)[number];
|
|
60
|
+
type UserSelectType = (typeof styleVariables.userSelect)[number];
|
|
60
61
|
interface BoxPseudoClasses {
|
|
61
62
|
hover?: boolean;
|
|
62
63
|
focus?: boolean;
|
|
@@ -205,7 +206,10 @@ interface BoxFlex {
|
|
|
205
206
|
interface BoxTransition {
|
|
206
207
|
transition?: TransitionType;
|
|
207
208
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
interface BoxUserSelect {
|
|
210
|
+
userSelect?: UserSelectType;
|
|
211
|
+
}
|
|
212
|
+
type BoxNormalStyles = BoxPseudoClasses & BoxDisplay & BoxSizing & BoxPosition & BoxSize & BoxMargin & BoxPadding & BoxBorder & BoxShadow & BoxBackground & BoxColors & BoxCursor & BoxZIndex & BoxOverflow & BoxOpacity & BoxFont & BoxText & BoxFlex & BoxOutline & BoxTransition & BoxUserSelect;
|
|
213
|
+
export type BoxStyles = BoxNormalStyles & Hovered<BoxNormalStyles> & Focused<BoxNormalStyles> & Activated<BoxNormalStyles>;
|
|
214
|
+
export declare const themeClasses: Partial<Record<keyof BoxStyles, string>>;
|
|
211
215
|
export {};
|
package/utils/utils.mjs
CHANGED
|
@@ -1,92 +1,102 @@
|
|
|
1
|
-
const
|
|
2
|
-
"
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
const h = {
|
|
2
|
+
hover: "_h",
|
|
3
|
+
focus: "_f",
|
|
4
|
+
shadow: "shadow_",
|
|
5
|
+
shadowH: "shadow_h_",
|
|
6
|
+
shadowF: "shadow_f_",
|
|
7
|
+
shadowA: "shadow_a_",
|
|
8
|
+
background: "bg_",
|
|
9
|
+
backgroundH: "bg_h_",
|
|
10
|
+
backgroundF: "bg_f_",
|
|
11
|
+
backgroundA: "bg_a_",
|
|
12
|
+
bg: "bg_",
|
|
13
|
+
bgH: "bg_h_",
|
|
14
|
+
bgF: "bg_f_",
|
|
15
|
+
bgA: "bg_a_",
|
|
16
|
+
color: "color_",
|
|
17
|
+
colorH: "color_h_",
|
|
18
|
+
colorF: "color_f_",
|
|
19
|
+
colorA: "color_a_",
|
|
20
|
+
backgroundColor: "bgColor_",
|
|
21
|
+
backgroundColorH: "bgColor_h_",
|
|
22
|
+
backgroundColorF: "bgColor_f_",
|
|
23
|
+
backgroundColorA: "bgColor_a_",
|
|
24
|
+
bgColor: "bgColor_",
|
|
25
|
+
bgColorH: "bgColor_h_",
|
|
26
|
+
bgColorF: "bgColor_f_",
|
|
27
|
+
bgColorA: "bgColor_a_",
|
|
28
|
+
borderColor: "borderColor_",
|
|
29
|
+
borderColorH: "borderColor_h_",
|
|
30
|
+
borderColorF: "borderColor_f_",
|
|
31
|
+
borderColorA: "borderColor_a_",
|
|
32
|
+
outlineColor: "outlineColor_",
|
|
33
|
+
outlineColorH: "outlineColor_h_",
|
|
34
|
+
outlineColorF: "outlineColor_f_",
|
|
35
|
+
outlineColorA: "outlineColor_a_"
|
|
36
|
+
};
|
|
37
|
+
var a;
|
|
38
|
+
((b) => {
|
|
39
|
+
function s(...n) {
|
|
40
|
+
return n.reduce((l, r) => r ? typeof r == "string" ? (l.push(r), l) : Array.isArray(r) ? (l.push(...s(...r)), l) : (Object.entries(r).forEach(([e, t]) => {
|
|
41
|
+
t && l.push(e);
|
|
42
|
+
}), l) : l, []);
|
|
33
43
|
}
|
|
34
|
-
|
|
35
|
-
})(
|
|
36
|
-
const
|
|
37
|
-
var
|
|
38
|
-
((
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
}), [
|
|
44
|
+
b.classNames = s;
|
|
45
|
+
})(a || (a = {}));
|
|
46
|
+
const f = a;
|
|
47
|
+
var d;
|
|
48
|
+
((b) => {
|
|
49
|
+
function s(n, ...l) {
|
|
50
|
+
const r = { ...n }, e = {};
|
|
51
|
+
return l.forEach((t) => {
|
|
52
|
+
t in r && (e[t] = r[t], delete r[t]);
|
|
53
|
+
}), [e, r];
|
|
44
54
|
}
|
|
45
|
-
|
|
46
|
-
})(
|
|
47
|
-
const
|
|
48
|
-
var
|
|
49
|
-
((
|
|
50
|
-
function
|
|
51
|
-
const
|
|
52
|
-
const
|
|
53
|
-
return
|
|
55
|
+
b.moveToTagProps = s;
|
|
56
|
+
})(d || (d = {}));
|
|
57
|
+
const p = d;
|
|
58
|
+
var C;
|
|
59
|
+
((b) => {
|
|
60
|
+
function s(l) {
|
|
61
|
+
const r = Array.from(l.elements).reduce((e, t) => {
|
|
62
|
+
const o = t.name;
|
|
63
|
+
return o && (e[o] || (e[o] = []), e[o].push(t)), e;
|
|
54
64
|
}, {});
|
|
55
|
-
return Object.entries(
|
|
56
|
-
if (
|
|
57
|
-
const
|
|
58
|
-
|
|
65
|
+
return Object.entries(r).reduce((e, [t, o]) => {
|
|
66
|
+
if (o.length === 1) {
|
|
67
|
+
const _ = o[0];
|
|
68
|
+
n(e, t, _.type === "checkbox" || _.type === "radio" ? _.checked : _.value);
|
|
59
69
|
} else {
|
|
60
|
-
const
|
|
61
|
-
|
|
70
|
+
const _ = o.reduce((i, c) => (c.type === "checkbox" || c.type === "radio" ? c.checked && i.push(c.value) : i.push(c.value), i), []);
|
|
71
|
+
n(e, t, _);
|
|
62
72
|
}
|
|
63
|
-
return
|
|
73
|
+
return e;
|
|
64
74
|
}, {});
|
|
65
75
|
}
|
|
66
|
-
|
|
67
|
-
function
|
|
68
|
-
if (
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
75
|
-
const [,
|
|
76
|
-
|
|
76
|
+
b.getFormEntries = s;
|
|
77
|
+
function n(l, r, e) {
|
|
78
|
+
if (r.includes(".")) {
|
|
79
|
+
const t = r.split(".");
|
|
80
|
+
let o = l;
|
|
81
|
+
t.forEach((_, i) => {
|
|
82
|
+
if (t.length > i + 1) {
|
|
83
|
+
const c = _.match(/^(.+)\[(\d)\]$/);
|
|
84
|
+
if (c) {
|
|
85
|
+
const [, u, g] = c;
|
|
86
|
+
o[u] = o[u] || [], o[u][g] = o[u][g] || {}, o = o[u][g];
|
|
77
87
|
} else
|
|
78
|
-
|
|
88
|
+
o[_] = o[_] || {}, o = o[_];
|
|
79
89
|
} else
|
|
80
|
-
|
|
90
|
+
o[_] = e;
|
|
81
91
|
});
|
|
82
92
|
} else
|
|
83
|
-
|
|
93
|
+
l[r] = e;
|
|
84
94
|
}
|
|
85
|
-
})(
|
|
86
|
-
const
|
|
95
|
+
})(C || (C = {}));
|
|
96
|
+
const F = C;
|
|
87
97
|
export {
|
|
88
|
-
C,
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
98
|
+
f as C,
|
|
99
|
+
F,
|
|
100
|
+
p as O,
|
|
101
|
+
h as t
|
|
92
102
|
};
|
package/vite-env.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|