@cronocode/react-box 1.1.9 → 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
@@ -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];
@@ -45,7 +44,7 @@ type GapType = (typeof styleVariables.gap)[number];
45
44
  type BoxSizeValue = (typeof styleVariables.sizeSpecialValues)[number];
46
45
  type BorderSizeType = (typeof styleVariables.borderSizes)[number];
47
46
  type SizeType = (typeof styleVariables.sizes)[number];
48
- export type ColorType = (typeof styleVariables.baseColors)[number];
47
+ export type ColorType = string;
49
48
  type CursorType = (typeof styleVariables.cursors)[number];
50
49
  type OverflowType = (typeof styleVariables.overflows)[number];
51
50
  type FontSizeType = (typeof styleVariables.fontSizes)[number];
@@ -212,5 +211,5 @@ interface BoxUserSelect {
212
211
  }
213
212
  type BoxNormalStyles = BoxPseudoClasses & BoxDisplay & BoxSizing & BoxPosition & BoxSize & BoxMargin & BoxPadding & BoxBorder & BoxShadow & BoxBackground & BoxColors & BoxCursor & BoxZIndex & BoxOverflow & BoxOpacity & BoxFont & BoxText & BoxFlex & BoxOutline & BoxTransition & BoxUserSelect;
214
213
  export type BoxStyles = BoxNormalStyles & Hovered<BoxNormalStyles> & Focused<BoxNormalStyles> & Activated<BoxNormalStyles>;
215
- export declare const themeClasses: Array<keyof BoxStyles>;
214
+ export declare const themeClasses: Partial<Record<keyof BoxStyles, string>>;
216
215
  export {};
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
  };