@heartpace/icons 0.1.1 → 0.1.3

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
@@ -102,21 +102,84 @@ Component names are automatically generated from the folder structure and file n
102
102
  After building, import icons from the package:
103
103
 
104
104
  ```tsx
105
- import { Icon, UiButtonIcon, ActionsSave } from 'heartpace-icons';
105
+ import { ArrowsIconsArrowArrow2, GeneralIconlyLightHome, FlagsUsa } from '@heartpace/icons';
106
106
 
107
107
  function MyComponent() {
108
108
  return (
109
109
  <div>
110
- <Icon className="w-6 h-6" />
111
- <UiButtonIcon width={24} height={24} fill="currentColor" />
112
- <ActionsSave stroke="blue" />
110
+ {/* Default size (24x24) with custom stroke color */}
111
+ <ArrowsIconsArrowArrow2 stroke="#00A0E5" />
112
+
113
+ {/* Custom size with custom stroke color */}
114
+ <ArrowsIconsArrowArrow2 width={100} height={100} stroke="#00A0E5" />
115
+
116
+ {/* Using CSS color via className */}
117
+ <GeneralIconlyLightHome className="w-6 h-6 text-blue-500" stroke="currentColor" />
118
+
119
+ {/* Flags keep their original colors */}
120
+ <FlagsUsa width={32} height={32} />
113
121
  </div>
114
122
  );
115
123
  }
116
124
  ```
117
125
 
126
+ ### Color Control
127
+
128
+ All icons (except flags) use `currentColor` for `stroke` and `fill` attributes, which means:
129
+
130
+ - **Pass `stroke` or `fill` props** to set specific colors: `<Icon stroke="#00A0E5" />`
131
+ - **Use CSS `color` property** via `className`: `<Icon className="text-blue-500" stroke="currentColor" />`
132
+ - **Flags preserve their original colors** and cannot be recolored
133
+
118
134
  All icons accept standard React SVG props (`className`, `width`, `height`, `fill`, `stroke`, etc.).
119
135
 
136
+ ## Categories
137
+
138
+ The library automatically generates a `categories.json` file that groups all icons by their root category (the first folder in the path). This file is available in the `dist` folder and can be imported for programmatic access to icons by category.
139
+
140
+ ### Accessing Categories
141
+
142
+ ```tsx
143
+ // Import categories JSON
144
+ import categories from '@heartpace/icons/categories';
145
+ // or
146
+ import categories from '@heartpace/icons/categories.json';
147
+
148
+ // Access icons by category
149
+ const arrowsIcons = categories.Arrows;
150
+ const flagsIcons = categories.Flags;
151
+ const generalIcons = categories.General;
152
+
153
+ // Each icon has:
154
+ // - componentName: The React component name
155
+ // - relativePath: Path from icons directory
156
+ // - fileName: The SVG file name
157
+
158
+ console.log(arrowsIcons[0]);
159
+ // {
160
+ // componentName: "ArrowsIconArrowCloseMenu",
161
+ // relativePath: "Arrows/Icon/Arrow/Close menu.svg",
162
+ // fileName: "Close menu.svg"
163
+ // }
164
+ ```
165
+
166
+ ### TypeScript Support
167
+
168
+ TypeScript types are included for the categories:
169
+
170
+ ```tsx
171
+ import type { Categories, IconInfo } from '@heartpace/icons/categories';
172
+
173
+ const categories: Categories = require('@heartpace/icons/categories.json');
174
+
175
+ // IconInfo type
176
+ interface IconInfo {
177
+ componentName: string;
178
+ relativePath: string;
179
+ fileName: string;
180
+ }
181
+ ```
182
+
120
183
  ## Tree-shaking Support
121
184
 
122
185
  This library is fully optimized for tree-shaking! Only the icons you import will be included in your final bundle.
@@ -0,0 +1,23 @@
1
+ // Auto-generated file - do not edit manually
2
+ // Generated from SVG files in src/icons
3
+
4
+ export interface IconInfo {
5
+ componentName: string;
6
+ relativePath: string;
7
+ fileName: string;
8
+ }
9
+
10
+ export interface Categories {
11
+ [category: string]: IconInfo[];
12
+ }
13
+
14
+ declare const categories: Categories;
15
+ export default categories;
16
+ export { categories };
17
+
18
+ // For JSON import support
19
+ declare module '@heartpace/icons/categories.json' {
20
+ const categories: Categories;
21
+ export default categories;
22
+ export { IconInfo, Categories };
23
+ }