@gnome-ui/icons 1.40.0 → 1.41.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 CHANGED
@@ -4,6 +4,8 @@ Framework-agnostic Adwaita symbolic icon definitions for the [gnome-ui](https://
4
4
 
5
5
  Each icon is a plain JavaScript object (`IconDefinition`) containing SVG path data — no DOM, no React, no styles. UI framework adapters consume this shape to render inline SVGs.
6
6
 
7
+ The `Icon` React adapter also accepts icons from [`simple-icons`](https://simpleicons.org/) directly, without any conversion.
8
+
7
9
  [![npm](https://img.shields.io/npm/v/@gnome-ui/icons)](https://www.npmjs.com/package/@gnome-ui/icons)
8
10
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](../../LICENSE)
9
11
 
@@ -41,6 +43,28 @@ import { Search, Settings, GoHome } from "@gnome-ui/icons";
41
43
  <Icon icon={Settings} size="lg" aria-hidden />
42
44
  ```
43
45
 
46
+ ### With `simple-icons`
47
+
48
+ The `Icon` component accepts any `simple-icons` icon directly — no adapter or conversion needed. `simple-icons` is not a dependency of this package; install it separately in your project.
49
+
50
+ ```tsx
51
+ import { Icon } from "@gnome-ui/react";
52
+ import { siGithub, siNpm } from "simple-icons";
53
+
54
+ <Icon icon={siGithub} label="GitHub" />
55
+ <Icon icon={siNpm} size="lg" label="npm" />
56
+ ```
57
+
58
+ You can also pass a plain `{ path }` object for any single-path SVG icon:
59
+
60
+ ```tsx
61
+ import { Icon } from "@gnome-ui/react";
62
+
63
+ <Icon icon={{ path: "M12 0C5.37 0 0 5.37 0 12s5.37 12 12 12..." }} label="My icon" />
64
+ // Custom viewBox (defaults to "0 0 24 24"):
65
+ <Icon icon={{ path: "M0 0h32v32H0z", viewBox: "0 0 32 32" }} />
66
+ ```
67
+
44
68
  ### Framework-agnostic (raw SVG)
45
69
 
46
70
  ```ts
@@ -65,9 +89,10 @@ function renderIcon(icon: IconDefinition, size = 16) {
65
89
  }
66
90
  ```
67
91
 
68
- ## `IconDefinition` type
92
+ ## Types
69
93
 
70
94
  ```ts
95
+ /** Icons from @gnome-ui/icons — multi-path, fixed viewBox. */
71
96
  interface IconDefinition {
72
97
  readonly viewBox: string;
73
98
  readonly paths: ReadonlyArray<{
@@ -76,6 +101,15 @@ interface IconDefinition {
76
101
  readonly clipRule?: "nonzero" | "evenodd" | "inherit";
77
102
  }>;
78
103
  }
104
+
105
+ /** Single-path icons from simple-icons or any { path } object. */
106
+ interface RawPathIconDefinition {
107
+ readonly path: string;
108
+ readonly viewBox?: string; // defaults to "0 0 24 24"
109
+ }
110
+
111
+ /** Union accepted by the Icon component. */
112
+ type AnyIconDefinition = IconDefinition | RawPathIconDefinition;
79
113
  ```
80
114
 
81
115
  ## Available icons
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export type { IconDefinition, IconPath } from './types.ts';
1
+ export type { IconDefinition, IconPath, RawPathIconDefinition, AnyIconDefinition } from './types.ts';
2
2
  export * from './icons/index.ts';
3
3
  export * from './third-party/index.ts';
package/dist/types.d.ts CHANGED
@@ -16,3 +16,22 @@ export interface IconPath {
16
16
  readonly fillRule?: "nonzero" | "evenodd" | "inherit";
17
17
  readonly clipRule?: "nonzero" | "evenodd" | "inherit";
18
18
  }
19
+ /**
20
+ * A minimal icon descriptor for single-path icons from third-party sets such
21
+ * as `simple-icons`. Structurally compatible with `SimpleIcon` from
22
+ * `simple-icons` — no cast or adapter needed.
23
+ *
24
+ * The viewBox defaults to `"0 0 24 24"` when omitted (simple-icons standard).
25
+ */
26
+ export interface RawPathIconDefinition {
27
+ /** SVG path `d` attribute string. */
28
+ readonly path: string;
29
+ /** SVG viewBox. Defaults to `"0 0 24 24"` when absent. */
30
+ readonly viewBox?: string;
31
+ }
32
+ /**
33
+ * Union of all accepted icon shapes for the `Icon` component.
34
+ * - `IconDefinition` — icons from `@gnome-ui/icons`
35
+ * - `RawPathIconDefinition` — single-path icons, e.g. from `simple-icons`
36
+ */
37
+ export type AnyIconDefinition = IconDefinition | RawPathIconDefinition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gnome-ui/icons",
3
- "version": "1.40.0",
3
+ "version": "1.41.0",
4
4
  "description": "Adwaita symbolic icon definitions (framework-agnostic SVG path data)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",