@cronocode/react-box 1.1.9 → 1.2.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/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
  };
@@ -21,7 +22,6 @@ export declare const styleVariables: {
21
22
  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
23
  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
24
  sizeMultiplier: number;
24
- baseColors: readonly ["none", "transparent", "black", "white", "blue", "red", "purple", "yellow", "pink", "green", "orange", "navy", "teal", "violet", "gray", "brown", "orange"];
25
25
  borderSizes: readonly [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
26
26
  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
27
  fontWeight: readonly [100, 200, 300, 400, 500, 600, 700, 800, 900];
@@ -45,7 +45,7 @@ type GapType = (typeof styleVariables.gap)[number];
45
45
  type BoxSizeValue = (typeof styleVariables.sizeSpecialValues)[number];
46
46
  type BorderSizeType = (typeof styleVariables.borderSizes)[number];
47
47
  type SizeType = (typeof styleVariables.sizes)[number];
48
- export type ColorType = (typeof styleVariables.baseColors)[number];
48
+ export type ColorType = string;
49
49
  type CursorType = (typeof styleVariables.cursors)[number];
50
50
  type OverflowType = (typeof styleVariables.overflows)[number];
51
51
  type FontSizeType = (typeof styleVariables.fontSizes)[number];
@@ -212,5 +212,6 @@ interface BoxUserSelect {
212
212
  }
213
213
  type BoxNormalStyles = BoxPseudoClasses & BoxDisplay & BoxSizing & BoxPosition & BoxSize & BoxMargin & BoxPadding & BoxBorder & BoxShadow & BoxBackground & BoxColors & BoxCursor & BoxZIndex & BoxOverflow & BoxOpacity & BoxFont & BoxText & BoxFlex & BoxOutline & BoxTransition & BoxUserSelect;
214
214
  export type BoxStyles = BoxNormalStyles & Hovered<BoxNormalStyles> & Focused<BoxNormalStyles> & Activated<BoxNormalStyles>;
215
- export declare const themeClasses: Array<keyof BoxStyles>;
215
+ export declare const themeClasses: Partial<Record<keyof BoxStyles, string>>;
216
+ export declare const themeSvgClasses: Partial<Record<keyof SvgStyles, string>>;
216
217
  export {};
package/utils/utils.mjs CHANGED
@@ -1,92 +1,112 @@
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
- ];
1
+ const C = {
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
+ }, 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_"
45
+ };
27
46
  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, []);
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, []);
33
52
  }
34
- l.classNames = i;
53
+ n.classNames = c;
35
54
  })(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];
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]);
62
+ }), [e, r];
44
63
  }
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;
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;
54
73
  }, {});
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);
74
+ return Object.entries(r).reduce((e, [l, o]) => {
75
+ if (o.length === 1) {
76
+ const _ = o[0];
77
+ i(e, l, _.type === "checkbox" || _.type === "radio" ? _.checked : _.value);
59
78
  } 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);
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, _);
62
81
  }
63
- return t;
82
+ return e;
64
83
  }, {});
65
84
  }
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];
85
+ n.getFormEntries = c;
86
+ function i(t, r, e) {
87
+ if (r.includes(".")) {
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];
77
96
  } else
78
- r[c] = r[c] || {}, r = r[c];
97
+ o[_] = o[_] || {}, o = o[_];
79
98
  } else
80
- r[c] = t;
99
+ o[_] = e;
81
100
  });
82
101
  } else
83
- s[o] = t;
102
+ t[r] = e;
84
103
  }
85
- })(b || (b = {}));
86
- const H = b;
104
+ })(h || (h = {}));
105
+ const F = h;
87
106
  export {
88
- C,
89
- H as F,
90
- A as O,
91
- p as t
107
+ p as C,
108
+ F,
109
+ k as O,
110
+ C as a,
111
+ d as t
92
112
  };