@omnific/icons 0.1.0

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/README.md ADDED
@@ -0,0 +1,19 @@
1
+ # @omnific/icons
2
+
3
+ React icon components for Omnific.
4
+
5
+ ```tsx
6
+ import { LoadingIcon } from '@omnific/icons';
7
+
8
+ <LoadingIcon size={20} aria-label='Loading' />;
9
+ ```
10
+
11
+ ## Icon preview
12
+
13
+ The React preview app lives in `docs/icons` and is deployed to GitHub Pages from `main`:
14
+
15
+ - Local dev: `pnpm --dir docs/icons dev`
16
+ - Production build: `pnpm --dir docs/icons build`
17
+ - Local production preview: `pnpm --dir docs/icons preview`
18
+ - Pages artifact check: `pnpm --dir docs/icons verify:pages`
19
+ - Online preview: https://monhan-97.github.io/omnific/
@@ -0,0 +1,14 @@
1
+ import { IconProps } from "./iconTypes.js";
2
+ import * as _$react from "react";
3
+
4
+ //#region EyeIcon.d.ts
5
+ /**
6
+ Props accepted by {@link EyeIcon}.
7
+ */
8
+ type EyeIconProps = IconProps;
9
+ /**
10
+ Renders an eye used to indicate visible content.
11
+ */
12
+ declare const EyeIcon: _$react.ComponentType<IconProps>;
13
+ //#endregion
14
+ export { EyeIcon, EyeIconProps };
@@ -0,0 +1,12 @@
1
+ import { createIcon } from "./createIcon.js";
2
+ //#region EyeIcon.tsx
3
+ /**
4
+ Renders an eye used to indicate visible content.
5
+ */
6
+ const EyeIcon = createIcon([["path", { d: "M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0" }], ["circle", {
7
+ cx: "12",
8
+ cy: "12",
9
+ r: "3"
10
+ }]]);
11
+ //#endregion
12
+ export { EyeIcon };
@@ -0,0 +1,14 @@
1
+ import { IconProps } from "./iconTypes.js";
2
+ import * as _$react from "react";
3
+
4
+ //#region EyeOffIcon.d.ts
5
+ /**
6
+ Props accepted by {@link EyeOffIcon}.
7
+ */
8
+ type EyeOffIconProps = IconProps;
9
+ /**
10
+ Renders a crossed-out eye used to indicate hidden content.
11
+ */
12
+ declare const EyeOffIcon: _$react.ComponentType<IconProps>;
13
+ //#endregion
14
+ export { EyeOffIcon, EyeOffIconProps };
@@ -0,0 +1,13 @@
1
+ import { createIcon } from "./createIcon.js";
2
+ //#region EyeOffIcon.tsx
3
+ /**
4
+ Renders a crossed-out eye used to indicate hidden content.
5
+ */
6
+ const EyeOffIcon = createIcon([
7
+ ["path", { d: "M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.8 10.8 0 0 1-1.444 2.49" }],
8
+ ["path", { d: "M14.084 14.158a3 3 0 0 1-4.242-4.242" }],
9
+ ["path", { d: "M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143" }],
10
+ ["path", { d: "m2 2 20 20" }]
11
+ ]);
12
+ //#endregion
13
+ export { EyeOffIcon };
@@ -0,0 +1,14 @@
1
+ import { IconProps } from "./iconTypes.js";
2
+ import * as _$react from "react";
3
+
4
+ //#region LoadingIcon.d.ts
5
+ /**
6
+ Props accepted by {@link LoadingIcon}.
7
+ */
8
+ type LoadingIconProps = IconProps;
9
+ /**
10
+ Renders the package loading indicator.
11
+ */
12
+ declare const LoadingIcon: _$react.ComponentType<IconProps>;
13
+ //#endregion
14
+ export { LoadingIcon, LoadingIconProps };
@@ -0,0 +1,8 @@
1
+ import { createIcon } from "./createIcon.js";
2
+ //#region LoadingIcon.tsx
3
+ /**
4
+ Renders the package loading indicator.
5
+ */
6
+ const LoadingIcon = createIcon([["path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }]]);
7
+ //#endregion
8
+ export { LoadingIcon };
@@ -0,0 +1,12 @@
1
+ import { IconProps } from "./iconTypes.js";
2
+ import * as _$react from "react";
3
+
4
+ //#region SvgIcon.d.ts
5
+ /**
6
+ * SvgIcon 组件,用于渲染自定义的 SVG 图标
7
+ * @param {IconProps} props - 组件的属性对象
8
+ * @returns {JSX.Element} 返回一个 SVG 元素
9
+ */
10
+ declare const SvgIcon: (props: IconProps) => _$react.JSX.Element;
11
+ //#endregion
12
+ export { SvgIcon };
@@ -0,0 +1,22 @@
1
+ import { svgAttributes } from "./svgAttributes.js";
2
+ import { jsx } from "react/jsx-runtime";
3
+ //#region SvgIcon.tsx
4
+ /**
5
+ * SvgIcon 组件,用于渲染自定义的 SVG 图标
6
+ * @param {IconProps} props - 组件的属性对象
7
+ * @returns {JSX.Element} 返回一个 SVG 元素
8
+ */
9
+ const SvgIcon = (props) => {
10
+ const { absoluteStrokeWidth = false, children, color = svgAttributes.stroke, size = 24, strokeWidth = 2, ...restProps } = props;
11
+ return /* @__PURE__ */ jsx("svg", {
12
+ ...svgAttributes,
13
+ width: size,
14
+ height: size,
15
+ stroke: color,
16
+ strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
17
+ ...restProps,
18
+ children
19
+ });
20
+ };
21
+ //#endregion
22
+ export { SvgIcon };
@@ -0,0 +1,19 @@
1
+ import { SvgIcon } from "./SvgIcon.js";
2
+ import { createElement } from "react";
3
+ //#region createIcon.ts
4
+ /**
5
+ Creates a named package icon from immutable SVG artwork nodes.
6
+ */
7
+ const createIcon = (nodes) => {
8
+ const artwork = nodes.map(([tag, attributes], index) => createElement(tag, {
9
+ ...attributes,
10
+ key: `${tag}-${index}`
11
+ }));
12
+ const Icon = (props) => {
13
+ const { children, ...properties } = props;
14
+ return createElement(SvgIcon, properties, artwork, children);
15
+ };
16
+ return Icon;
17
+ };
18
+ //#endregion
19
+ export { createIcon };
@@ -0,0 +1,22 @@
1
+ import { ComponentPropsWithRef, ReactNode } from "react";
2
+
3
+ //#region iconTypes.d.ts
4
+ /**
5
+ Props shared by the package's SVG icon components.
6
+ */
7
+ type IconProps = ComponentPropsWithRef<'svg'> & {
8
+ /**
9
+ Icon width and height in pixels.
10
+ */
11
+ size?: number | string;
12
+ /**
13
+ Keeps the apparent stroke width constant when the icon is resized.
14
+ */
15
+ absoluteStrokeWidth?: boolean;
16
+ /**
17
+ Optional artwork or consumer content rendered after the icon nodes.
18
+ */
19
+ children?: ReactNode;
20
+ };
21
+ //#endregion
22
+ export { IconProps };
package/dist/main.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { EyeIcon, EyeIconProps } from "./EyeIcon.js";
2
+ import { EyeOffIcon, EyeOffIconProps } from "./EyeOffIcon.js";
3
+ import { LoadingIcon, LoadingIconProps } from "./LoadingIcon.js";
4
+ export { EyeIcon, type EyeIconProps, EyeOffIcon, type EyeOffIconProps, LoadingIcon, type LoadingIconProps };
package/dist/main.js ADDED
@@ -0,0 +1,4 @@
1
+ import { EyeIcon } from "./EyeIcon.js";
2
+ import { EyeOffIcon } from "./EyeOffIcon.js";
3
+ import { LoadingIcon } from "./LoadingIcon.js";
4
+ export { EyeIcon, EyeOffIcon, LoadingIcon };
@@ -0,0 +1,15 @@
1
+ //#region svgAttributes.ts
2
+ /**
3
+ Default SVG attributes shared by the package's icon components.
4
+ */
5
+ const svgAttributes = {
6
+ xmlns: "http://www.w3.org/2000/svg",
7
+ viewBox: "0 0 24 24",
8
+ fill: "none",
9
+ stroke: "currentColor",
10
+ strokeWidth: 2,
11
+ strokeLinecap: "round",
12
+ strokeLinejoin: "round"
13
+ };
14
+ //#endregion
15
+ export { svgAttributes };
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "@omnific/icons",
3
+ "version": "0.1.0",
4
+ "description": "React icon components for Omnific",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "keywords": [
8
+ "react",
9
+ "icons",
10
+ "svg"
11
+ ],
12
+ "author": "monhan-97",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/monhan-97/omnific.git",
16
+ "directory": "packages/icons"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/monhan-97/omnific.git/issues"
20
+ },
21
+ "main": "./dist/main.js",
22
+ "module": "./dist/main.js",
23
+ "types": "./dist/main.d.ts",
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/main.d.ts",
27
+ "import": "./dist/main.js",
28
+ "default": "./dist/main.js"
29
+ },
30
+ "./EyeIcon": {
31
+ "types": "./dist/EyeIcon.d.ts",
32
+ "import": "./dist/EyeIcon.js",
33
+ "default": "./dist/EyeIcon.js"
34
+ },
35
+ "./EyeOffIcon": {
36
+ "types": "./dist/EyeOffIcon.d.ts",
37
+ "import": "./dist/EyeOffIcon.js",
38
+ "default": "./dist/EyeOffIcon.js"
39
+ },
40
+ "./LoadingIcon": {
41
+ "types": "./dist/LoadingIcon.d.ts",
42
+ "import": "./dist/LoadingIcon.js",
43
+ "default": "./dist/LoadingIcon.js"
44
+ }
45
+ },
46
+ "sideEffects": false,
47
+ "files": [
48
+ "dist",
49
+ "README.md"
50
+ ],
51
+ "peerDependencies": {
52
+ "react": "^19.0.0"
53
+ },
54
+ "devDependencies": {
55
+ "@types/react": "^19.2.18",
56
+ "react": "^19.2.8",
57
+ "vitest": "^4.1.10",
58
+ "@omnific/tsconfig": "0.2.0"
59
+ },
60
+ "scripts": {
61
+ "build": "tsdown -c tsdown.config.mjs",
62
+ "test": "vitest run",
63
+ "typecheck": "tsc -p tsconfig.json --noEmit"
64
+ }
65
+ }