stera-icons 8.0.2 → 8.0.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
@@ -26,37 +26,54 @@ npm install stera-icons
26
26
  ## Quick Start
27
27
 
28
28
  ```tsx
29
- import { SearchBold, SiHome } from 'stera-icons';
29
+ import { Search, Home } from 'stera-icons';
30
30
 
31
31
  function App() {
32
32
  return (
33
33
  <>
34
- <SearchBold size={24} color="blue" />
35
- <SiHome size={32} />
34
+ <Search size={24} color="blue" />
35
+ <Home size={32} />
36
36
  </>
37
37
  );
38
38
  }
39
39
  ```
40
40
 
41
+ Base icon names (`Search`, `Home`, etc.) give you the Regular variant with optimal bundle size (~300 bytes each).
42
+
41
43
  ## Usage
42
44
 
43
- ### Direct Import (Recommended)
45
+ ### Simple Import (Recommended)
44
46
 
45
47
  ```tsx
46
- import { SearchBold, HomeFill } from 'stera-icons';
48
+ import { Search, Home, User } from 'stera-icons';
47
49
 
48
- <SearchBold size={24} />
49
- <HomeFill />
50
+ <Search size={24} />
51
+ <Home />
52
+ <User color="gray" />
53
+ ```
54
+
55
+ ### Explicit Variant Imports
56
+
57
+ Need a specific weight or duotone style? Import it directly
58
+
59
+ ```tsx
60
+ import { SearchBold, HomeFill, UserRegularDuotone } from 'stera-icons';
61
+
62
+ <SearchBold size={24} /> {/* Bold weight */}
63
+ <HomeFill /> {/* Fill weight */}
64
+ <UserRegularDuotone color="blue" /> {/* Regular + Duotone */}
50
65
  ```
51
66
 
52
- Fully tree-shakeable—only ~300 bytes per icon variant in your bundle.
67
+ Each icon has 6 variants available:
68
+ - `SearchRegular`, `SearchBold`, `SearchFill`
69
+ - `SearchRegularDuotone`, `SearchBoldDuotone`, `SearchFillDuotone`
53
70
 
54
- ### Aliased Imports (Prevent Name Collisions)
71
+ ### Triple Aliasing (Prevent Name Collisions)
55
72
 
56
- All icons support 3 naming styles:
73
+ All icons support 3 naming styles to avoid conflicts with your codebase:
57
74
 
58
75
  ```tsx
59
- // Base name
76
+ // Base name (gives you Regular variant)
60
77
  import { Search } from 'stera-icons';
61
78
 
62
79
  // Icon suffix style
@@ -68,48 +85,35 @@ import { SiSearch, SiHome, SiUser } from 'stera-icons';
68
85
 
69
86
  All aliases point to the same component with zero bundle size overhead.
70
87
 
71
- ### Variant Imports
72
-
73
- Each icon has 6 variants available:
74
-
75
- ```tsx
76
- import { SearchRegular, SearchBold, SearchFill } from 'stera-icons';
77
- import { SearchRegularDuotone, SearchBoldDuotone, SearchFillDuotone } from 'stera-icons';
78
-
79
- // All variants also support triple aliasing
80
- import { SiSearchBold, SiSearchRegularDuotone } from 'stera-icons';
81
- ```
82
-
83
- ### Dynamic Variants (Convenience)
88
+ ### Dynamic Variants (Runtime Switching)
84
89
 
85
- Use wrapper components when you need to switch variants at runtime (~1KB per icon, includes all 6 variants):
90
+ Need to switch icon weight or duotone at runtime? Use the dynamic variants entry point
86
91
 
87
92
  ```tsx
88
- import { Search } from 'stera-icons';
93
+ import { Search } from 'stera-icons/dynamic-variants';
89
94
 
90
95
  <Search /> {/* Regular */}
91
96
  <Search weight="bold" /> {/* Bold */}
92
97
  <Search weight="fill" duotone /> {/* Fill + Duotone */}
93
98
  ```
94
99
 
100
+ **Note:** Dynamic variants include all 6 variants per icon (~1KB each vs ~300 bytes for direct imports). Only use this when you need runtime variant switching.
101
+
95
102
  ### Subpath Imports
96
103
 
97
- For even better tree-shaking and smaller bundles, import directly from icon paths:
104
+ For maximum tree-shaking control, import directly from icon paths
98
105
 
99
106
  ```tsx
100
- // Import individual icons
101
107
  import { Search } from 'stera-icons/icons/Search';
102
108
  import { SearchBold } from 'stera-icons/icons/SearchBold';
103
- import { SiHome } from 'stera-icons/icons/SiHome';
104
109
 
105
110
  <Search size={24} />
106
111
  <SearchBold size={24} />
107
- <SiHome size={24} />
108
112
  ```
109
113
 
110
114
  ### Dynamic Icon Loading
111
115
 
112
- **New!** Load icons dynamically at runtime - perfect for CMS-driven content, icon pickers, or when icon names come from APIs:
116
+ **New!** Load icons dynamically at runtime - perfect for CMS-driven content, icon pickers, or when icon names come from APIs
113
117
 
114
118
  ```tsx
115
119
  import { DynamicIcon, iconNames } from 'stera-icons/dynamic';
@@ -147,8 +151,10 @@ function IconPicker() {
147
151
  |------|------|---------|-------------|
148
152
  | `size` | `number \| string` | `24` | Icon size in pixels |
149
153
  | `color` | `string` | `'currentColor'` | Icon color |
150
- | `weight` | `'regular' \| 'bold' \| 'fill'` | `'regular'` | Icon weight (wrapper only) |
151
- | `duotone` | `boolean` | `false` | Use duotone variant (wrapper only) |
154
+ | `weight` | `'regular' \| 'bold' \| 'fill'` | `'regular'` | Icon weight (dynamic variants only) |
155
+ | `duotone` | `boolean` | `false` | Use duotone variant (dynamic variants only) |
156
+
157
+ The `weight` and `duotone` props are only available when importing from `stera-icons/dynamic-variants`. For regular imports, choose the specific variant you need (e.g., `SearchBold`, `HomeFillDuotone`).
152
158
 
153
159
  All standard SVG props are also supported.
154
160
 
@@ -226,8 +232,10 @@ import type {
226
232
  IconNode, // Icon data structure
227
233
  } from 'stera-icons';
228
234
 
235
+ import { Search } from 'stera-icons';
236
+
229
237
  // Use in your components
230
- const MyComponent: React.FC<IconProps> = (props) => {
238
+ const MyComponent: React.FC<Omit<IconProps, 'weight' | 'duotone'>> = (props) => {
231
239
  return <Search {...props} />;
232
240
  };
233
241
  ```
@@ -253,12 +261,15 @@ function CustomIcon(props: IconBaseProps) {
253
261
 
254
262
  Stera Icons is optimized for minimal bundle impact:
255
263
 
256
- - **Direct variant import:** ~300 bytes (e.g., `SearchBold`)
257
- - **Wrapper component:** ~1KB (e.g., `Search` with all 6 variants)
258
- - **Dynamic loading:** ~2KB + lazy-loaded icons on demand
259
- - **Base imports only:** ~500 bytes (IconBase + utilities)
264
+ | Import Pattern | Bundle Size | Example |
265
+ |---------------|-------------|---------|
266
+ | Base name import | ~300 bytes | `import { Search } from 'stera-icons'` |
267
+ | Explicit variant | ~300 bytes | `import { SearchBold } from 'stera-icons'` |
268
+ | Dynamic variant | ~1KB | `import { Search } from 'stera-icons/dynamic-variants'` |
269
+ | Dynamic loading | ~2KB + lazy | `import { DynamicIcon } from 'stera-icons/dynamic'` |
270
+ | Base utilities | ~500 bytes | `import { IconBase } from 'stera-icons/base'` |
260
271
 
261
- All measurements are gzipped and minified.
272
+ All measurements are gzipped and minified. The default import pattern (`import { Search }`) is optimized for the smallest possible bundle size.
262
273
 
263
274
  ## Browser Support
264
275
 
@@ -270,10 +281,6 @@ Stera Icons supports all browsers that support React 16.8+:
270
281
  - Edge (latest)
271
282
  - React Native (via react-native-svg wrapper)
272
283
 
273
- ## Contributing
274
-
275
- Contributions are welcome! Please see our [contributing guidelines](https://github.com/chazgiese/Stera-Icons/blob/main/CONTRIBUTING.md).
276
-
277
284
  ## License
278
285
 
279
286
  MIT © [Chaz Giese](https://github.com/chazgiese)