@cronocode/react-box 1.2.0 → 1.2.2

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 CHANGED
@@ -1,13 +1,13 @@
1
1
  import N, { forwardRef as v, useState as b } from "react";
2
2
  import { c as a } from "./box.module.css.mjs";
3
- import { C as g, t as u } from "./utils/utils.mjs";
3
+ import { C as g, a as u } from "./utils/utils.mjs";
4
4
  function C(n, r) {
5
- const { tag: d, children: e, props: h, className: c, style: l } = n, t = c ? g.classNames(a.box, c) : [a.box];
6
- Object.entries(n).forEach(([o, m]) => {
7
- const p = a[o + m];
8
- p ? t.push(p) : o in u && t.push(`${u[o]}${m}`);
5
+ const { tag: d, children: e, props: h, className: c, style: l } = n, o = c ? g.classNames(a.box, c) : [a.box];
6
+ Object.entries(n).forEach(([t, m]) => {
7
+ const p = a[t + m];
8
+ p ? o.push(p) : t in u && o.push(`${u[t]}${m}`);
9
9
  });
10
- const s = { ...h, className: t.join(" ") };
10
+ const s = { ...h, className: o.join(" ") };
11
11
  l && (s.style = l), r && (s.ref = r);
12
12
  const [x, f] = b(!1), i = typeof e == "function";
13
13
  return i && (s.onMouseEnter = () => f(!0), s.onMouseLeave = () => f(!1)), N.createElement(d || "div", s, i ? e({ isHover: x }) : e);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ColorType, Hovered } from '../types';
2
+ import { Activated, ColorType, Focused, Hovered } from '../types';
3
3
  import ClassNameUtils from '../utils/className/classNameUtils';
4
4
  interface SvgNormalStyles {
5
5
  fill?: ColorType | string;
@@ -7,7 +7,7 @@ interface SvgNormalStyles {
7
7
  rotate?: 0 | 90 | 180 | 270;
8
8
  flip?: 'xAxis' | 'yAxis';
9
9
  }
10
- export type SvgStyles = SvgNormalStyles & Hovered<SvgNormalStyles>;
10
+ export type SvgStyles = SvgNormalStyles & Hovered<SvgNormalStyles> & Focused<SvgNormalStyles> & Activated<SvgNormalStyles>;
11
11
  type AllSvgProps = React.SVGProps<SVGElement>;
12
12
  type SvgPropsType = Omit<AllSvgProps, 'className' | 'style' | 'width' | 'height'>;
13
13
  type SvgStyleType = Omit<React.CSSProperties, 'width' | 'height'>;
@@ -1,21 +1,21 @@
1
- import x, { useState as v } from "react";
2
- import { C as d } from "../utils/utils.mjs";
3
- const a = { base: "cGH", rotate0: "cGI", rotateH0: "cGJ", hovertrue: "_h", rotate90: "cGK", rotateH90: "cGL", rotate180: "cGM", rotateH180: "cGN", rotate270: "cGO", rotateH270: "cGP", flipxAxis: "cGQ", flipHxAxis: "cGR", flipyAxis: "cGS", flipHyAxis: "cGT" }, g = ["fill", "fillH", "stroke", "strokeH"];
1
+ import H, { useState as g } from "react";
2
+ import { C as w, t as p } from "../utils/utils.mjs";
3
+ const a = { base: "cGH", rotate0: "cGI", rotateH0: "cGJ", hovertrue: "_h", rotate90: "cGK", rotateH90: "cGL", rotate180: "cGM", rotateH180: "cGN", rotate270: "cGO", rotateH270: "cGP", flipxAxis: "cGQ", flipHxAxis: "cGR", flipyAxis: "cGS", flipHyAxis: "cGT" };
4
4
  function A(c) {
5
- const { children: s, props: m, className: r, style: p, viewBox: G, width: u, height: H } = c, e = r ? d.classNames(r, a.base) : [a.base];
6
- Object.entries(c).forEach(([o, n]) => {
7
- const f = a[o + n];
8
- f ? e.push(f) : g.includes(o) && e.push(`${o}${n}`);
5
+ const { children: s, props: G, className: r, style: m, viewBox: h, width: u, height: v } = c, e = r ? w.classNames(r, a.base) : [a.base];
6
+ Object.entries(c).forEach(([o, l]) => {
7
+ const f = a[o + l];
8
+ f ? e.push(f) : o in p && e.push(`${p[o]}${l}`);
9
9
  });
10
10
  const t = {
11
- ...m,
12
- style: { ...p, width: u, height: H },
11
+ ...G,
12
+ style: { ...m, width: u, height: v },
13
13
  className: e.join(" "),
14
- viewBox: G || "0 0 24 24",
14
+ viewBox: h || "0 0 24 24",
15
15
  xmlns: "http://www.w3.org/2000/svg",
16
16
  fill: "none"
17
- }, [h, i] = v(!1), l = typeof s == "function";
18
- return l && (t.onMouseEnter = () => i(!0), t.onMouseLeave = () => i(!1)), x.createElement("svg", t, l ? s({ isHover: h }) : s);
17
+ }, [x, i] = g(!1), n = typeof s == "function";
18
+ return n && (t.onMouseEnter = () => i(!0), t.onMouseLeave = () => i(!1)), H.createElement("svg", t, n ? s({ isHover: x }) : s);
19
19
  }
20
20
  export {
21
21
  A as default
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronocode/react-box",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "main": "./box.mjs",
5
5
  "module": "./box.mjs",
6
6
  "types": "./box.d.ts",