@cronocode/react-box 1.0.0 → 1.0.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.module.css.js +1 -1
- package/components/buttonCore.d.ts +1 -1
- package/components/formAsync.d.ts +6 -2
- package/components/formAsync.js +11 -28
- package/package.json +1 -1
- package/style.css +1 -1
- package/types.d.ts +36 -36
- package/utils/form/formUtils.d.ts +5 -0
- package/utils/utils.js +33 -10
package/types.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare 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"];
|
|
11
|
+
display: readonly ["none", "block", "inline-block", "flex", "inline-flex", "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"];
|
|
@@ -44,40 +44,40 @@ export declare const styleVariables: {
|
|
|
44
44
|
flexSelf: readonly ["auto", "flex-start", "flex-end", "center", "baseline", "stretch"];
|
|
45
45
|
outlineOffset: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
|
46
46
|
};
|
|
47
|
-
declare type GapType = typeof styleVariables.gap[number];
|
|
48
|
-
declare type BoxSizeValue = typeof styleVariables.sizeSpecialValues[number];
|
|
49
|
-
declare type BorderSizeType = typeof styleVariables.borderSizes[number];
|
|
50
|
-
declare type SizeType = typeof styleVariables.sizes[number];
|
|
51
|
-
declare type ColorType = typeof styleVariables.baseColors[number];
|
|
52
|
-
declare type BaseFontColorType = typeof styleVariables.fontColors[number];
|
|
53
|
-
declare type BaseBgColorType = typeof styleVariables.bgColors[number];
|
|
54
|
-
declare type BaseBorderColorType = typeof styleVariables.borderColors[number];
|
|
55
|
-
declare type BaseOutlineColorType = typeof styleVariables.outlineColors[number];
|
|
56
|
-
declare type BackgroundType = typeof styleVariables.backgrounds[number];
|
|
57
|
-
declare type ShadowType = typeof styleVariables.shadows[number];
|
|
58
|
-
declare type CursorType = typeof styleVariables.cursors[number];
|
|
59
|
-
declare type OverflowType = typeof styleVariables.overflows[number];
|
|
60
|
-
declare type FontSizeType = typeof styleVariables.fontSizes[number];
|
|
61
|
-
declare type FontWeightType = typeof styleVariables.fontWeight[number];
|
|
62
|
-
declare type ZIndexSizeType = typeof styleVariables.zIndexSizes[number];
|
|
63
|
-
declare type OpacitySizeType = typeof styleVariables.opacity[number];
|
|
64
|
-
declare type TextDecorationType = typeof styleVariables.textDecoration[number];
|
|
65
|
-
declare type TextTransformType = typeof styleVariables.textTransform[number];
|
|
66
|
-
declare type TextAlignType = typeof styleVariables.textAlign[number];
|
|
67
|
-
declare type BorderAndOutlineStyleType = typeof styleVariables.borderAndOutlineStyles[number];
|
|
47
|
+
declare type GapType = (typeof styleVariables.gap)[number];
|
|
48
|
+
declare type BoxSizeValue = (typeof styleVariables.sizeSpecialValues)[number];
|
|
49
|
+
declare type BorderSizeType = (typeof styleVariables.borderSizes)[number];
|
|
50
|
+
declare type SizeType = (typeof styleVariables.sizes)[number];
|
|
51
|
+
declare type ColorType = (typeof styleVariables.baseColors)[number];
|
|
52
|
+
declare type BaseFontColorType = (typeof styleVariables.fontColors)[number];
|
|
53
|
+
declare type BaseBgColorType = (typeof styleVariables.bgColors)[number];
|
|
54
|
+
declare type BaseBorderColorType = (typeof styleVariables.borderColors)[number];
|
|
55
|
+
declare type BaseOutlineColorType = (typeof styleVariables.outlineColors)[number];
|
|
56
|
+
declare type BackgroundType = (typeof styleVariables.backgrounds)[number];
|
|
57
|
+
declare type ShadowType = (typeof styleVariables.shadows)[number];
|
|
58
|
+
declare type CursorType = (typeof styleVariables.cursors)[number];
|
|
59
|
+
declare type OverflowType = (typeof styleVariables.overflows)[number];
|
|
60
|
+
declare type FontSizeType = (typeof styleVariables.fontSizes)[number];
|
|
61
|
+
declare type FontWeightType = (typeof styleVariables.fontWeight)[number];
|
|
62
|
+
declare type ZIndexSizeType = (typeof styleVariables.zIndexSizes)[number];
|
|
63
|
+
declare type OpacitySizeType = (typeof styleVariables.opacity)[number];
|
|
64
|
+
declare type TextDecorationType = (typeof styleVariables.textDecoration)[number];
|
|
65
|
+
declare type TextTransformType = (typeof styleVariables.textTransform)[number];
|
|
66
|
+
declare type TextAlignType = (typeof styleVariables.textAlign)[number];
|
|
67
|
+
declare type BorderAndOutlineStyleType = (typeof styleVariables.borderAndOutlineStyles)[number];
|
|
68
68
|
interface BoxPseudoClasses {
|
|
69
69
|
hover?: boolean;
|
|
70
70
|
focus?: boolean;
|
|
71
71
|
}
|
|
72
72
|
interface BoxDisplay {
|
|
73
|
-
display?: typeof styleVariables.display[number];
|
|
73
|
+
display?: (typeof styleVariables.display)[number];
|
|
74
74
|
inline?: boolean;
|
|
75
75
|
}
|
|
76
76
|
interface BoxSizing {
|
|
77
|
-
boxSizing?: typeof styleVariables.boxSizing[number];
|
|
77
|
+
boxSizing?: (typeof styleVariables.boxSizing)[number];
|
|
78
78
|
}
|
|
79
79
|
interface BoxPosition {
|
|
80
|
-
position?: typeof styleVariables.position[number];
|
|
80
|
+
position?: (typeof styleVariables.position)[number];
|
|
81
81
|
inset?: SizeType;
|
|
82
82
|
top?: SizeType;
|
|
83
83
|
right?: SizeType;
|
|
@@ -127,7 +127,7 @@ interface BoxPadding {
|
|
|
127
127
|
interface BoxOutline {
|
|
128
128
|
outline?: BorderSizeType;
|
|
129
129
|
outlineStyle?: BorderAndOutlineStyleType;
|
|
130
|
-
outlineOffset?: typeof styleVariables.outlineOffset[number];
|
|
130
|
+
outlineOffset?: (typeof styleVariables.outlineOffset)[number];
|
|
131
131
|
}
|
|
132
132
|
interface BoxBorder {
|
|
133
133
|
border?: BorderSizeType;
|
|
@@ -195,20 +195,20 @@ interface BoxText {
|
|
|
195
195
|
textAlign?: TextAlignType;
|
|
196
196
|
}
|
|
197
197
|
interface BoxFlex {
|
|
198
|
-
flexWrap?: typeof styleVariables.flexWrap[number];
|
|
199
|
-
justifyContent?: typeof styleVariables.justifyContent[number];
|
|
200
|
-
alignItems?: typeof styleVariables.alignItems[number];
|
|
201
|
-
alignContent?: typeof styleVariables.alignContent[number];
|
|
198
|
+
flexWrap?: (typeof styleVariables.flexWrap)[number];
|
|
199
|
+
justifyContent?: (typeof styleVariables.justifyContent)[number];
|
|
200
|
+
alignItems?: (typeof styleVariables.alignItems)[number];
|
|
201
|
+
alignContent?: (typeof styleVariables.alignContent)[number];
|
|
202
202
|
flex1?: boolean;
|
|
203
|
-
flexDirection?: typeof styleVariables.flexDirection[number];
|
|
203
|
+
flexDirection?: (typeof styleVariables.flexDirection)[number];
|
|
204
204
|
gap?: GapType;
|
|
205
205
|
rowGap?: GapType;
|
|
206
206
|
columnGap?: GapType;
|
|
207
|
-
order?: typeof styleVariables.order[number];
|
|
208
|
-
flexGrow?: typeof styleVariables.flexGrow[number];
|
|
209
|
-
flexShrink?: typeof styleVariables.flexShrink[number];
|
|
210
|
-
alignSelf?: typeof styleVariables.flexSelf[number];
|
|
211
|
-
justifySelf?: typeof styleVariables.flexSelf[number];
|
|
207
|
+
order?: (typeof styleVariables.order)[number];
|
|
208
|
+
flexGrow?: (typeof styleVariables.flexGrow)[number];
|
|
209
|
+
flexShrink?: (typeof styleVariables.flexShrink)[number];
|
|
210
|
+
alignSelf?: (typeof styleVariables.flexSelf)[number];
|
|
211
|
+
justifySelf?: (typeof styleVariables.flexSelf)[number];
|
|
212
212
|
}
|
|
213
213
|
declare type BoxNormalStyles = BoxPseudoClasses & BoxDisplay & BoxSizing & BoxPosition & BoxSize & BoxMargin & BoxPadding & BoxBorder & BoxShadow & BoxBackground & BoxColors & BoxCursor & BoxZIndex & BoxOverflow & BoxOpacity & BoxFont & BoxText & BoxFlex & BoxOutline;
|
|
214
214
|
export declare type BoxStyles = BoxNormalStyles & Hovered<BoxNormalStyles> & Focused<BoxNormalStyles> & Activated<BoxNormalStyles>;
|
package/utils/utils.js
CHANGED
|
@@ -1,13 +1,36 @@
|
|
|
1
|
-
var
|
|
2
|
-
((
|
|
3
|
-
function
|
|
4
|
-
return o.reduce((
|
|
5
|
-
|
|
6
|
-
}),
|
|
1
|
+
var f;
|
|
2
|
+
((s) => {
|
|
3
|
+
function u(...o) {
|
|
4
|
+
return o.reduce((c, r) => typeof r == "string" ? (c.push(r), c) : Array.isArray(r) ? (c.push(...u(...r)), c) : (Object.entries(r).forEach(([t, e]) => {
|
|
5
|
+
e && c.push(t);
|
|
6
|
+
}), c), []);
|
|
7
7
|
}
|
|
8
|
-
|
|
9
|
-
})(
|
|
10
|
-
const
|
|
8
|
+
s.classNames = u;
|
|
9
|
+
})(f || (f = {}));
|
|
10
|
+
const d = f;
|
|
11
|
+
var n;
|
|
12
|
+
((s) => {
|
|
13
|
+
function u(o) {
|
|
14
|
+
const c = Array.from(o.elements).reduce((r, t) => {
|
|
15
|
+
const e = t.name;
|
|
16
|
+
return e && (r[e] || (r[e] = []), r[e].push(t)), r;
|
|
17
|
+
}, {});
|
|
18
|
+
return Object.entries(c).reduce((r, [t, e]) => {
|
|
19
|
+
if (e.length === 1) {
|
|
20
|
+
const i = e[0];
|
|
21
|
+
r[t] = i.type === "checkbox" || i.type === "radio" ? i.checked : i.value;
|
|
22
|
+
} else
|
|
23
|
+
r[t] = [], e.forEach((i) => {
|
|
24
|
+
var h;
|
|
25
|
+
i.type === "checkbox" ? i.checked && r[t].push(i.value) : i.type === "radio" ? r[t] = (h = e.find((p) => p.checked)) == null ? void 0 : h.value : r[t].push(i.value);
|
|
26
|
+
});
|
|
27
|
+
return r;
|
|
28
|
+
}, {});
|
|
29
|
+
}
|
|
30
|
+
s.getFormEntries = u;
|
|
31
|
+
})(n || (n = {}));
|
|
32
|
+
const y = n;
|
|
11
33
|
export {
|
|
12
|
-
|
|
34
|
+
d as C,
|
|
35
|
+
y as F
|
|
13
36
|
};
|