@jannchie/icons-react 0.14.0 → 0.15.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/dist/index.cjs +7 -2
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +7 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -10,13 +10,14 @@ let react = require("react");
|
|
|
10
10
|
//#region packages/react/src/index.js
|
|
11
11
|
var IconContext = (0, react.createContext)(null);
|
|
12
12
|
var getServerDpr = () => 1;
|
|
13
|
-
function IconProvider({ children, size, radius, weight, duo, theme, colors, hinting }) {
|
|
13
|
+
function IconProvider({ children, size, radius, weight, variant, duo, theme, colors, hinting }) {
|
|
14
14
|
const parent = (0, react.useContext)(IconContext);
|
|
15
15
|
const value = (0, react.useMemo)(() => {
|
|
16
16
|
const own = Object.fromEntries(Object.entries({
|
|
17
17
|
size,
|
|
18
18
|
radius,
|
|
19
19
|
weight,
|
|
20
|
+
variant,
|
|
20
21
|
duo,
|
|
21
22
|
theme,
|
|
22
23
|
colors,
|
|
@@ -28,6 +29,7 @@ function IconProvider({ children, size, radius, weight, duo, theme, colors, hint
|
|
|
28
29
|
size,
|
|
29
30
|
radius,
|
|
30
31
|
weight,
|
|
32
|
+
variant,
|
|
31
33
|
duo,
|
|
32
34
|
theme,
|
|
33
35
|
colors,
|
|
@@ -35,7 +37,7 @@ function IconProvider({ children, size, radius, weight, duo, theme, colors, hint
|
|
|
35
37
|
]);
|
|
36
38
|
return (0, react.createElement)(IconContext.Provider, { value }, children);
|
|
37
39
|
}
|
|
38
|
-
var JIcon = (0, react.forwardRef)(function JIcon({ icon, size, radius, weight, duo, theme, colors, title, hinting, children, ...rest }, ref) {
|
|
40
|
+
var JIcon = (0, react.forwardRef)(function JIcon({ icon, size, radius, weight, variant, duo, theme, colors, title, hinting, children, ...rest }, ref) {
|
|
39
41
|
const d = (0, react.useContext)(IconContext) ?? {};
|
|
40
42
|
const dpr = (0, react.useSyncExternalStore)(_jannchie_icons_runtime.subscribeDpr, _jannchie_icons_runtime.getDpr, getServerDpr);
|
|
41
43
|
const s = size ?? d.size ?? 24;
|
|
@@ -43,6 +45,7 @@ var JIcon = (0, react.forwardRef)(function JIcon({ icon, size, radius, weight, d
|
|
|
43
45
|
const px = (hinting ?? d.hinting ?? false) && css ? Math.round(css * dpr) : 0;
|
|
44
46
|
const r = radius ?? d.radius;
|
|
45
47
|
const w = weight ?? d.weight;
|
|
48
|
+
const v = variant ?? d.variant;
|
|
46
49
|
const du = duo ?? d.duo;
|
|
47
50
|
const th = theme ?? d.theme;
|
|
48
51
|
const c = d.colors || colors ? {
|
|
@@ -53,6 +56,7 @@ var JIcon = (0, react.forwardRef)(function JIcon({ icon, size, radius, weight, d
|
|
|
53
56
|
const shape = (0, react.useMemo)(() => (0, _jannchie_icons.toPaths)(icon, {
|
|
54
57
|
radius: r,
|
|
55
58
|
weight: w,
|
|
59
|
+
variant: v,
|
|
56
60
|
duo: du,
|
|
57
61
|
theme: th,
|
|
58
62
|
colors: c,
|
|
@@ -62,6 +66,7 @@ var JIcon = (0, react.forwardRef)(function JIcon({ icon, size, radius, weight, d
|
|
|
62
66
|
icon,
|
|
63
67
|
r,
|
|
64
68
|
w,
|
|
69
|
+
v,
|
|
65
70
|
du,
|
|
66
71
|
th,
|
|
67
72
|
ckey,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Icon, Radius, Role, Theme, Weight } from '@jannchie/icons'
|
|
1
|
+
import type { Icon, Radius, Role, Theme, Variant, Weight } from '@jannchie/icons'
|
|
2
2
|
import type { Context, ForwardRefExoticComponent, ReactElement, ReactNode, RefAttributes, SVGProps } from 'react'
|
|
3
3
|
|
|
4
4
|
export type IconColors = Partial<Record<'primary' | Role, string>>
|
|
@@ -11,6 +11,8 @@ export interface IconDefaults {
|
|
|
11
11
|
radius?: Radius
|
|
12
12
|
/** Stroke weight: 'light', 'regular' or 'bold'. Defaults to 'regular' */
|
|
13
13
|
weight?: Weight
|
|
14
|
+
/** 'fill' draws the solid version (icons without one fall back to the outline, see hasFill). Defaults to 'outline' */
|
|
15
|
+
variant?: Variant
|
|
14
16
|
/** Color badges and strike-throughs by their meaning */
|
|
15
17
|
duo?: boolean
|
|
16
18
|
/** Light or dark recommended colors for duo */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Icon, Radius, Role, Theme, Weight } from '@jannchie/icons'
|
|
1
|
+
import type { Icon, Radius, Role, Theme, Variant, Weight } from '@jannchie/icons'
|
|
2
2
|
import type { Context, ForwardRefExoticComponent, ReactElement, ReactNode, RefAttributes, SVGProps } from 'react'
|
|
3
3
|
|
|
4
4
|
export type IconColors = Partial<Record<'primary' | Role, string>>
|
|
@@ -11,6 +11,8 @@ export interface IconDefaults {
|
|
|
11
11
|
radius?: Radius
|
|
12
12
|
/** Stroke weight: 'light', 'regular' or 'bold'. Defaults to 'regular' */
|
|
13
13
|
weight?: Weight
|
|
14
|
+
/** 'fill' draws the solid version (icons without one fall back to the outline, see hasFill). Defaults to 'outline' */
|
|
15
|
+
variant?: Variant
|
|
14
16
|
/** Color badges and strike-throughs by their meaning */
|
|
15
17
|
duo?: boolean
|
|
16
18
|
/** Light or dark recommended colors for duo */
|
package/dist/index.js
CHANGED
|
@@ -6,13 +6,14 @@ import { createContext, createElement, forwardRef, useContext, useMemo, useSyncE
|
|
|
6
6
|
//#region packages/react/src/index.js
|
|
7
7
|
var IconContext = createContext(null);
|
|
8
8
|
var getServerDpr = () => 1;
|
|
9
|
-
function IconProvider({ children, size, radius, weight, duo, theme, colors, hinting }) {
|
|
9
|
+
function IconProvider({ children, size, radius, weight, variant, duo, theme, colors, hinting }) {
|
|
10
10
|
const parent = useContext(IconContext);
|
|
11
11
|
const value = useMemo(() => {
|
|
12
12
|
const own = Object.fromEntries(Object.entries({
|
|
13
13
|
size,
|
|
14
14
|
radius,
|
|
15
15
|
weight,
|
|
16
|
+
variant,
|
|
16
17
|
duo,
|
|
17
18
|
theme,
|
|
18
19
|
colors,
|
|
@@ -24,6 +25,7 @@ function IconProvider({ children, size, radius, weight, duo, theme, colors, hint
|
|
|
24
25
|
size,
|
|
25
26
|
radius,
|
|
26
27
|
weight,
|
|
28
|
+
variant,
|
|
27
29
|
duo,
|
|
28
30
|
theme,
|
|
29
31
|
colors,
|
|
@@ -31,7 +33,7 @@ function IconProvider({ children, size, radius, weight, duo, theme, colors, hint
|
|
|
31
33
|
]);
|
|
32
34
|
return createElement(IconContext.Provider, { value }, children);
|
|
33
35
|
}
|
|
34
|
-
var JIcon = forwardRef(function JIcon({ icon, size, radius, weight, duo, theme, colors, title, hinting, children, ...rest }, ref) {
|
|
36
|
+
var JIcon = forwardRef(function JIcon({ icon, size, radius, weight, variant, duo, theme, colors, title, hinting, children, ...rest }, ref) {
|
|
35
37
|
const d = useContext(IconContext) ?? {};
|
|
36
38
|
const dpr = useSyncExternalStore(subscribeDpr, getDpr, getServerDpr);
|
|
37
39
|
const s = size ?? d.size ?? 24;
|
|
@@ -39,6 +41,7 @@ var JIcon = forwardRef(function JIcon({ icon, size, radius, weight, duo, theme,
|
|
|
39
41
|
const px = (hinting ?? d.hinting ?? false) && css ? Math.round(css * dpr) : 0;
|
|
40
42
|
const r = radius ?? d.radius;
|
|
41
43
|
const w = weight ?? d.weight;
|
|
44
|
+
const v = variant ?? d.variant;
|
|
42
45
|
const du = duo ?? d.duo;
|
|
43
46
|
const th = theme ?? d.theme;
|
|
44
47
|
const c = d.colors || colors ? {
|
|
@@ -49,6 +52,7 @@ var JIcon = forwardRef(function JIcon({ icon, size, radius, weight, duo, theme,
|
|
|
49
52
|
const shape = useMemo(() => toPaths(icon, {
|
|
50
53
|
radius: r,
|
|
51
54
|
weight: w,
|
|
55
|
+
variant: v,
|
|
52
56
|
duo: du,
|
|
53
57
|
theme: th,
|
|
54
58
|
colors: c,
|
|
@@ -58,6 +62,7 @@ var JIcon = forwardRef(function JIcon({ icon, size, radius, weight, duo, theme,
|
|
|
58
62
|
icon,
|
|
59
63
|
r,
|
|
60
64
|
w,
|
|
65
|
+
v,
|
|
61
66
|
du,
|
|
62
67
|
th,
|
|
63
68
|
ckey,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jannchie/icons-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
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
5
|
"license": "MIT",
|
|
6
6
|
"author": "Jianqi Pan",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"./package.json": "./package.json"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@jannchie/icons": "^0.
|
|
51
|
+
"@jannchie/icons": "^0.15.0",
|
|
52
52
|
"react": ">=18.0.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|