@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/box.mjs +12 -12
- package/box.module.css.mjs +2 -2
- package/components/baseSvg.d.ts +2 -2
- package/components/baseSvg.mjs +15 -15
- package/package.json +3 -1
- package/style.css +1 -1
- package/types.d.ts +4 -3
- package/utils/utils.mjs +96 -76
package/components/baseSvg.d.ts
CHANGED
|
@@ -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'>;
|
package/components/baseSvg.mjs
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { C as
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
const { children:
|
|
6
|
-
Object.entries(
|
|
7
|
-
const
|
|
8
|
-
|
|
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
|
+
function A(c) {
|
|
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
|
-
...
|
|
12
|
-
style: { ...
|
|
13
|
-
className:
|
|
14
|
-
viewBox:
|
|
11
|
+
...G,
|
|
12
|
+
style: { ...m, width: u, height: v },
|
|
13
|
+
className: e.join(" "),
|
|
14
|
+
viewBox: h || "0 0 24 24",
|
|
15
15
|
xmlns: "http://www.w3.org/2000/svg",
|
|
16
16
|
fill: "none"
|
|
17
|
-
}, [
|
|
18
|
-
return
|
|
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
|
|
22
22
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cronocode/react-box",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"main": "./box.mjs",
|
|
5
5
|
"module": "./box.mjs",
|
|
6
6
|
"types": "./box.d.ts",
|
|
@@ -50,8 +50,10 @@
|
|
|
50
50
|
"@vitejs/plugin-react": "^3.1.0",
|
|
51
51
|
"autoprefixer": "^10.4.14",
|
|
52
52
|
"postcss": "^8.4.21",
|
|
53
|
+
"postcss-each": "^1.1.0",
|
|
53
54
|
"postcss-mixins": "^9.0.4",
|
|
54
55
|
"postcss-nested": "^6.0.1",
|
|
56
|
+
"postcss-simple-vars": "^7.0.1",
|
|
55
57
|
"prettier": "^2.8.7",
|
|
56
58
|
"react": "^18.1.0",
|
|
57
59
|
"react-dom": "^18.2.0",
|