@yakit-libs/yakit-ui-icons 0.1.2 → 0.2.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 +30 -5
- package/dist/createIcon-QEZGVf73.js +22 -0
- package/dist/createIcon.d.ts +2 -0
- package/dist/figmaNameCatalog.d.ts +915 -771
- package/dist/index-COg0_949.js +962 -0
- package/dist/{index-C7cW06K3.js → index-MM6ZyIq4.js} +413 -425
- package/dist/index.js +593 -585
- package/dist/outline/index.d.ts +8 -4
- package/dist/outline/index.js +319 -311
- package/dist/registry.js +315 -259
- package/dist/solid/index.d.ts +255 -255
- package/dist/solid/index.js +257 -257
- package/package.json +10 -1
- package/dist/createIcon-DLie83v6.js +0 -21
- package/dist/index-DXCBgsiK.js +0 -940
package/README.md
CHANGED
|
@@ -1,31 +1,56 @@
|
|
|
1
1
|
# @yakit-libs/yakit-ui-icons
|
|
2
2
|
|
|
3
|
-
Yakit UI 的 React
|
|
3
|
+
Yakit UI 的 React 图标包。它不依赖 Ant Design、`@ant-design/cssinjs`、Emotion 或 ReactDOM,颜色 token 由运行时依赖 `@yakit-libs/color` 提供。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
pnpm add @yakit-libs/yakit-ui-icons react
|
|
8
|
+
pnpm add @yakit-libs/yakit-ui-icons @yakit-libs/color@1.4.1 react
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
`@yakit-libs/color@1.4.1` 通过 JavaScript 生成颜色变量,不再提供 `dist/index.css`。在应用的浏览器入口初始化主题:
|
|
12
|
+
|
|
13
|
+
```tsx
|
|
14
|
+
import { applyThemeColors, getColors } from "@yakit-libs/color/preview";
|
|
15
|
+
|
|
16
|
+
const theme = "light";
|
|
17
|
+
applyThemeColors(theme, getColors(theme));
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
这段初始化只能在浏览器生命周期执行;SSR 或静态主题可以在构建阶段使用 `@yakit-libs/color/css` 或 `yakit-color-css` 生成主题 CSS。图标包本身不会隐式操作 `document`,因此 Node SSR 与按图标摇树仍然可用。未初始化颜色变量时,默认色会回退到 Figma 的 `#353639`。
|
|
21
|
+
|
|
11
22
|
## 使用
|
|
12
23
|
|
|
13
24
|
```tsx
|
|
14
|
-
import {
|
|
25
|
+
import { HomeSolid, HomeOutlined } from "@yakit-libs/yakit-ui-icons";
|
|
15
26
|
|
|
16
27
|
export const HomeEntry = () => (
|
|
17
28
|
<button type="button">
|
|
18
29
|
<HomeOutlined aria-hidden size={16} />
|
|
19
|
-
<
|
|
30
|
+
<HomeSolid aria-label="首页" size={16} />
|
|
20
31
|
</button>
|
|
21
32
|
);
|
|
22
33
|
```
|
|
23
34
|
|
|
35
|
+
Outline 与 Solid 的主色默认使用 `var(--Colors-Use-Neutral-Text-1-Title, #353639)`。消费者仍可以通过 `color`、`style.color`、`color="inherit"` 或局部覆盖 CSS 变量改变颜色:
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
<HomeOutlined color="#2f87ff" />
|
|
39
|
+
<HomeSolid style={{ color: "#10b981" }} />
|
|
40
|
+
<span
|
|
41
|
+
style={{
|
|
42
|
+
"--Colors-Use-Neutral-Text-1-Title": "#7b51f7",
|
|
43
|
+
} as React.CSSProperties}
|
|
44
|
+
>
|
|
45
|
+
<HomeOutlined />
|
|
46
|
+
</span>
|
|
47
|
+
```
|
|
48
|
+
|
|
24
49
|
也可以按图标家族导入:
|
|
25
50
|
|
|
26
51
|
```tsx
|
|
27
52
|
import { HomeOutlined } from "@yakit-libs/yakit-ui-icons/outline";
|
|
28
|
-
import {
|
|
53
|
+
import { HomeSolid } from "@yakit-libs/yakit-ui-icons/solid";
|
|
29
54
|
```
|
|
30
55
|
|
|
31
56
|
完整注册表是显式的重入口,仅在图标浏览器等需要枚举所有图标的场景使用:
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as d } from "react/jsx-runtime";
|
|
2
|
+
const u = "var(--Colors-Use-Neutral-Text-1-Title, #353639)";
|
|
3
|
+
// @__NO_SIDE_EFFECTS__
|
|
4
|
+
function b(a, r, l = u) {
|
|
5
|
+
const i = a, t = ({ size: e, color: c, style: n, ...o }) => {
|
|
6
|
+
const s = e === void 0 ? void 0 : { height: e, width: e };
|
|
7
|
+
return /* @__PURE__ */ d(
|
|
8
|
+
i,
|
|
9
|
+
{
|
|
10
|
+
"aria-hidden": o["aria-label"] || o["aria-labelledby"] ? void 0 : !0,
|
|
11
|
+
focusable: "false",
|
|
12
|
+
...s,
|
|
13
|
+
...o,
|
|
14
|
+
style: { color: c ?? l, ...n }
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
};
|
|
18
|
+
return t.displayName = r, t;
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
b as c
|
|
22
|
+
};
|
package/dist/createIcon.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { ComponentType } from 'react';
|
|
2
2
|
import type { IconProps } from './types.js';
|
|
3
|
+
/** Figma `Colors-Use/Neutral/Text 1-Title`, provided by @yakit-libs/color. */
|
|
4
|
+
export declare const DEFAULT_ICON_COLOR = "var(--Colors-Use-Neutral-Text-1-Title, #353639)";
|
|
3
5
|
/**
|
|
4
6
|
* Turns a Figma-exported SVG into an icon component with an Ant Design-like API.
|
|
5
7
|
*/
|