@cronocode/react-box 1.2.0 → 1.2.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/box.mjs +6 -6
- package/components/baseSvg.d.ts +2 -2
- package/components/baseSvg.mjs +12 -12
- package/package.json +1 -1
- package/style.css +1 -1
- package/types.d.ts +2 -0
- package/utils/utils.mjs +55 -45
package/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { SvgStyles } from './components/baseSvg/baseSvg';
|
|
1
2
|
export type Hovered<T> = {
|
|
2
3
|
[K in keyof T as K extends string ? `${K}H` : never]: T[K];
|
|
3
4
|
};
|
|
@@ -212,4 +213,5 @@ interface BoxUserSelect {
|
|
|
212
213
|
type BoxNormalStyles = BoxPseudoClasses & BoxDisplay & BoxSizing & BoxPosition & BoxSize & BoxMargin & BoxPadding & BoxBorder & BoxShadow & BoxBackground & BoxColors & BoxCursor & BoxZIndex & BoxOverflow & BoxOpacity & BoxFont & BoxText & BoxFlex & BoxOutline & BoxTransition & BoxUserSelect;
|
|
213
214
|
export type BoxStyles = BoxNormalStyles & Hovered<BoxNormalStyles> & Focused<BoxNormalStyles> & Activated<BoxNormalStyles>;
|
|
214
215
|
export declare const themeClasses: Partial<Record<keyof BoxStyles, string>>;
|
|
216
|
+
export declare const themeSvgClasses: Partial<Record<keyof SvgStyles, string>>;
|
|
215
217
|
export {};
|
package/utils/utils.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const C = {
|
|
2
2
|
hover: "_h",
|
|
3
3
|
focus: "_f",
|
|
4
4
|
shadow: "shadow_",
|
|
@@ -33,70 +33,80 @@ const h = {
|
|
|
33
33
|
outlineColorH: "outlineColor_h_",
|
|
34
34
|
outlineColorF: "outlineColor_f_",
|
|
35
35
|
outlineColorA: "outlineColor_a_"
|
|
36
|
+
}, d = {
|
|
37
|
+
fill: "fill_",
|
|
38
|
+
fillH: "fill_h_",
|
|
39
|
+
fillF: "fill_f_",
|
|
40
|
+
fillA: "fill_a_",
|
|
41
|
+
stroke: "stroke_",
|
|
42
|
+
strokeH: "stroke_h_",
|
|
43
|
+
strokeF: "stroke_f_",
|
|
44
|
+
strokeA: "stroke_a_"
|
|
36
45
|
};
|
|
37
|
-
var
|
|
38
|
-
((
|
|
39
|
-
function
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
}),
|
|
46
|
+
var g;
|
|
47
|
+
((n) => {
|
|
48
|
+
function c(...i) {
|
|
49
|
+
return i.reduce((t, r) => r ? typeof r == "string" ? (t.push(r), t) : Array.isArray(r) ? (t.push(...c(...r)), t) : (Object.entries(r).forEach(([e, l]) => {
|
|
50
|
+
l && t.push(e);
|
|
51
|
+
}), t) : t, []);
|
|
43
52
|
}
|
|
44
|
-
|
|
45
|
-
})(
|
|
46
|
-
const
|
|
47
|
-
var
|
|
48
|
-
((
|
|
49
|
-
function
|
|
50
|
-
const r = { ...
|
|
51
|
-
return
|
|
52
|
-
|
|
53
|
+
n.classNames = c;
|
|
54
|
+
})(g || (g = {}));
|
|
55
|
+
const p = g;
|
|
56
|
+
var u;
|
|
57
|
+
((n) => {
|
|
58
|
+
function c(i, ...t) {
|
|
59
|
+
const r = { ...i }, e = {};
|
|
60
|
+
return t.forEach((l) => {
|
|
61
|
+
l in r && (e[l] = r[l], delete r[l]);
|
|
53
62
|
}), [e, r];
|
|
54
63
|
}
|
|
55
|
-
|
|
56
|
-
})(
|
|
57
|
-
const
|
|
58
|
-
var
|
|
59
|
-
((
|
|
60
|
-
function
|
|
61
|
-
const r = Array.from(
|
|
62
|
-
const o =
|
|
63
|
-
return o && (e[o] || (e[o] = []), e[o].push(
|
|
64
|
+
n.moveToTagProps = c;
|
|
65
|
+
})(u || (u = {}));
|
|
66
|
+
const k = u;
|
|
67
|
+
var h;
|
|
68
|
+
((n) => {
|
|
69
|
+
function c(t) {
|
|
70
|
+
const r = Array.from(t.elements).reduce((e, l) => {
|
|
71
|
+
const o = l.name;
|
|
72
|
+
return o && (e[o] || (e[o] = []), e[o].push(l)), e;
|
|
64
73
|
}, {});
|
|
65
|
-
return Object.entries(r).reduce((e, [
|
|
74
|
+
return Object.entries(r).reduce((e, [l, o]) => {
|
|
66
75
|
if (o.length === 1) {
|
|
67
76
|
const _ = o[0];
|
|
68
|
-
|
|
77
|
+
i(e, l, _.type === "checkbox" || _.type === "radio" ? _.checked : _.value);
|
|
69
78
|
} else {
|
|
70
|
-
const _ = o.reduce((
|
|
71
|
-
|
|
79
|
+
const _ = o.reduce((b, s) => (s.type === "checkbox" || s.type === "radio" ? s.checked && b.push(s.value) : b.push(s.value), b), []);
|
|
80
|
+
i(e, l, _);
|
|
72
81
|
}
|
|
73
82
|
return e;
|
|
74
83
|
}, {});
|
|
75
84
|
}
|
|
76
|
-
|
|
77
|
-
function
|
|
85
|
+
n.getFormEntries = c;
|
|
86
|
+
function i(t, r, e) {
|
|
78
87
|
if (r.includes(".")) {
|
|
79
|
-
const
|
|
80
|
-
let o =
|
|
81
|
-
|
|
82
|
-
if (
|
|
83
|
-
const
|
|
84
|
-
if (
|
|
85
|
-
const [,
|
|
86
|
-
o[
|
|
88
|
+
const l = r.split(".");
|
|
89
|
+
let o = t;
|
|
90
|
+
l.forEach((_, b) => {
|
|
91
|
+
if (l.length > b + 1) {
|
|
92
|
+
const s = _.match(/^(.+)\[(\d)\]$/);
|
|
93
|
+
if (s) {
|
|
94
|
+
const [, a, f] = s;
|
|
95
|
+
o[a] = o[a] || [], o[a][f] = o[a][f] || {}, o = o[a][f];
|
|
87
96
|
} else
|
|
88
97
|
o[_] = o[_] || {}, o = o[_];
|
|
89
98
|
} else
|
|
90
99
|
o[_] = e;
|
|
91
100
|
});
|
|
92
101
|
} else
|
|
93
|
-
|
|
102
|
+
t[r] = e;
|
|
94
103
|
}
|
|
95
|
-
})(
|
|
96
|
-
const F =
|
|
104
|
+
})(h || (h = {}));
|
|
105
|
+
const F = h;
|
|
97
106
|
export {
|
|
98
|
-
|
|
107
|
+
p as C,
|
|
99
108
|
F,
|
|
100
|
-
|
|
101
|
-
|
|
109
|
+
k as O,
|
|
110
|
+
C as a,
|
|
111
|
+
d as t
|
|
102
112
|
};
|