@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.
- package/box.mjs +14 -13
- package/package.json +1 -1
- package/types.d.ts +1 -2
package/box.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import
|
|
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:
|
|
7
|
-
const a =
|
|
8
|
-
return Object.entries(
|
|
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
|
-
|
|
14
|
-
const [$, d] = N(!1), f = typeof
|
|
15
|
-
return f && (r.onMouseEnter = () => d(!0), r.onMouseLeave = () => d(!1)),
|
|
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 =
|
|
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
|
-
|
|
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((
|
|
48
|
-
const n = v[
|
|
49
|
-
n && (n in e || (e[n] = e[
|
|
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
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<
|
|
228
|
+
export declare const themeClasses: Partial<Record<string, string>>;
|
|
230
229
|
export declare const themeSvgClasses: Partial<Record<keyof SvgStyles, string>>;
|
|
231
230
|
export {};
|