@cronocode/react-box 1.3.3 → 1.3.5

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.
@@ -1,4 +1,4 @@
1
- const t = { base: "cGQ", rotate0: "cGR", rotateH0: "cGS", hovertrue: "_h", rotate90: "cGT", rotateH90: "cGU", rotate180: "cGV", rotateH180: "cGW", rotate270: "cGX", rotateH270: "cGY", flipxAxis: "cGZ", flipHxAxis: "cG0", flipyAxis: "cG1", flipHyAxis: "cG2", rotateF0: "cG3", focustrue: "_f", rotateF90: "cG4", rotateF180: "cG5", rotateF270: "cG6", flipFxAxis: "cG7", flipFyAxis: "cG8", rotateA0: "cG9", rotateA90: "cHa", rotateA180: "cHb", rotateA270: "cHc", flipAxAxis: "cHd", flipAyAxis: "cHe" };
1
+ const t = { base: "bDG", rotate0: "bDH", rotateH0: "bDI", hovertrue: "_h", rotate90: "bDJ", rotateH90: "bDK", rotate180: "bDL", rotateH180: "bDM", rotate270: "bDN", rotateH270: "bDO", flipxAxis: "bDP", flipHxAxis: "bDQ", flipyAxis: "bDR", flipHyAxis: "bDS", rotateF0: "bDT", focustrue: "_f", rotateF90: "bDU", rotateF180: "bDV", rotateF270: "bDW", flipFxAxis: "bDX", flipFyAxis: "bDY", rotateA0: "bDZ", rotateA90: "bD0", rotateA180: "bD1", rotateA270: "bD2", flipAxAxis: "bD3", flipAyAxis: "bD4" };
2
2
  export {
3
3
  t as c
4
4
  };
package/box.mjs CHANGED
@@ -1,22 +1,54 @@
1
- import $, { forwardRef as b, useState as E } from "react";
2
- import { c } from "./box.module.css.mjs";
3
- import { C as T, a as n } from "./utils/utils.mjs";
4
- import { useTheme as g } from "./theme.mjs";
5
- function j(r, f) {
6
- const { tag: p, children: i, props: d, className: l, style: m } = r, e = l ? T.classNames(c.box, l) : [c.box], x = g(r);
7
- Object.entries(x).forEach(([s, o]) => {
8
- const a = c[s + o];
9
- a ? e.push(a) : s in n && e.push(`${n[s]}${o}`);
10
- }), Object.entries(r).forEach(([s, o]) => {
11
- const a = c[s + o];
12
- a ? e.push(a) : s in n && e.push(`${n[s]}${o}`);
13
- });
14
- const t = { ...d, className: e.join(" ") };
15
- m && (t.style = m), f && (t.ref = f);
16
- const [N, u] = E(!1), h = typeof i == "function";
17
- return h && (t.onMouseEnter = () => u(!0), t.onMouseLeave = () => u(!1)), $.createElement(p || "div", t, h ? i({ isHover: N }) : i);
1
+ import T, { forwardRef as j, useMemo as C, useState as N } from "react";
2
+ import { c as m } from "./box.module.css.mjs";
3
+ import { C as y, a as p } from "./utils/utils.mjs";
4
+ import { useTheme as B } from "./theme.mjs";
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]) => {
9
+ const g = m[i + b];
10
+ g ? a.push(g) : i in p && a.push(`${p[i]}${b}`);
11
+ }), a.join(" ");
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);
16
+ }
17
+ const z = j(P), R = {
18
+ m: "margin",
19
+ mx: "marginHorizontal",
20
+ my: "marginVertical",
21
+ mt: "marginTop",
22
+ mr: "marginRight",
23
+ mb: "marginBottom",
24
+ ml: "marginLeft",
25
+ p: "padding",
26
+ px: "paddingHorizontal",
27
+ py: "paddingVertical",
28
+ pt: "paddingTop",
29
+ pr: "paddingRight",
30
+ pb: "paddingBottom",
31
+ pl: "paddingLeft",
32
+ b: "border",
33
+ bx: "borderHorizontal",
34
+ by: "borderVertical",
35
+ bt: "borderTop",
36
+ br: "borderRight",
37
+ bb: "borderBottom",
38
+ bl: "borderLeft",
39
+ bg: "background",
40
+ jc: "justifyContent",
41
+ ai: "alignItems",
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), {});
45
+ function u(t) {
46
+ 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]);
50
+ }), e;
18
51
  }
19
- const A = b(j);
20
52
  export {
21
- A as default
53
+ z as default
22
54
  };