@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/types.d.ts CHANGED
@@ -1,14 +1,14 @@
1
- export declare type Hovered<T> = {
1
+ export type Hovered<T> = {
2
2
  [K in keyof T as K extends string ? `${K}H` : never]: T[K];
3
3
  };
4
- export declare type Focused<T> = {
4
+ export type Focused<T> = {
5
5
  [K in keyof T as K extends string ? `${K}F` : never]: T[K];
6
6
  };
7
- export declare type Activated<T> = {
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
- declare type GapType = (typeof styleVariables.gap)[number];
44
- declare type BoxSizeValue = (typeof styleVariables.sizeSpecialValues)[number];
45
- declare type BorderSizeType = (typeof styleVariables.borderSizes)[number];
46
- declare type SizeType = (typeof styleVariables.sizes)[number];
47
- export declare type ColorType = (typeof styleVariables.baseColors)[number];
48
- declare type CursorType = (typeof styleVariables.cursors)[number];
49
- declare type OverflowType = (typeof styleVariables.overflows)[number];
50
- declare type FontSizeType = (typeof styleVariables.fontSizes)[number];
51
- declare type FontWeightType = (typeof styleVariables.fontWeight)[number];
52
- declare type ZIndexSizeType = (typeof styleVariables.zIndexSizes)[number];
53
- declare type OpacitySizeType = (typeof styleVariables.opacity)[number];
54
- declare type TextDecorationType = (typeof styleVariables.textDecoration)[number];
55
- declare type TextTransformType = (typeof styleVariables.textTransform)[number];
56
- declare type TextAlignType = (typeof styleVariables.textAlign)[number];
57
- declare type BorderAndOutlineStyleType = (typeof styleVariables.borderAndOutlineStyles)[number];
58
- declare type TransitionType = (typeof styleVariables.transition)[number];
59
- declare type BackgroundType = (typeof styleVariables.background)[number];
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
- declare type BoxNormalStyles = BoxPseudoClasses & BoxDisplay & BoxSizing & BoxPosition & BoxSize & BoxMargin & BoxPadding & BoxBorder & BoxShadow & BoxBackground & BoxColors & BoxCursor & BoxZIndex & BoxOverflow & BoxOpacity & BoxFont & BoxText & BoxFlex & BoxOutline & BoxTransition;
209
- export declare type BoxStyles = BoxNormalStyles & Hovered<BoxNormalStyles> & Focused<BoxNormalStyles> & Activated<BoxNormalStyles>;
210
- export declare const themeClasses: Array<keyof BoxStyles>;
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 {};
@@ -1,4 +1,4 @@
1
- declare type FormValue = string | string[] | number | number[] | boolean;
1
+ type FormValue = string | string[] | number | number[] | boolean;
2
2
  interface FormObject {
3
3
  [index: string]: FormValue | FormObject;
4
4
  }
package/utils/utils.mjs CHANGED
@@ -1,92 +1,102 @@
1
- const p = [
2
- "shadow",
3
- "shadowH",
4
- "shadowA",
5
- "background",
6
- "backgroundH",
7
- "backgroundA",
8
- "bg",
9
- "bgH",
10
- "bgA",
11
- "color",
12
- "colorH",
13
- "colorA",
14
- "backgroundColor",
15
- "backgroundColorH",
16
- "backgroundColorA",
17
- "bgColor",
18
- "bgColorH",
19
- "bgColorA",
20
- "borderColor",
21
- "borderColorH",
22
- "borderColorA",
23
- "outlineColor",
24
- "outlineColorH",
25
- "outlineColorA"
26
- ];
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, []);
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
- 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
+ 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
- l.moveToTagProps = i;
46
- })(h || (h = {}));
47
- const A = h;
48
- var b;
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;
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(o).reduce((t, [e, r]) => {
56
- if (r.length === 1) {
57
- const c = r[0];
58
- u(t, e, c.type === "checkbox" || c.type === "radio" ? c.checked : c.value);
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 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);
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 t;
73
+ return e;
64
74
  }, {});
65
75
  }
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) {
73
- const n = c.match(/^(.+)\[(\d)\]$/);
74
- if (n) {
75
- const [, a, f] = n;
76
- r[a] = r[a] || [], r[a][f] = r[a][f] || {}, r = r[a][f];
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
- r[c] = r[c] || {}, r = r[c];
88
+ o[_] = o[_] || {}, o = o[_];
79
89
  } else
80
- r[c] = t;
90
+ o[_] = e;
81
91
  });
82
92
  } else
83
- s[o] = t;
93
+ l[r] = e;
84
94
  }
85
- })(b || (b = {}));
86
- const H = b;
95
+ })(C || (C = {}));
96
+ const F = C;
87
97
  export {
88
- C,
89
- H as F,
90
- A as O,
91
- p as t
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" />