@jannchie/icons-react 0.7.0 → 0.9.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.
Files changed (3) hide show
  1. package/NOTICE +32 -32
  2. package/README.md +96 -96
  3. package/package.json +64 -64
package/NOTICE CHANGED
@@ -1,32 +1,32 @@
1
- Jannchie Icons
2
- Copyright (c) 2026 Jianqi Pan
3
-
4
- What the MIT license covers
5
-
6
- The MIT license in LICENSE covers this project's code, including the drawing
7
- code of every icon, and the original icons designed for this project.
8
-
9
- Third-party characters and marks
10
-
11
- Some icons refer to or depict characters, logos and marks that belong to third
12
- parties. They are included as fan art or for nominative reference only, for
13
- example to label a link, a file type or a rating. All rights in these
14
- characters, trademarks and logos remain with their respective owners. The MIT
15
- license does not grant any right to them, and including them here does not
16
- imply any affiliation with or endorsement by their owners. Check the owners'
17
- guidelines before using these icons. They include:
18
-
19
- - Chiikawa characters: chiikawa, hachiware, usagi
20
- - Content rating marks: MPA, ESRB, PEGI, BBFC, ACB, Eirin, CERO, KMRB, USK,
21
- CADPA (the rating-* icons, except the original rating-sensitivity-* set)
22
- - Creative Commons symbols (cc and the cc-* icons)
23
- - Company and project logos: GitHub (github), Model Context Protocol (mcp)
24
- and programming language logos
25
- (python, javascript, typescript, java, c, csharp, cpp, golang, rust, php,
26
- kotlin, swift, ruby, lua, haskell, html)
27
- - Game controller buttons: PlayStation (playstation-*) and Xbox (xbox-*)
28
- - License names (the license-* icons)
29
-
30
- These icons are still exported from the main entry of @jannchie/icons so that
31
- existing imports keep working. They are planned to move to a separate entry in
32
- version 1.0.
1
+ Jannchie Icons
2
+ Copyright (c) 2026 Jianqi Pan
3
+
4
+ What the MIT license covers
5
+
6
+ The MIT license in LICENSE covers this project's code, including the drawing
7
+ code of every icon, and the original icons designed for this project.
8
+
9
+ Third-party characters and marks
10
+
11
+ Some icons refer to or depict characters, logos and marks that belong to third
12
+ parties. They are included as fan art or for nominative reference only, for
13
+ example to label a link, a file type or a rating. All rights in these
14
+ characters, trademarks and logos remain with their respective owners. The MIT
15
+ license does not grant any right to them, and including them here does not
16
+ imply any affiliation with or endorsement by their owners. Check the owners'
17
+ guidelines before using these icons. They include:
18
+
19
+ - Chiikawa characters: chiikawa, hachiware, usagi
20
+ - Content rating marks: MPA, ESRB, PEGI, BBFC, ACB, Eirin, CERO, KMRB, USK,
21
+ CADPA (the rating-* icons, except the original rating-sensitivity-* set)
22
+ - Creative Commons symbols (cc and the cc-* icons)
23
+ - Company and project logos: GitHub (github), Model Context Protocol (mcp)
24
+ and programming language logos
25
+ (python, javascript, typescript, java, c, csharp, cpp, golang, rust, php,
26
+ kotlin, swift, ruby, lua, haskell, html)
27
+ - Game controller buttons: PlayStation (playstation-*) and Xbox (xbox-*)
28
+ - License names (the license-* icons)
29
+
30
+ These icons are still exported from the main entry of @jannchie/icons so that
31
+ existing imports keep working. They are planned to move to a separate entry in
32
+ version 1.0.
package/README.md CHANGED
@@ -1,96 +1,96 @@
1
- # @jannchie/icons-react
2
-
3
- React component for [Jannchie Icons](https://icons.jannchie.com): one `<JIcon>` renders any icon from [`@jannchie/icons`](https://www.npmjs.com/package/@jannchie/icons), redrawn for the corner radius and stroke weight you choose, snapped to the device pixel grid, with optional duo-tone colors. Set the radius and weight once for the whole app.
4
-
5
- ```sh
6
- pnpm add @jannchie/icons @jannchie/icons-react
7
- ```
8
-
9
- ```jsx
10
- import { IconFolderPlus, IconHeart } from '@jannchie/icons'
11
- import { JIcon } from '@jannchie/icons-react'
12
-
13
- export function Toolbar({ onCreate }) {
14
- return (
15
- <>
16
- <JIcon icon={IconHeart} size={20} />
17
- <JIcon icon={IconFolderPlus} radius="sharp" weight="bold" duo title="New folder" className="icon" onClick={onCreate} />
18
- </>
19
- )
20
- }
21
- ```
22
-
23
- Icons are imported one by one, so bundlers keep only those you use. One icon, the drawing engine and the component add about 9 KB gzipped to an app (measured with Vite 8); the [static entry](#static-entry) adds about 0.5 KB.
24
-
25
- ## Props
26
-
27
- | Prop | Values | Default |
28
- |---|---|---|
29
- | `icon` | an icon object such as `IconHeart` (required) | — |
30
- | `size` | width and height: a number (px) or a CSS length such as `'1em'` | `24` |
31
- | `radius` | `'sharp'`, `0`, `1`, `2`, `3` | `2` |
32
- | `weight` | `'light'`, `'regular'`, `'bold'` | `'regular'` |
33
- | `duo` | color badges and strike-throughs by meaning | `false` |
34
- | `theme` | `'light'` or `'dark'` recommended colors for `duo` | `'light'` |
35
- | `colors` | overrides: `{ primary, danger, success, warning, info, accent }`, any CSS color including `var(--x)` | — |
36
- | `title` | accessible name, see [Accessibility](#accessibility) | — |
37
- | `hinting` | shift the icon so stroke edges land on device pixels | `false` |
38
-
39
- The icon is drawn with `currentColor`, so it follows the text color. All other props (`className`, `style`, event handlers, `aria-*`, `data-*`) go to the root `<svg>`, and `ref` gives you the `SVGSVGElement`. Animated icons (such as `IconLoadingAtom`) play through SVG `<animate>` elements, without JavaScript.
40
-
41
- ### Pixel hinting
42
-
43
- Off by default: icons render with their exact geometry, like other icon sets. Turn it on (`hinting`, or in the defaults) to redraw the icon for `size × devicePixelRatio` device pixels and shift it by less than half a pixel so the outer edges of horizontal and vertical strokes land on pixel boundaries. This sharpens small icons on 1× screens (16 and 20 px) at the cost of sub-pixel offsets between icons. It needs `size` in pixels (a number, `'20'` or `'20px'`) and follows changes of the device pixel ratio.
44
-
45
- ## App-wide defaults
46
-
47
- Wrap the app (or any part of it) in `IconProvider` to give every `JIcon` below it the same radius, weight or size; props on a single icon still win. Nested providers merge with outer ones (`colors` merges role by role).
48
-
49
- ```jsx
50
- import { IconProvider } from '@jannchie/icons-react'
51
-
52
- root.render(
53
- <IconProvider radius="sharp" weight="bold" size={18}>
54
- <App />
55
- </IconProvider>,
56
- )
57
- ```
58
-
59
- `IconProvider` takes `size`, `radius`, `weight`, `duo`, `theme`, `colors` and `hinting`. Pass a stable `colors` object (a constant or `useMemo`) so that the context value does not change on every render. `IconContext` is exported for reading the merged defaults.
60
-
61
- ## Server-side rendering
62
-
63
- The component is safe to render on the server (Next.js, Remix, Vite SSR): nothing touches `window` at import or render time. The server renders as if the device pixel ratio were 1; during hydration React uses the same value, then re-renders icons with the real ratio, so hydration does not report mismatches.
64
-
65
- The main entry uses hooks and starts with `'use client'`, so in the Next.js App Router it works from Server Components as a client component. To render icons inside Server Components without client JavaScript, use the [static entry](#static-entry), which has no hooks.
66
-
67
- ## Accessibility
68
-
69
- Icons are decorative by default: the `<svg>` gets `aria-hidden="true"`, and screen readers read the surrounding text instead. When an icon carries meaning on its own (an icon-only button, a status mark), pass `title`: the `<svg>` gets `role="img"` and a `<title>` child that names it.
70
-
71
- ```jsx
72
- <button type="button" onClick={remove}>
73
- <JIcon icon={IconTrash} title="Delete" />
74
- </button>
75
- ```
76
-
77
- You can also label the button itself (`aria-label="Delete"`) and keep the icon decorative. Props you pass, such as `aria-label` or `aria-hidden`, override the defaults.
78
-
79
- ## Static entry
80
-
81
- `@jannchie/icons-react/static` renders the precomputed icons of [`@jannchie/icons/static`](https://www.npmjs.com/package/@jannchie/icons#static-entry): the default style only (radius 2, regular weight, single color), no hinting, and no drawing engine in the bundle. It takes `icon`, `size` (default 24) and `title`, does not read `IconProvider`, and uses no hooks, so it also renders in React Server Components.
82
-
83
- ```jsx
84
- import { IconHeart } from '@jannchie/icons/static'
85
- import { JIcon } from '@jannchie/icons-react/static'
86
-
87
- <JIcon icon={IconHeart} size="1em" />
88
- ```
89
-
90
- ## Requirements
91
-
92
- React 18 or later, and `@jannchie/icons` of the same version as this package (both are peer dependencies). ES modules and CommonJS builds with TypeScript types are included.
93
-
94
- ## License
95
-
96
- MIT. See the [`@jannchie/icons` README](https://www.npmjs.com/package/@jannchie/icons#license) for third-party marks among the icons.
1
+ # @jannchie/icons-react
2
+
3
+ React component for [Jannchie Icons](https://icons.jannchie.com): one `<JIcon>` renders any icon from [`@jannchie/icons`](https://www.npmjs.com/package/@jannchie/icons), redrawn for the corner radius and stroke weight you choose, snapped to the device pixel grid, with optional duo-tone colors. Set the radius and weight once for the whole app.
4
+
5
+ ```sh
6
+ pnpm add @jannchie/icons @jannchie/icons-react
7
+ ```
8
+
9
+ ```jsx
10
+ import { IconFolderPlus, IconHeart } from '@jannchie/icons'
11
+ import { JIcon } from '@jannchie/icons-react'
12
+
13
+ export function Toolbar({ onCreate }) {
14
+ return (
15
+ <>
16
+ <JIcon icon={IconHeart} size={20} />
17
+ <JIcon icon={IconFolderPlus} radius="sharp" weight="bold" duo title="New folder" className="icon" onClick={onCreate} />
18
+ </>
19
+ )
20
+ }
21
+ ```
22
+
23
+ Icons are imported one by one, so bundlers keep only those you use. One icon, the drawing engine and the component add about 9 KB gzipped to an app (measured with Vite 8); the [static entry](#static-entry) adds about 0.5 KB.
24
+
25
+ ## Props
26
+
27
+ | Prop | Values | Default |
28
+ |---|---|---|
29
+ | `icon` | an icon object such as `IconHeart` (required) | — |
30
+ | `size` | width and height: a number (px) or a CSS length such as `'1em'` | `24` |
31
+ | `radius` | `'sharp'`, `0`, `1`, `2`, `3` | `2` |
32
+ | `weight` | `'light'`, `'regular'`, `'bold'` | `'regular'` |
33
+ | `duo` | color badges and strike-throughs by meaning | `false` |
34
+ | `theme` | `'light'` or `'dark'` recommended colors for `duo` | `'light'` |
35
+ | `colors` | overrides: `{ primary, danger, success, warning, info, accent }`, any CSS color including `var(--x)` | — |
36
+ | `title` | accessible name, see [Accessibility](#accessibility) | — |
37
+ | `hinting` | shift the icon so stroke edges land on device pixels | `false` |
38
+
39
+ The icon is drawn with `currentColor`, so it follows the text color. All other props (`className`, `style`, event handlers, `aria-*`, `data-*`) go to the root `<svg>`, and `ref` gives you the `SVGSVGElement`. Animated icons (such as `IconLoadingAtom`) play through SVG `<animate>` elements, without JavaScript.
40
+
41
+ ### Pixel hinting
42
+
43
+ Off by default: icons render with their exact geometry, like other icon sets. Turn it on (`hinting`, or in the defaults) to redraw the icon for `size × devicePixelRatio` device pixels and shift it by less than half a pixel so the outer edges of horizontal and vertical strokes land on pixel boundaries. This sharpens small icons on 1× screens (16 and 20 px) at the cost of sub-pixel offsets between icons. It needs `size` in pixels (a number, `'20'` or `'20px'`) and follows changes of the device pixel ratio.
44
+
45
+ ## App-wide defaults
46
+
47
+ Wrap the app (or any part of it) in `IconProvider` to give every `JIcon` below it the same radius, weight or size; props on a single icon still win. Nested providers merge with outer ones (`colors` merges role by role).
48
+
49
+ ```jsx
50
+ import { IconProvider } from '@jannchie/icons-react'
51
+
52
+ root.render(
53
+ <IconProvider radius="sharp" weight="bold" size={18}>
54
+ <App />
55
+ </IconProvider>,
56
+ )
57
+ ```
58
+
59
+ `IconProvider` takes `size`, `radius`, `weight`, `duo`, `theme`, `colors` and `hinting`. Pass a stable `colors` object (a constant or `useMemo`) so that the context value does not change on every render. `IconContext` is exported for reading the merged defaults.
60
+
61
+ ## Server-side rendering
62
+
63
+ The component is safe to render on the server (Next.js, Remix, Vite SSR): nothing touches `window` at import or render time. The server renders as if the device pixel ratio were 1; during hydration React uses the same value, then re-renders icons with the real ratio, so hydration does not report mismatches.
64
+
65
+ The main entry uses hooks and starts with `'use client'`, so in the Next.js App Router it works from Server Components as a client component. To render icons inside Server Components without client JavaScript, use the [static entry](#static-entry), which has no hooks.
66
+
67
+ ## Accessibility
68
+
69
+ Icons are decorative by default: the `<svg>` gets `aria-hidden="true"`, and screen readers read the surrounding text instead. When an icon carries meaning on its own (an icon-only button, a status mark), pass `title`: the `<svg>` gets `role="img"` and a `<title>` child that names it.
70
+
71
+ ```jsx
72
+ <button type="button" onClick={remove}>
73
+ <JIcon icon={IconTrash} title="Delete" />
74
+ </button>
75
+ ```
76
+
77
+ You can also label the button itself (`aria-label="Delete"`) and keep the icon decorative. Props you pass, such as `aria-label` or `aria-hidden`, override the defaults.
78
+
79
+ ## Static entry
80
+
81
+ `@jannchie/icons-react/static` renders the precomputed icons of [`@jannchie/icons/static`](https://www.npmjs.com/package/@jannchie/icons#static-entry): the default style only (radius 2, regular weight, single color), no hinting, and no drawing engine in the bundle. It takes `icon`, `size` (default 24) and `title`, does not read `IconProvider`, and uses no hooks, so it also renders in React Server Components.
82
+
83
+ ```jsx
84
+ import { IconHeart } from '@jannchie/icons/static'
85
+ import { JIcon } from '@jannchie/icons-react/static'
86
+
87
+ <JIcon icon={IconHeart} size="1em" />
88
+ ```
89
+
90
+ ## Requirements
91
+
92
+ React 18 or later, and `@jannchie/icons` of the same version as this package (both are peer dependencies). ES modules and CommonJS builds with TypeScript types are included.
93
+
94
+ ## License
95
+
96
+ MIT. See the [`@jannchie/icons` README](https://www.npmjs.com/package/@jannchie/icons#license) for third-party marks among the icons.
package/package.json CHANGED
@@ -1,64 +1,64 @@
1
- {
2
- "name": "@jannchie/icons-react",
3
- "version": "0.7.0",
4
- "description": "React component for Jannchie Icons: one <JIcon> for every icon, with context defaults for radius and weight, pixel hinting and duo-tone colors",
5
- "license": "MIT",
6
- "author": "Jianqi Pan",
7
- "homepage": "https://icons.jannchie.com",
8
- "bugs": {
9
- "url": "https://github.com/Jannchie/jannchie-icons/issues"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "git+https://github.com/Jannchie/jannchie-icons.git",
14
- "directory": "packages/react"
15
- },
16
- "keywords": [
17
- "icons",
18
- "svg",
19
- "line-icons",
20
- "react", "component"
21
- ],
22
- "type": "module",
23
- "sideEffects": false,
24
- "main": "./dist/index.cjs",
25
- "module": "./dist/index.js",
26
- "types": "./dist/index.d.ts",
27
- "exports": {
28
- ".": {
29
- "import": {
30
- "types": "./dist/index.d.ts",
31
- "default": "./dist/index.js"
32
- },
33
- "require": {
34
- "types": "./dist/index.d.cts",
35
- "default": "./dist/index.cjs"
36
- }
37
- },
38
- "./static": {
39
- "import": {
40
- "types": "./dist/static.d.ts",
41
- "default": "./dist/static.js"
42
- },
43
- "require": {
44
- "types": "./dist/static.d.cts",
45
- "default": "./dist/static.cjs"
46
- }
47
- },
48
- "./package.json": "./package.json"
49
- },
50
- "peerDependencies": {
51
- "@jannchie/icons": "^0.7.0",
52
- "react": ">=18.0.0"
53
- },
54
- "devDependencies": {
55
- "@jannchie/icons": "workspace:^"
56
- },
57
- "engines": {
58
- "node": ">=18"
59
- },
60
- "files": [
61
- "dist",
62
- "NOTICE"
63
- ]
64
- }
1
+ {
2
+ "name": "@jannchie/icons-react",
3
+ "version": "0.9.0",
4
+ "description": "React component for Jannchie Icons: one <JIcon> for every icon, with context defaults for radius and weight, pixel hinting and duo-tone colors",
5
+ "license": "MIT",
6
+ "author": "Jianqi Pan",
7
+ "homepage": "https://icons.jannchie.com",
8
+ "bugs": {
9
+ "url": "https://github.com/Jannchie/jannchie-icons/issues"
10
+ },
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/Jannchie/jannchie-icons.git",
14
+ "directory": "packages/react"
15
+ },
16
+ "keywords": [
17
+ "icons",
18
+ "svg",
19
+ "line-icons",
20
+ "react", "component"
21
+ ],
22
+ "type": "module",
23
+ "sideEffects": false,
24
+ "main": "./dist/index.cjs",
25
+ "module": "./dist/index.js",
26
+ "types": "./dist/index.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "import": {
30
+ "types": "./dist/index.d.ts",
31
+ "default": "./dist/index.js"
32
+ },
33
+ "require": {
34
+ "types": "./dist/index.d.cts",
35
+ "default": "./dist/index.cjs"
36
+ }
37
+ },
38
+ "./static": {
39
+ "import": {
40
+ "types": "./dist/static.d.ts",
41
+ "default": "./dist/static.js"
42
+ },
43
+ "require": {
44
+ "types": "./dist/static.d.cts",
45
+ "default": "./dist/static.cjs"
46
+ }
47
+ },
48
+ "./package.json": "./package.json"
49
+ },
50
+ "peerDependencies": {
51
+ "@jannchie/icons": "^0.9.0",
52
+ "react": ">=18.0.0"
53
+ },
54
+ "devDependencies": {
55
+ "@jannchie/icons": "workspace:^"
56
+ },
57
+ "engines": {
58
+ "node": ">=18"
59
+ },
60
+ "files": [
61
+ "dist",
62
+ "NOTICE"
63
+ ]
64
+ }