@impulse-ui-native/icon 3.0.0 → 5.0.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 +39 -38
- package/dist/components/icon.js +14 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,38 +1,39 @@
|
|
|
1
|
-
# @impulse-ui-native/icon
|
|
2
|
-
|
|
3
|
-
A React Native SVG icon library with a common renderer and six visual weights.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
pnpm add @impulse-ui-native/icon react-native-svg
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Main exports
|
|
12
|
-
|
|
13
|
-
- `Icon` normalizes icon size, color, and rendering.
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
- `
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
# @impulse-ui-native/icon
|
|
2
|
+
|
|
3
|
+
A React Native SVG icon library with a common renderer and six visual weights.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm add @impulse-ui-native/icon react-native-svg
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Main exports
|
|
12
|
+
|
|
13
|
+
- `Icon` normalizes icon size, color, and rendering. Its default foreground is
|
|
14
|
+
`theme.colors.text.primary`; explicit `color`, then `fill`, override that default.
|
|
15
|
+
- Named wrapper icons such as `HeartIcon` select a visual weight through the `variant` prop.
|
|
16
|
+
- Available weights are `bold`, `duotone`, `fill`, `light`, `regular`, and `thin`.
|
|
17
|
+
- `IconProps`, `IconWrapperProps`, `IconVariant`, and `IconStyle` support typed composition.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { Icon } from "@impulse-ui-native/icon/components/icon";
|
|
23
|
+
import { HeartIcon } from "@impulse-ui-native/icon/icons/heart";
|
|
24
|
+
|
|
25
|
+
<Icon icon={HeartIcon} variant="duotone" size="large" color="#6d5dfc" />;
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
You can also render a named wrapper directly when you want to control the SVG dimensions yourself. Supply its `color` explicitly; automatic theme defaults come from the shared `Icon` renderer.
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
<HeartIcon variant="regular" width={24} height={24} color="#111827" />
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Wrapper names use the `{Name}Icon` form. Import wrappers through their per-icon
|
|
35
|
+
entrypoints so Metro only includes the icons used by the application:
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { HeartIcon } from "@impulse-ui-native/icon/icons/heart";
|
|
39
|
+
```
|
package/dist/components/icon.js
CHANGED
|
@@ -1,19 +1,29 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { useTheme } from "@impulse-ui-native/theme";
|
|
4
4
|
const Icon = memo(function Icon2({
|
|
5
5
|
size = "medium",
|
|
6
6
|
icon,
|
|
7
7
|
...props
|
|
8
8
|
}) {
|
|
9
9
|
const Icon3 = icon;
|
|
10
|
-
const
|
|
11
|
-
const iconTokens =
|
|
10
|
+
const theme = useTheme();
|
|
11
|
+
const iconTokens = theme.components.icon;
|
|
12
|
+
const color = props.color ?? props.fill ?? theme.colors.text.primary;
|
|
12
13
|
const iconSize = useMemo(
|
|
13
14
|
() => typeof size === "number" ? size : iconTokens.sizes[size],
|
|
14
15
|
[iconTokens.sizes, size]
|
|
15
16
|
);
|
|
16
|
-
return /* @__PURE__ */ jsx(
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
Icon3,
|
|
19
|
+
{
|
|
20
|
+
...props,
|
|
21
|
+
color,
|
|
22
|
+
width: iconSize,
|
|
23
|
+
height: iconSize,
|
|
24
|
+
fill: color
|
|
25
|
+
}
|
|
26
|
+
);
|
|
17
27
|
});
|
|
18
28
|
export {
|
|
19
29
|
Icon
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@impulse-ui-native/icon",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "A typed icon library for ImpulseUI Native applications.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"sideEffects": false,
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@impulse-ui-native/theme": "
|
|
37
|
+
"@impulse-ui-native/theme": "5.0.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^22.18.12",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"react-native-svg": "15.15.4",
|
|
47
47
|
"typescript": "~6.0.3",
|
|
48
48
|
"@impulse-ui-native/eslint-config": "1.0.0",
|
|
49
|
-
"@impulse-ui-native/
|
|
50
|
-
"@impulse-ui-native/
|
|
49
|
+
"@impulse-ui-native/tsconfig": "1.0.0",
|
|
50
|
+
"@impulse-ui-native/prettier-config": "1.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
53
|
"react": ">=18",
|