@vnejs/uis.react.icon 0.1.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/dist/Icon.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ import "./Icon.styl";
2
+ export declare const Icon: ({ zIndex, transition, width, height, marginTop, marginRight, marginBottom, marginLeft, aspectRatioX, aspectRatioY, transformOriginX, transformOriginY, scale, opacity, className, src, srcHover, isDisabled, isNotRender, isOpacityOnHover, view, onClick, value, }: {
3
+ zIndex?: any;
4
+ transition?: number;
5
+ width?: number;
6
+ height?: number;
7
+ marginTop?: number;
8
+ marginRight?: number;
9
+ marginBottom?: number;
10
+ marginLeft?: number;
11
+ aspectRatioX?: number;
12
+ aspectRatioY?: number;
13
+ transformOriginX?: any;
14
+ transformOriginY?: any;
15
+ scale?: any;
16
+ opacity?: any;
17
+ className: any;
18
+ src: any;
19
+ srcHover: any;
20
+ isDisabled?: boolean;
21
+ isNotRender?: boolean;
22
+ isOpacityOnHover?: boolean;
23
+ view?: string;
24
+ onClick: any;
25
+ value: any;
26
+ }) => import("react/jsx-runtime").JSX.Element;
27
+ //# sourceMappingURL=Icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../src/Icon.tsx"],"names":[],"mappings":"AAIA,OAAO,aAAa,CAAC;AAIrB,eAAO,MAAM,IAAI,GAAI;;;;;;;;;;;;;;;;;;;;;;;;CAwBpB,4CAyDA,CAAC"}
package/dist/Icon.js ADDED
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useCallback, useMemo } from "react";
3
+ import { cn, getVneLength } from "@vnejs/uis.utils";
4
+ import "./Icon.styl";
5
+ const b = cn("Icon");
6
+ export const Icon = ({ zIndex = null, transition = 300, width = 0, height = 0, marginTop = 0, marginRight = 0, marginBottom = 0, marginLeft = 0, aspectRatioX = 0, aspectRatioY = 0, transformOriginX = null, transformOriginY = null, scale = null, opacity = null, className, src, srcHover, isDisabled = false, isNotRender = false, isOpacityOnHover = false, view = "", onClick, value, }) => {
7
+ const withHoverSrc = !isDisabled && Boolean(srcHover);
8
+ const withOpacityOnHover = !isDisabled && isOpacityOnHover;
9
+ const style = useMemo(() => {
10
+ const result = {};
11
+ if (width)
12
+ result.width = getVneLength(width);
13
+ if (height)
14
+ result.height = getVneLength(height);
15
+ if (scale)
16
+ result.transform = `scale(${scale})`;
17
+ if (transformOriginX !== null || transformOriginY !== null)
18
+ result.transformOrigin = `${transformOriginX || 0} ${transformOriginY || 0}`;
19
+ if (aspectRatioX || aspectRatioY)
20
+ result.aspectRatio = `${aspectRatioX || 1} / ${aspectRatioY || 1}`;
21
+ if (zIndex !== null)
22
+ result.zIndex = zIndex;
23
+ if (opacity !== null)
24
+ result.opacity = opacity;
25
+ if (transition !== null)
26
+ result.transition = transition ? `${transition}ms` : "none";
27
+ if (marginTop)
28
+ result.marginTop = getVneLength(marginTop);
29
+ if (marginRight)
30
+ result.marginRight = getVneLength(marginRight);
31
+ if (marginBottom)
32
+ result.marginBottom = getVneLength(marginBottom);
33
+ if (marginLeft)
34
+ result.marginLeft = getVneLength(marginLeft);
35
+ if (src)
36
+ result["--vne-icon-src"] = `url("${src}")`;
37
+ if (srcHover)
38
+ result["--vne-icon-src-hover"] = `url("${srcHover}")`;
39
+ return result;
40
+ }, [
41
+ zIndex,
42
+ transition,
43
+ opacity,
44
+ width,
45
+ height,
46
+ aspectRatioX,
47
+ aspectRatioY,
48
+ transformOriginX,
49
+ transformOriginY,
50
+ scale,
51
+ src,
52
+ srcHover,
53
+ marginTop,
54
+ marginRight,
55
+ marginBottom,
56
+ marginLeft,
57
+ ]);
58
+ const onClickHandler = useCallback(() => !isDisabled && onClick && onClick(value), [onClick, value, isDisabled]);
59
+ if (isNotRender)
60
+ return null;
61
+ return (_jsx("div", { className: b({ view, isDisabled, withHoverSrc, withOpacityOnHover }, [className]), onClick: onClickHandler, style: style, "vne-cursor-type": !isDisabled ? "pointer" : "" }));
62
+ };
63
+ //# sourceMappingURL=Icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../src/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,aAAa,CAAC;AAErB,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;AAErB,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,EACnB,MAAM,GAAG,IAAI,EACb,UAAU,GAAG,GAAG,EAChB,KAAK,GAAG,CAAC,EACT,MAAM,GAAG,CAAC,EACV,SAAS,GAAG,CAAC,EACb,WAAW,GAAG,CAAC,EACf,YAAY,GAAG,CAAC,EAChB,UAAU,GAAG,CAAC,EACd,YAAY,GAAG,CAAC,EAChB,YAAY,GAAG,CAAC,EAChB,gBAAgB,GAAG,IAAI,EACvB,gBAAgB,GAAG,IAAI,EACvB,KAAK,GAAG,IAAI,EACZ,OAAO,GAAG,IAAI,EACd,SAAS,EACT,GAAG,EACH,QAAQ,EACR,UAAU,GAAG,KAAK,EAClB,WAAW,GAAG,KAAK,EACnB,gBAAgB,GAAG,KAAK,EACxB,IAAI,GAAG,EAAE,EACT,OAAO,EACP,KAAK,GACN,EAAE,EAAE;IACH,MAAM,YAAY,GAAG,CAAC,UAAU,IAAI,OAAO,CAAC,QAAQ,CAAC,CAAC;IACtD,MAAM,kBAAkB,GAAG,CAAC,UAAU,IAAI,gBAAgB,CAAC;IAE3D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACzB,MAAM,MAAM,GAAwB,EAAE,CAAC;QAEvC,IAAI,KAAK;YAAE,MAAM,CAAC,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,MAAM;YAAE,MAAM,CAAC,M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AK;QACL,MAAM;QACN,YAAY;QACZ,YAAY;QACZ,gBAAgB;QAChB,gBAAgB;QAChB,KAAK;QACL,GAAG;QACH,QAAQ;QACR,SAAS;QACT,WAAW;QACX,YAAY;QACZ,UAAU;KACX,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,UAAU,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;IAEjH,IAAI,WAAW;QAAE,OAAO,IAAI,CAAC;IAE7B,OAAO,CACL,cACE,SAAS,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,kBAAkB,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EACjF,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,KAAK,qBACK,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAC7C,CACH,CAAC;AACJ,CAAC,CAAC"}
package/dist/Icon.styl ADDED
@@ -0,0 +1,16 @@
1
+ .Icon
2
+ display: block
3
+
4
+ background-size: 100% 100%;
5
+ background-position: center;
6
+ background-repeat: no-repeat;
7
+ background-image: var(--vne-icon-src)
8
+
9
+ &_withHoverSrc[vne-cursor-target]
10
+ background-image: var(--vne-icon-src-hover)
11
+
12
+ &_withOpacityOnHover
13
+ opacity: 1
14
+
15
+ &[vne-cursor-target]
16
+ opacity: 0.75
@@ -0,0 +1,2 @@
1
+ export * from "./Icon";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from "./Icon";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@vnejs/uis.react.icon",
3
+ "version": "0.1.2",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "scripts": {
7
+ "build": "node ../../scripts/build-package.mjs",
8
+ "publish:major:plugin": "npm run publish:major",
9
+ "publish:minor:plugin": "npm run publish:minor",
10
+ "publish:patch:plugin": "npm run publish:patch",
11
+ "publish:major": "npm run build && npm version major && npm publish --access public",
12
+ "publish:minor": "npm run build && npm version minor && npm publish --access public",
13
+ "publish:patch": "npm run build && npm version patch && npm publish --access public"
14
+ },
15
+ "peerDependencies": {
16
+ "@bem-react/classname": "1.5.12",
17
+ "@vnejs/uis.utils": "~0.1.0",
18
+ "react": "19.2.4",
19
+ "react-dom": "19.2.4"
20
+ },
21
+ "devDependencies": {
22
+ "@vnejs/uis.react": "~0.1.0",
23
+ "typescript": "^5.7.3",
24
+ "@types/react": "^19.0.10",
25
+ "@types/react-dom": "^19.0.4"
26
+ },
27
+ "files": [
28
+ "dist",
29
+ "package.json"
30
+ ]
31
+ }