@cronocode/react-box 1.3.7 → 1.3.8

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.
Files changed (3) hide show
  1. package/box.mjs +14 -13
  2. package/package.json +1 -1
  3. package/types.d.ts +1 -2
package/box.mjs CHANGED
@@ -1,20 +1,20 @@
1
- import T, { forwardRef as j, useMemo as C, useState as N } from "react";
1
+ import H, { forwardRef as T, useMemo as j, useState as N } from "react";
2
2
  import { c as m } from "./box.module.css.mjs";
3
3
  import { C as y, a as p } from "./utils/utils.mjs";
4
4
  import { useTheme as B } from "./theme.mjs";
5
5
  function P(t, e) {
6
- const { tag: s, children: o, props: n, className: c, style: l } = t, h = B(t), x = C(() => {
7
- const a = c ? y.classNames(m.box, c) : [m.box], H = { ...u(h), ...u(t) };
8
- return Object.entries(H).forEach(([i, b]) => {
6
+ const { tag: o, children: s, props: n, className: l, style: c } = t, h = B(t), x = j(() => {
7
+ const a = l ? y.classNames(m.box, l) : [m.box], C = { ...u(h), ...u(t) };
8
+ return Object.entries(C).forEach(([i, b]) => {
9
9
  const g = m[i + b];
10
10
  g ? a.push(g) : i in p && a.push(`${p[i]}${b}`);
11
11
  }), a.join(" ");
12
12
  }, [t]), r = { ...n, className: x };
13
- l && (r.style = l), e && (r.ref = e);
14
- const [$, d] = N(!1), f = typeof o == "function";
15
- return f && (r.onMouseEnter = () => d(!0), r.onMouseLeave = () => d(!1)), T.createElement(s || "div", r, f ? o({ isHover: $ }) : o);
13
+ c && (r.style = c), e && (r.ref = e);
14
+ const [$, d] = N(!1), f = typeof s == "function";
15
+ return f && (r.onMouseEnter = () => d(!0), r.onMouseLeave = () => d(!1)), H.createElement(o || "div", r, f ? s({ isHover: $ }) : s);
16
16
  }
17
- const z = j(P), R = {
17
+ const z = T(P), R = {
18
18
  m: "margin",
19
19
  mx: "marginHorizontal",
20
20
  my: "marginVertical",
@@ -40,13 +40,14 @@ const z = j(P), R = {
40
40
  jc: "justifyContent",
41
41
  ai: "alignItems",
42
42
  ac: "alignContent",
43
- d: "flexDirection"
44
- }, v = Object.entries(R).reduce((t, [e, s]) => (t[e] = s, t[`${e}H`] = `${s}H`, t[`${e}F`] = `${s}F`, t[`${e}A`] = `${s}A`, t), {});
43
+ d: "flexDirection",
44
+ bgColor: "backgroundColor"
45
+ }, v = Object.entries(R).reduce((t, [e, o]) => (t[e] = o, t[`${e}H`] = `${o}H`, t[`${e}F`] = `${o}F`, t[`${e}A`] = `${o}A`, t), {});
45
46
  function u(t) {
46
47
  const e = { ...t };
47
- return Object.keys(e).forEach((o) => {
48
- const n = v[o];
49
- n && (n in e || (e[n] = e[o]), delete e[o]);
48
+ return Object.keys(e).forEach((s) => {
49
+ const n = v[s];
50
+ n && (n in e || (e[n] = e[s]), delete e[s]);
50
51
  }), e;
51
52
  }
52
53
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "main": "./box.mjs",
5
5
  "module": "./box.mjs",
6
6
  "types": "./box.d.ts",
package/types.d.ts CHANGED
@@ -161,7 +161,6 @@ interface BoxBackground {
161
161
  bg?: BackgroundType | string;
162
162
  }
163
163
  interface BoxColors {
164
- color?: ColorType | string;
165
164
  backgroundColor?: ColorType | string;
166
165
  bgColor?: ColorType | string;
167
166
  borderColor?: ColorType | string;
@@ -226,6 +225,6 @@ interface BoxPointerEvents {
226
225
  }
227
226
  type BoxNormalStyles = BoxPseudoClasses & BoxDisplay & BoxSizing & BoxPosition & BoxSize & BoxMargin & BoxPadding & BoxBorder & BoxShadow & BoxBackground & BoxColors & BoxCursor & BoxZIndex & BoxOverflow & BoxOpacity & BoxFont & BoxText & BoxFlex & BoxOutline & BoxTransition & BoxUserSelect & BoxAppearance & BoxPointerEvents;
228
227
  export type BoxStyles = BoxNormalStyles & Hovered<BoxNormalStyles> & Focused<BoxNormalStyles> & Activated<BoxNormalStyles>;
229
- export declare const themeClasses: Partial<Record<keyof BoxStyles, string>>;
228
+ export declare const themeClasses: Partial<Record<string, string>>;
230
229
  export declare const themeSvgClasses: Partial<Record<keyof SvgStyles, string>>;
231
230
  export {};