@rockshin/tao-icons 0.1.1 → 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/README.md +65 -110
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,172 +1,127 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Tao Icons
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**2,165 rounded line icons for React — made for polished products, from everyday interfaces to insurance workspaces.**
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Give your product a consistent visual language with a versatile library of 24px icons. Tao Icons pairs a clean, rounded style with practical React APIs, so you can move from idea to interface with confidence.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
[Browse the icon catalog](https://rickyshin93.github.io/tao-ui/components/icons) · [npm](https://www.npmjs.com/package/@rockshin/tao-icons) · [中文说明](#中文说明)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- **A wide range of icons:** navigation, actions, files, development, data, finance and insurance.
|
|
10
|
+
- **Designed to work together:** a consistent 24px canvas, rounded strokes and `currentColor` styling.
|
|
11
|
+
- **Ready for React:** named components, TypeScript types, refs and native SVG props for React 18.2+ and 19.
|
|
12
|
+
- **Import what you need:** root exports and explicit per-icon entry points, with tree-shaking verified in consumer builds.
|
|
13
|
+
- **Accessible by default:** decorative unless named, with support for `title` and ARIA attributes.
|
|
14
|
+
- **Flexible assets:** use the React components or the included SVG files. MIT licensed.
|
|
15
|
+
|
|
16
|
+
## Install
|
|
10
17
|
|
|
11
18
|
```sh
|
|
12
|
-
npm install @rockshin/tao-icons
|
|
19
|
+
npm install @rockshin/tao-icons
|
|
13
20
|
```
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
React is a peer dependency (`^18.2.0 || ^19.0.0`). The package provides ESM and TypeScript declarations; it does not provide a CommonJS entry point.
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
16
25
|
|
|
17
26
|
```tsx
|
|
18
27
|
import { SearchIcon, HomeIcon } from '@rockshin/tao-icons';
|
|
19
|
-
// 显式单图标入口(kebab-case;没有 .js 后缀)
|
|
20
28
|
import { ArrowRightIcon } from '@rockshin/tao-icons/icons/arrow-right';
|
|
21
29
|
|
|
22
30
|
export function Toolbar() {
|
|
23
31
|
return (
|
|
24
|
-
<button type="button" aria-label="
|
|
25
|
-
<SearchIcon size={20}
|
|
32
|
+
<button type="button" aria-label="Search">
|
|
33
|
+
<SearchIcon size={20} />
|
|
26
34
|
</button>
|
|
27
35
|
);
|
|
28
36
|
}
|
|
29
37
|
```
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
Use kebab-case names without a `.js` suffix for per-icon imports. Browse the catalog or the included `@rockshin/tao-icons/manifest.json` for the complete set.
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
import { FileSpreadsheetIcon, ChartPieIcon } from '@rockshin/tao-icons';
|
|
35
|
-
import { GitPullRequestIcon } from '@rockshin/tao-icons/icons/git-pull-request';
|
|
36
|
-
|
|
37
|
-
export function CommonActions() {
|
|
38
|
-
return <nav aria-label="常用操作">
|
|
39
|
-
<button><FileSpreadsheetIcon size={20} />表格文件</button>
|
|
40
|
-
<button><ChartPieIcon size={20} />占比图</button>
|
|
41
|
-
<button><GitPullRequestIcon size={20} />合并请求</button>
|
|
42
|
-
</nav>;
|
|
43
|
-
}
|
|
44
|
-
```
|
|
41
|
+
## Customize
|
|
45
42
|
|
|
46
|
-
|
|
43
|
+
Each icon is a named `*Icon` export. Import `IconProps` from the root when you need the shared type.
|
|
47
44
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
<button><CoverageIcon size={20} />保障责任</button>
|
|
55
|
-
<button><RiskScoreIcon size={20} />风险评分</button>
|
|
56
|
-
<button><ProductBuilderIcon size={20} />产品配置</button>
|
|
57
|
-
</nav>;
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
新增图标是用于导航、按钮、流程状态和数据项的视觉候选;具体金融业务含义以系统文案和业务规则为准,不应单独依靠图形区分审批/支付状态。所有新增导出继续遵循同一 IconProps 和单图标子路径约定。
|
|
62
|
-
|
|
63
|
-
## API
|
|
64
|
-
|
|
65
|
-
每个组件用 `*Icon` 具名导出。可从根入口导入 `IconProps` 类型。
|
|
66
|
-
|
|
67
|
-
- `size?: number | string`,默认 24,同时设置宽高;显式 `width` / `height` 优先
|
|
68
|
-
- `color` 或 CSS `color` 控制默认 `currentColor`;`strokeWidth` 默认 1.8
|
|
69
|
-
- `className`、`style`、SVG 属性、`aria-*`、`data-*` 和事件处理器可直接传入
|
|
70
|
-
- `ref` 指向实际 `SVGSVGElement`,React 18/19 都支持
|
|
71
|
-
- `title?: string` 渲染 SVG title,并在没有显式 ARIA 名称时提供可访问名称
|
|
72
|
-
- `titleId?: string` 可选;提供时连接 title 与 `aria-labelledby`。调用方须保证页面内唯一
|
|
73
|
-
- `children` 追加在图标几何后;`dangerouslySetInnerHTML` 不支持,以保护固定子元素结构
|
|
45
|
+
- `size?: number | string` sets width and height (default `24`); explicit `width` and `height` take precedence.
|
|
46
|
+
- `color` or CSS `color` controls the default `currentColor`; `strokeWidth` defaults to `1.8`.
|
|
47
|
+
- Pass `className`, `style`, SVG attributes, `aria-*`, `data-*` and event handlers directly.
|
|
48
|
+
- `ref` points to the underlying `SVGSVGElement`.
|
|
49
|
+
- `title` supplies an accessible name when no explicit ARIA name is present. `titleId` optionally associates the title via `aria-labelledby`; keep it unique on the page.
|
|
50
|
+
- `children` are appended after the icon geometry. `dangerouslySetInnerHTML` is not supported.
|
|
74
51
|
|
|
75
52
|
```tsx
|
|
76
|
-
import { createRef } from 'react';
|
|
77
53
|
import { SearchIcon, type IconProps } from '@rockshin/tao-icons';
|
|
78
54
|
|
|
79
|
-
const ref = createRef<SVGSVGElement>();
|
|
80
55
|
const props: IconProps = { size: '1em', color: '#275EFE' };
|
|
81
|
-
const
|
|
56
|
+
const icon = <SearchIcon {...props} title="Search" />;
|
|
82
57
|
```
|
|
83
58
|
|
|
84
|
-
###
|
|
85
|
-
|
|
86
|
-
不提供名称时默认装饰性:`aria-hidden="true"`、`focusable="false"`。按钮里已有文字或按钮本身有 `aria-label` 时,让图标保持装饰性。
|
|
59
|
+
### Accessibility
|
|
87
60
|
|
|
88
|
-
|
|
61
|
+
Icons without a name are decorative by default (`aria-hidden="true"`, `focusable="false"`). Leave an icon decorative when its button already has visible text or an accessible label. For an icon that conveys meaning on its own, provide `title`, `aria-label`, or `aria-labelledby`; named icons default to `role="img"`. An explicit ARIA name takes precedence over the title. An empty title does not provide a name. Explicit `aria-hidden` and `role` remain the caller's responsibility.
|
|
89
62
|
|
|
90
63
|
```tsx
|
|
91
|
-
<SearchIcon title="
|
|
92
|
-
<SearchIcon title="
|
|
64
|
+
<SearchIcon title="Search" />
|
|
65
|
+
<SearchIcon title="Search" titleId="header-search-title" />
|
|
93
66
|
<SearchIcon aria-labelledby="visible-search-label" />
|
|
94
67
|
```
|
|
95
68
|
|
|
96
|
-
|
|
69
|
+
DOM and SSR behavior is tested; real screen-reader certification has not been performed. Do not rely on icons alone to communicate financial or approval status.
|
|
97
70
|
|
|
98
71
|
## Next.js App Router
|
|
99
72
|
|
|
100
|
-
|
|
73
|
+
Icons retain a `use client` boundary. A Server Component can import an icon and pass serializable props, and the SVG is rendered in server HTML. Use your own Client Component for refs or event handlers.
|
|
101
74
|
|
|
102
75
|
```tsx
|
|
103
|
-
// app/page.tsx
|
|
76
|
+
// app/page.tsx — a Server Component
|
|
104
77
|
import { HomeIcon } from '@rockshin/tao-icons/icons/home';
|
|
78
|
+
|
|
105
79
|
export default function Page() {
|
|
106
|
-
return <HomeIcon title="
|
|
80
|
+
return <HomeIcon title="Home" />;
|
|
107
81
|
}
|
|
108
82
|
```
|
|
109
83
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
优先使用上例的逐图标子路径。测试发现:同一 Server Component 中,用两条独立语句从根入口导入不同图标,会让 Next 16.4.2 的 client chunk 意外包含整套图标。把 root named imports 合并为一条语句,或全部使用单图标子路径,已验证不带入无关图标。
|
|
84
|
+
In the tested Next.js 16.4.2 production webpack build, separate root import statements in one Server Component can include the entire icon set in the client chunk. Prefer per-icon paths, or combine root imports into one statement. This result does not establish behavior for every Next.js version or Turbopack. These components use a client boundary; they are not native server-only RSC icons.
|
|
113
85
|
|
|
114
|
-
|
|
115
|
-
// 根入口需要导入多个图标时,合并成同一条语句
|
|
116
|
-
import { HomeIcon, CoverageIcon } from '@rockshin/tao-icons';
|
|
117
|
-
// Next 项目更推荐明确的子路径
|
|
118
|
-
import { RiskScoreIcon } from '@rockshin/tao-icons/icons/risk-score';
|
|
119
|
-
```
|
|
86
|
+
## Migration
|
|
120
87
|
|
|
121
|
-
|
|
88
|
+
The 554 legacy import names remain available. For 39 names whose current artwork changed, the previous artwork is available under `original-*`, for example `@rockshin/tao-icons/icons/original-chart-bar`. See `@rockshin/tao-icons/migration.json` for the full mapping.
|
|
122
89
|
|
|
123
|
-
|
|
90
|
+
## Development and verification
|
|
124
91
|
|
|
125
|
-
|
|
92
|
+
From the repository root, install dependencies with `bun install`. In `packages/icons`, run `bun run check` for generation, build, type, behavior and package checks, or `bun run check:extended` for real-tarball React 18/19 and Next.js consumer checks. See [HARNESS.md](./HARNESS.md) for the test matrix and known limitations. Code and artwork are covered by the [MIT license](./ARTWORK-LICENSE).
|
|
126
93
|
|
|
127
|
-
|
|
94
|
+
---
|
|
128
95
|
|
|
129
|
-
|
|
130
|
-
bun install # 仓库根目录:安装全部 workspace
|
|
131
|
-
bun run check # 生成漂移 → 最新构建 → 类型/几何/SSR/DOM/包内容
|
|
132
|
-
bun run check:extended # 再加真实 tgz 消费、React 18/19、tree-shaking、Next
|
|
133
|
-
npm pack --pack-destination artifacts
|
|
134
|
-
```
|
|
96
|
+
## 中文说明
|
|
135
97
|
|
|
136
|
-
|
|
98
|
+
**Tao Icons 是一套为 React 产品打造的 2,165 枚圆角线性图标。** 从日常界面、数据和开发工具,到金融保险工作台,统一的视觉语言帮助团队更快构建清晰、一致的产品体验。
|
|
137
99
|
|
|
138
|
-
|
|
100
|
+
[浏览图标目录](https://rickyshin93.github.io/tao-ui/components/icons) · [npm](https://www.npmjs.com/package/@rockshin/tao-icons)
|
|
139
101
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
src/icon-props.ts 共享的纯 props / accessibility helper
|
|
146
|
-
rslib.config.ts ESM、非合并构建、类型声明、React external
|
|
147
|
-
tests/ 单元、golden、包消费和 Next 测试
|
|
148
|
-
dist/ 构建产物,不要手改
|
|
149
|
-
```
|
|
102
|
+
- 统一的 24px 画布、圆角描边和 `currentColor` 配色。
|
|
103
|
+
- 支持 React 18.2+、React 19、TypeScript、ref 和 SVG 原生属性。
|
|
104
|
+
- 支持根入口与逐图标导入;消费构建验证了按需打包。
|
|
105
|
+
- 默认作为装饰图标,也可通过 `title` 或 ARIA 属性提供无障碍名称。
|
|
106
|
+
- 提供 React 组件和原始 SVG,采用 MIT 许可。
|
|
150
107
|
|
|
151
|
-
|
|
108
|
+
### 安装与使用
|
|
152
109
|
|
|
153
|
-
|
|
110
|
+
```sh
|
|
111
|
+
npm install @rockshin/tao-icons
|
|
112
|
+
```
|
|
154
113
|
|
|
155
|
-
|
|
114
|
+
```tsx
|
|
115
|
+
import { SearchIcon } from '@rockshin/tao-icons';
|
|
116
|
+
import { ArrowRightIcon } from '@rockshin/tao-icons/icons/arrow-right';
|
|
156
117
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
- Next App Router:生产 webpack 构建与 SSR;详细结果和限定条件在 `artifacts/next-results.json`
|
|
162
|
-
- 不承诺 CommonJS、React Native、所有第三方框架/打包器或旧 React 版本
|
|
118
|
+
<button type="button" aria-label="搜索">
|
|
119
|
+
<SearchIcon size={20} />
|
|
120
|
+
</button>
|
|
121
|
+
```
|
|
163
122
|
|
|
164
|
-
|
|
123
|
+
`size` 默认 24,`strokeWidth` 默认 1.8;可使用 `color`、CSS、`className` 和 SVG 属性定制。图标单独表达含义时,请设置 `title`、`aria-label` 或 `aria-labelledby`;按钮已有文字或无障碍名称时,图标保持默认的装饰状态即可。详细 API 和无障碍说明见上方英文部分。
|
|
165
124
|
|
|
166
|
-
|
|
167
|
-
2. 核对代码的 LICENSE 与素材的 ARTWORK-LICENSE,确认公开分发授权
|
|
168
|
-
3. 确认发布版本(当前 `0.1.1`),同步包名示例与测试,再运行 `bun run release:check`
|
|
169
|
-
4. `bun install && bun run check:extended`,检查 `npm pack --dry-run` 与实际 tgz 安装
|
|
170
|
-
5. 在明确批准发布后,创建 GitHub Release `icons-v<version>` 触发 `release-icons.yml`;新包首次发布会进入 npm staged publishing,需维护者用 2FA 在 Staged Packages 批准,之后可在 npmjs 配置 trusted publisher 供后续版本使用
|
|
125
|
+
本包输出 ESM 与 TypeScript 声明,不提供 CommonJS 入口。Next.js App Router 中图标带有 client boundary;在已测试的 Next.js 16.4.2 webpack 构建中,建议使用逐图标路径,或将根入口导入合并为一条语句,以避免引入整套图标。
|
|
171
126
|
|
|
172
|
-
|
|
127
|
+
旧版 554 个导入名称仍可使用;其中 39 个图形的旧版可通过 `original-*` 路径访问,完整映射见 `@rockshin/tao-icons/migration.json`。开发和验证命令见 [HARNESS.md](./HARNESS.md)。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rockshin/tao-icons",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.2",
|
|
4
|
+
"description": "2,165 rounded line icons for React, from everyday interfaces to insurance, with TypeScript and accessible defaults.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
7
7
|
"icons",
|